Skip to contentSkip to conversation

arm64: dts: allwinner: h616: orangepi-zero2w: add 24-pin expansion overlay

PATCH In review Vladimir 3 participants 6 messages Sep 23 – Sep 24

Subsystems (2)
lore
Share & tools
lore

Vladimir

author
#0 lore raw

PATCH v3 1/2 arm64: dts: allwinner: h616: orangepi-zero2w: add 24-pin expansion overlay

The optional 24-pin expansion board carries two buttons on LRADC channel 0 and an IR receiver. Keep them out of the base board .dts: with the board detached the LRADC input and the IR receiver pin are not driven and float, which can produce phantom key presses and interrupt storms.

Provide them as a devicetree overlay instead, following the existing sun8i-orangepi-zero-interface-board.dtso approach.

Tested on: OrangePi Zero 2W (Allwinner H618) with the 24-pin expansion board.

---
 arch/arm64/boot/dts/allwinner/Makefile        |  2 +
 .../sun50i-h618-orangepi-zero2w-24pin.dtso    | 42 +++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w-24pin.dtso
arch/arm64/boot/dts/allwinner/Makefile +2 -0
index d1f768dd646..e4576030276 100644
@@ -57,6 +57,8 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-orangepi-zero2.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-x96-mate.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-longanpi-3h.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-orangepi-zero2w.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-orangepi-zero2w-24pin.dtb
+sun50i-h618-orangepi-zero2w-24pin-dtbs := sun50i-h618-orangepi-zero2w.dtb sun50i-h618-orangepi-zero2w-24pin.dtbo
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-orangepi-zero3.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-transpeed-8k618-t.dtb
 dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-yuzukihd-chameleon.dtb
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w-24pin.dtso new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.55.0.windows.3
author
#1 lore raw

PATCH v3 2/2 arm64: dts: allwinner: h616: orangepi-zero2w: add SDIO WiFi/BT (AW859A)

Enable the SDIO bus (mmc1) and power the on-board AW859A (UWE5622) WiFi/BT combo through an mmc-pwrseq-simple that resets WL_REG_ON (PG18) and gates the RTC 32 kHz fanout clock (PG10), with the 3.3 V and 1.8 V supplies.

The pwrseq clock must be named "ext_clock" (what mmc-pwrseq-simple requests) and its output pin must be muxed to the clock function, as done for the other H616/H618 boards.

Tested on: OrangePi Zero 2W (Allwinner H618) with the out-of-tree uwe5622 driver.

---
 .../allwinner/sun50i-h618-orangepi-zero2w.dts | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w.dts +42 -0
index ff9b40352a5..39f580af15b 100644
@@ -189,3 +189,45 @@ &usbphy {
 	usb1_vbus-supply = <&reg_vcc5v>;
 	status = "okay";
 };
+
+/ {
+	reg_vcc33_wifi: vcc33-wifi {
+		/* Always-on 3.3V regulator for WiFi and BT */
+		compatible = "regulator-fixed";
+		regulator-name = "vcc33-wifi";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+		vin-supply = <&reg_vcc5v>;
+	};
+
+	reg_vcc_wifi_io: vcc-wifi-io {
+		/* Always-on 1.8V regulator for WiFi and BT IO */
+		compatible = "regulator-fixed";
+		regulator-name = "vcc-wifi-io";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-always-on;
+		vin-supply = <&reg_vcc33_wifi>;
+	};
+
+	wifi_pwrseq: wifi-pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		clocks = <&rtc CLK_OSC32K_FANOUT>;
+		clock-names = "ext_clock";
+		pinctrl-names = "default";
+		pinctrl-0 = <&x32clk_fanout_pin>;
+		reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>;	/* PG18 */
+		post-power-on-delay-ms = <200>;
+	};
+};
+
+&mmc1 {
+	vmmc-supply = <&reg_vcc33_wifi>;
+	vqmmc-supply = <&reg_vcc_wifi_io>;
+	mmc-pwrseq = <&wifi_pwrseq>;
+	bus-width = <4>;
+	non-removable;
+	mmc-ddr-1_8v;
+	status = "okay";
+};
Signature · 1 line
2.55.0.windows.3
#2 lore raw

Re: [PATCH v3 2/2] arm64: dts: allwinner: h616: orangepi-zero2w: add SDIO WiFi/BT (AW859A)

Hi,

your threading looks somewhat off, and you are missing a cover letter, so I am a bit lost in here. But just jumping in here:

Quoted 20 lines · Vladimir

Enable the SDIO bus (mmc1) and power the on-board AW859A (UWE5622) WiFi/BT combo through an mmc-pwrseq-simple that resets WL_REG_ON (PG18) and gates the RTC 32 kHz fanout clock (PG10), with the 3.3 V and 1.8 V supplies.

The pwrseq clock must be named "ext_clock" (what mmc-pwrseq-simple requests) and its output pin must be muxed to the clock function, as done for the other H616/H618 boards.

Tested on: OrangePi Zero 2W (Allwinner H618) with the out-of-tree uwe5622 driver.

---
  .../allwinner/sun50i-h618-orangepi-zero2w.dts | 42 +++++++++++++++++++
  1 file changed, 42 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w.dts +0 -0
index ff9b40352a5..39f580af15b 100644

arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w.dts &usbphy { · line 195

Quoted 7 lines
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w.dts +4 -0
@@ -189,3 +189,45 @@ &usbphy {
  	usb1_vbus-supply = <&reg_vcc5v>;
  	status = "okay";
  };
+
+/ {
+	reg_vcc33_wifi: vcc33-wifi {
+		/* Always-on 3.3V regulator for WiFi and BT */

Why is this a separate regulator? Looking at the schematics, the WiFi chip seems supplied by VCC-WIFI, which is connected to DCDCE/VDD33, which is already modelled as reg_vcc3v3, in the .dts file.

arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w.dts &usbphy { · line 205

Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w.dts +10 -0
+		compatible = "regulator-fixed";
+		regulator-name = "vcc33-wifi";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-always-on;
+		vin-supply = <&reg_vcc5v>;
+	};
+
+	reg_vcc_wifi_io: vcc-wifi-io {
+		/* Always-on 1.8V regulator for WiFi and BT IO */

Same here, VCC-WIFI-IO, which is supplied by aldo1. It's naturally the same voltage as the PortG supply, already specified in the "pio" node.

So I think those two regulators can go, and ...

Quoted 12 lines
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w.dts +12 -0
+		compatible = "regulator-fixed";
+		regulator-name = "vcc-wifi-io";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-always-on;
+		vin-supply = <&reg_vcc33_wifi>;
+	};
+
+	wifi_pwrseq: wifi-pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		clocks = <&rtc CLK_OSC32K_FANOUT>;
+		clock-names = "ext_clock";

arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w.dts &usbphy { · line 227

Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w.dts +10 -0
+		pinctrl-names = "default";
+		pinctrl-0 = <&x32clk_fanout_pin>;
+		reset-gpios = <&pio 6 18 GPIO_ACTIVE_LOW>;	/* PG18 */
+		post-power-on-delay-ms = <200>;
+	};
+};
+
+&mmc1 {
+	vmmc-supply = <&reg_vcc33_wifi>;
+	vqmmc-supply = <&reg_vcc_wifi_io>;

... be replaced here with &reg_vcc3v3 and &aldo1, respectively.

And this is all depending on that we actually make DT changes for devices which don't have a binding, and for which we don't specify a child node in here.

Cheers,
Andre

Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w.dts +5 -0
+	mmc-pwrseq = <&wifi_pwrseq>;
+	bus-width = <4>;
+	non-removable;
+	mmc-ddr-1_8v;
+	status = "okay";> +};
#3 lore raw

Re: [PATCH v3 2/2] arm64: dts: allwinner: h616: orangepi-zero2w: add SDIO WiFi/BT (AW859A)

I'd better rework my patch and letter, do more testing and then resend it.

#4 lore raw
In reply to Vladimir
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] dts: missing USB 2.0 nodes in 24-pin expansion board overlay --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dts: missing USB 2.0 nodes in 24-pin expansion board overlay
--

commit 1a9550663d27bb916af61d191100635d3dbfb863
Author: Vladimir <[email protected]>

arm64: dts: allwinner: h616: orangepi-zero2w: add 24-pin expansion overlay

This adds a devicetree overlay for the optional 24-pin expansion board, which provides two buttons on LRADC channel 0 and an IR receiver.

Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w-24pin.dtso new file +0 -0
new file mode 100644
index 0000000000000..2d7e98e4b66d8

[ ... ]

Quoted 13 lines

+&lradc {

arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w-24pin.dtso new file +12 -0
+	vref-supply = <&reg_vcc3v3>;
+	status = "okay";
+	wakeup-source;
+
+	button-1000 {
+		label = "KEY_1";
+		linux,code = <KEY_1>;
+		channel = <0>;
+		voltage = <1000000>;
+	};
+
+	button-1600 {

arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w-24pin.dtso line 42

Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w-24pin.dtso new file +10 -0
+		label = "KEY_ENTER";
+		linux,code = <KEY_ENTER>;
+		channel = <0>;
+		voltage = <1600000>;
+	};
+};
+
+&ir {
+	status = "okay";
+};

[Severity: Medium]
Are the USB 2.0 nodes missing here?

The base board device tree (sun50i-h618-orangepi-zero2w.dts) explicitly leaves USB 2 and 3 disabled, expecting them to be enabled by an overlay. Without references to &ehci2, &ehci3, &ohci2, and &ohci3, the physical USB ports on the 24-pin expansion board will remain disabled and non-functional when this overlay is applied.

Could these nodes be added so the expansion board is fully supported?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#5 lore raw
In reply to Vladimir

Hi Vladimir,

thanks for your patches, but please do not send new revisions that quickly! The kernel doc says to leave *at least* 24 hours between respins, but I would wait even longer: we are all humans, mostly hobbyists, so please give all the reviewers some time to have a look!

Thanks,
Andre

Quoted 78 lines · Vladimir

The optional 24-pin expansion board carries two buttons on LRADC channel 0 and an IR receiver. Keep them out of the base board .dts: with the board detached the LRADC input and the IR receiver pin are not driven and float, which can produce phantom key presses and interrupt storms.

Provide them as a devicetree overlay instead, following the existing sun8i-orangepi-zero-interface-board.dtso approach.

Tested on: OrangePi Zero 2W (Allwinner H618) with the 24-pin expansion board.

---
  arch/arm64/boot/dts/allwinner/Makefile        |  2 +
  .../sun50i-h618-orangepi-zero2w-24pin.dtso    | 42 +++++++++++++++++++
  2 files changed, 44 insertions(+)

create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w-24pin.dtso

arch/arm64/boot/dts/allwinner/Makefile +2 -0
index d1f768dd646..e4576030276 100644
@@ -57,6 +57,8 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-orangepi-zero2.dtb
  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-x96-mate.dtb
  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-longanpi-3h.dtb
  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-orangepi-zero2w.dtb
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-orangepi-zero2w-24pin.dtb
+sun50i-h618-orangepi-zero2w-24pin-dtbs := sun50i-h618-orangepi-zero2w.dtb sun50i-h618-orangepi-zero2w-24pin.dtbo
  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-orangepi-zero3.dtb
  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-transpeed-8k618-t.dtb
  dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-yuzukihd-chameleon.dtb
arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w-24pin.dtso new file +42 -0
new file mode 100644
index 00000000000..2d7e98e4b66
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: (GPL-2.0-or-later OR X11)
+/*
+ * Device tree overlay for the Orange Pi Zero 2W 24-pin expansion board.
+ *
+ * The expansion board provides two buttons wired to LRADC channel 0 and an
+ * IR receiver.  These are only present when the board is attached, so they
+ * are deliberately kept out of the base .dts: on a bare board the LRADC
+ * input and the IR receiver pin are not driven and float, which can cause
+ * phantom key presses and interrupt storms.
+ *
+ * Apply on top of:
+ *   arch/arm64/boot/dts/allwinner/sun50i-h618-orangepi-zero2w.dts
+ */
+
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/input/input.h>
+
+&lradc {
+	vref-supply = <&reg_vcc3v3>;
+	status = "okay";
+	wakeup-source;
+
+	button-1000 {
+		label = "KEY_1";
+		linux,code = <KEY_1>;
+		channel = <0>;
+		voltage = <1000000>;
+	};
+
+	button-1600 {
+		label = "KEY_ENTER";
+		linux,code = <KEY_ENTER>;
+		channel = <0>;
+		voltage = <1600000>;
+	};
+};
+
+&ir {
+	status = "okay";
+};