Skip to contentSkip to conversation

Enable Bluetooth and WiFi rfkill on K3 Pico ITX

PATCH Superseded Aurelien Jarno 3 participants 9 messages Jul 29 – Jul 30

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Enable Bluetooth and WiFi rfkill on K3 Pico ITX

This patchset enables Bluetooth through USB on the K3 Pico ITX board and adds the rfkill nodes for Bluetooth and WiFi so that the devices can be activated.

Note that the patch 4 is only useful with the following patch series (but it doesn't hurt appying it before):
- https://lore.kernel.org/spacemit/[email protected]/

Changes v1 -> v2:
- Rebase on current spacemit/dt-for-next branch
- Collect Tested-by tag
- Add link to USB3 PHYs in DT now that K3 PHY support is merged

Aurelien Jarno (4):
riscv: defconfig: enable RFKILL and RFKILL_GPIO
riscv: dts: spacemit: k3: add rfkill node for Bluetooth on Pico-ITX
board
riscv: dts: spacemit: k3: add USB3 B and C controllers for Pico-ITX
board
riscv: dts: spacemit: k3: add rfkill node for WLAN

 arch/riscv/boot/dts/spacemit/k3-pico-itx.dts | 32 ++++++++++
 arch/riscv/boot/dts/spacemit/k3.dtsi         | 66 ++++++++++++++++++++
 arch/riscv/configs/defconfig                 |  2 +
 3 files changed, 100 insertions(+)
Signature · 1 line
2.53.0
#1 lore raw

PATCH v2 1/4 riscv: defconfig: enable RFKILL and RFKILL_GPIO

The SpacemiT K3 Pico-ITX requires RFKILL_GPIO to enable bluetooth and wlan.

---
 arch/riscv/configs/defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/riscv/configs/defconfig +2 -0
index 74ba5acc12a40..8668aa31e79aa 100644
@@ -99,6 +99,8 @@ CONFIG_NET_CLS_CGROUP=m
 CONFIG_NETLINK_DIAG=y
 CONFIG_CGROUP_NET_PRIO=y
 CONFIG_CAN=m
+CONFIG_RFKILL=m
+CONFIG_RFKILL_GPIO=m
 CONFIG_NET_9P=y
 CONFIG_NET_9P_VIRTIO=y
 CONFIG_PCI=y
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH v2 1/4] riscv: defconfig: enable RFKILL and RFKILL_GPIO

Hi Aurelien,

Quoted 15 lines · Aurelien Jarno

The SpacemiT K3 Pico-ITX requires RFKILL_GPIO to enable bluetooth and wlan.

---
 arch/riscv/configs/defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/riscv/configs/defconfig +0 -0
index 74ba5acc12a40..8668aa31e79aa 100644

arch/riscv/configs/defconfig CONFIG_NET_CLS_CGROUP=m · line 106

Quoted 8 lines
arch/riscv/configs/defconfig +2 -0
@@ -99,6 +99,8 @@ CONFIG_NET_CLS_CGROUP=m
 CONFIG_NETLINK_DIAG=y
 CONFIG_CGROUP_NET_PRIO=y
 CONFIG_CAN=m
+CONFIG_RFKILL=m
+CONFIG_RFKILL_GPIO=m
 CONFIG_NET_9P=y
 CONFIG_NET_9P_VIRTIO=y
 CONFIG_PCI=y

The riscv defconfig doesn't have CONFIG_RTW89=m and CONFIG_RTW89_8852BE in it. Do we need to add it?

I was testing with a distro defconfig, so didn't need to add it manually. I should have realized this sooner.

Quoted 3 lines

--
2.53.0

#3 lore raw

Re: [PATCH v2 1/4] riscv: defconfig: enable RFKILL and RFKILL_GPIO

Hi, Anirudh,

Quoted 13 lines · Anirudh Srinivasan

Hi Aurelien,

Quoted 10 lines · Aurelien Jarno

The SpacemiT K3 Pico-ITX requires RFKILL_GPIO to enable bluetooth and wlan.

---
 arch/riscv/configs/defconfig | 2 ++
 1 file changed, 2 insertions(+)
Quoted 16 lines

arch/riscv/configs/defconfig CONFIG_NET_CLS_CGROUP=m · line 106

Quoted 13 lines
arch/riscv/configs/defconfig +2 -0
index 74ba5acc12a40..8668aa31e79aa 100644
@@ -99,6 +99,8 @@ CONFIG_NET_CLS_CGROUP=m
 CONFIG_NETLINK_DIAG=y
 CONFIG_CGROUP_NET_PRIO=y
 CONFIG_CAN=m
+CONFIG_RFKILL=m
+CONFIG_RFKILL_GPIO=m
 CONFIG_NET_9P=y
 CONFIG_NET_9P_VIRTIO=y
 CONFIG_PCI=y

The riscv defconfig doesn't have CONFIG_RTW89=m and CONFIG_RTW89_8852BE in it. Do we need to add it?

