From 5033452fcdc0477cf294ec09f0343964540c41d8 Mon Sep 17 00:00:00 2001 From: Qubot <1445788683@qq.com> Date: Sat, 6 Jun 2026 18:39:53 +0800 Subject: [PATCH] sun60iw2: align BPI-M8 rfkill power control --- .../dts/sunxi/sun60i-a733-bananapi-m8.dts | 58 ++++++++++++++----- bsp/drivers/clk/sunxi-ng/ccu-ddr.c | 4 +- bsp/drivers/misc/sunxi-rf/sunxi-bluetooth.c | 3 +- bsp/drivers/misc/sunxi-rf/sunxi-gnss.c | 3 +- bsp/drivers/misc/sunxi-rf/sunxi-modem.c | 3 +- bsp/drivers/misc/sunxi-rf/sunxi-rfkill.c | 9 +-- bsp/drivers/misc/sunxi-rf/sunxi-wlan.c | 3 +- 7 files changed, 60 insertions(+), 23 deletions(-) diff --git a/arch/arm64/boot/dts/sunxi/sun60i-a733-bananapi-m8.dts b/arch/arm64/boot/dts/sunxi/sun60i-a733-bananapi-m8.dts index 8b89ce5a8..5e87b3dfb 100644 --- a/arch/arm64/boot/dts/sunxi/sun60i-a733-bananapi-m8.dts +++ b/arch/arm64/boot/dts/sunxi/sun60i-a733-bananapi-m8.dts @@ -60,12 +60,6 @@ regulator-boot-on; }; - wifi_pwrseq: wifi-pwrseq { - compatible = "mmc-pwrseq-simple"; - reset-gpios = <&r_pio PM 1 GPIO_ACTIVE_LOW>; - post-power-on-delay-ms = <200>; - }; - standby_param: standby_param { vdd-cpub = <0x00000004 0x00000000>; vdd-cpu = <0x00000010 0x00000000>; @@ -903,7 +897,6 @@ cap-sdio-irq; keep-power-in-suspend; ignore-pm-notify; - mmc-pwrseq = <&wifi_pwrseq>; /* * The on-board Wi-Fi SDIO link is unstable at SDR104/200MHz on BPI-M8: * the card can probe once, then hit cmd7/cmd52 timeouts and re-enumerate. @@ -1664,18 +1657,21 @@ &rfkill { compatible = "allwinner,sunxi-rfkill"; + chip_en; + power_en; + pinctrl-0; + pinctrl-names; status = "okay"; - chip_en = <&pio PG 10 GPIO_ACTIVE_HIGH>; /* wlan session */ wlan { compatible = "allwinner,sunxi-wlan"; clocks; clock-names; - wlan_power = "axp8191-dcdc1", "axp8191-bldo5", "axp8191-cldo1"; /* vcc-wifi/vcc-pg/vcc-pm */ - wlan_power_vol= <3300000>, <1800000>, <1800000>; + wlan_power = "axp8191-bldo5", "axp8191-cldo1"; /* vcc-pg/vcc-pm */ + wlan_power_vol= <1800000>, <1800000>; wlan_busnum = <0x1>; - /* PM1/WLAN_REGON is owned by wifi_pwrseq for pre-enumeration power-up. */ + wlan_regon = <&r_pio PM 1 GPIO_ACTIVE_HIGH>; wlan_hostwake = <&r_pio PM 0 GPIO_ACTIVE_HIGH>; wakeup-source; }; @@ -1685,12 +1681,28 @@ compatible = "allwinner,sunxi-bt"; clocks; clock-names; - bt_power = "axp8191-dcdc1", "axp8191-bldo5", "axp8191-cldo1"; /* vcc-wifi/vcc-pg/vcc-pm */ - bt_power_vol= <3300000>, <1800000>, <1800000>; + bt_power = "axp8191-bldo5", "axp8191-cldo1"; /* vcc-pg/vcc-pm */ + bt_power_vol= <1800000>, <1800000>; bt_rst_n = <&r_pio PM 2 GPIO_ACTIVE_LOW>; }; }; +&pd_vi_test { + status = "disabled"; +}; + +&pd_ve_dec_test { + status = "disabled"; +}; + +&pd_ve_enc_test { + status = "disabled"; +}; + +&pd_npu_test { + status = "disabled"; +}; + &pd_gpu_top_test { status = "disabled"; }; @@ -1699,6 +1711,26 @@ status = "disabled"; }; +&pd_pcie_test { + status = "disabled"; +}; + +&pd_usb2_test { + status = "disabled"; +}; + +&pd_de_sys_test { + status = "disabled"; +}; + +&pd_vo_test { + status = "disabled"; +}; + +&pd_vo1_test { + status = "disabled"; +}; + &addr_mgt { compatible = "allwinner,sunxi-addr_mgt"; type_addr_wifi = <0x0>; diff --git a/bsp/drivers/clk/sunxi-ng/ccu-ddr.c b/bsp/drivers/clk/sunxi-ng/ccu-ddr.c index 22e4dcea6..e7e5dd0a8 100644 --- a/bsp/drivers/clk/sunxi-ng/ccu-ddr.c +++ b/bsp/drivers/clk/sunxi-ng/ccu-ddr.c @@ -252,7 +252,7 @@ static int ddr_clock_probe(struct platform_device *pdev) } } - sunxi_err(NULL, "dram_clk:%d\n", ddrclk->dram_clk); + sunxi_info(NULL, "dram_clk:%d\n", ddrclk->dram_clk); ret = of_property_read_u32(dram_np, "dram_para[24]", &ddrclk->dram_div); if (ret) { @@ -263,7 +263,7 @@ static int ddr_clock_probe(struct platform_device *pdev) } } - sunxi_err(NULL, "dram_div:0x%x\n", ddrclk->dram_div); + sunxi_info(NULL, "dram_div:0x%x\n", ddrclk->dram_div); ddrclk->ccmu_base = of_iomap(np, 0); if (!ddrclk->ccmu_base) { diff --git a/bsp/drivers/misc/sunxi-rf/sunxi-bluetooth.c b/bsp/drivers/misc/sunxi-rf/sunxi-bluetooth.c index eca7b61ff..42467d43a 100644 --- a/bsp/drivers/misc/sunxi-rf/sunxi-bluetooth.c +++ b/bsp/drivers/misc/sunxi-rf/sunxi-bluetooth.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -220,7 +221,7 @@ int sunxi_bt_init(struct platform_device *pdev) if (!dev) return -ENOMEM; - if (!np) + if (!np || !of_device_is_available(np)) return 0; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); diff --git a/bsp/drivers/misc/sunxi-rf/sunxi-gnss.c b/bsp/drivers/misc/sunxi-rf/sunxi-gnss.c index f00ccaed3..9c246ce3b 100644 --- a/bsp/drivers/misc/sunxi-rf/sunxi-gnss.c +++ b/bsp/drivers/misc/sunxi-rf/sunxi-gnss.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -221,7 +222,7 @@ int sunxi_gnss_init(struct platform_device *pdev) if (!dev) return -ENOMEM; - if (!np) + if (!np || !of_device_is_available(np)) return 0; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); diff --git a/bsp/drivers/misc/sunxi-rf/sunxi-modem.c b/bsp/drivers/misc/sunxi-rf/sunxi-modem.c index b8ca67466..2fd9c7add 100644 --- a/bsp/drivers/misc/sunxi-rf/sunxi-modem.c +++ b/bsp/drivers/misc/sunxi-rf/sunxi-modem.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -176,7 +177,7 @@ int sunxi_modem_init(struct platform_device *pdev) if (!dev) return -ENOMEM; - if (!np) + if (!np || !of_device_is_available(np)) return 0; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); diff --git a/bsp/drivers/misc/sunxi-rf/sunxi-rfkill.c b/bsp/drivers/misc/sunxi-rf/sunxi-rfkill.c index c5d190faf..015f33968 100644 --- a/bsp/drivers/misc/sunxi-rf/sunxi-rfkill.c +++ b/bsp/drivers/misc/sunxi-rf/sunxi-rfkill.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -111,7 +112,7 @@ static int rfkill_probe(struct platform_device *pdev) dev_info(dev, "module version: %s\n", MODULE_CUR_VERSION); data->pctrl = devm_pinctrl_get(dev); if (IS_ERR(data->pctrl)) { - dev_warn(dev, "devm_pinctrl_get() failed!\n"); + dev_dbg(dev, "no pinctrl state configured\n"); } else { pctrl_state = pinctrl_lookup_state(data->pctrl, pctrl_name); if (IS_ERR(pctrl_state)) { @@ -132,7 +133,7 @@ static int rfkill_probe(struct platform_device *pdev) data->gpio_chip_en = of_get_named_gpio_flags(np, "chip_en", 0, &config); #endif if (!gpio_is_valid(data->gpio_chip_en)) { - dev_err(dev, "get gpio chip_en failed\n"); + dev_dbg(dev, "no chip_en gpio configured\n"); } else { #if (LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0)) of_property_read_u32_index(np, "chip_en", 3, &config); @@ -163,7 +164,7 @@ static int rfkill_probe(struct platform_device *pdev) data->gpio_power_en = of_get_named_gpio_flags(np, "power_en", 0, &config); #endif if (!gpio_is_valid(data->gpio_power_en)) { - dev_err(dev, "get gpio power_en failed\n"); + dev_dbg(dev, "no power_en gpio configured\n"); } else { #if (LINUX_VERSION_CODE > KERNEL_VERSION(6, 2, 0)) of_property_read_u32_index(np, "power_en", 3, &config); @@ -180,7 +181,7 @@ static int rfkill_probe(struct platform_device *pdev) return ret; } - ret = gpio_direction_output(data->gpio_power_en, !data->gpio_power_en); + ret = gpio_direction_output(data->gpio_power_en, !data->gpio_power_en_assert); if (ret < 0) { dev_err(dev, "can't request output direction power_en gpio %d\n", data->gpio_power_en); diff --git a/bsp/drivers/misc/sunxi-rf/sunxi-wlan.c b/bsp/drivers/misc/sunxi-rf/sunxi-wlan.c index 813a7678a..8493e1608 100644 --- a/bsp/drivers/misc/sunxi-rf/sunxi-wlan.c +++ b/bsp/drivers/misc/sunxi-rf/sunxi-wlan.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -280,7 +281,7 @@ int sunxi_wlan_init(struct platform_device *pdev) if (!dev) return -ENOMEM; - if (!np) + if (!np || !of_device_is_available(np)) return 0; data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);