linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support
@ 2023-06-04 14:56 Paul Cercueil
  2023-06-04 14:56 ` [PATCH 1/9] MIPS: DTS: CI20: Fix regulators Paul Cercueil
                   ` (10 more replies)
  0 siblings, 11 replies; 17+ messages in thread
From: Paul Cercueil @ 2023-06-04 14:56 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: H . Nikolaus Schaller, linux-mips, devicetree, linux-kernel,
	list, Paul Cercueil

Hi,

Here's a set of patches to add support for the WiFi / Bluetooth chip on
the CI20.

WiFi works pretty well, provided it is used with the latest firmware
provided by linux-firmware. Bluetooth does not work very well here, as
I cannot get my wireless keyboard to pair; but it does detect it, and it
does see they key presses when I type the pairing code.

I only tested with a somewhat recent (~2022) Buildroot-based userspace.
I enabled WEXT compatibility because the CI20 is typically used with a
very old userspace, but I did not try to use it with old tools like
ifconfig/iwconfig.

Cheers,
-Paul

Paul Cercueil (9):
  MIPS: DTS: CI20: Fix regulators
  MIPS: DTS: CI20: Fix ACT8600 regulator node names
  MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators
  MIPS: DTS: CI20: Do not force-enable CIM and WiFi regulators
  MIPS: DTS: CI20: Misc. cleanups
  MIPS: DTS: CI20: Parent MSCMUX clock to MPLL
  MIPS: DTS: CI20: Enable support for WiFi / Bluetooth
  MIPS: configs: CI20: Regenerate defconfig
  MIPS: configs: CI20: Enable WiFi / Bluetooth

 arch/mips/boot/dts/ingenic/ci20.dts | 148 +++++++++++++++++++---------
 arch/mips/configs/ci20_defconfig    |  47 ++++++---
 2 files changed, 133 insertions(+), 62 deletions(-)

-- 
2.39.2


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH 1/9] MIPS: DTS: CI20: Fix regulators
  2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
@ 2023-06-04 14:56 ` Paul Cercueil
  2023-06-04 14:56 ` [PATCH 2/9] MIPS: DTS: CI20: Fix ACT8600 regulator node names Paul Cercueil
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Paul Cercueil @ 2023-06-04 14:56 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: H . Nikolaus Schaller, linux-mips, devicetree, linux-kernel,
	list, Paul Cercueil

The regulators don't have any "reg" property, and therefore shouldn't
use an unit address in their node names. They also don't need to specify
the GPIO_ACTIVE_LOW flag, which will be ignored anyway, as they are
active-high.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 arch/mips/boot/dts/ingenic/ci20.dts | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
index 239c4537484d..e76953dce2e7 100644
--- a/arch/mips/boot/dts/ingenic/ci20.dts
+++ b/arch/mips/boot/dts/ingenic/ci20.dts
@@ -67,14 +67,14 @@ led-3 {
 		};
 	};
 
