sun60iw2: align BPI-M8 rfkill power control

This commit is contained in:
Qubot 2026-06-06 18:39:53 +08:00
parent 957c2289ae
commit 5033452fcd
7 changed files with 60 additions and 23 deletions

View File

@ -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>;

View File

@ -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) {

View File

@ -22,6 +22,7 @@
#include <linux/err.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/clk.h>
#include <linux/rfkill.h>
@ -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);

View File

@ -22,6 +22,7 @@
#include <linux/err.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/clk.h>
#include <linux/regulator/consumer.h>
@ -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);

View File

@ -22,6 +22,7 @@
#include <linux/err.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/clk.h>
#include <linux/regulator/consumer.h>
@ -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);

View File

@ -21,6 +21,7 @@
#include <linux/gpio.h>
#include <linux/err.h>
#include <linux/device.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/platform_device.h>
#include <linux/capability.h>
@ -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);

View File

@ -22,6 +22,7 @@
#include <linux/err.h>
#include <linux/device.h>
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/clk.h>
#include <linux/interrupt.h>
@ -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);