Skip to contentSkip to conversation

Make WLAN and Bluetooth basically work for CI20

RFC Applied H. Nikolaus Schaller 3 participants 11 messages Feb 15, 2023 – Feb 19, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Make WLAN and Bluetooth basically work for CI20

RFC V1 2023-02-15 18:31:58:
With the applied patch

rtc: jz4740: Register clock provider for the CLK32K pin

by Paul Cercueil <[email protected]> it is now possible to make the CI20 WiFi and Bluetooth setup do something reasonable.

This series adds #clock-cells to the jz4780 and fixes the device tree for the CI20. It contains two ugly workarounds since BL_WAKE and WL_WAKE can not be controlled as shutdown-gpios or device-wakeup-gpios by the drivers. We also update the power setup and sequencing and add a clock chain for the 32 kHz clock.
Finally, we enable some required CONFIGs for the CI20.

Tested on CI20 with v6.2-rc6.

H. Nikolaus Schaller (3):
MIPS: DTS: jz4780: add #clock-cells to rtc_dev
MIPS: DTS: CI20: fixes for WiFi/Bluetooth
MIPS: configs: ci20: enable drivers we need for WiFi/Bluetooth

 arch/mips/boot/dts/ingenic/ci20.dts    | 77 ++++++++++++++++++++++----
 arch/mips/boot/dts/ingenic/jz4780.dtsi |  2 +
 arch/mips/configs/ci20_defconfig       | 18 +++++-
 3 files changed, 84 insertions(+), 13 deletions(-)
Signature · 1 line
2.38.1
#1 lore raw

RFC 1/3 MIPS: DTS: jz4780: add #clock-cells to rtc_dev

This makes the driver present the clk32k signal if requested. It is needed to clock the PMU of the BCM4330 WiFi and Bluetooth module of the CI20 board.

---
 arch/mips/boot/dts/ingenic/jz4780.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/mips/boot/dts/ingenic/jz4780.dtsi +2 -0