-	eth0_power: fixedregulator@0 {
+	eth0_power: fixedregulator-0 {
 		compatible = "regulator-fixed";
 
 		regulator-name = "eth0_power";
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
 
-		gpio = <&gpb 25 GPIO_ACTIVE_LOW>;
+		gpio = <&gpb 25 0>;
 		enable-active-high;
 	};
 
@@ -97,23 +97,23 @@ ir: ir {
 		gpios = <&gpe 3 GPIO_ACTIVE_LOW>;
 	};
 
-	wlan0_power: fixedregulator@1 {
+	wlan0_power: fixedregulator-1 {
 		compatible = "regulator-fixed";
 
 		regulator-name = "wlan0_power";
 
-		gpio = <&gpb 19 GPIO_ACTIVE_LOW>;
+		gpio = <&gpb 19 0>;
 		enable-active-high;
 	};
 
-	otg_power: fixedregulator@2 {
+	otg_power: fixedregulator-2 {
 		compatible = "regulator-fixed";
 
 		regulator-name = "otg_power";
 		regulator-min-microvolt = <5000000>;
 		regulator-max-microvolt = <5000000>;
 
-		gpio = <&gpf 15 GPIO_ACTIVE_LOW>;
+		gpio = <&gpf 15 0>;
 		enable-active-high;
 	};
 };
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/9] MIPS: DTS: CI20: Fix ACT8600 regulator node names
  2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
  2023-06-04 14:56 ` [PATCH 1/9] MIPS: DTS: CI20: Fix regulators Paul Cercueil
@ 2023-06-04 14:56 ` Paul Cercueil
  2023-06-15  7:00   ` H. Nikolaus Schaller
  2023-06-04 14:56 ` [PATCH 3/9] MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators Paul Cercueil
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Paul Cercueil @ 2023-06-04 14:56 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: H . Nikolaus Schaller, linux-mips, devicetree, linux-kernel,
	list, Paul Cercueil

The Device Tree was using invalid node names for the ACT8600 regulators.
To be fair, it is not the original committer's fault, as the
documentation did gives invalid names as well.

In theory, the fix should have been to modify the driver to accept the
alternative names. However, even though the act8865 driver spits
warnings, the kernel seemed to work fine with what is currently
supported upstream. For that reason, I think it is okay to just update
the DTS.

I removed the "regulator-name" too, since they really didn't bring any
information. The node names are enough.

Fixes: 73f2b940474d ("MIPS: CI20: DTS: Add I2C nodes")
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 arch/mips/boot/dts/ingenic/ci20.dts | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
index e76953dce2e7..5361606c5e13 100644
--- a/arch/mips/boot/dts/ingenic/ci20.dts
+++ b/arch/mips/boot/dts/ingenic/ci20.dts
@@ -237,59 +237,49 @@ &i2c0 {
 	act8600: act8600@5a {
 		compatible = "active-semi,act8600";
 		reg = <0x5a>;
-		status = "okay";
 
 		regulators {
-			vddcore: SUDCDC1 {
-				regulator-name = "DCDC_REG1";
+			vddcore: DCDC1 {
 				regulator-min-microvolt = <1100000>;
 				regulator-max-microvolt = <1100000>;
 				regulator-always-on;
 			};
-			vddmem: SUDCDC2 {
-				regulator-name = "DCDC_REG2";
+			vddmem: DCDC2 {
 				regulator-min-microvolt = <1500000>;
 				regulator-max-microvolt = <1500000>;
 				regulator-always-on;
 			};
-			vcc_33: SUDCDC3 {
-				regulator-name = "DCDC_REG3";
+			vcc_33: DCDC3 {
 				regulator-min-microvolt = <3300000>;
 				regulator-max-microvolt = <3300000>;
 				regulator-always-on;
 			};
-			vcc_50: SUDCDC4 {
-				regulator-name = "SUDCDC_REG4";
+			vcc_50: SUDCDC_REG4 {
 				regulator-min-microvolt = <5000000>;
 				regulator-max-microvolt = <5000000>;
 				regulator-always-on;
 			};
-			vcc_25: LDO_REG5 {
-				regulator-name = "LDO_REG5";
+			vcc_25: LDO5 {
 				regulator-min-microvolt = <2500000>;
 				regulator-max-microvolt = <2500000>;
 				regulator-always-on;
 			};
-			wifi_io: LDO_REG6 {
-				regulator-name = "LDO_REG6";
+			wifi_io: LDO6 {
 				regulator-min-microvolt = <2500000>;
 				regulator-max-microvolt = <2500000>;
 				regulator-always-on;
 			};
-			vcc_28: LDO_REG7 {
-				regulator-name = "LDO_REG7";
+			cim_io_28: LDO7 {
 				regulator-min-microvolt = <2800000>;
 				regulator-max-microvolt = <2800000>;
 				regulator-always-on;
 			};
-			vcc_15: LDO_REG8 {
-				regulator-name = "LDO_REG8";
+			cim_io_15: LDO8 {
 				regulator-min-microvolt = <1500000>;
 				regulator-max-microvolt = <1500000>;
 				regulator-always-on;
 			};
 			vrtc_18: LDO_REG9 {
-				regulator-name = "LDO_REG9";
 				/* Despite the datasheet stating 3.3V
 				 * for REG9 and the driver expecting that,
 				 * REG9 outputs 1.8V.
@@ -303,7 +293,6 @@ vrtc_18: LDO_REG9 {
 				regulator-always-on;
 			};
 			vcc_11: LDO_REG10 {
-				regulator-name = "LDO_REG10";
 				regulator-min-microvolt = <1200000>;
 				regulator-max-microvolt = <1200000>;
 				regulator-always-on;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/9] MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators
  2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
  2023-06-04 14:56 ` [PATCH 1/9] MIPS: DTS: CI20: Fix regulators Paul Cercueil
  2023-06-04 14:56 ` [PATCH 2/9] MIPS: DTS: CI20: Fix ACT8600 regulator node names Paul Cercueil
@ 2023-06-04 14:56 ` Paul Cercueil
  2023-06-15  7:00   ` H. Nikolaus Schaller
  2023-06-04 14:56 ` [PATCH 4/9] MIPS: DTS: CI20: Do not force-enable CIM and WiFi regulators Paul Cercueil
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Paul Cercueil @ 2023-06-04 14:56 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: H . Nikolaus Schaller, linux-mips, devicetree, linux-kernel,
	list, Paul Cercueil

Provide parent regulators to the ACT8600 regulators that need one.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 arch/mips/boot/dts/ingenic/ci20.dts | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
index 5361606c5e13..662796acda41 100644
--- a/arch/mips/boot/dts/ingenic/ci20.dts
+++ b/arch/mips/boot/dts/ingenic/ci20.dts
@@ -242,16 +242,19 @@ regulators {
 			vddcore: DCDC1 {
 				regulator-min-microvolt = <1100000>;
 				regulator-max-microvolt = <1100000>;
+				vp1-supply = <&vcc_33v>;
 				regulator-always-on;
 			};
 			vddmem: DCDC2 {
 				regulator-min-microvolt = <1500000>;
 				regulator-max-microvolt = <1500000>;
+				vp2-supply = <&vcc_33v>;
 				regulator-always-on;
 			};
 			vcc_33: DCDC3 {
 				regulator-min-microvolt = <3300000>;
 				regulator-max-microvolt = <3300000>;
+				vp3-supply = <&vcc_33v>;
 				regulator-always-on;
 			};
 			vcc_50: SUDCDC_REG4 {
@@ -262,21 +265,25 @@ vcc_50: SUDCDC_REG4 {
 			vcc_25: LDO5 {
 				regulator-min-microvolt = <2500000>;
 				regulator-max-microvolt = <2500000>;
+				inl-supply = <&vcc_33v>;
 				regulator-always-on;
 			};
 			wifi_io: LDO6 {
 				regulator-min-microvolt = <2500000>;
 				regulator-max-microvolt = <2500000>;
+				inl-supply = <&vcc_33v>;
 				regulator-always-on;
 			};
 			cim_io_28: LDO7 {
 				regulator-min-microvolt = <2800000>;
 				regulator-max-microvolt = <2800000>;
+				inl-supply = <&vcc_33v>;
 				regulator-always-on;
 			};
 			cim_io_15: LDO8 {
 				regulator-min-microvolt = <1500000>;
 				regulator-max-microvolt = <1500000>;
+				inl-supply = <&vcc_33v>;
 				regulator-always-on;
 			};
 			vrtc_18: LDO_REG9 {
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/9] MIPS: DTS: CI20: Do not force-enable CIM and WiFi regulators
  2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
                   ` (2 preceding siblings ...)
  2023-06-04 14:56 ` [PATCH 3/9] MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators Paul Cercueil
@ 2023-06-04 14:56 ` Paul Cercueil
  2023-06-04 14:56 ` [PATCH 5/9] MIPS: DTS: CI20: Misc. cleanups Paul Cercueil
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Paul Cercueil @ 2023-06-04 14:56 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: H . Nikolaus Schaller, linux-mips, devicetree, linux-kernel,
	list, Paul Cercueil

These regulators should be enabled by their respective drivers.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 arch/mips/boot/dts/ingenic/ci20.dts | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
index 662796acda41..7f6e7a4e3915 100644
--- a/arch/mips/boot/dts/ingenic/ci20.dts
+++ b/arch/mips/boot/dts/ingenic/ci20.dts
@@ -272,19 +272,16 @@ wifi_io: LDO6 {
 				regulator-min-microvolt = <2500000>;
 				regulator-max-microvolt = <2500000>;
 				inl-supply = <&vcc_33v>;
-				regulator-always-on;
 			};
 			cim_io_28: LDO7 {
 				regulator-min-microvolt = <2800000>;
 				regulator-max-microvolt = <2800000>;
 				inl-supply = <&vcc_33v>;
-				regulator-always-on;
 			};
 			cim_io_15: LDO8 {
 				regulator-min-microvolt = <1500000>;
 				regulator-max-microvolt = <1500000>;
 				inl-supply = <&vcc_33v>;
-				regulator-always-on;
 			};
 			vrtc_18: LDO_REG9 {
 				/* Despite the datasheet stating 3.3V
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 5/9] MIPS: DTS: CI20: Misc. cleanups
  2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
                   ` (3 preceding siblings ...)
  2023-06-04 14:56 ` [PATCH 4/9] MIPS: DTS: CI20: Do not force-enable CIM and WiFi regulators Paul Cercueil
@ 2023-06-04 14:56 ` Paul Cercueil
  2023-06-15  7:01   ` H. Nikolaus Schaller
  2023-06-04 14:56 ` [PATCH 6/9] MIPS: DTS: CI20: Parent MSCMUX clock to MPLL Paul Cercueil
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Paul Cercueil @ 2023-06-04 14:56 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: H . Nikolaus Schaller, linux-mips, devicetree, linux-kernel,
	list, Paul Cercueil

- Use the standard "ecc-engine" property instead of the custom
"ingenic,bch-controller" to get a handle to the BCH controller.

- Respect cell sizes in the Ethernet controller node.

- Use proper macro for interrupt type instead of hardcoding magic
  values.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 arch/mips/boot/dts/ingenic/ci20.dts | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
index 7f6e7a4e3915..b7dbafa1f85d 100644
--- a/arch/mips/boot/dts/ingenic/ci20.dts
+++ b/arch/mips/boot/dts/ingenic/ci20.dts
@@ -356,7 +356,7 @@ nandc: nand-controller@1 {
 		#address-cells = <1>;
 		#size-cells = <0>;
 
-		ingenic,bch-controller = <&bch>;
+		ecc-engine = <&bch>;
 
 		ingenic,nemc-tAS = <10>;
 		ingenic,nemc-tAH = <5>;
@@ -422,8 +422,8 @@ dm9000@6 {
 		pinctrl-names = "default";
 		pinctrl-0 = <&pins_nemc_cs6>;
 
-		reg = <6 0 1   /* addr */
-		       6 2 1>; /* data */
+		reg = <6 0 1>, /* addr */
+		      <6 2 1>; /* data */
 
 		ingenic,nemc-tAS = <15>;
 		ingenic,nemc-tAH = <10>;
@@ -435,7 +435,7 @@ dm9000@6 {
 		vcc-supply = <&eth0_power>;
 
 		interrupt-parent = <&gpe>;
-		interrupts = <19 4>;
+		interrupts = <19 IRQ_TYPE_EDGE_RISING>;
 
 		nvmem-cells = <&eth0_addr>;
 		nvmem-cell-names = "mac-address";
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 6/9] MIPS: DTS: CI20: Parent MSCMUX clock to MPLL
  2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
                   ` (4 preceding siblings ...)
  2023-06-04 14:56 ` [PATCH 5/9] MIPS: DTS: CI20: Misc. cleanups Paul Cercueil
@ 2023-06-04 14:56 ` Paul Cercueil
  2023-06-04 14:56 ` [PATCH 7/9] MIPS: DTS: CI20: Enable support for WiFi / Bluetooth Paul Cercueil
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Paul Cercueil @ 2023-06-04 14:56 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: H . Nikolaus Schaller, linux-mips, devicetree, linux-kernel,
	list, Paul Cercueil

This makes it possible to clock the SD cards much higher, as the MPLL is
running at 1.2 GHz by default. The previous parent was the EXT clock,
which caused the SD cards to be clocked at 24 MHz maximum.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 arch/mips/boot/dts/ingenic/ci20.dts | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
index b7dbafa1f85d..bdbd064c90e1 100644
--- a/arch/mips/boot/dts/ingenic/ci20.dts
+++ b/arch/mips/boot/dts/ingenic/ci20.dts
@@ -129,10 +129,11 @@ &cgu {
 	 */
 	assigned-clocks = <&cgu JZ4780_CLK_OTGPHY>, <&cgu JZ4780_CLK_RTC>,
 			  <&cgu JZ4780_CLK_SSIPLL>, <&cgu JZ4780_CLK_SSI>,
-			  <&cgu JZ4780_CLK_HDMI>;
+			  <&cgu JZ4780_CLK_HDMI>, <&cgu JZ4780_CLK_MSCMUX>;
 	assigned-clock-parents = <0>, <&cgu JZ4780_CLK_RTCLK>,
 				 <&cgu JZ4780_CLK_MPLL>,
-				 <&cgu JZ4780_CLK_SSIPLL>;
+				 <&cgu JZ4780_CLK_SSIPLL>,
+				 <0>, <&cgu JZ4780_CLK_MPLL>;
 	assigned-clock-rates = <48000000>, <0>, <54000000>, <0>, <27000000>;
 };
 
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 7/9] MIPS: DTS: CI20: Enable support for WiFi / Bluetooth
  2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
                   ` (5 preceding siblings ...)
  2023-06-04 14:56 ` [PATCH 6/9] MIPS: DTS: CI20: Parent MSCMUX clock to MPLL Paul Cercueil
@ 2023-06-04 14:56 ` Paul Cercueil
  2023-06-15  7:01   ` H. Nikolaus Schaller
  2023-06-04 14:56 ` [PATCH 8/9] MIPS: configs: CI20: Regenerate defconfig Paul Cercueil
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 17+ messages in thread
From: Paul Cercueil @ 2023-06-04 14:56 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: H . Nikolaus Schaller, linux-mips, devicetree, linux-kernel,
	list, Paul Cercueil

Wire the WiFi/Bluetooth chip properly in the Device Tree.

- Provide it with the correct regulators and clocks;
- Change the MMC I/O bus to 1.8V which seems to be enough;
- Change the MMC I/O bus frequency to 25 MHz as 50 MHz causes errors;
- Fix the Bluetooth powerdown GPIO being inverted and add reset GPIO;
- Convert host-wakeup-gpios to IRQ.

With these changes, the WiFi works properly with the latest firmware
provided by linux-firmware. The Bluetooth does not work very well here,
as I cannot get my wireless keyboard to pair; but it does detect it, and
it does see the key presses when I type the pairing code.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 arch/mips/boot/dts/ingenic/ci20.dts | 88 ++++++++++++++++++++++++-----
 1 file changed, 73 insertions(+), 15 deletions(-)

diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
index bdbd064c90e1..cec0caa2350c 100644
--- a/arch/mips/boot/dts/ingenic/ci20.dts
+++ b/arch/mips/boot/dts/ingenic/ci20.dts
@@ -97,10 +97,15 @@ ir: ir {
 		gpios = <&gpe 3 GPIO_ACTIVE_LOW>;
 	};
 
-	wlan0_power: fixedregulator-1 {
+	bt_power: fixedregulator-1 {
 		compatible = "regulator-fixed";
 
-		regulator-name = "wlan0_power";
+		regulator-name = "bt_power";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-settling-time-us = <1400>;
+
+		vin-supply = <&vcc_50>;
 
 		gpio = <&gpb 19 0>;
 		enable-active-high;
@@ -116,6 +121,40 @@ otg_power: fixedregulator-2 {
 		gpio = <&gpf 15 0>;
 		enable-active-high;
 	};
+
+	wifi_power: fixedregulator-4 {
+		compatible = "regulator-fixed";
+
+		regulator-name = "wifi_power";
+
+		/*
+		 * Technically it's 5V, the WiFi chip has its own internal
+		 * regulators; but the MMC/SD subsystem won't accept such a
+		 * value.
+		 */
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-settling-time-us = <150000>;
+
+		vin-supply = <&bt_power>;
+	};
+
+	vcc_33v: fixedregulator-5 {
+		compatible = "regulator-fixed";
+
+		regulator-name = "vcc_33v";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+	};
+
+	wifi_pwrseq: pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&gpf 7 GPIO_ACTIVE_LOW>;
+
+		clocks = <&rtc_dev>;
+		clock-names = "ext_clock";
+	};
 };
 
 &ext {
@@ -161,24 +200,33 @@ &mmc0 {
 	pinctrl-0 = <&pins_mmc0>;
 
 	cd-gpios = <&gpf 20 GPIO_ACTIVE_LOW>;
+	vmmc-supply = <&vcc_33v>;
+	vqmmc-supply = <&vcc_33v>;
 };
 
 &mmc1 {
 	status = "okay";
 
 	bus-width = <4>;
-	max-frequency = <50000000>;
+	max-frequency = <25000000>;
+	mmc-pwrseq = <&wifi_pwrseq>;
+	vmmc-supply = <&wifi_power>;
+	vqmmc-supply = <&wifi_io>;
 	non-removable;
 
 	pinctrl-names = "default";
 	pinctrl-0 = <&pins_mmc1>;
 
-	brcmf: wifi@1 {
-/*		reg = <4>;*/
-		compatible = "brcm,bcm4330-fmac";
-		vcc-supply = <&wlan0_power>;
-		device-wakeup-gpios = <&gpd 9 GPIO_ACTIVE_HIGH>;
-		shutdown-gpios = <&gpf 7 GPIO_ACTIVE_LOW>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	wifi@1 {
+		compatible = "brcm,bcm4329-fmac";
+		reg = <1>;
+
+		interrupt-parent = <&gpd>;
+		interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
+		interrupt-names = "host-wake";
 	};
 };
 
@@ -205,11 +253,20 @@ &uart2 {
 
 	bluetooth {
 		compatible = "brcm,bcm4330-bt";
-		reset-gpios = <&gpf 8 GPIO_ACTIVE_HIGH>;
-		vcc-supply = <&wlan0_power>;
+
+		vbat-supply = <&bt_power>;
+		vddio-supply = <&wifi_io>;
+
+		interrupt-parent = <&gpf>;
+		interrupts = <6 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "host-wakeup";
+
+		clocks = <&rtc_dev>;
+		clock-names = "lpo";
+
+		reset-gpios = <&gpf 8 GPIO_ACTIVE_LOW>;
 		device-wakeup-gpios = <&gpf 5 GPIO_ACTIVE_HIGH>;
-		host-wakeup-gpios = <&gpf 6 GPIO_ACTIVE_HIGH>;
-		shutdown-gpios = <&gpf 4 GPIO_ACTIVE_LOW>;
+		shutdown-gpios = <&gpf 4 GPIO_ACTIVE_HIGH>;
 	};
 };
 
@@ -270,8 +327,9 @@ vcc_25: LDO5 {
 				regulator-always-on;
 			};
 			wifi_io: LDO6 {
-				regulator-min-microvolt = <2500000>;
-				regulator-max-microvolt = <2500000>;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-settling-time-us = <150000>;
 				inl-supply = <&vcc_33v>;
 			};
 			cim_io_28: LDO7 {
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 8/9] MIPS: configs: CI20: Regenerate defconfig
  2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
                   ` (6 preceding siblings ...)
  2023-06-04 14:56 ` [PATCH 7/9] MIPS: DTS: CI20: Enable support for WiFi / Bluetooth Paul Cercueil
@ 2023-06-04 14:56 ` Paul Cercueil
  2023-06-04 14:56 ` [PATCH 9/9] MIPS: configs: CI20: Enable WiFi / Bluetooth Paul Cercueil
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 17+ messages in thread
From: Paul Cercueil @ 2023-06-04 14:56 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: H . Nikolaus Schaller, linux-mips, devicetree, linux-kernel,
	list, Paul Cercueil

Just a "make ci20_defconfig menuconfig savedefconfig"
Without changing anything in the menuconfig. No functional change.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 arch/mips/configs/ci20_defconfig | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/arch/mips/configs/ci20_defconfig b/arch/mips/configs/ci20_defconfig
index 11f08b6a3013..a161387f8fce 100644
--- a/arch/mips/configs/ci20_defconfig
+++ b/arch/mips/configs/ci20_defconfig
@@ -19,19 +19,19 @@ CONFIG_USER_NS=y
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_KALLSYMS_ALL=y
 CONFIG_EMBEDDED=y
-# CONFIG_VM_EVENT_COUNTERS is not set
-# CONFIG_COMPAT_BRK is not set
-CONFIG_SLAB=y
 CONFIG_MACH_INGENIC_SOC=y
 CONFIG_JZ4780_CI20=y
 CONFIG_HIGHMEM=y
 CONFIG_HZ_100=y
-# CONFIG_SECCOMP is not set
 # CONFIG_SUSPEND is not set
+# CONFIG_SECCOMP is not set
 CONFIG_MODULES=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+CONFIG_SLAB=y
+# CONFIG_COMPAT_BRK is not set
 # CONFIG_COMPACTION is not set
 CONFIG_CMA=y
+# CONFIG_VM_EVENT_COUNTERS is not set
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
@@ -71,7 +71,6 @@ CONFIG_DM9000_FORCE_SIMPLE_PHY_POLL=y
 # CONFIG_WLAN is not set
 CONFIG_KEYBOARD_GPIO=m
 # CONFIG_INPUT_MOUSE is not set
-CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_LEGACY_PTY_COUNT=2
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
@@ -99,13 +98,12 @@ CONFIG_IR_GPIO_CIR=m
 CONFIG_IR_GPIO_TX=m
 CONFIG_MEDIA_SUPPORT=m
 CONFIG_DRM=m
+CONFIG_DRM_DISPLAY_CONNECTOR=m
 CONFIG_DRM_INGENIC=m
 CONFIG_DRM_INGENIC_DW_HDMI=m
-CONFIG_DRM_DISPLAY_CONNECTOR=m
-# CONFIG_VGA_CONSOLE is not set
 CONFIG_FB=y
+# CONFIG_VGA_CONSOLE is not set
 CONFIG_FRAMEBUFFER_CONSOLE=y
-# CONFIG_HID is not set
 CONFIG_USB=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_DWC2=y
@@ -125,7 +123,6 @@ CONFIG_LEDS_TRIGGER_HEARTBEAT=y
 CONFIG_LEDS_TRIGGER_BACKLIGHT=m
 CONFIG_LEDS_TRIGGER_CPU=y
 CONFIG_LEDS_TRIGGER_ACTIVITY=y
-CONFIG_LEDS_TRIGGER_GPIO=y
 CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
 CONFIG_LEDS_TRIGGER_TRANSIENT=y
 CONFIG_LEDS_TRIGGER_CAMERA=m
@@ -144,7 +141,6 @@ CONFIG_JZ4780_NEMC=y
 CONFIG_PWM=y
 CONFIG_PWM_JZ4740=m
 CONFIG_NVMEM_JZ4780_EFUSE=y
-CONFIG_JZ4770_PHY=y
 CONFIG_EXT4_FS=y
 # CONFIG_DNOTIFY is not set
 CONFIG_AUTOFS_FS=y
@@ -157,7 +153,6 @@ CONFIG_CONFIGFS_FS=y
 CONFIG_UBIFS_FS=y
 CONFIG_NFS_FS=y
 CONFIG_ROOT_NFS=y
-CONFIG_NLS=y
 CONFIG_NLS_CODEPAGE_437=y
 CONFIG_NLS_CODEPAGE_737=y
 CONFIG_NLS_CODEPAGE_775=y
@@ -206,7 +201,6 @@ CONFIG_DEBUG_FS=y
 CONFIG_PANIC_ON_OOPS=y
 CONFIG_PANIC_TIMEOUT=10
 # CONFIG_SCHED_DEBUG is not set
-# CONFIG_DEBUG_PREEMPT is not set
 CONFIG_STACKTRACE=y
 # CONFIG_FTRACE is not set
 CONFIG_CMDLINE_BOOL=y
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 9/9] MIPS: configs: CI20: Enable WiFi / Bluetooth
  2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
                   ` (7 preceding siblings ...)
  2023-06-04 14:56 ` [PATCH 8/9] MIPS: configs: CI20: Regenerate defconfig Paul Cercueil
@ 2023-06-04 14:56 ` Paul Cercueil
  2023-06-09  8:23 ` [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Thomas Bogendoerfer
  2023-06-15  7:00 ` H. Nikolaus Schaller
  10 siblings, 0 replies; 17+ messages in thread
From: Paul Cercueil @ 2023-06-04 14:56 UTC (permalink / raw)
  To: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: H . Nikolaus Schaller, linux-mips, devicetree, linux-kernel,
	list, Paul Cercueil

Enable the required drivers for the WiFi / Bluetooth functionality.

I enabled WEXT compatibility as well since the CI20 is typically used
with a very old userspace.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 arch/mips/configs/ci20_defconfig | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/arch/mips/configs/ci20_defconfig b/arch/mips/configs/ci20_defconfig
index a161387f8fce..920b27977dac 100644
--- a/arch/mips/configs/ci20_defconfig
+++ b/arch/mips/configs/ci20_defconfig
@@ -40,7 +40,12 @@ CONFIG_IP_PNP=y
 CONFIG_IP_PNP_DHCP=y
 # CONFIG_INET_DIAG is not set
 # CONFIG_IPV6 is not set
-# CONFIG_WIRELESS is not set
+CONFIG_BT=m
+# CONFIG_BT_LE is not set
+CONFIG_BT_HCIUART=m
+CONFIG_BT_HCIUART_BCM=y
+CONFIG_CFG80211=m
+CONFIG_CFG80211_WEXT=y
 CONFIG_DEVTMPFS=y
 CONFIG_FW_LOADER=m
 # CONFIG_ALLOW_DEV_COREDUMP is not set
@@ -68,7 +73,25 @@ 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_VENDOR_ADMTEK is not set
+# CONFIG_WLAN_VENDOR_ATH is not set
+# CONFIG_WLAN_VENDOR_ATMEL is not set
+CONFIG_BRCMFMAC=m
+# CONFIG_WLAN_VENDOR_CISCO is not set
+# CONFIG_WLAN_VENDOR_INTEL is not set
+# CONFIG_WLAN_VENDOR_INTERSIL is not set
+# CONFIG_WLAN_VENDOR_MARVELL is not set
+# CONFIG_WLAN_VENDOR_MEDIATEK is not set
+# CONFIG_WLAN_VENDOR_MICROCHIP is not set
+# CONFIG_WLAN_VENDOR_PURELIFI is not set
+# CONFIG_WLAN_VENDOR_RALINK is not set
+# CONFIG_WLAN_VENDOR_REALTEK is not set
+# CONFIG_WLAN_VENDOR_RSI is not set
+# CONFIG_WLAN_VENDOR_SILABS is not set
+# CONFIG_WLAN_VENDOR_ST is not set
+# CONFIG_WLAN_VENDOR_TI is not set
+# CONFIG_WLAN_VENDOR_ZYDAS is not set
+# CONFIG_WLAN_VENDOR_QUANTENNA is not set
 CONFIG_KEYBOARD_GPIO=m
 # CONFIG_INPUT_MOUSE is not set
 CONFIG_LEGACY_PTY_COUNT=2
@@ -78,6 +101,7 @@ CONFIG_SERIAL_8250_NR_UARTS=5
 CONFIG_SERIAL_8250_RUNTIME_UARTS=5
 CONFIG_SERIAL_8250_INGENIC=y
 CONFIG_SERIAL_OF_PLATFORM=y
+CONFIG_SERIAL_DEV_BUS=y
 CONFIG_I2C=y
 CONFIG_I2C_JZ4780=y
 CONFIG_SPI=y
@@ -191,6 +215,7 @@ CONFIG_NLS_ISO8859_15=y
 CONFIG_NLS_KOI8_R=y
 CONFIG_NLS_KOI8_U=y
 CONFIG_NLS_UTF8=y
+# CONFIG_CRYPTO_AES is not set
 CONFIG_DMA_CMA=y
 CONFIG_CMA_SIZE_MBYTES=32
 CONFIG_PRINTK_TIME=y
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support
  2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
                   ` (8 preceding siblings ...)
  2023-06-04 14:56 ` [PATCH 9/9] MIPS: configs: CI20: Enable WiFi / Bluetooth Paul Cercueil
@ 2023-06-09  8:23 ` Thomas Bogendoerfer
  2023-06-15  7:08   ` H. Nikolaus Schaller
  2023-06-15  7:00 ` H. Nikolaus Schaller
  10 siblings, 1 reply; 17+ messages in thread
From: Thomas Bogendoerfer @ 2023-06-09  8:23 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	H . Nikolaus Schaller, linux-mips, devicetree, linux-kernel,
	list

On Sun, Jun 04, 2023 at 04:56:33PM +0200, Paul Cercueil wrote:
> Hi,
> 
> Here's a set of patches to add support for the WiFi / Bluetooth chip on
> the CI20.
> 
> WiFi works pretty well, provided it is used with the latest firmware
> provided by linux-firmware. Bluetooth does not work very well here, as
> I cannot get my wireless keyboard to pair; but it does detect it, and it
> does see they key presses when I type the pairing code.
> 
> I only tested with a somewhat recent (~2022) Buildroot-based userspace.
> I enabled WEXT compatibility because the CI20 is typically used with a
> very old userspace, but I did not try to use it with old tools like
> ifconfig/iwconfig.
> 
> Cheers,
> -Paul
> 
> Paul Cercueil (9):
>   MIPS: DTS: CI20: Fix regulators
>   MIPS: DTS: CI20: Fix ACT8600 regulator node names
>   MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators
>   MIPS: DTS: CI20: Do not force-enable CIM and WiFi regulators
>   MIPS: DTS: CI20: Misc. cleanups
>   MIPS: DTS: CI20: Parent MSCMUX clock to MPLL
>   MIPS: DTS: CI20: Enable support for WiFi / Bluetooth
>   MIPS: configs: CI20: Regenerate defconfig
>   MIPS: configs: CI20: Enable WiFi / Bluetooth
> 
>  arch/mips/boot/dts/ingenic/ci20.dts | 148 +++++++++++++++++++---------
>  arch/mips/configs/ci20_defconfig    |  47 ++++++---
>  2 files changed, 133 insertions(+), 62 deletions(-)
> 
> -- 
> 2.39.2

series applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support
  2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
                   ` (9 preceding siblings ...)
  2023-06-09  8:23 ` [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Thomas Bogendoerfer
@ 2023-06-15  7:00 ` H. Nikolaus Schaller
  10 siblings, 0 replies; 17+ messages in thread
From: H. Nikolaus Schaller @ 2023-06-15  7:00 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-mips, devicetree, linux-kernel, list

Hi Paul,
I was in holidays and could not review this series earlier.


> Am 04.06.2023 um 16:56 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> Hi,
> 
> Here's a set of patches to add support for the WiFi / Bluetooth chip on
> the CI20.
> 
> WiFi works pretty well, provided it is used with the latest firmware
> provided by linux-firmware. Bluetooth does not work very well here, as
> I cannot get my wireless keyboard to pair; but it does detect it, and it
> does see they key presses when I type the pairing code.
> 
> I only tested with a somewhat recent (~2022) Buildroot-based userspace.
> I enabled WEXT compatibility because the CI20 is typically used with a
> very old userspace, but I did not try to use it with old tools like
> ifconfig/iwconfig.

^^^ great since not everyone is using memory hungry latest user-space and
ifconfig/iwconfig is also available on some other OS so users like me
can share scripts.


But I had quite some issues with this series.

1. I could not boot my CI20 V2a board after applying the full series to v6.4-rc6
2. bisecting failed because vcc_33v is used in a patch preceding its definition
   leading to DTC compile abort
3. after fixing I could bisect that "MIPS: DTS: CI20: Fix ACT8600 regulator node names"
   is the first bad commit - although I don't see immediately why

So this series seems to be severely broken and I could not even come to
a test of WiFi and/or Bluetooth which the series claims to support.

Comments to some individual patches follow.

Best regards and looking forward to a v2 for testing,
Nikolaus


> 
> Cheers,
> -Paul
> 
> Paul Cercueil (9):
>  MIPS: DTS: CI20: Fix regulators
>  MIPS: DTS: CI20: Fix ACT8600 regulator node names
>  MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators

^^^ should IMHO be a separate series since it is not directly related to WiFi / Bluetooth

>  MIPS: DTS: CI20: Do not force-enable CIM and WiFi regulators
>  MIPS: DTS: CI20: Misc. cleanups

^^^ these two do not compile
The Misc. cleanups do not belong to this topic.

>  MIPS: DTS: CI20: Parent MSCMUX clock to MPLL

^^^ this is only loosely related to Wifi / Bluetooth

>  MIPS: DTS: CI20: Enable support for WiFi / Bluetooth
>  MIPS: configs: CI20: Regenerate defconfig
>  MIPS: configs: CI20: Enable WiFi / Bluetooth
> 
> arch/mips/boot/dts/ingenic/ci20.dts | 148 +++++++++++++++++++---------
> arch/mips/configs/ci20_defconfig    |  47 ++++++---
> 2 files changed, 133 insertions(+), 62 deletions(-)
> 
> -- 
> 2.39.2
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/9] MIPS: DTS: CI20: Fix ACT8600 regulator node names
  2023-06-04 14:56 ` [PATCH 2/9] MIPS: DTS: CI20: Fix ACT8600 regulator node names Paul Cercueil
@ 2023-06-15  7:00   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 17+ messages in thread
From: H. Nikolaus Schaller @ 2023-06-15  7:00 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-mips, devicetree, linux-kernel, list



> Am 04.06.2023 um 16:56 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> The Device Tree was using invalid node names for the ACT8600 regulators.
> To be fair, it is not the original committer's fault, as the
> documentation did gives invalid names as well.

s/did gives /did give /

> 
> In theory, the fix should have been to modify the driver to accept the
> alternative names. However, even though the act8865 driver spits
> warnings, the kernel seemed to work fine with what is currently
> supported upstream. For that reason, I think it is okay to just update
> the DTS.
> 
> I removed the "regulator-name" too, since they really didn't bring any
> information. The node names are enough.

For me this patch breaks boot on my CI20 V2a - but I don't see why.
Maybe the driver or something else relies on regulator names indirectly?

Last and only signs of activity:

U-Boot 2013.10-rc3-00096-gef995a1-dirty (Apr 13 2019 - 19:15:18)

Board: ci20 (r2) (Ingenic XBurst JZ4780 SoC)
DRAM:  1 GiB
NAND:  8192 MiB
MMC:   jz_mmc msc1: 0
*** Warning - bad CRC, using default environment

In:    eserial4
Out:   eserial4
Err:   eserial4
Net:   dm9000
Hit any key to stop autoboot:  0 
4357173 bytes read in 724 ms (5.7 MiB/s)
## Booting kernel from Legacy Image at 88000000 ...
   Image Name:   Linux-6.4.0-rc6+
   Image Type:   MIPS Linux Kernel Image (gzip compressed)
   Data Size:    4357109 Bytes = 4.2 MiB
   Load Address: 80100000
   Entry Point:  80718080
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

[    0.070854] jz4780-nemc 13410000.nemc: /nemc@13410000/efuse@d0 requests invalid bank 0
[    0.078858] jz4780-nemc 13410000.nemc: /nemc@13410000/efuse@d0 has no addresses
[    0.109013] jz4740-rtc 10003000.rtc: hctosys: unable to read the hardware clock
[    0.199104] dm9000 16000000.dm9000: read wrong id 0x00000a46

--- hangs ---

> 
> Fixes: 73f2b940474d ("MIPS: CI20: DTS: Add I2C nodes")
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> arch/mips/boot/dts/ingenic/ci20.dts | 27 ++++++++-------------------
> 1 file changed, 8 insertions(+), 19 deletions(-)
> 
> diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
> index e76953dce2e7..5361606c5e13 100644
> --- a/arch/mips/boot/dts/ingenic/ci20.dts
> +++ b/arch/mips/boot/dts/ingenic/ci20.dts
> @@ -237,59 +237,49 @@ &i2c0 {
> 	act8600: act8600@5a {
> 		compatible = "active-semi,act8600";
> 		reg = <0x5a>;
> -		status = "okay";
> 
> 		regulators {
> -			vddcore: SUDCDC1 {
> -				regulator-name = "DCDC_REG1";
> +			vddcore: DCDC1 {
> 				regulator-min-microvolt = <1100000>;
> 				regulator-max-microvolt = <1100000>;
> 				regulator-always-on;
> 			};
> -			vddmem: SUDCDC2 {
> -				regulator-name = "DCDC_REG2";
> +			vddmem: DCDC2 {
> 				regulator-min-microvolt = <1500000>;
> 				regulator-max-microvolt = <1500000>;
> 				regulator-always-on;
> 			};
> -			vcc_33: SUDCDC3 {
> -				regulator-name = "DCDC_REG3";
> +			vcc_33: DCDC3 {
> 				regulator-min-microvolt = <3300000>;
> 				regulator-max-microvolt = <3300000>;
> 				regulator-always-on;
> 			};
> -			vcc_50: SUDCDC4 {
> -				regulator-name = "SUDCDC_REG4";
> +			vcc_50: SUDCDC_REG4 {
> 				regulator-min-microvolt = <5000000>;
> 				regulator-max-microvolt = <5000000>;
> 				regulator-always-on;
> 			};
> -			vcc_25: LDO_REG5 {
> -				regulator-name = "LDO_REG5";
> +			vcc_25: LDO5 {
> 				regulator-min-microvolt = <2500000>;
> 				regulator-max-microvolt = <2500000>;
> 				regulator-always-on;
> 			};
> -			wifi_io: LDO_REG6 {
> -				regulator-name = "LDO_REG6";
> +			wifi_io: LDO6 {
> 				regulator-min-microvolt = <2500000>;
> 				regulator-max-microvolt = <2500000>;
> 				regulator-always-on;
> 			};
> -			vcc_28: LDO_REG7 {
> -				regulator-name = "LDO_REG7";
> +			cim_io_28: LDO7 {
> 				regulator-min-microvolt = <2800000>;
> 				regulator-max-microvolt = <2800000>;
> 				regulator-always-on;
> 			};
> -			vcc_15: LDO_REG8 {
> -				regulator-name = "LDO_REG8";
> +			cim_io_15: LDO8 {
> 				regulator-min-microvolt = <1500000>;
> 				regulator-max-microvolt = <1500000>;
> 				regulator-always-on;
> 			};
> 			vrtc_18: LDO_REG9 {
> -				regulator-name = "LDO_REG9";
> 				/* Despite the datasheet stating 3.3V
> 				 * for REG9 and the driver expecting that,
> 				 * REG9 outputs 1.8V.
> @@ -303,7 +293,6 @@ vrtc_18: LDO_REG9 {
> 				regulator-always-on;
> 			};
> 			vcc_11: LDO_REG10 {
> -				regulator-name = "LDO_REG10";
> 				regulator-min-microvolt = <1200000>;
> 				regulator-max-microvolt = <1200000>;
> 				regulator-always-on;
> -- 
> 2.39.2
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/9] MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators
  2023-06-04 14:56 ` [PATCH 3/9] MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators Paul Cercueil
@ 2023-06-15  7:00   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 17+ messages in thread
From: H. Nikolaus Schaller @ 2023-06-15  7:00 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-mips, devicetree, linux-kernel, list



> Am 04.06.2023 um 16:56 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> Provide parent regulators to the ACT8600 regulators that need one.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> arch/mips/boot/dts/ingenic/ci20.dts | 7 +++++++
> 1 file changed, 7 insertions(+)
> 
> diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
> index 5361606c5e13..662796acda41 100644
> --- a/arch/mips/boot/dts/ingenic/ci20.dts
> +++ b/arch/mips/boot/dts/ingenic/ci20.dts
> @@ -242,16 +242,19 @@ regulators {
> 			vddcore: DCDC1 {
> 				regulator-min-microvolt = <1100000>;
> 				regulator-max-microvolt = <1100000>;
> +				vp1-supply = <&vcc_33v>;

where is vcc_33v defined?

Unless [7/9] "MIPS: DTS: CI20: Enable support for WiFi / Bluetooth" is applied?

This way the patches in between can't be bisected.

> 				regulator-always-on;
> 			};
> 			vddmem: DCDC2 {
> 				regulator-min-microvolt = <1500000>;
> 				regulator-max-microvolt = <1500000>;
> +				vp2-supply = <&vcc_33v>;
> 				regulator-always-on;
> 			};
> 			vcc_33: DCDC3 {
> 				regulator-min-microvolt = <3300000>;
> 				regulator-max-microvolt = <3300000>;
> +				vp3-supply = <&vcc_33v>;
> 				regulator-always-on;
> 			};
> 			vcc_50: SUDCDC_REG4 {
> @@ -262,21 +265,25 @@ vcc_50: SUDCDC_REG4 {
> 			vcc_25: LDO5 {
> 				regulator-min-microvolt = <2500000>;
> 				regulator-max-microvolt = <2500000>;
> +				inl-supply = <&vcc_33v>;
> 				regulator-always-on;
> 			};
> 			wifi_io: LDO6 {
> 				regulator-min-microvolt = <2500000>;
> 				regulator-max-microvolt = <2500000>;
> +				inl-supply = <&vcc_33v>;
> 				regulator-always-on;
> 			};
> 			cim_io_28: LDO7 {
> 				regulator-min-microvolt = <2800000>;
> 				regulator-max-microvolt = <2800000>;
> +				inl-supply = <&vcc_33v>;
> 				regulator-always-on;
> 			};
> 			cim_io_15: LDO8 {
> 				regulator-min-microvolt = <1500000>;
> 				regulator-max-microvolt = <1500000>;
> +				inl-supply = <&vcc_33v>;
> 				regulator-always-on;
> 			};
> 			vrtc_18: LDO_REG9 {
> -- 
> 2.39.2
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/9] MIPS: DTS: CI20: Misc. cleanups
  2023-06-04 14:56 ` [PATCH 5/9] MIPS: DTS: CI20: Misc. cleanups Paul Cercueil
@ 2023-06-15  7:01   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 17+ messages in thread
From: H. Nikolaus Schaller @ 2023-06-15  7:01 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-mips, devicetree, linux-kernel, list

Please find a more useful subject.

> Am 04.06.2023 um 16:56 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> - Use the standard "ecc-engine" property instead of the custom
> "ingenic,bch-controller" to get a handle to the BCH controller.
> 
> - Respect cell sizes in the Ethernet controller node.
> 
> - Use proper macro for interrupt type instead of hardcoding magic
>  values.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> arch/mips/boot/dts/ingenic/ci20.dts | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
> index 7f6e7a4e3915..b7dbafa1f85d 100644
> --- a/arch/mips/boot/dts/ingenic/ci20.dts
> +++ b/arch/mips/boot/dts/ingenic/ci20.dts
> @@ -356,7 +356,7 @@ nandc: nand-controller@1 {
> 		#address-cells = <1>;
> 		#size-cells = <0>;
> 
> -		ingenic,bch-controller = <&bch>;
> +		ecc-engine = <&bch>;
> 
> 		ingenic,nemc-tAS = <10>;
> 		ingenic,nemc-tAH = <5>;
> @@ -422,8 +422,8 @@ dm9000@6 {
> 		pinctrl-names = "default";
> 		pinctrl-0 = <&pins_nemc_cs6>;
> 
> -		reg = <6 0 1   /* addr */
> -		       6 2 1>; /* data */
> +		reg = <6 0 1>, /* addr */
> +		      <6 2 1>; /* data */
> 
> 		ingenic,nemc-tAS = <15>;
> 		ingenic,nemc-tAH = <10>;
> @@ -435,7 +435,7 @@ dm9000@6 {
> 		vcc-supply = <&eth0_power>;
> 
> 		interrupt-parent = <&gpe>;
> -		interrupts = <19 4>;
> +		interrupts = <19 IRQ_TYPE_EDGE_RISING>;
> 
> 		nvmem-cells = <&eth0_addr>;
> 		nvmem-cell-names = "mac-address";


For better bisecting it would be helpful to split this into 3 patches.

And they are not really related to WiFi/Bluetooth.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 7/9] MIPS: DTS: CI20: Enable support for WiFi / Bluetooth
  2023-06-04 14:56 ` [PATCH 7/9] MIPS: DTS: CI20: Enable support for WiFi / Bluetooth Paul Cercueil
@ 2023-06-15  7:01   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 17+ messages in thread
From: H. Nikolaus Schaller @ 2023-06-15  7:01 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Thomas Bogendoerfer, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, linux-mips, devicetree, linux-kernel, list



> Am 04.06.2023 um 16:56 schrieb Paul Cercueil <paul@crapouillou.net>:
> 
> Wire the WiFi/Bluetooth chip properly in the Device Tree.
> 
> - Provide it with the correct regulators and clocks;
> - Change the MMC I/O bus to 1.8V which seems to be enough;
> - Change the MMC I/O bus frequency to 25 MHz as 50 MHz causes errors;
> - Fix the Bluetooth powerdown GPIO being inverted and add reset GPIO;
> - Convert host-wakeup-gpios to IRQ.
> 
> With these changes, the WiFi works properly with the latest firmware
> provided by linux-firmware. The Bluetooth does not work very well here,
> as I cannot get my wireless keyboard to pair; but it does detect it, and
> it does see the key presses when I type the pairing code.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> arch/mips/boot/dts/ingenic/ci20.dts | 88 ++++++++++++++++++++++++-----
> 1 file changed, 73 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/mips/boot/dts/ingenic/ci20.dts b/arch/mips/boot/dts/ingenic/ci20.dts
> index bdbd064c90e1..cec0caa2350c 100644
> --- a/arch/mips/boot/dts/ingenic/ci20.dts
> +++ b/arch/mips/boot/dts/ingenic/ci20.dts
> @@ -97,10 +97,15 @@ ir: ir {
> 		gpios = <&gpe 3 GPIO_ACTIVE_LOW>;
> 	};
> 
> -	wlan0_power: fixedregulator-1 {
> +	bt_power: fixedregulator-1 {
> 		compatible = "regulator-fixed";
> 
> -		regulator-name = "wlan0_power";
> +		regulator-name = "bt_power";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-settling-time-us = <1400>;
> +
> +		vin-supply = <&vcc_50>;
> 
> 		gpio = <&gpb 19 0>;
> 		enable-active-high;
> @@ -116,6 +121,40 @@ otg_power: fixedregulator-2 {
> 		gpio = <&gpf 15 0>;
> 		enable-active-high;
> 	};
> +
> +	wifi_power: fixedregulator-4 {
> +		compatible = "regulator-fixed";
> +
> +		regulator-name = "wifi_power";
> +
> +		/*
> +		 * Technically it's 5V, the WiFi chip has its own internal
> +		 * regulators; but the MMC/SD subsystem won't accept such a
> +		 * value.
> +		 */
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-settling-time-us = <150000>;
> +
> +		vin-supply = <&bt_power>;
> +	};
> +
> +	vcc_33v: fixedregulator-5 {

why is this defined here? It is used earlier in [3/9] and not directly related to WiFi / Bluetooth

So please move into [3/9] or even before [3/9] as a separate patch.

> +		compatible = "regulator-fixed";
> +
> +		regulator-name = "vcc_33v";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-always-on;
> +	};
> +
> +	wifi_pwrseq: pwrseq {
> +		compatible = "mmc-pwrseq-simple";
> +		reset-gpios = <&gpf 7 GPIO_ACTIVE_LOW>;
> +
> +		clocks = <&rtc_dev>;
> +		clock-names = "ext_clock";
> +	};
> };
> 
> &ext {
> @@ -161,24 +200,33 @@ &mmc0 {
> 	pinctrl-0 = <&pins_mmc0>;
> 
> 	cd-gpios = <&gpf 20 GPIO_ACTIVE_LOW>;
> +	vmmc-supply = <&vcc_33v>;
> +	vqmmc-supply = <&vcc_33v>;
> };
> 
> &mmc1 {
> 	status = "okay";
> 
> 	bus-width = <4>;
> -	max-frequency = <50000000>;
> +	max-frequency = <25000000>;
> +	mmc-pwrseq = <&wifi_pwrseq>;
> +	vmmc-supply = <&wifi_power>;
> +	vqmmc-supply = <&wifi_io>;
> 	non-removable;
> 
> 	pinctrl-names = "default";
> 	pinctrl-0 = <&pins_mmc1>;
> 
> -	brcmf: wifi@1 {
> -/*		reg = <4>;*/
> -		compatible = "brcm,bcm4330-fmac";
> -		vcc-supply = <&wlan0_power>;
> -		device-wakeup-gpios = <&gpd 9 GPIO_ACTIVE_HIGH>;
> -		shutdown-gpios = <&gpf 7 GPIO_ACTIVE_LOW>;
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +
> +	wifi@1 {
> +		compatible = "brcm,bcm4329-fmac";
> +		reg = <1>;
> +
> +		interrupt-parent = <&gpd>;
> +		interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
> +		interrupt-names = "host-wake";
> 	};
> };
> 
> @@ -205,11 +253,20 @@ &uart2 {
> 
> 	bluetooth {
> 		compatible = "brcm,bcm4330-bt";
> -		reset-gpios = <&gpf 8 GPIO_ACTIVE_HIGH>;
> -		vcc-supply = <&wlan0_power>;
> +
> +		vbat-supply = <&bt_power>;
> +		vddio-supply = <&wifi_io>;
> +
> +		interrupt-parent = <&gpf>;
> +		interrupts = <6 IRQ_TYPE_EDGE_RISING>;
> +		interrupt-names = "host-wakeup";
> +
> +		clocks = <&rtc_dev>;
> +		clock-names = "lpo";
> +
> +		reset-gpios = <&gpf 8 GPIO_ACTIVE_LOW>;
> 		device-wakeup-gpios = <&gpf 5 GPIO_ACTIVE_HIGH>;
> -		host-wakeup-gpios = <&gpf 6 GPIO_ACTIVE_HIGH>;
> -		shutdown-gpios = <&gpf 4 GPIO_ACTIVE_LOW>;
> +		shutdown-gpios = <&gpf 4 GPIO_ACTIVE_HIGH>;
> 	};
> };
> 
> @@ -270,8 +327,9 @@ vcc_25: LDO5 {
> 				regulator-always-on;
> 			};
> 			wifi_io: LDO6 {
> -				regulator-min-microvolt = <2500000>;
> -				regulator-max-microvolt = <2500000>;
> +				regulator-min-microvolt = <1800000>;
> +				regulator-max-microvolt = <1800000>;
> +				regulator-settling-time-us = <150000>;
> 				inl-supply = <&vcc_33v>;
> 			};
> 			cim_io_28: LDO7 {
> -- 
> 2.39.2
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support
  2023-06-09  8:23 ` [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Thomas Bogendoerfer
@ 2023-06-15  7:08   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 17+ messages in thread
From: H. Nikolaus Schaller @ 2023-06-15  7:08 UTC (permalink / raw)
  To: Thomas Bogendoerfer
  Cc: Paul Cercueil, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-mips, devicetree, linux-kernel, list

Hi Thomas,

> Am 09.06.2023 um 10:23 schrieb Thomas Bogendoerfer <tsbogend@alpha.franken.de>:
> 
> On Sun, Jun 04, 2023 at 04:56:33PM +0200, Paul Cercueil wrote:
>> Hi,
>> 
>> Here's a set of patches to add support for the WiFi / Bluetooth chip on
>> the CI20.
>> 
>> WiFi works pretty well, provided it is used with the latest firmware
>> provided by linux-firmware. Bluetooth does not work very well here, as
>> I cannot get my wireless keyboard to pair; but it does detect it, and it
>> does see they key presses when I type the pairing code.
>> 
>> I only tested with a somewhat recent (~2022) Buildroot-based userspace.
>> I enabled WEXT compatibility because the CI20 is typically used with a
>> very old userspace, but I did not try to use it with old tools like
>> ifconfig/iwconfig.
>> 
>> Cheers,
>> -Paul
>> 
>> Paul Cercueil (9):
>>  MIPS: DTS: CI20: Fix regulators
>>  MIPS: DTS: CI20: Fix ACT8600 regulator node names
>>  MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators
>>  MIPS: DTS: CI20: Do not force-enable CIM and WiFi regulators
>>  MIPS: DTS: CI20: Misc. cleanups
>>  MIPS: DTS: CI20: Parent MSCMUX clock to MPLL
>>  MIPS: DTS: CI20: Enable support for WiFi / Bluetooth
>>  MIPS: configs: CI20: Regenerate defconfig
>>  MIPS: configs: CI20: Enable WiFi / Bluetooth
>> 
>> arch/mips/boot/dts/ingenic/ci20.dts | 148 +++++++++++++++++++---------
>> arch/mips/configs/ci20_defconfig    |  47 ++++++---
>> 2 files changed, 133 insertions(+), 62 deletions(-)
>> 
>> -- 
>> 2.39.2
> 
> series applied to mips-next.

I think this was a little too early. Please see my review.

Best regards,
Nikolaus

> 
> Thomas.
> 
> -- 
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea.                                                [ RFC1925, 2.3 ]


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2023-06-15  7:20 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-04 14:56 [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Paul Cercueil
2023-06-04 14:56 ` [PATCH 1/9] MIPS: DTS: CI20: Fix regulators Paul Cercueil
2023-06-04 14:56 ` [PATCH 2/9] MIPS: DTS: CI20: Fix ACT8600 regulator node names Paul Cercueil
2023-06-15  7:00   ` H. Nikolaus Schaller
2023-06-04 14:56 ` [PATCH 3/9] MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators Paul Cercueil
2023-06-15  7:00   ` H. Nikolaus Schaller
2023-06-04 14:56 ` [PATCH 4/9] MIPS: DTS: CI20: Do not force-enable CIM and WiFi regulators Paul Cercueil
2023-06-04 14:56 ` [PATCH 5/9] MIPS: DTS: CI20: Misc. cleanups Paul Cercueil
2023-06-15  7:01   ` H. Nikolaus Schaller
2023-06-04 14:56 ` [PATCH 6/9] MIPS: DTS: CI20: Parent MSCMUX clock to MPLL Paul Cercueil
2023-06-04 14:56 ` [PATCH 7/9] MIPS: DTS: CI20: Enable support for WiFi / Bluetooth Paul Cercueil
2023-06-15  7:01   ` H. Nikolaus Schaller
2023-06-04 14:56 ` [PATCH 8/9] MIPS: configs: CI20: Regenerate defconfig Paul Cercueil
2023-06-04 14:56 ` [PATCH 9/9] MIPS: configs: CI20: Enable WiFi / Bluetooth Paul Cercueil
2023-06-09  8:23 ` [PATCH 0/9] MIPS: CI20: Add WiFi / Bluetooth support Thomas Bogendoerfer
2023-06-15  7:08   ` H. Nikolaus Schaller
2023-06-15  7:00 ` H. Nikolaus Schaller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).