[RFC 2/3] MIPS: DTS: CI20: fixes for WiFi/Bluetooth

From: H. Nikolaus Schaller
Date: Wed Feb 15 2023 - 12:32:26 EST


CI20 has a BCM4330 based WiFi and Bluetooth module.

- add proper power supply regulators
- fix polarity of some GPIOs
- add a simple pwrseq node for WiFi
- reduce max-frequency for WiFi since 50 MHz seems not to work
- add fixed regulators to activate the BT_WAKE and WL_WAKE gpios
before the chip is powered up.
This can not be done by the driver since it is not loaded if
compiled as kernel module before the WiFi/BT module responds.
- add clock chain from the external i2c rtc through the clk32k
to the WiFi and Bluetooth module.

Signed-off-by: H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>
---
arch/mips/boot/dts/ingenic/ci20.dts | 77 ++++++++++++++++++++++++-----
1 file changed, 65 insertions(+), 12 deletions(-)

diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
index 8f21d2304737c..139507d8c26e3 100644
--- a/arch/mips/boot/dts/ingenic/ci20.dts
+++ b/arch/mips/boot/dts/ingenic/ci20.dts
@@ -97,13 +97,45 @@ ir: ir {
gpios = <&gpe 3 GPIO_ACTIVE_LOW>;
};

+ /* WORKAROUND: Keeping WLAN wake high before power on. No simple driver fix */
+ wlan0_wake: fixedregulator@4 {
+ compatible = "regulator-fixed";
+ regulator-name = "wlan0_wake";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ gpio = <&gpd 9 GPIO_ACTIVE_HIGH>;/* WL_WAKE */
+ enable-active-high;
+ regulator-always-on;
+ };
+
+ /* WORKAROUND: Keeping BT wake high before power on. No simple driver fix */
+ bt_wake: fixedregulator@7 {
+ compatible = "regulator-fixed";
+ regulator-name = "bt_wake";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ gpio = <&gpf 5 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ };
+
+ wlan0_pwrseq: wlan0_pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ reset-gpios = <&gpf 7 GPIO_ACTIVE_LOW>;
+ clocks = <&rtc_dev>;
+ clock-names = "clk32k";
+ post-power-on-delay-ms = <150>;
+ };
+
wlan0_power: fixedregulator@1 {
compatible = "regulator-fixed";

regulator-name = "wlan0_power";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;

- gpio = <&gpb 19 GPIO_ACTIVE_LOW>;
+ gpio = <&gpb 19 GPIO_ACTIVE_HIGH>;
enable-active-high;
+ regulator-always-on;
};

otg_power: fixedregulator@2 {
@@ -159,6 +191,9 @@ &mmc0 {
pinctrl-names = "default";
pinctrl-0 = <&pins_mmc0>;

+ vmmc-supply = <&vcc_33>;
+ vqmmc-supply = <&vcc_33>; /* VDDIOMSC */
+
cd-gpios = <&gpf 20 GPIO_ACTIVE_LOW>;
};

@@ -166,21 +201,34 @@ &mmc1 {
status = "okay";

bus-width = <4>;
- max-frequency = <50000000>;
+ max-frequency = <25000000>;
non-removable;

pinctrl-names = "default";
pinctrl-0 = <&pins_mmc1>;

+ vmmc-supply = <&wlan0_power>;
+ vqmmc-supply = <&wlan0_io>;
+
+ mmc-pwrseq = <&wlan0_pwrseq>;
+
+ #address-cells = <1>;
+ #size-cells = <0>;
+
brcmf: wifi@1 {
-/* reg = <4>;*/
+ reg = <1>;
compatible = "brcm,bcm4330-fmac";
vcc-supply = <&wlan0_power>;
- device-wakeup-gpios = <&gpd 9 GPIO_ACTIVE_HIGH>;
- shutdown-gpios = <&gpf 7 GPIO_ACTIVE_LOW>;
};
};

+&rtc_dev {
+ clocks = <&ext_rtc 0>, <&ext_rtc 0>;
+ clock-names = "rtc", "clk32k";
+
+ system-power-controller;
+};
+
&uart0 {
status = "okay";

@@ -204,11 +252,16 @@ &uart2 {

bluetooth {
compatible = "brcm,bcm4330-bt";
- reset-gpios = <&gpf 8 GPIO_ACTIVE_HIGH>;
- vcc-supply = <&wlan0_power>;
- device-wakeup-gpios = <&gpf 5 GPIO_ACTIVE_HIGH>;
- host-wakeup-gpios = <&gpf 6 GPIO_ACTIVE_HIGH>;
- shutdown-gpios = <&gpf 4 GPIO_ACTIVE_LOW>;
+ vbat-supply = <&wlan0_power &bt_wake>;
+ vddio-supply = <&wlan0_power>;
+ max-speed = <115200>; /* stay with default data rate */
+ brcm,bt-pcm-int-params = [01 02 00 01 01];
+ shutdown-gpios = <&gpf 4 GPIO_ACTIVE_HIGH>;
+ reset-gpios = <&gpf 8 GPIO_ACTIVE_LOW>;
+ interrupt-parent = <&gpf>;
+ interrupts = <6 IRQ_TYPE_EDGE_FALLING>;
+ clocks = <&rtc_dev>;
+ clock-names = "clk32k";
};
};

@@ -270,7 +323,7 @@ vcc_25: LDO_REG5 {
regulator-max-microvolt = <2500000>;
regulator-always-on;
};
- wifi_io: LDO_REG6 {
+ wlan0_io: LDO_REG6 {
regulator-name = "LDO_REG6";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
@@ -344,7 +397,7 @@ &i2c4 {

clock-frequency = <400000>;

- rtc@51 {
+ ext_rtc: rtc@51 {
compatible = "nxp,pcf8563";
reg = <0x51>;

--
2.38.1