index c182a656d63bc..18affff85ce38 100644
@@ -155,6 +155,8 @@ rtc_dev: rtc@10003000 {
 
 		clocks = <&cgu JZ4780_CLK_RTCLK>;
 		clock-names = "rtc";
+
+		#clock-cells = <0>;
 	};
 
 	pinctrl: pin-controller@10010000 {
Signature · 1 line
2.38.1
maintainer Reviewed-by on v1 1/3
#2 lore raw

Re: [RFC 1/3] MIPS: DTS: jz4780: add #clock-cells to rtc_dev

Le mercredi 15 février 2023 à 18:31 +0100, H. Nikolaus Schaller a écrit :

Quoted 5 lines

This makes the driver present the clk32k signal if requested. It is needed to clock the PMU of the BCM4330 WiFi and Bluetooth module of the CI20 board.

Cheers,
-Paul

Quoted 18 lines

---
 arch/mips/boot/dts/ingenic/jz4780.dtsi | 2 ++

 1 file changed, 2 insertions(+)
arch/mips/boot/dts/ingenic/jz4780.dtsi +0 -0
index c182a656d63bc..18affff85ce38 100644
@@ -155,6 +155,8 @@ rtc_dev: rtc@10003000 {


                clocks = <&cgu JZ4780_CLK_RTCLK>;
                clock-names = "rtc";
+
+               #clock-cells = <0>;
        };

        pinctrl: pin-controller@10010000 {

maintainer Applied
#3 lore raw

Re: [RFC 1/3] MIPS: DTS: jz4780: add #clock-cells to rtc_dev

Quoted 17 lines · Paul Cercueil

Le mercredi 15 février 2023 à 18:31 +0100, H. Nikolaus Schaller a écrit :

Quoted 5 lines

This makes the driver present the clk32k signal if requested. It is needed to clock the PMU of the BCM4330 WiFi and Bluetooth module of the CI20 board.

Cheers,
-Paul

Quoted 4 lines

---
 arch/mips/boot/dts/ingenic/jz4780.dtsi | 2 ++

 1 file changed, 2 insertions(+)
Quoted 14 lines
Quoted 6 lines
arch/mips/boot/dts/ingenic/jz4780.dtsi +0 -0
index c182a656d63bc..18affff85ce38 100644
@@ -155,6 +155,8 @@ rtc_dev: rtc@10003000 {
Quoted 8 lines


                clocks = <&cgu JZ4780_CLK_RTCLK>;
                clock-names = "rtc";
+
+               #clock-cells = <0>;
        };

        pinctrl: pin-controller@10010000 {

applied to mips-next.

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
#4 lore raw

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

In reply to H. Nikolaus Schaller

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.

---
 arch/mips/boot/dts/ingenic/ci20.dts | 77 ++++++++++++++++++++++++-----
 1 file changed, 65 insertions(+), 12 deletions(-)
arch/mips/boot/dts/ingenic/ci20.dts +65 -12
index 8f21d2304737c..139507d8c26e3 100644
@@ -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>;
 
Signature · 1 line
2.38.1
#5 lore raw

RFC 3/3 MIPS: configs: ci20: enable drivers we need for WiFi/Bluetooth

In reply to H. Nikolaus Schaller

We need to add CONFIG to load the serdev Bluetooth driver from the DTS hints.

Bluetooth must be configured as built into the kernel, otherwise some components will be loaded in the wrong order.

WLAN must be configured as a kernel module, otherwise the driver will not be loaded properly by the SDIO subsystem. If it is started too early, there is no root file system (if initrd is not present) with the required brcm/BCM4330B1.hcd firmware.

The pcf8563 driver should not be enabled because it can interrupt the 32 kHz clock after the modules are already powered on, depending on the random driver probe sequence.

---
 arch/mips/configs/ci20_defconfig | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
arch/mips/configs/ci20_defconfig +17 -1
index 11f08b6a3013f..2f58d4da30ffb 100644
@@ -68,7 +68,17 @@ CONFIG_DM9000_FORCE_SIMPLE_PHY_POLL=y
 # CONFIG_NET_VENDOR_STMICRO is not set
 # CONFIG_NET_VENDOR_VIA is not set
 # CONFIG_NET_VENDOR_WIZNET is not set
-# CONFIG_WLAN is not set
+CONFIG_WLAN=y
+CONFIG_WLAN_VENDOR_BROADCOM=y
+CONFIG_WIRELESS_EXT=y
+CONFIG_WEXT_CORE=y
+CONFIG_WEXT_PROC=y
+CONFIG_WEXT_PRIV=y
+CONFIG_CFG80211=m
+CONFIG_CFG80211_WEXT=y
+CONFIG_MAC80211=m
+CONFIG_BRCMFMAC=m
+CONFIG_BRCMFMAC_SDIO=y
 CONFIG_KEYBOARD_GPIO=m
 # CONFIG_INPUT_MOUSE is not set
 CONFIG_VT_HW_CONSOLE_BINDING=y
@@ -211,3 +221,9 @@ CONFIG_STACKTRACE=y
 # CONFIG_FTRACE is not set
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="earlycon console=ttyS4,115200 clk_ignore_unused"
+# CONFIG_RTC_DRV_PCF8563 is not set
+CONFIG_BT=y
+CONFIG_BT_HCIUART=y
+CONFIG_BT_HCIUART_BCM=y
+CONFIG_SERIAL_DEV_BUS=y
+CONFIG_SERIAL_DEV_CTRL_TTYPORT=y
Signature · 1 line
2.38.1
maintainer
#6 lore raw
In reply to H. Nikolaus Schaller

Hi Nikolaus,

Le mercredi 15 février 2023 à 18:31 +0100, H. Nikolaus Schaller a écrit :

Quoted 9 lines

RFC V1 2023-02-15 18:31:58:
With the applied patch

rtc: jz4740: Register clock provider for the CLK32K pin

by Paul Cercueil <[email protected]> it is now possible to make the
CI20 WiFi and Bluetooth setup do something reasonable.

Quoted 10 lines

This series adds #clock-cells to the jz4780 and fixes the device tree for
the CI20. It contains two ugly workarounds since BL_WAKE and WL_WAKE can not
be controlled as shutdown-gpios or device-wakeup-gpios by the drivers.
We also update the power setup and sequencing and add a clock chain for
the 32 kHz clock.
Finally, we enable some required CONFIGs for the CI20.

I do have my own patchset that I wanted to send in time for 6.3-rc1, but the RTC patchset was merged very late so I was waiting for -rc1 to be out before sending it to Thomas.

I think my DT changes are better as I have no workarounds. I need to clean up the commits (and have proper commit messages) but you can find my current work there:
https://github.com/OpenDingux/linux/commits/for-upstream-ci20

Cheers,
-Paul

Quoted 14 lines

Tested on CI20 with v6.2-rc6.

H. Nikolaus Schaller (3):
  MIPS: DTS: jz4780: add #clock-cells to rtc_dev
  MIPS: DTS: CI20: fixes for WiFi/Bluetooth
  MIPS: configs: ci20: enable drivers we need for WiFi/Bluetooth

 arch/mips/boot/dts/ingenic/ci20.dts    | 77 ++++++++++++++++++++++-- --
 arch/mips/boot/dts/ingenic/jz4780.dtsi |  2 + arch/mips/configs/ci20_defconfig       | 18 +++++-

 3 files changed, 84 insertions(+), 13 deletions(-)
#7 lore raw

Hi Paul,
I wasn't aware of your work and it could have saved me a lot of time to experiment and try to make my patch set work.

But we are still lucky, as we can merge ideas and find the really best solution.

Anyways you can take my patch 1/3 and 3/3 and we have only to discuss details of 2/3.

Interesting is your setup of several fixed regulators using regulator-settling-time-us to take care of power up sequencing. What I don't understand is the fixedregulator-5 which has no controlling gpio but is always on. What is it needed for? Maybe just to be used to silence v(q)mmc-supply warnings etc.?
But you do not really switch or enable/disable power of the SDIO or bluetooth UART interface?

Is it necessary to add a compatible of "ingenic,iw8103-fmac"? If it works with the standard "brcm,bcm4329-fmac" driver (note that I have "brcm,bcm4330-fmac" because that is how the module identifies itself) there seems to be no need for another compatible and a special bindings documentation.

For bluetooth you could add brcm,bt-pcm-int-params = [01 02 00 01 01]; so that we can eventually add some PCM stream to the sound setup.

Finally you have made node labels more consistent by calling them wifi* while I made them wlan0*... Well, just a matter of taste.

Then I tried to take your tree, add my defconfig (because it seems as if you have not updated configs), but I could only see

[    0.929072] Bluetooth: hci0: BCM: firmware Patch file not found, tried:
[    0.935704] Bluetooth: hci0: BCM: 'brcm/BCM4330B1.img,ci20.hcd'
[    0.941683] Bluetooth: hci0: BCM: 'brcm/BCM4330B1.hcd'
[    0.946827] Bluetooth: hci0: BCM: 'brcm/BCM.img,ci20.hcd'
[    0.952278] Bluetooth: hci0: BCM: 'brcm/BCM.hcd'

and then the kernel is stuck.

So what is your defconfig that I can test your build?

BR and thanks,
Nikolaus

Quoted 53 lines

Am 15.02.2023 um 18:55 schrieb Paul Cercueil <[email protected]>:

Hi Nikolaus,

Le mercredi 15 février 2023 à 18:31 +0100, H. Nikolaus Schaller a écrit :

Quoted 9 lines

RFC V1 2023-02-15 18:31:58:
With the applied patch

rtc: jz4740: Register clock provider for the CLK32K pin

by Paul Cercueil <[email protected]> it is now possible to make the
CI20 WiFi and Bluetooth setup do something reasonable.

Quoted 10 lines

This series adds #clock-cells to the jz4780 and fixes the device tree for
the CI20. It contains two ugly workarounds since BL_WAKE and WL_WAKE can not
be controlled as shutdown-gpios or device-wakeup-gpios by the drivers.
We also update the power setup and sequencing and add a clock chain for
the 32 kHz clock.
Finally, we enable some required CONFIGs for the CI20.

I do have my own patchset that I wanted to send in time for 6.3-rc1, but the RTC patchset was merged very late so I was waiting for -rc1 to be out before sending it to Thomas.

I think my DT changes are better as I have no workarounds. I need to clean up the commits (and have proper commit messages) but you can find my current work there:
https://github.com/OpenDingux/linux/commits/for-upstream-ci20

Cheers,
-Paul

Quoted 14 lines

Tested on CI20 with v6.2-rc6.

H. Nikolaus Schaller (3):
MIPS: DTS: jz4780: add #clock-cells to rtc_dev
MIPS: DTS: CI20: fixes for WiFi/Bluetooth
MIPS: configs: ci20: enable drivers we need for WiFi/Bluetooth

 arch/mips/boot/dts/ingenic/ci20.dts    | 77 ++++++++++++++++++++++--
--
 arch/mips/boot/dts/ingenic/jz4780.dtsi |  2 +
 arch/mips/configs/ci20_defconfig       | 18 +++++-
 3 files changed, 84 insertions(+), 13 deletions(-)
maintainer
#8 lore raw

Hi Nikolaus,

Le mercredi 15 février 2023 à 21:32 +0100, H. Nikolaus Schaller a écrit :

Quoted 11 lines

Hi Paul,
I wasn't aware of your work and it could have saved me a lot of time to
experiment and try to make my patch set work.

But we are still lucky, as we can merge ideas and find the really best solution.

Anyways you can take my patch 1/3 and 3/3 and we have only to discuss details of 2/3.

Quoted 7 lines

Interesting is your setup of several fixed regulators using regulator-settling-time-us
to take care of power up sequencing. What I don't understand is the fixedregulator-5
which has no controlling gpio but is always on. What is it needed for? Maybe just to
be used to silence v(q)mmc-supply warnings etc.?

It's wired to the various inputs of the ACT8600 chip. The driver will complain if they are not connected to anything. And while we're at it, it will also silence the v(q)mmc-supply warnings, yes.

Quoted 3 lines

But you do not really switch or enable/disable power of the SDIO or bluetooth UART
interface?

The badly named "bt_power" regulator powers on the chip, while the "wifi_io" regulator controls the voltage on the VDDIO pins. So these are enabled/disabled when needed.

Quoted 7 lines

Is it necessary to add a compatible of "ingenic,iw8103-fmac"? If it works with the
standard "brcm,bcm4329-fmac" driver (note that I have "brcm,bcm4330- fmac" because that
is how the module identifies itself) there seems to be no need for another compatible
and a special bindings documentation.

The chip has a different name so we can't guarantee that it works exactly like the BCM4330. So that was my reason behind using a new compatible string with a fallback.

However I sent a patch to add the new compatible string to the documentation and it got refused and I was told to just use the brcm,bcm4330-fmac, so I'll just do that.

Quoted 3 lines

For bluetooth you could add brcm,bt-pcm-int-params = [01 02 00 01 01]; so that we
can eventually add some PCM stream to the sound setup.

Sure, does that work though?

One (unrelated) note about Bluetooth, I didn't get it to work properly; it works enough to detect my keyboard and allow me to pair with it (typing the password on the BT keyboard) but it will never connect properly after that.

Quoted 3 lines

Finally you have made node labels more consistent by calling them wifi* while I made
them wlan0*... Well, just a matter of taste.

Actually the node names should use as much as possible the generic names specified in the devicetree specification
(https://www.devicetree.org/specifications/) and "wifi" is one of those.

Quoted 11 lines

Then I tried to take your tree, add my defconfig (because it seems as if you have not
updated configs), but I could only see

[    0.929072] Bluetooth: hci0: BCM: firmware Patch file not found, tried:
[    0.935704] Bluetooth: hci0: BCM: 'brcm/BCM4330B1.img,ci20.hcd' [    0.941683] Bluetooth: hci0: BCM: 'brcm/BCM4330B1.hcd' [    0.946827] Bluetooth: hci0: BCM: 'brcm/BCM.img,ci20.hcd' [    0.952278] Bluetooth: hci0: BCM: 'brcm/BCM.hcd'

Quoted 3 lines

and then the kernel is stuck.

So what is your defconfig that I can test your build?

I test with the OpenDingux userspace so my defconfig is probably very different from yours. What are you using?

About the crash: make sure you have the *very* latest WiFi firmware from
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/

I do remember that one particular version of the firmware will crash the kernel. You also don't need the .hcd firmware for Bluetooth to (somewhat) work.

Quoted 2 lines

BR and thanks,
Nikolaus

Cheers,
-Paul

Quoted 64 lines
Quoted 63 lines

Am 15.02.2023 um 18:55 schrieb Paul Cercueil
<[email protected]>:

Hi Nikolaus,

Le mercredi 15 février 2023 à 18:31 +0100, H. Nikolaus Schaller a écrit :

Quoted 10 lines

RFC V1 2023-02-15 18:31:58:
With the applied patch

rtc: jz4740: Register clock provider for the CLK32K pin

by Paul Cercueil <[email protected]> it is now possible to make
the
CI20 WiFi and Bluetooth setup do something reasonable.

Quoted 13 lines

This series adds #clock-cells to the jz4780 and fixes the device tree
for
the CI20. It contains two ugly workarounds since BL_WAKE and WL_WAKE
can not
be controlled as shutdown-gpios or device-wakeup-gpios by the drivers.
We also update the power setup and sequencing and add a clock chain
for
the 32 kHz clock.
Finally, we enable some required CONFIGs for the CI20.

I do have my own patchset that I wanted to send in time for 6.3- rc1,
but the RTC patchset was merged very late so I was waiting for -rc1 to
be out before sending it to Thomas.

I think my DT changes are better as I have no workarounds. I need to
clean up the commits (and have proper commit messages) but you can find
my current work there:
https://github.com/OpenDingux/linux/commits/for-upstream-ci20

Cheers,
-Paul

Quoted 15 lines

Tested on CI20 with v6.2-rc6.

H. Nikolaus Schaller (3):
  MIPS: DTS: jz4780: add #clock-cells to rtc_dev
  MIPS: DTS: CI20: fixes for WiFi/Bluetooth
  MIPS: configs: ci20: enable drivers we need for WiFi/Bluetooth

 arch/mips/boot/dts/ingenic/ci20.dts    | 77
++++++++++++++++++++++--
--
 arch/mips/boot/dts/ingenic/jz4780.dtsi |  2 + arch/mips/configs/ci20_defconfig       | 18 +++++-

 3 files changed, 84 insertions(+), 13 deletions(-)
#9 lore raw

Hi Paul,

Quoted 45 lines

Am 15.02.2023 um 22:19 schrieb Paul Cercueil <[email protected]>:

Hi Nikolaus,

Le mercredi 15 février 2023 à 21:32 +0100, H. Nikolaus Schaller a écrit :

Quoted 11 lines

Hi Paul,
I wasn't aware of your work and it could have saved me a lot of time to
experiment and try to make my patch set work.

But we are still lucky, as we can merge ideas and find the really best solution.

Anyways you can take my patch 1/3 and 3/3 and we have only to discuss details of 2/3.

Quoted 7 lines

Interesting is your setup of several fixed regulators using regulator-settling-time-us
to take care of power up sequencing. What I don't understand is the fixedregulator-5
which has no controlling gpio but is always on. What is it needed for? Maybe just to
be used to silence v(q)mmc-supply warnings etc.?

It's wired to the various inputs of the ACT8600 chip. The driver will complain if they are not connected to anything. And while we're at it, it will also silence the v(q)mmc-supply warnings, yes.

Quoted 3 lines

But you do not really switch or enable/disable power of the SDIO or bluetooth UART
interface?

The badly named "bt_power" regulator powers on the chip, while the "wifi_io" regulator controls the voltage on the VDDIO pins. So these are enabled/disabled when needed.

Quoted 7 lines

Is it necessary to add a compatible of "ingenic,iw8103-fmac"? If it works with the
standard "brcm,bcm4329-fmac" driver (note that I have "brcm,bcm4330- fmac" because that
is how the module identifies itself) there seems to be no need for another compatible
and a special bindings documentation.

Quoted 3 lines

The chip has a different name so we can't guarantee that it works exactly like the BCM4330. So that was my reason behind using a new compatible string with a fallback.

Ok, that would be a good reason.

Quoted 10 lines

However I sent a patch to add the new compatible string to the documentation and it got refused and I was told to just use the brcm,bcm4330-fmac, so I'll just do that.

Quoted 3 lines

For bluetooth you could add brcm,bt-pcm-int-params = [01 02 00 01 01]; so that we
can eventually add some PCM stream to the sound setup.

Sure, does that work though?

Well, I don't know. We have no sound setup.

Quoted 4 lines

One (unrelated) note about Bluetooth, I didn't get it to work properly; it works enough to detect my keyboard and allow me to pair with it (typing the password on the BT keyboard) but it will never connect properly after that.

I haven't tested it that way in my setup.

Quoted 9 lines
Quoted 4 lines

Finally you have made node labels more consistent by calling them wifi* while I made
them wlan0*... Well, just a matter of taste.

Actually the node names should use as much as possible the generic names specified in the devicetree specification
(https://www.devicetree.org/specifications/) and "wifi" is one of those.

I meant the node labels, not the node names.

BTW: Wi-Fi is a trademark of the Wi-Fi Alliance and means certification while WLAN means the function. Of course the first must be compatible to 802.11 and other standards while a WLAN could use some different technology.

Quoted 12 lines
Quoted 12 lines

Then I tried to take your tree, add my defconfig (because it seems as if you have not
updated configs), but I could only see

[    0.929072] Bluetooth: hci0: BCM: firmware Patch file not found,
tried:
[    0.935704] Bluetooth: hci0: BCM: 'brcm/BCM4330B1.img,ci20.hcd'
[    0.941683] Bluetooth: hci0: BCM: 'brcm/BCM4330B1.hcd'
[    0.946827] Bluetooth: hci0: BCM: 'brcm/BCM.img,ci20.hcd'
[    0.952278] Bluetooth: hci0: BCM: 'brcm/BCM.hcd'
Quoted 6 lines
Quoted 3 lines

and then the kernel is stuck.

So what is your defconfig that I can test your build?

I test with the OpenDingux userspace so my defconfig is probably very different from yours. What are you using?

upstream ci20_defconfig + my patch 3/3.
Otherwise I test with Debian user-space.

Can you share your defconfig just for testing purposes?

Quoted 4 lines

About the crash: make sure you have the *very* latest WiFi firmware from
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/

The BCM4330B1.hcd firmware is missing there. I get mine from

https://github.com/armbian/firmware/raw/master/brcm

And it works with my setup but not yours. So I think something else is missing or wrong. Note that it is loaded from the SD card but the kernel is stuck earlier.

Quoted 3 lines

I do remember that one particular version of the firmware will crash the kernel. You also don't need the .hcd firmware for Bluetooth to (somewhat) work.

Yes, I know. There may also be some race if the drivers are compiled into the kernel that the bluetooth subsystem searches for the .hcd files before the mmc subsystem has found and SD card. Then we have no firmware even if it is stored.

BR,
Nikolaus

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines

Tested on CI20 with v6.2-rc6.

H. Nikolaus Schaller (3):
MIPS: DTS: jz4780: add #clock-cells to rtc_dev
MIPS: DTS: CI20: fixes for WiFi/Bluetooth
MIPS: configs: ci20: enable drivers we need for WiFi/Bluetooth

 arch/mips/boot/dts/ingenic/ci20.dts    | 77
++++++++++++++++++++++--
--
 arch/mips/boot/dts/ingenic/jz4780.dtsi |  2 +
 arch/mips/configs/ci20_defconfig       | 18 +++++-
 3 files changed, 84 insertions(+), 13 deletions(-)
maintainer
#10 lore raw

Hi Nikolaus,

Le jeudi 16 février 2023 à 07:58 +0100, H. Nikolaus Schaller a écrit :

Quoted 122 lines

Hi Paul,

Quoted 56 lines

Am 15.02.2023 um 22:19 schrieb Paul Cercueil
<[email protected]>:

Hi Nikolaus,

Le mercredi 15 février 2023 à 21:32 +0100, H. Nikolaus Schaller a écrit :

Quoted 13 lines

Hi Paul,
I wasn't aware of your work and it could have saved me a lot of time
to
experiment and try to make my patch set work.

But we are still lucky, as we can merge ideas and find the really best solution.

Anyways you can take my patch 1/3 and 3/3 and we have only to discuss
details of 2/3.

Quoted 8 lines

Interesting is your setup of several fixed regulators using regulator-settling-time-us
to take care of power up sequencing. What I don't understand is the
fixedregulator-5
which has no controlling gpio but is always on. What is it needed for? Maybe just to
be used to silence v(q)mmc-supply warnings etc.?

It's wired to the various inputs of the ACT8600 chip. The driver will
complain if they are not connected to anything. And while we're at it,
it will also silence the v(q)mmc-supply warnings, yes.

Quoted 4 lines

But you do not really switch or enable/disable power of the SDIO or
bluetooth UART
interface?

The badly named "bt_power" regulator powers on the chip, while the "wifi_io" regulator controls the voltage on the VDDIO pins. So these
are enabled/disabled when needed.

Quoted 10 lines

Is it necessary to add a compatible of "ingenic,iw8103-fmac"? If it
works with the
standard "brcm,bcm4329-fmac" driver (note that I have "brcm,bcm4330-
fmac" because that
is how the module identifies itself) there seems to be no need for
another compatible
and a special bindings documentation.

Quoted 3 lines

The chip has a different name so we can't guarantee that it works exactly like the BCM4330. So that was my reason behind using a new compatible string with a fallback.

Ok, that would be a good reason.

Quoted 10 lines

However I sent a patch to add the new compatible string to the documentation and it got refused and I was told to just use the brcm,bcm4330-fmac, so I'll just do that.

Quoted 3 lines

For bluetooth you could add brcm,bt-pcm-int-params = [01 02 00 01 01]; so that we
can eventually add some PCM stream to the sound setup.

Sure, does that work though?

Well, I don't know. We have no sound setup.

Quoted 5 lines

One (unrelated) note about Bluetooth, I didn't get it to work properly;
it works enough to detect my keyboard and allow me to pair with it (typing the password on the BT keyboard) but it will never connect properly after that.

I haven't tested it that way in my setup.

Quoted 9 lines
Quoted 4 lines

Finally you have made node labels more consistent by calling them wifi* while I made
them wlan0*... Well, just a matter of taste.

Actually the node names should use as much as possible the generic names specified in the devicetree specification
(https://www.devicetree.org/specifications/) and "wifi" is one of those.

I meant the node labels, not the node names.

BTW: Wi-Fi is a trademark of the Wi-Fi Alliance and means certification
while WLAN means the function. Of course the first must be compatible to 802.11 and other standards while a WLAN could use some different technology.

Quoted 19 lines
Quoted 18 lines

Then I tried to take your tree, add my defconfig (because it seems as
if you have not
updated configs), but I could only see

[    0.929072] Bluetooth: hci0: BCM: firmware Patch file not found,
tried:
[    0.935704] Bluetooth: hci0: BCM:
'brcm/BCM4330B1.img,ci20.hcd'
[    0.941683] Bluetooth: hci0: BCM: 'brcm/BCM4330B1.hcd' [    0.946827] Bluetooth: hci0: BCM: 'brcm/BCM.img,ci20.hcd' [    0.952278] Bluetooth: hci0: BCM: 'brcm/BCM.hcd'

and then the kernel is stuck.

So what is your defconfig that I can test your build?

Quoted 8 lines
Quoted 3 lines

I test with the OpenDingux userspace so my defconfig is probably very
different from yours. What are you using?

upstream ci20_defconfig + my patch 3/3.
Otherwise I test with Debian user-space.

Can you share your defconfig just for testing purposes?

There are my changes to ci20_defconfig:
https://github.com/OpenDingux/linux/commit/52278b1871e6eb7fbdba7a4bda608b37b6cbc1c7

Some of these changes are irrelevant for you and are only for booting the OpenDingux userspace.

Note that all the WEXT stuff in your config can go away if you use a more recent userspace (and use e.g. ip/iw instead of ifconfig/iwconfig).

Cheers,
-Paul

Quoted 44 lines
Quoted 5 lines

About the crash: make sure you have the *very* latest WiFi firmware from
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/

The BCM4330B1.hcd firmware is missing there. I get mine from

https://github.com/armbian/firmware/raw/master/brcm

And it works with my setup but not yours. So I think something else is missing or wrong. Note that it is loaded from the SD card but the kernel is stuck earlier.

Quoted 4 lines

I do remember that one particular version of the firmware will crash
the kernel. You also don't need the .hcd firmware for Bluetooth to (somewhat) work.

Yes, I know. There may also be some race if the drivers are compiled into the kernel that the bluetooth subsystem searches for the .hcd files before the mmc subsystem has found and SD card. Then we have no firmware even if it is stored.

BR,
Nikolaus

Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines

Tested on CI20 with v6.2-rc6.

H. Nikolaus Schaller (3):
  MIPS: DTS: jz4780: add #clock-cells to rtc_dev
  MIPS: DTS: CI20: fixes for WiFi/Bluetooth
  MIPS: configs: ci20: enable drivers we need for
WiFi/Bluetooth

 arch/mips/boot/dts/ingenic/ci20.dts    | 77
++++++++++++++++++++++--
--
 arch/mips/boot/dts/ingenic/jz4780.dtsi |  2 + arch/mips/configs/ci20_defconfig       | 18 +++++-

 3 files changed, 84 insertions(+), 13 deletions(-)