MIPS: CI20: Add WiFi / Bluetooth support
Subsystems (3)
Paul Cercueil
maintainercover MIPS: CI20: Add WiFi / Bluetooth support
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(-)
Signature · 1 line
2.39.2
Paul Cercueil
maintainerPATCH 1/9 MIPS: DTS: CI20: Fix regulators
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.
--- arch/mips/boot/dts/ingenic/ci20.dts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/mips/boot/dts/ingenic/ci20.dts +6 -6
@@ -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; }; };
Signature · 1 line
2.39.2
Paul Cercueil
maintainerPATCH 2/9 MIPS: DTS: CI20: Fix ACT8600 regulator node names
In reply to Paul CercueilThe 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.
--- arch/mips/boot/dts/ingenic/ci20.dts | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-)
arch/mips/boot/dts/ingenic/ci20.dts +8 -19
@@ -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;
Signature · 1 line
2.39.2
Re: [PATCH 2/9] MIPS: DTS: CI20: Fix ACT8600 regulator node names
Quoted 7 lines
Am 04.06.2023 um 16:56 schrieb Paul Cercueil <[email protected]>:
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 /
Quoted 9 lines
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 ---
Quoted 90 lines
Fixes 73f2b940474d ("MIPS: CI20: DTS: Add I2C nodes")Signed-off-by Paul Cercueil <[email protected]>---
arch/mips/boot/dts/ingenic/ci20.dts| 27 ++++++++-------------------1 file changed, 8 insertions(+), 19 deletions(-)arch/mips/boot/dts/ingenic/ci20.dts +8
-19@@ -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;Signature · 1 line
2.39.2
Paul Cercueil
maintainerPATCH 3/9 MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators
In reply to Paul CercueilProvide parent regulators to the ACT8600 regulators that need one.
--- arch/mips/boot/dts/ingenic/ci20.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/mips/boot/dts/ingenic/ci20.dts +7 -0
@@ -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 {
Signature · 1 line
2.39.2
Re: [PATCH 3/9] MIPS: DTS: CI20: Add parent supplies to ACT8600 regulators
Quoted 16 lines
Am 04.06.2023 um 16:56 schrieb Paul Cercueil <[email protected]>:
Provide parent regulators to the ACT8600 regulators that need one.
Signed-off-by Paul Cercueil <[email protected]>---
arch/mips/boot/dts/ingenic/ci20.dts| 7 +++++++1 file changed, 7 insertions(+)arch/mips/boot/dts/ingenic/ci20.dts +0
-0
arch/mips/boot/dts/ingenic/ci20.dts regulators { · line 245
Quoted 4 lines
arch/mips/boot/dts/ingenic/ci20.dts +1
-0@@ -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.
Quoted 44 lines
arch/mips/boot/dts/ingenic/ci20.dts +6
-0regulator-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 {Signature · 1 line
2.39.2
Paul Cercueil
maintainerPATCH 4/9 MIPS: DTS: CI20: Do not force-enable CIM and WiFi regulators
In reply to Paul CercueilThese regulators should be enabled by their respective drivers.
--- arch/mips/boot/dts/ingenic/ci20.dts | 3 --- 1 file changed, 3 deletions(-)
arch/mips/boot/dts/ingenic/ci20.dts +0 -3
@@ -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
Signature · 1 line
2.39.2
Paul Cercueil
maintainerPATCH 5/9 MIPS: DTS: CI20: Misc. cleanups
In reply to 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.
--- arch/mips/boot/dts/ingenic/ci20.dts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/mips/boot/dts/ingenic/ci20.dts +4 -4
@@ -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 = <ð0_power>; interrupt-parent = <&gpe>; - interrupts = <19 4>; + interrupts = <19 IRQ_TYPE_EDGE_RISING>; nvmem-cells = <ð0_addr>; nvmem-cell-names = "mac-address";
Signature · 1 line
2.39.2
Re: [PATCH 5/9] MIPS: DTS: CI20: Misc. cleanups
Please find a more useful subject.
Quoted 40 lines
Am 04.06.2023 um 16:56 schrieb Paul Cercueil <[email protected]>:
- 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 <[email protected]>---
arch/mips/boot/dts/ingenic/ci20.dts| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)arch/mips/boot/dts/ingenic/ci20.dts +3
-3@@ -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>;
arch/mips/boot/dts/ingenic/ci20.dts dm9000@6 { · line 441
Quoted 8 lines
arch/mips/boot/dts/ingenic/ci20.dts +1
-1@@ -435,7 +435,7 @@ dm9000@6 { vcc-supply = <ð0_power>; interrupt-parent = <&gpe>; - interrupts = <19 4>; + interrupts = <19 IRQ_TYPE_EDGE_RISING>; nvmem-cells = <ð0_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.
Paul Cercueil
maintainerPATCH 6/9 MIPS: DTS: CI20: Parent MSCMUX clock to MPLL
In reply to Paul CercueilThis 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.
--- arch/mips/boot/dts/ingenic/ci20.dts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/mips/boot/dts/ingenic/ci20.dts +3 -2
@@ -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>; };
Signature · 1 line
2.39.2
Paul Cercueil
maintainerPATCH 7/9 MIPS: DTS: CI20: Enable support for WiFi / Bluetooth
In reply to Paul CercueilWire 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.
--- arch/mips/boot/dts/ingenic/ci20.dts | 88 ++++++++++++++++++++++++----- 1 file changed, 73 insertions(+), 15 deletions(-)
arch/mips/boot/dts/ingenic/ci20.dts +73 -15
@@ -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 {
Signature · 1 line
2.39.2
Re: [PATCH 7/9] MIPS: DTS: CI20: Enable support for WiFi / Bluetooth
Quoted 57 lines
Am 04.06.2023 um 16:56 schrieb Paul Cercueil <[email protected]>:
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 <[email protected]>---
arch/mips/boot/dts/ingenic/ci20.dts| 88 ++++++++++++++++++++++++-----1 file changed, 73 insertions(+), 15 deletions(-)arch/mips/boot/dts/ingenic/ci20.dts +16
-2@@ -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
arch/mips/boot/dts/ingenic/ci20.dts otg_power: fixedregulator-2 { · line 142
Quoted 10 lines
arch/mips/boot/dts/ingenic/ci20.dts +10
-0+ * 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.
Quoted 99 lines
arch/mips/boot/dts/ingenic/ci20.dts +47
-13+ 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 {Signature · 1 line
2.39.2
Paul Cercueil
maintainerPATCH 8/9 MIPS: configs: CI20: Regenerate defconfig
In reply to Paul CercueilJust a "make ci20_defconfig menuconfig savedefconfig" Without changing anything in the menuconfig. No functional change.
--- arch/mips/configs/ci20_defconfig | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
arch/mips/configs/ci20_defconfig +6 -12
@@ -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
Signature · 1 line
2.39.2
Paul Cercueil
maintainerPATCH 9/9 MIPS: configs: CI20: Enable WiFi / Bluetooth
In reply to Paul CercueilEnable 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.
--- arch/mips/configs/ci20_defconfig | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-)
arch/mips/configs/ci20_defconfig +27 -2
@@ -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
Signature · 1 line
2.39.2
Thomas Bogendoerfer
maintainerQuoted 29 lines · 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,
-PaulPaul 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
Quoted 6 lines
arch/mips/boot/dts/ingenic/ci20.dts | 148 +++++++++++++++++++--------- arch/mips/configs/ci20_defconfig | 47 ++++++--- 2 files changed, 133 insertions(+), 62 deletions(-)Signature · 1 line
2.39.2
series 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 ]
Hi Thomas,
Quoted 32 lines
Am 09.06.2023 um 10:23 schrieb Thomas Bogendoerfer <[email protected]>:
Quoted 29 lines · 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,
-PaulPaul 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
Quoted 8 lines
Quoted 6 lines
arch/mips/boot/dts/ingenic/ci20.dts| 148 +++++++++++++++++++---------arch/mips/configs/ci20_defconfig| 47 ++++++---2 files changed, 133 insertions(+), 62 deletions(-)Signature · 1 line
2.39.2series applied to mips-next.
I think this was a little too early. Please see my review.
Best regards,
Nikolaus
Quoted 6 lines
Thomas.
Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a good idea. [ RFC1925, 2.3 ]
Hi Paul,
I was in holidays and could not review this series earlier.
Quoted 12 lines
Am 04.06.2023 um 16:56 schrieb Paul Cercueil <[email protected]>:
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.
Quoted 4 lines
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
Quoted 8 lines
Cheers,
-PaulPaul 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
Quoted 2 lines
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.
Quoted 1 line
MIPS: DTS: CI20: Parent MSCMUX clock to MPLL
^^^ this is only loosely related to Wifi / Bluetooth
Quoted 11 lines
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(-)Signature · 1 line
2.39.2