That's a good point, not sure to which level we need to enable all modules of supported hardware. I added RFKILL and RFKILL_GPIO as it was not obvious to me that those need to be enabled to get proper WiFi support. Also those are tiny drivers compared to the RTW89 driver. OTOH, I see that this driver is enabled for the loongarch architecture, so maybe we can do the same for riscv..

Paul, any idea about that, any policy?

Quoted 2 lines

I was testing with a distro defconfig, so didn't need to add it manually. I should have realized this sooner.

Yes same, so I also didn't notice.

Regards
Aurelien

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
#4 lore raw

PATCH v2 2/4 riscv: dts: spacemit: k3: add rfkill node for Bluetooth on Pico-ITX board

In reply to Aurelien Jarno

On the K3 PICO-ITX board, by default the GPIO pin that connects to the RTL8852BE Bluetooth enable signal is driven low, resulting in impossibility to use Bluetooth. Add a DT node to expose it as an RFKILL device, which lets the Bluetooth driver or userspace toggle it as required.

---
 arch/riscv/boot/dts/spacemit/k3-pico-itx.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/riscv/boot/dts/spacemit/k3-pico-itx.dts +7 -0
index b084a35aa00e3..6a60fae1f8b50 100644
@@ -43,6 +43,13 @@ reg_aux_vcc5v: regulator-aux-vcc5v {
 		regulator-max-microvolt = <5000000>;
 		regulator-always-on;
 	};
+
+	rfkill-usb-bt {
+		compatible = "rfkill-gpio";
+		label = "rfkill-usb-bt";
+		radio-type = "bluetooth";
+		shutdown-gpios = <&gpio 0 30 GPIO_ACTIVE_HIGH>;
+	};
 };
 
 &i2c2 {
Signature · 1 line
2.53.0
#5 lore raw

PATCH v2 3/4 riscv: dts: spacemit: k3: add USB3 B and C controllers for Pico-ITX board

In reply to Aurelien Jarno

The SpacemiT K3 has 4 USB3 controllers labelled A to D.

On the K3 Pico-ITX board, the controllers B and C are used in USB 2 mode only respectively for the M.2 B-Key slot and for the RTL8852BE Bluetooth controller.

Add the two controller nodes, the two corresponding USB2 PHY nodes and the two corresponding USB3 PHY nodes, and enable them on the K3 Pico-ITX board.

---
 arch/riscv/boot/dts/spacemit/k3-pico-itx.dts | 18 ++++++
 arch/riscv/boot/dts/spacemit/k3.dtsi         | 66 ++++++++++++++++++++
 2 files changed, 84 insertions(+)
arch/riscv/boot/dts/spacemit/k3-pico-itx.dts +18 -0
index 6a60fae1f8b50..37d3422af32ac 100644
@@ -330,6 +330,24 @@ &usb2_phy {
 	status = "okay";
 };
 
+&usb3b {
+	maximum-speed = "high-speed";
+	status = "okay";
+};
+
+&usb3b_u2phy {
+	status = "okay";
+};
+
+&usb3c {
+	maximum-speed = "high-speed";
+	status = "okay";
+};
+
+&usb3c_u2phy {
+	status = "okay";
+};
+
 &usb3d_u2phy {
 	status = "okay";
 };
arch/riscv/boot/dts/spacemit/k3.dtsi +66 -0

72 lines not on this page · raw message

Signature · 1 line
2.53.0
#6 lore raw

Re: [PATCH v2 3/4] riscv: dts: spacemit: k3: add USB3 B and C controllers for Pico-ITX board

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Mismatch between the length of the `phys` and `phy-names` properties in the `usb3b` and `usb3c`…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Mismatch between the length of the phys and phy-names properties in the usb3b and usb3c device tree nodes. --

--- Patch [3]: [PATCH v2 3/4] riscv: dts: spacemit: k3: add USB3 B and C controllers for Pico-ITX board --- commit 2aa9a6448bde1ee249cba54ddbed1021d4ace1cc
Author: Aurelien Jarno <[email protected]>

riscv: dts: spacemit: k3: add USB3 B and C controllers for Pico-ITX board

This commit adds the USB3 B and C controller nodes and their corresponding USB2 and USB3 PHY nodes to the SpacemiT K3 SoC device tree. It also enables them on the K3 Pico-ITX board in USB 2 mode.

Quoted 4 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +0 -0
index 0eb24fac4733e..b786f119d4f95 100644

[ ... ]

Quoted 3 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +3 -0
+		usb3b: usb@81400000 {
+			compatible = "spacemit,k3-dwc3";
+			reg = <0x0 0x81400000 0x0 0x10000>;

[ ... ]

arch/riscv/boot/dts/spacemit/k3.dtsi soc: soc { · line 457

Quoted 7 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +7 -0
+			resets = <&syscon_apmu RESET_APMU_USB3_B_AHB>,
+				 <&syscon_apmu RESET_APMU_USB3_B_VCC>,
+				 <&syscon_apmu RESET_APMU_USB3_B_PHY>;
+			reset-names = "ahb", "vcc", "phy";
+			phys = <&usb3b_u2phy>,
+			       <&combophy 2 PHY_TYPE_USB3>;
+			phy-names = "usb2-phy";

[Severity: Medium]
Does this mismatch between the array lengths of phys and phy-names cause dtbs_check schema validation to fail? The phys property defines two items, but phy-names only lists "usb2-phy", omitting "usb3-phy".

Without "usb3-phy" in the phy-names list, devm_phy_get(dev, "usb3-phy") in the DWC3 core driver will fail. While the current Pico-ITX board limits this controller to high-speed mode, does this omission bypass USB3 PHY initialization and break SuperSpeed functionality for any future generic boards using this SoC-level .dtsi?

Quoted 1 line
arch/riscv/boot/dts/spacemit/k3.dtsi +1 -0
+			phy_type = "utmi";

[ ... ]

Quoted 3 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +3 -0
+		usb3c: usb@81700000 {
+			compatible = "spacemit,k3-dwc3";
+			reg = <0x0 0x81700000 0x0 0x10000>;

[ ... ]

arch/riscv/boot/dts/spacemit/k3.dtsi soc: soc { · line 490

Quoted 7 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +7 -0
+			resets = <&syscon_apmu RESET_APMU_USB3_C_AHB>,
+				 <&syscon_apmu RESET_APMU_USB3_C_VCC>,
+				 <&syscon_apmu RESET_APMU_USB3_C_PHY>;
+			reset-names = "ahb", "vcc", "phy";
+			phys = <&usb3c_u2phy>,
+			       <&combophy 3 PHY_TYPE_USB3>;
+			phy-names = "usb2-phy";

[Severity: Medium]
Similarly here, does omitting "usb3-phy" from the phy-names array also break USB3 PHY power-on and initialization for the usb3c controller on future boards?

Quoted 1 line
arch/riscv/boot/dts/spacemit/k3.dtsi +1 -0
+			phy_type = "utmi";
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#7 lore raw

Re: [PATCH v2 3/4] riscv: dts: spacemit: k3: add USB3 B and C controllers for Pico-ITX board

Hi,

Quoted 23 lines · On 2026-07-29 17:33, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Mismatch between the length of the phys and phy-names properties in the usb3b and usb3c device tree nodes. --

--- Patch [3]: [PATCH v2 3/4] riscv: dts: spacemit: k3: add USB3 B and C controllers for Pico-ITX board --- commit 2aa9a6448bde1ee249cba54ddbed1021d4ace1cc
Author: Aurelien Jarno <[email protected]>

riscv: dts: spacemit: k3: add USB3 B and C controllers for Pico-ITX board

This commit adds the USB3 B and C controller nodes and their corresponding USB2 and USB3 PHY nodes to the SpacemiT K3 SoC device tree. It also enables them on the K3 Pico-ITX board in USB 2 mode.

Quoted 4 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +0 -0
index 0eb24fac4733e..b786f119d4f95 100644

[ ... ]

Quoted 3 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +3 -0
+		usb3b: usb@81400000 {
+			compatible = "spacemit,k3-dwc3";
+			reg = <0x0 0x81400000 0x0 0x10000>;

[ ... ]

Quoted 13 lines

arch/riscv/boot/dts/spacemit/k3.dtsi soc: soc { · line 457

Quoted 7 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +7 -0
+			resets = <&syscon_apmu RESET_APMU_USB3_B_AHB>,
+				 <&syscon_apmu RESET_APMU_USB3_B_VCC>,
+				 <&syscon_apmu RESET_APMU_USB3_B_PHY>;
+			reset-names = "ahb", "vcc", "phy";
+			phys = <&usb3b_u2phy>,
+			       <&combophy 2 PHY_TYPE_USB3>;
+			phy-names = "usb2-phy";

[Severity: Medium]
Does this mismatch between the array lengths of phys and phy-names cause dtbs_check schema validation to fail? The phys property defines two items, but phy-names only lists "usb2-phy", omitting "usb3-phy".

This is correct, i'll fix that in v3.

Regards
Aurelien

Signature · 2 lines
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                     http://aurel32.net
#8 lore raw

PATCH v2 4/4 riscv: dts: spacemit: k3: add rfkill node for WLAN

In reply to Aurelien Jarno

By default the GPIO pin that connects to the RTL8852BE WLAN enable signal is driven low, resulting in impossibility to connect to any network. Add a DT node to expose it as an RFKILL device, which lets the WiFi driver or userspace toggle it as required.

---
 arch/riscv/boot/dts/spacemit/k3-pico-itx.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/riscv/boot/dts/spacemit/k3-pico-itx.dts +7 -0
index 37d3422af32ac..d1e53cfbc9030 100644
@@ -44,6 +44,13 @@ reg_aux_vcc5v: regulator-aux-vcc5v {
 		regulator-always-on;
 	};
 
+	rfkill-pcie-wlan {
+		compatible = "rfkill-gpio";
+		label = "rfkill-pcie-wlan";
+		radio-type = "wlan";
+		shutdown-gpios = <&gpio 1 3 GPIO_ACTIVE_HIGH>;
+	};
+
 	rfkill-usb-bt {
 		compatible = "rfkill-gpio";
 		label = "rfkill-usb-bt";
Signature · 1 line
2.53.0