Skip to contentSkip to conversation

Enable wifi on the BeagleV-Ahead

PATCH New Thomas Gerner 4 participants 10 messages May 11 – May 14

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

PATCH 1/1 Enable wifi on the BeagleV-Ahead

The BeagleV-Ahead board uses an AP6203BM WiFi chip from AMPAK Technology Inc. connected to SDIO1. The chip is compatible to the broadcom wireless driver.

Enable wifi on the BeagleV-Ahead.

---
 .../boot/dts/thead/th1520-beaglev-ahead.dts   | 50 +++++++++++++++++++
 1 file changed, 50 insertions(+)
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +50 -0
index 91f3f9b987bc..5e0dc47d263c 100644
@@ -86,6 +86,11 @@ hdmi_con_in: endpoint {
 			};
 		};
 	};
+
+	brcmf_pwrseq: brcmf_pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&gpio2 31 GPIO_ACTIVE_LOW>;	/* WL-REG-ON */
+	};
 };
 
 &osc {
@@ -239,6 +244,28 @@ rx-pins {
 			slew-rate = <0>;
 		};
 	};
+
+	wifi_pins: wifi-pins {
+	    host-wake-wl {
+			pins = "GPIO2_25";
+			function = "gpio";
+			bias-pull-up;
+			drive-strength = <1>;
+			input-enable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+
+	    reg-on-wl {
+		    pins = "GPIO2_31";
+		    function = "gpio";
+			bias-pull-up;
+			drive-strength = <3>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+	    };
+	};
 };
 
 &sdio0 {
@@ -247,6 +274,29 @@ &sdio0 {
 	status = "okay";
 };
 
+&sdio1 {
+	bus-width = <4>;
+	max-frequency = <198000000>;
+	status = "okay";
+	#address-cells = <1>;
+	#size-cells = <0>;
+	non-removable;
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&wifi_pins>;
+	mmc-pwrseq = <&brcmf_pwrseq>;
+
+	wifi@1 {
+		compatible = "cypress,cyw43012-fmac", "brcm,bcm4329-fmac";
+		reg = <1>;
+		brcm,sd_head_align = <4>;
+		brcm,sd_sgentry_align = <512>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <25 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "host-wake";
+	};
+};
+
 &dpu {
 	status = "okay";
 };
Signature · 7 lines
2.43.0


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw
Thank you for your contribution! Sashiko AI review found 6 potential issue(s) to consider: - [High] Missing `keep-power-in-suspend` property breaks WoWLAN functionality. - [Medium] Contradictory…

Thank you for your contribution! Sashiko AI review found 6 potential issue(s) to consider:
- [High] Missing keep-power-in-suspend property breaks WoWLAN functionality.
- [Medium] Contradictory pull-up configuration on WiFi GPIOs causes power leakage.
- [Medium] Incorrect hardware-specific compatible string misrepresents the device.
- [Low] The brcm,sd_head_align and brcm,sd_sgentry_align properties are undocumented and ignored.
- [Low] The devicetree node name brcmf_pwrseq uses an underscore instead of a hyphen.
- [Low] Mixed space and tab indentation within the wifi_pins node.
--

commit 927889c06368228ec05bf0df849cea905cfb5d42
Author: Thomas Gerner <[email protected]>

Enable wifi on the BeagleV-Ahead

The BeagleV-Ahead board uses an AP6203BM WiFi chip from AMPAK Technology Inc. connected to SDIO1. The chip is compatible to the broadcom wireless driver.

Quoted 4 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +0 -0
index 91f3f9b987bc3..5e0dc47d263c9 100644

[ ... ]

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts hdmi_con_in: endpoint { · line 90

Quoted 6 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +2 -0
@@ -86,6 +86,11 @@ hdmi_con_in: endpoint {
 			};
 		};
 	};
+
+	brcmf_pwrseq: brcmf_pwrseq {

This isn't a bug, but does the node name violate the devicetree specification? Section 2.2.1 and kernel conventions dictate using hyphens to separate words. Using an underscore here will trigger a node_name_chars_strict warning from the dtc compiler. Should it be renamed to brcmf-pwrseq or wifi-pwrseq?

Quoted 4 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +3 -0
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&gpio2 31 GPIO_ACTIVE_LOW>;	/* WL-REG-ON */
+	};
 };

[ ... ]

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts rx-pins { · line 249

Quoted 7 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +3 -0
@@ -239,6 +244,28 @@ rx-pins {
 			slew-rate = <0>;
 		};
 	};
+
+	wifi_pins: wifi-pins {
+	    host-wake-wl {

This isn't a bug, but are these lines indented with 4 spaces? The Linux kernel coding style requires the exclusive use of tabs for indentation in device tree sources.

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts rx-pins { · line 252

Quoted 3 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +3 -0
+			pins = "GPIO2_25";
+			function = "gpio";
+			bias-pull-up;

Since the host-wake interrupt is configured below as IRQ_TYPE_EDGE_RISING, it implies the signal idles low. Does pulling up a signal that idles low cause continuous power leakage? Should this be configured with bias-disable or bias-pull-down instead?

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts rx-pins { · line 262

Quoted 10 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +10 -0
+			drive-strength = <1>;
+			input-enable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+
+	    reg-on-wl {
+		    pins = "GPIO2_31";
+		    function = "gpio";
+			bias-pull-up;

The mmc-pwrseq-simple configuration uses this pin as an active-low reset and actively drives it low to power off the WiFi chip during sleep or suspend. Could pulling up this pin while it is driven low cause continuous current leakage to ground?

Quoted 7 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +6 -0
+			drive-strength = <3>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+	    };
+	};
 };

[ ... ]

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdio0 { · line 283

Quoted 7 lines

+&sdio1 {

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +6 -0
+	bus-width = <4>;
+	max-frequency = <198000000>;
+	status = "okay";
+	#address-cells = <1>;
+	#size-cells = <0>;
+	non-removable;

Will Wake-on-WLAN (WoWLAN) fail to function without the keep-power-in-suspend property here?

The wifi@1 node below configures an Out-Of-Band host-wake interrupt to support WoWLAN. However, without keep-power-in-suspend on the sdio1 node, the MMC core will not set the MMC_PM_KEEP_POWER flag and will assert the reset GPIO to cut power to the WiFi chip during system suspend.

This would cause the WiFi module to lose its firmware state, rendering the configured OOB interrupt useless.

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdio0 { · line 290

Quoted 7 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +7 -0
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&wifi_pins>;
+	mmc-pwrseq = <&brcmf_pwrseq>;
+
+	wifi@1 {
+		compatible = "cypress,cyw43012-fmac", "brcm,bcm4329-fmac";

Does this compatible string misrepresent the underlying hardware?

The commit message states the board uses an AMPAK AP6203BM WiFi chip, which is based on Broadcom BCM43436 silicon. However, this compatible string corresponds to a dual-band Cypress chip architecture. Should it use an appropriate BCM4343x compatible string (e.g., brcm,bcm43430-fmac) instead?

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdio0 { · line 293

Quoted 3 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +3 -0
+		reg = <1>;
+		brcm,sd_head_align = <4>;
+		brcm,sd_sgentry_align = <512>;

Are these properties used by the kernel?

They do not appear to be defined in the brcm,bcm4329-fmac.yaml binding schema, which strictly enforces unevaluatedProperties: false, and their presence will cause make dtbs_check validation to fail.

A review of the brcmfmac driver also shows these properties are only used for legacy C platform data structs and are never parsed from the device tree.

Quoted 5 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +5 -0
+		interrupt-parent = <&gpio2>;
+		interrupts = <25 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "host-wake";
+	};
+};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#2 lore raw

PATCH 1/1 Enable wifi on the BeagleV-Ahead

In reply to Thomas Gerner

The BeagleV-Ahead board uses an AP6203BM WiFi chip from AMPAK Technology Inc. connected to SDIO1. The chip is compatible to the broadcom wireless driver.

The AP6203BM is a dual-band 2.4GHz/5GHz Wi-Fi 4 (802.11a/b/g/n) and Bluetooth 5.4 module. Bluetooth is not enabled by this patch.

Change in v2:
- consider issues found by sashiko AI review

---
 .../boot/dts/thead/th1520-beaglev-ahead.dts   | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +49 -0
index 91f3f9b987bc..86da4bd8ceaf 100644
@@ -86,6 +86,11 @@ hdmi_con_in: endpoint {
 			};
 		};
 	};
+
+	brcmf_pwrseq: brcmf-pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&gpio2 31 GPIO_ACTIVE_LOW>;	/* WL-REG-ON */
+	};
 };
 
 &osc {
@@ -239,6 +244,28 @@ rx-pins {
 			slew-rate = <0>;
 		};
 	};
+
+	wifi_pins: wifi-pins {
+		host-wake-wl {
+			pins = "GPIO2_25";
+			function = "gpio";
+			bias-disable;
+			drive-strength = <1>;
+			input-enable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+
+		reg-on-wl {
+			pins = "GPIO2_31";
+			function = "gpio";
+			bias-disable;
+			drive-strength = <3>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
 };
 
 &sdio0 {
@@ -247,6 +274,28 @@ &sdio0 {
 	status = "okay";
 };
 
+&sdio1 {
+	bus-width = <4>;
+	max-frequency = <198000000>;
+	status = "okay";
+	#address-cells = <1>;
+	#size-cells = <0>;
+	non-removable;
+	keep-power-in-suspend;
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&wifi_pins>;
+	mmc-pwrseq = <&brcmf_pwrseq>;
+
+	wifi@1 {
+		compatible = "cypress,cyw43012-fmac";
+		reg = <1>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <25 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "host-wake";
+	};
+};
+
 &dpu {
 	status = "okay";
 };
Signature · 1 line
2.43.0
#3 lore raw

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts hdmi_con_in: endpoint { · line 94

Quoted 6 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +5 -0
+
+	brcmf_pwrseq: brcmf-pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&gpio2 31 GPIO_ACTIVE_LOW>;	/* WL-REG-ON */
+	};
  };

I think such pwrseq won't work? Need to set timing parameter, for example:
https://github.com/torvalds/linux/blob/1d5dcaa3bd65f2e8c9baa14a393d3a2dc5db7524/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts#L71

Best regards,
Shengyu

#4 lore raw

Am 12.05.26 um 20:39 schrieb Shengyu Qu:

Quoted 10 lines
Quoted 6 lines

+
+    brcmf_pwrseq: brcmf-pwrseq {
+        compatible = "mmc-pwrseq-simple";
+        reset-gpios = <&gpio2 31 GPIO_ACTIVE_LOW>; /* WL-REG-ON */ +    };
  };

I think such pwrseq won't work? Need to set timing parameter, for example:
https://github.com/torvalds/linux/blob/1d5dcaa3bd65f2e8c9baa14a393d3a2dc5db7524/arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts#L71

I think this is not necessary. The WiFi chip gets powerd up with the board power and the power cannot be disabled. The only job for this pwrseq is to release gpio2 pin 31 when the kernel initialize the chip. According to the data sheet the release of the pin should happen not earlier than 2 cycles of the 32.768kHz clock after powered up. As the kernel start takes much longer than this 2 cycles and I think there is no extra timing necessary.

The broadcom driver has a also a property "reset-gpios", but this does not work. It does not configure the pin as output, it configure it as input. Then the driver does not initialize the chip. May be this is a bug in the broadcom driver, don't know.

Best regards
Thomas

#5 lore raw
In reply to Thomas Gerner
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] Missing mandatory fallback compatible string `brcm,bcm4329-fmac` silently breaks driver interrupt…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Missing mandatory fallback compatible string brcm,bcm4329-fmac silently breaks driver interrupt parsing.
- [Low] Pinctrl node names violate the thead,th1520-pinctrl schema constraints.
--

commit 36b13556394c8110c85a42dc09295453444c2a36
Author: Thomas Gerner <[email protected]>

Enable wifi on the BeagleV-Ahead

The BeagleV-Ahead board uses an AP6203BM WiFi chip from AMPAK Technology Inc. connected to SDIO1.

Quoted 4 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +0 -0
index 91f3f9b987bc3..86da4bd8ceaf9 100644

[ ... ]

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts rx-pins { · line 249

Quoted 7 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +3 -0
@@ -239,6 +244,28 @@ rx-pins {
 			slew-rate = <0>;
 		};
 	};
+
+	wifi_pins: wifi-pins {
+		host-wake-wl {

Does this naming follow the thead,th1520-pinctrl schema constraints?

The schema requires pad group nodes to match the regex -[0-9]+$ (for example, wifi-0) and inner pin-mux child nodes to match -pins$ (for example, host-wake-pins).

Using wifi-pins and host-wake-wl / reg-on-wl will trigger dtbs_check validation errors.

Quoted 10 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +10 -0
+			pins = "GPIO2_25";
+			function = "gpio";
+			bias-disable;
+			drive-strength = <1>;
+			input-enable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+
+		reg-on-wl {

[ ... ]

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdio0 { · line 291

Quoted 2 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +2 -0
+	wifi@1 {
+		compatible = "cypress,cyw43012-fmac";

Does this compatible string need the brcm,bcm4329-fmac fallback?

In drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c, brcmf_of_probe() explicitly checks for this fallback:

	if (!of_device_is_compatible(np, "brcm,bcm4329-fmac"))
		return;

Without the fallback string, the driver skips parsing the interrupts property, which breaks the wake-on-WLAN functionality intended by configuring the host-wake pin.

Quoted 6 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +6 -0
+		reg = <1>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <25 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "host-wake";
+	};
+};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#6 lore raw

PATCH v3 1/1 Enable wifi on the BeagleV-Ahead

In reply to Thomas Gerner

The BeagleV-Ahead board uses an AP6203BM WiFi chip from AMPAK Technology Inc. connected to SDIO1. The chip is compatible to the broadcom wireless driver.

The AP6203BM is a dual-band 2.4GHz/5GHz Wi-Fi 4 (802.11a/b/g/n) and Bluetooth 5.4 module. Bluetooth is not enabled by this patch.

Change in v3:
- consider further issues found by sashiko AI review

Change in v2:
- consider issues found by sashiko AI review

---
 .../boot/dts/thead/th1520-beaglev-ahead.dts   | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +49 -0
index 91f3f9b987bc..f13a2d1deefa 100644
@@ -86,6 +86,11 @@ hdmi_con_in: endpoint {
 			};
 		};
 	};
+
+	brcmf_pwrseq: brcmf-pwrseq {
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&gpio2 31 GPIO_ACTIVE_LOW>;	/* WL-REG-ON */
+	};
 };
 
 &osc {
@@ -239,6 +244,28 @@ rx-pins {
 			slew-rate = <0>;
 		};
 	};
+
+	wifi_pins: wifi-0 {
+		host-wake-pins {
+			pins = "GPIO2_25";
+			function = "gpio";
+			bias-disable;
+			drive-strength = <1>;
+			input-enable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+
+		reg-on-pins {
+			pins = "GPIO2_31";
+			function = "gpio";
+			bias-disable;
+			drive-strength = <3>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
 };
 
 &sdio0 {
@@ -247,6 +274,28 @@ &sdio0 {
 	status = "okay";
 };
 
+&sdio1 {
+	bus-width = <4>;
+	max-frequency = <198000000>;
+	status = "okay";
+	#address-cells = <1>;
+	#size-cells = <0>;
+	non-removable;
+	keep-power-in-suspend;
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&wifi_pins>;
+	mmc-pwrseq = <&brcmf_pwrseq>;
+
+	wifi@1 {
+		compatible = "cypress,cyw43012-fmac", "brcm,bcm4329-fmac";
+		reg = <1>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <25 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "host-wake";
+	};
+};
+
 &dpu {
 	status = "okay";
 };
Signature · 1 line
2.43.0
#7 lore raw
Quoted 4 lines · Thomas Gerner

The BeagleV-Ahead board uses an AP6203BM WiFi chip from AMPAK Technology Inc. connected to SDIO1. The chip is compatible to the broadcom wireless driver.

Please use subject prefixes matching the subsystem. You can get them for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching. For bindings, the preferred subjects are explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters

Quoted 4 lines

The AP6203BM is a dual-band 2.4GHz/5GHz Wi-Fi 4 (802.11a/b/g/n) and Bluetooth 5.4 module. Bluetooth is not enabled by this patch.

Change in v3:

This goes to changelog part, so after ---

Quoted 4 lines

- consider further issues found by sashiko AI review

Change in v2:
- consider issues found by sashiko AI review

Do not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets. See also:
https://elixir.bootlin.com/linux/v6.16-rc2/source/Documentation/process/submitting-patches.rst#L830

Quoted 11 lines
---
 .../boot/dts/thead/th1520-beaglev-ahead.dts   | 49 +++++++++++++++++++
 1 file changed, 49 insertions(+)
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +0 -0
index 91f3f9b987bc..f13a2d1deefa 100644

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts hdmi_con_in: endpoint { · line 90

Quoted 5 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +2 -0
@@ -86,6 +86,11 @@ hdmi_con_in: endpoint {
 			};
 		};
 	};
+
+	brcmf_pwrseq: brcmf-pwrseq {

Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
If you cannot find a name matching your device, please check in kernel sources for similar cases or you can grow the spec (via pull request to DT spec repo).

pwrseq?

Quoted 36 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +25 -0
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&gpio2 31 GPIO_ACTIVE_LOW>;	/* WL-REG-ON */
+	};
 };
 
 &osc {
@@ -239,6 +244,28 @@ rx-pins {
 			slew-rate = <0>;
 		};
 	};
+
+	wifi_pins: wifi-0 {
+		host-wake-pins {
+			pins = "GPIO2_25";
+			function = "gpio";
+			bias-disable;
+			drive-strength = <1>;
+			input-enable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+
+		reg-on-pins {
+			pins = "GPIO2_31";
+			function = "gpio";
+			bias-disable;
+			drive-strength = <3>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
 };
 
 &sdio0 {

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdio0 { · line 280

Quoted 7 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +4 -0
@@ -247,6 +274,28 @@ &sdio0 {
 	status = "okay";
 };
 
+&sdio1 {
+	bus-width = <4>;
+	max-frequency = <198000000>;
+	status = "okay";

Please follow DTS coding style in way of organizing properties.

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdio0 { · line 284

Quoted 4 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +4 -0
+	#address-cells = <1>;
+	#size-cells = <0>;
+	non-removable;
+	keep-power-in-suspend;

Best regards,
Krzysztof

#8 lore raw

Am 14.05.26 um 16:55 schrieb Krzysztof Kozlowski:

Quoted 10 lines · Thomas Gerner
Quoted 4 lines

The BeagleV-Ahead board uses an AP6203BM WiFi chip from AMPAK Technology Inc. connected to SDIO1. The chip is compatible to the broadcom wireless driver.

Please use subject prefixes matching the subsystem. You can get them for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching. For bindings, the preferred subjects are explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters

I read some more docs and will hopefully make things right with my next patch version. And I start a new thread with every new version and the recommended subject.

Quoted 5 lines
Quoted 4 lines

The AP6203BM is a dual-band 2.4GHz/5GHz Wi-Fi 4 (802.11a/b/g/n) and Bluetooth 5.4 module. Bluetooth is not enabled by this patch.

Change in v3:

This goes to changelog part, so after ---

Okay.

Quoted 8 lines
Quoted 4 lines

- consider further issues found by sashiko AI review

Change in v2:
- consider issues found by sashiko AI review

Do not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets. See also:
https://elixir.bootlin.com/linux/v6.16-rc2/source/Documentation/process/submitting-patches.rst#L830

Okay, I start new threads with new versions.

Quoted 22 lines
Quoted 10 lines
---
  .../boot/dts/thead/th1520-beaglev-ahead.dts   | 49 +++++++++++++++++++
  1 file changed, 49 insertions(+)
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +0 -0
index 91f3f9b987bc..f13a2d1deefa 100644

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts hdmi_con_in: endpoint { · line 90

Quoted 5 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +2 -0
@@ -86,6 +86,11 @@ hdmi_con_in: endpoint {
  			};
  		};
  	};
+
+	brcmf_pwrseq: brcmf-pwrseq {

Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
If you cannot find a name matching your device, please check in kernel sources for similar cases or you can grow the spec (via pull request to DT spec repo).

Quoted 1 line

pwrseq?

Other device trees with wifi connected to mmc controller use wifi-pwrseq as node name. Wifi is one of the generic names. I use this node name in the next patch version.

Quoted 39 lines
Quoted 39 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +25 -0
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&gpio2 31 GPIO_ACTIVE_LOW>;	/* WL-REG-ON */
+	};
  };
 
  &osc {
@@ -239,6 +244,28 @@ rx-pins {
  			slew-rate = <0>;
  		};
  	};
+
+	wifi_pins: wifi-0 {
+		host-wake-pins {
+			pins = "GPIO2_25";
+			function = "gpio";
+			bias-disable;
+			drive-strength = <1>;
+			input-enable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+
+		reg-on-pins {
+			pins = "GPIO2_31";
+			function = "gpio";
+			bias-disable;
+			drive-strength = <3>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
  };
 
  &sdio0 {
@@ -247,6 +274,28 @@ &sdio0 {
  	status = "okay";
  };
 
Quoted 5 lines

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdio0 { · line 280

Quoted 4 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +4 -0
+&sdio1 {
+	bus-width = <4>;
+	max-frequency = <198000000>;
+	status = "okay";

Please follow DTS coding style in way of organizing properties.

My next patch will contain the properies order according to DTS coding style.

Quoted 5 lines

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdio0 { · line 284

Quoted 5 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +4 -0
+	#address-cells = <1>;
+	#size-cells = <0>;
+	non-removable;
+	keep-power-in-suspend;

Best regards
Thomas

#9 lore raw
In reply to Thomas Gerner
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [Medium] The `host-wake` interrupt pin is configured with `input-schmitt-disable`, which makes it…

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] The host-wake interrupt pin is configured with input-schmitt-disable, which makes it susceptible to noise and false interrupts.
- [Medium] The pinctrl for the Wi-Fi reg-on GPIO is incorrectly assigned to the SDIO host (&sdio1) instead of the power sequence provider (brcmf_pwrseq).
- [Low] The power sequence node uses a non-generic name (brcmf-pwrseq), violating Devicetree naming guidelines.
--

commit aef7ec6dc80f633bb4abb51e59f66c088fa8d55f
Author: Thomas Gerner <[email protected]>

Enable wifi on the BeagleV-Ahead

This commit enables the AP6203BM WiFi chip on the BeagleV-Ahead board by adding the necessary device tree nodes. It sets up the SDIO interface, pin configurations, and power sequence for the wireless module.

Quoted 3 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +0 -0

[ ... ]

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts hdmi_con_in: endpoint { · line 90

Quoted 6 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +2 -0
@@ -86,6 +86,11 @@ hdmi_con_in: endpoint {
 			};
 		};
 	};
+
+	brcmf_pwrseq: brcmf-pwrseq {

This isn't a bug, but should this node use a generic name like wifi-pwrseq instead of the vendor-specific brcmf-pwrseq? Section 2.2.2 of the Devicetree Specification suggests node names should reflect the function of the device.

Quoted 4 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +3 -0
+		compatible = "mmc-pwrseq-simple";
+		reset-gpios = <&gpio2 31 GPIO_ACTIVE_LOW>;	/* WL-REG-ON */
+	};
 };

[ ... ]

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts rx-pins { · line 255

Quoted 13 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +9 -0
@@ -239,6 +244,28 @@ rx-pins {
 			slew-rate = <0>;
 		};
 	};
+
+	wifi_pins: wifi-0 {
+		host-wake-pins {
+			pins = "GPIO2_25";
+			function = "gpio";
+			bias-disable;
+			drive-strength = <1>;
+			input-enable;
+			input-schmitt-disable;

Could disabling the Schmitt trigger here cause issues with false interrupts?

The host-wake pin is configured later in this patch as an external, asynchronous signal triggering on a rising edge (IRQ_TYPE_EDGE_RISING).

Disabling hysteresis removes protection against signal noise and slow transitions, which might lead to multiple false triggers or interrupt storms on a single edge.

Quoted 14 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +13 -0
+			slew-rate = <0>;
+		};
+
+		reg-on-pins {
+			pins = "GPIO2_31";
+			function = "gpio";
+			bias-disable;
+			drive-strength = <3>;
+			input-disable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
 };

[ ... ]

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts &sdio0 { · line 287

Quoted 11 lines

+&sdio1 {

arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +10 -0
+	bus-width = <4>;
+	max-frequency = <198000000>;
+	status = "okay";
+	#address-cells = <1>;
+	#size-cells = <0>;
+	non-removable;
+	keep-power-in-suspend;
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&wifi_pins>;

Does the reg-on-pins pinctrl configuration need to be assigned to the brcmf_pwrseq node rather than the sdio1 node?

The mmc-pwrseq-simple device is an independent platform device that requests and drives the reset-gpios (GPIO2_31) during its own probe sequence.

By keeping the pinctrl assignment here in the sdio1 node, the power sequencer might attempt to drive the GPIO before the SDIO host has multiplexed the pin correctly.

Quoted 10 lines
arch/riscv/boot/dts/thead/th1520-beaglev-ahead.dts +10 -0
+	mmc-pwrseq = <&brcmf_pwrseq>;
+
+	wifi@1 {
+		compatible = "cypress,cyw43012-fmac", "brcm,bcm4329-fmac";
+		reg = <1>;
+		interrupt-parent = <&gpio2>;
+		interrupts = <25 IRQ_TYPE_EDGE_RISING>;
+		interrupt-names = "host-wake";
+	};
+};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1