Enable Bluetooth and WiFi on K3 Pico ITX
Subsystems (3)
v3 cover Enable Bluetooth and WiFi on K3 Pico ITX
This patchset enables Bluetooth through USB on the K3 Pico ITX board and adds the rfkill nodes for Bluetooth and WLAN so that the devices can be activated.
Note that WLAN support also require the following patch series, but both series can be applied independently:
- https://lore.kernel.org/spacemit/[email protected]/
Changes v2 -> v3
- reorder patches in a more logical order
- rebase on current linus/master
- add patch 1 to move phy definition to the board level for the "usb3d" controller
- remove link to USB3 phys, they can't be added if the combo phy is not configured accordingly
- enable Bluetooth and WLAN drivers in defconfig
Aurelien Jarno (5):
riscv: dts: spacemit: k3: move USB3 phy to board level
riscv: dts: spacemit: k3: add USB3 B and C controllers for Pico-ITX
board
riscv: dts: spacemit: k3: add rfkill node for Bluetooth on Pico-ITX
board
riscv: dts: spacemit: k3: add rfkill node for WLAN on the K3 Pico-ITX
board
riscv64: defconfig: Enable BT and WLAN support for SpacemiT K3
Pico-ITX board
arch/riscv/boot/dts/spacemit/k3-pico-itx.dts | 35 ++++++++++ arch/riscv/boot/dts/spacemit/k3.dtsi | 69 +++++++++++++++++++- arch/riscv/configs/defconfig | 8 +++ 3 files changed, 109 insertions(+), 3 deletions(-)
Signature · 7 lines
2.53.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
PATCH v3 1/5 riscv: dts: spacemit: k3: move USB3 phy to board level
On the SpacemiT K3 SoC, the combo phy provides 8 lines that can either be used for PCIe or USB3, depending on its configuration (spacemit,apmu). This configuration is defined at the board level, and assigning a phy line to a USB3 controller while it is configured as PCIe results in an "Invalid PHY mode" error.
Move the USB3 phy at the board level, the as it is done for the submitted PCIe controller [1]. Keep the USB2 phy at the SoC level as there is one phy per USB controller.
[1] https://lore.kernel.org/[email protected]/
--- arch/riscv/boot/dts/spacemit/k3-pico-itx.dts | 3 +++ arch/riscv/boot/dts/spacemit/k3.dtsi | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-)
arch/riscv/boot/dts/spacemit/k3-pico-itx.dts +3 -0
@@ -328,5 +328,8 @@ &usb3d_u2phy { }; &usb3d { + phys = <&usb3d_u2phy>, + <&combophy 4 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; status = "okay"; };
arch/riscv/boot/dts/spacemit/k3.dtsi +2 -3
@@ -452,9 +452,8 @@ usb3d: usb@81a00000 { <&syscon_apmu RESET_APMU_USB3_D_VCC>, <&syscon_apmu RESET_APMU_USB3_D_PHY>; reset-names = "ahb", "vcc", "phy"; - phys = <&usb3d_u2phy>, - <&combophy 4 PHY_TYPE_USB3>; - phy-names = "usb2-phy", "usb3-phy"; + phys = <&usb3d_u2phy>; + phy-names = "usb2-phy"; phy_type = "utmi"; snps,dis_enblslpm_quirk; snps,dis_u2_susphy_quirk;
Signature · 7 lines
2.53.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Re: [PATCH v3 1/5] riscv: dts: spacemit: k3: move USB3 phy to board level
Quoted 38 lines · Aurelien Jarno
On the SpacemiT K3 SoC, the combo phy provides 8 lines that can either be used for PCIe or USB3, depending on its configuration (spacemit,apmu). This configuration is defined at the board level, and assigning a phy line to a USB3 controller while it is configured as PCIe results in an "Invalid PHY mode" error.
Move the USB3 phy at the board level, the as it is done for the submitted PCIe controller [1]. Keep the USB2 phy at the SoC level as there is one phy per USB controller.
[1] https://lore.kernel.org/[email protected]/
Fixes 46380e4b1534c1626cecd7f4d0abb5e0cce09af6 ("riscv: dts: spacemit: k3: add USB controller and USB phy support")Cc Inochi Amaoto <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>--- arch/riscv/boot/dts/spacemit/k3-pico-itx.dts | 3 +++ arch/riscv/boot/dts/spacemit/k3.dtsi | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-)arch/riscv/boot/dts/spacemit/k3-pico-itx.dts +3
-0@@ -328,5 +328,8 @@ &usb3d_u2phy { }; &usb3d { + phys = <&usb3d_u2phy>, + <&combophy 4 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; status = "okay"; };arch/riscv/boot/dts/spacemit/k3.dtsi +0
-0
arch/riscv/boot/dts/spacemit/k3.dtsi usb3d: usb@81a00000 { · line 457
Quoted 9 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +2
-3@@ -452,9 +452,8 @@ usb3d: usb@81a00000 { <&syscon_apmu RESET_APMU_USB3_D_VCC>, <&syscon_apmu RESET_APMU_USB3_D_PHY>; reset-names = "ahb", "vcc", "phy"; - phys = <&usb3d_u2phy>, - <&combophy 4 PHY_TYPE_USB3>; - phy-names = "usb2-phy", "usb3-phy"; + phys = <&usb3d_u2phy>; + phy-names = "usb2-phy";
I suggest removing this completely as we can not determine the phy we used. I think it is suitable for setting this in board file only
Regards,
Inochi
Quoted 11 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +0
-0phy_type = "utmi"; snps,dis_enblslpm_quirk;snps,dis_u2_susphy_quirk;
Signature · 7 lines
2.53.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
Re: [PATCH v3 1/5] riscv: dts: spacemit: k3: move USB3 phy to board level
Quoted 43 lines · Inochi Amaoto
Quoted 41 lines · Aurelien Jarno
On the SpacemiT K3 SoC, the combo phy provides 8 lines that can either be used for PCIe or USB3, depending on its configuration (spacemit,apmu). This configuration is defined at the board level, and assigning a phy line to a USB3 controller while it is configured as PCIe results in an "Invalid PHY mode" error.
Move the USB3 phy at the board level, the as it is done for the submitted PCIe controller [1]. Keep the USB2 phy at the SoC level as there is one phy per USB controller.
[1] https://lore.kernel.org/[email protected]/
Fixes 46380e4b1534c1626cecd7f4d0abb5e0cce09af6 ("riscv: dts: spacemit: k3: add USB controller and USB phy support")Cc Inochi Amaoto <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>--- arch/riscv/boot/dts/spacemit/k3-pico-itx.dts | 3 +++ arch/riscv/boot/dts/spacemit/k3.dtsi | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-)arch/riscv/boot/dts/spacemit/k3-pico-itx.dts +3
-0@@ -328,5 +328,8 @@ &usb3d_u2phy { }; &usb3d { + phys = <&usb3d_u2phy>, + <&combophy 4 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; status = "okay"; };arch/riscv/boot/dts/spacemit/k3.dtsi +0
-0@@ -452,9 +452,8 @@ usb3d: usb@81a00000 { <&syscon_apmu RESET_APMU_USB3_D_VCC>, <&syscon_apmu RESET_APMU_USB3_D_PHY>; reset-names = "ahb", "vcc", "phy";
Quoted 9 lines
arch/riscv/boot/dts/spacemit/k3.dtsi usb3d: usb@81a00000 { · line 456
Quoted 5 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +2
-3- phys = <&usb3d_u2phy>, - <&combophy 4 PHY_TYPE_USB3>; - phy-names = "usb2-phy", "usb3-phy"; + phys = <&usb3d_u2phy>; + phy-names = "usb2-phy";I suggest removing this completely as we can not determine the phy we used. I think it is suitable for setting this in board file only
Yes, moving all the phy definition to the board level is an option. I decided to keep the USB2 phy at the SoC level, because contrary to the USB3 phys, there is a one to one mapping between the controller and the phy. Do you think it is a wrong assumption?
Regards
Aurelien
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://aurel32.net
Re: [PATCH v3 1/5] riscv: dts: spacemit: k3: move USB3 phy to board level
Quoted 54 lines · Aurelien Jarno
Quoted 43 lines · Inochi Amaoto
Quoted 41 lines · Aurelien Jarno
On the SpacemiT K3 SoC, the combo phy provides 8 lines that can either be used for PCIe or USB3, depending on its configuration (spacemit,apmu). This configuration is defined at the board level, and assigning a phy line to a USB3 controller while it is configured as PCIe results in an "Invalid PHY mode" error.
Move the USB3 phy at the board level, the as it is done for the submitted PCIe controller [1]. Keep the USB2 phy at the SoC level as there is one phy per USB controller.
[1] https://lore.kernel.org/[email protected]/
Fixes 46380e4b1534c1626cecd7f4d0abb5e0cce09af6 ("riscv: dts: spacemit: k3: add USB controller and USB phy support")Cc Inochi Amaoto <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>--- arch/riscv/boot/dts/spacemit/k3-pico-itx.dts | 3 +++ arch/riscv/boot/dts/spacemit/k3.dtsi | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-)arch/riscv/boot/dts/spacemit/k3-pico-itx.dts +3
-0@@ -328,5 +328,8 @@ &usb3d_u2phy { }; &usb3d { + phys = <&usb3d_u2phy>, + <&combophy 4 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; status = "okay"; };arch/riscv/boot/dts/spacemit/k3.dtsi +0
-0@@ -452,9 +452,8 @@ usb3d: usb@81a00000 { <&syscon_apmu RESET_APMU_USB3_D_VCC>, <&syscon_apmu RESET_APMU_USB3_D_PHY>; reset-names = "ahb", "vcc", "phy";Quoted 9 lines
arch/riscv/boot/dts/spacemit/k3.dtsi usb3d: usb@81a00000 { · line 456
Quoted 5 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +2
-3- phys = <&usb3d_u2phy>, - <&combophy 4 PHY_TYPE_USB3>; - phy-names = "usb2-phy", "usb3-phy"; + phys = <&usb3d_u2phy>; + phy-names = "usb2-phy";I suggest removing this completely as we can not determine the phy we used. I think it is suitable for setting this in board file only
Quoted 5 lines
Yes, moving all the phy definition to the board level is an option. I decided to keep the USB2 phy at the SoC level, because contrary to the USB3 phys, there is a one to one mapping between the controller and the phy. Do you think it is a wrong assumption?
By default, I prefer to make the forgotten thing as an error in validation for any flexible field. If you leave the default value, the forgotten field will lead to a downgrade hardware (or maybe broken hardware). So I prefer to remove this rather than give a default value.
Regards,
Inochi
Re: [PATCH v3 1/5] riscv: dts: spacemit: k3: move USB3 phy to board level
Quoted 61 lines · Inochi Amaoto
Quoted 54 lines · Aurelien Jarno
Quoted 43 lines · Inochi Amaoto
Quoted 41 lines · Aurelien Jarno
On the SpacemiT K3 SoC, the combo phy provides 8 lines that can either be used for PCIe or USB3, depending on its configuration (spacemit,apmu). This configuration is defined at the board level, and assigning a phy line to a USB3 controller while it is configured as PCIe results in an "Invalid PHY mode" error.
Move the USB3 phy at the board level, the as it is done for the submitted PCIe controller [1]. Keep the USB2 phy at the SoC level as there is one phy per USB controller.
[1] https://lore.kernel.org/[email protected]/
Fixes 46380e4b1534c1626cecd7f4d0abb5e0cce09af6 ("riscv: dts: spacemit: k3: add USB controller and USB phy support")Cc Inochi Amaoto <[email protected]>Signed-off-by Aurelien Jarno <[email protected]>--- arch/riscv/boot/dts/spacemit/k3-pico-itx.dts | 3 +++ arch/riscv/boot/dts/spacemit/k3.dtsi | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-)arch/riscv/boot/dts/spacemit/k3-pico-itx.dts +3
-0@@ -328,5 +328,8 @@ &usb3d_u2phy { }; &usb3d { + phys = <&usb3d_u2phy>, + <&combophy 4 PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; status = "okay"; };arch/riscv/boot/dts/spacemit/k3.dtsi +0
-0@@ -452,9 +452,8 @@ usb3d: usb@81a00000 { <&syscon_apmu RESET_APMU_USB3_D_VCC>, <&syscon_apmu RESET_APMU_USB3_D_PHY>; reset-names = "ahb", "vcc", "phy";Quoted 9 lines
arch/riscv/boot/dts/spacemit/k3.dtsi usb3d: usb@81a00000 { · line 456
Quoted 5 lines
arch/riscv/boot/dts/spacemit/k3.dtsi +2
-3- phys = <&usb3d_u2phy>, - <&combophy 4 PHY_TYPE_USB3>; - phy-names = "usb2-phy", "usb3-phy"; + phys = <&usb3d_u2phy>; + phy-names = "usb2-phy";I suggest removing this completely as we can not determine the phy we used. I think it is suitable for setting this in board file only
Quoted 5 lines
Yes, moving all the phy definition to the board level is an option. I decided to keep the USB2 phy at the SoC level, because contrary to the USB3 phys, there is a one to one mapping between the controller and the phy. Do you think it is a wrong assumption?
Quoted 5 lines
By default, I prefer to make the forgotten thing as an error in validation for any flexible field. If you leave the default value, the forgotten field will lead to a downgrade hardware (or maybe broken hardware). So I prefer to remove this rather than give a default value.
Ok, thanks for the feedback, i'll fix that in the v4.
Regards
Aurelien
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://aurel32.net
PATCH v3 2/5 riscv: dts: spacemit: k3: add USB3 B and C controllers for Pico-ITX board
In reply to Aurelien JarnoThe SpacemiT K3 has 4 USB3 controllers labelled A to D.
On the K3 Pico-ITX board, the controllers B and C are used in USB2 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 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 | 64 ++++++++++++++++++++ 2 files changed, 82 insertions(+)
arch/riscv/boot/dts/spacemit/k3-pico-itx.dts +18 -0
@@ -323,6 +323,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 +64 -0
70 lines not on this page · raw message
Signature · 7 lines
2.53.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
PATCH v3 3/5 riscv: dts: spacemit: k3: add rfkill node for Bluetooth on Pico-ITX board
In reply to Aurelien JarnoOn 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
@@ -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 · 7 lines
2.53.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
PATCH v3 4/5 riscv: dts: spacemit: k3: add rfkill node for WLAN on the K3 Pico-ITX board
In reply to Aurelien JarnoOn the K3 Pico-ITX board, 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 WLAN 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
@@ -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 · 7 lines
2.53.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
PATCH v3 5/5 riscv64: defconfig: Enable BT and WLAN support for SpacemiT K3 Pico-ITX board
In reply to Aurelien JarnoThe SpacemiT K3 Pico-ITX board has a RTL8852BE Bluetooth and WLAN controller connected through PCIe and USB. For the WLAN part, enable CFG80211, MAC80211, RTW89 and RTW89_8852BE as modules. For the Bluetooth, enable CONFIG_BT and CONFIG_BT_HCIBTUSB as modules.
Both also require RFKILL and RFKILL_GPIO.
--- arch/riscv/configs/defconfig | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/riscv/configs/defconfig +8 -0
@@ -100,6 +100,12 @@ CONFIG_NET_CLS_CGROUP=m CONFIG_NETLINK_DIAG=y CONFIG_CGROUP_NET_PRIO=y CONFIG_CAN=m +CONFIG_BT=m +CONFIG_BT_HCIBTUSB=m +CONFIG_CFG80211=m +CONFIG_MAC80211=m +CONFIG_RFKILL=m +CONFIG_RFKILL_GPIO=m CONFIG_NET_9P=y CONFIG_NET_9P_VIRTIO=y CONFIG_PCI=y
@@ -143,6 +149,8 @@ CONFIG_DWMAC_THEAD=m CONFIG_MICREL_PHY=y CONFIG_MICROSEMI_PHY=y CONFIG_MOTORCOMM_PHY=y +CONFIG_RTW89=m +CONFIG_RTW89_8852BE=m CONFIG_INPUT_MOUSEDEV=y CONFIG_INPUT_EVDEV=y CONFIG_KEYBOARD_GPIO=y
Signature · 7 lines
2.53.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv