riscv: dts: spacemit: Add USB 3.0 support for K1
Subsystems (3)
v3 cover riscv: dts: spacemit: Add USB 3.0 support for K1
This patch series enables the DWC3 USB 3.0 host controller on the Spacemit K1 SoC and enables it for the Banana Pi F3 board.
For testing, the following kernel configurations should be enabled:
CONFIG_PHY_SPACEMIT_K1_USB2=yCONFIG_PHY_SPACEMIT_K1_PCIE=yCONFIG_USB_DWC3=yCONFIG_USB_ONBOARD_DEV=y
This series is based on the spacemit k1/for-next branch.
---
Changes in v3:
- rename vbus and hub regulator to match schematics
- reorder node reference to keep alphabet order
- drop regulator-always-on in usb hub regulator node
- drop unmanaged vbus-supply in usb host node
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- rebased on spacemit k1/for-next
- Link to v1: https://lore.kernel.org/all/[email protected]/
---
Ze Huang (3):
riscv: dts: spacemit: Add USB2 PHY node for K1
riscv: dts: spacemit: Add DWC3 USB 3.0 controller node for K1
riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 46 +++++++++++++++++++++++++ arch/riscv/boot/dts/spacemit/k1.dtsi | 32 +++++++++++++++++ 2 files changed, 78 insertions(+)
---
base-commit: 4f67c877a9069c60dfb1767038fba5180bc12d68
change-id: 20260107-k1-usb3dts-v2-220c0fa7702a
Best regards,
Signature · 1 line
Ze Huang <[email protected]>
PATCH v3 1/3 riscv: dts: spacemit: Add USB2 PHY node for K1
K1's DWC3 USB 3.0 controller requires two separate PHYs to function:
the USB 3.0 combophy (for SuperSpeed) and a USB 2.0 PHY (for High-Speed, Full-Speed, etc.).
Add node for this second USB 2.0 PHY (usbphy2).
--- arch/riscv/boot/dts/spacemit/k1.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/riscv/boot/dts/spacemit/k1.dtsi +8 -0
@@ -424,6 +424,14 @@ i2c5: i2c@d4013800 { status = "disabled"; }; + usbphy2: phy@c0a30000 { + compatible = "spacemit,k1-usb2-phy"; + reg = <0x0 0xc0a30000 0x0 0x200>; + clocks = <&syscon_apmu CLK_USB30>; + #phy-cells = <0>; + status = "disabled"; + }; + combo_phy: phy@c0b10000 { compatible = "spacemit,k1-combo-phy"; reg = <0x0 0xc0b10000 0x0 0x1000>;
Signature · 1 line
2.52.0
PATCH v3 2/3 riscv: dts: spacemit: Add DWC3 USB 3.0 controller node for K1
In reply to Ze HuangAdd node for the Synopsys DWC3 USB 3.0 host controller on the K1 SoC. The controller resides on the 'storage-bus' and uses its DMA translations.
--- arch/riscv/boot/dts/spacemit/k1.dtsi | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/riscv/boot/dts/spacemit/k1.dtsi +24 -0
@@ -1162,6 +1162,30 @@ storage-bus { #size-cells = <2>; dma-ranges = <0x0 0x00000000 0x0 0x00000000 0x0 0x80000000>; + usb_dwc3: usb@c0a00000 { + compatible = "spacemit,k1-dwc3"; + reg = <0x0 0xc0a00000 0x0 0x10000>; + clocks = <&syscon_apmu CLK_USB30>; + clock-names = "usbdrd30"; + interrupts = <125>; + phys = <&usbphy2>, <&combo_phy PHY_TYPE_USB3>; + phy-names = "usb2-phy", "usb3-phy"; + phy_type = "utmi"; + resets = <&syscon_apmu RESET_USB30_AHB>, + <&syscon_apmu RESET_USB30_VCC>, + <&syscon_apmu RESET_USB30_PHY>; + reset-names = "ahb", "vcc", "phy"; + reset-delay = <2>; + snps,hsphy_interface = "utmi"; + snps,dis_enblslpm_quirk; + snps,dis-u2-freeclk-exists-quirk; + snps,dis-del-phy-power-chg-quirk; + snps,dis_u2_susphy_quirk; + snps,dis_u3_susphy_quirk; + snps,dis_rxdet_inp3_quirk; + status = "disabled"; + }; + emmc: mmc@d4281000 { compatible = "spacemit,k1-sdhci"; reg = <0x0 0xd4281000 0x0 0x200>;
Signature · 1 line
2.52.0
PATCH v3 3/3 riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3
In reply to Ze HuangEnable the DWC3 USB 3.0 controller and its associated usbphy2 on the Banana Pi F3 board.
The board utilizes a VLI VL817 hub, which requires two separate power
supplies: one VBUS and one for hub itself. Add two GPIO-controlled fixed-regulators to manage this.
--- arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts +46 -0
@@ -59,6 +59,25 @@ reg_vcc_4v: vcc-4v { regulator-always-on; vin-supply = <®_dc_in>; }; + + usb3-vbus-5v { + compatible = "regulator-fixed"; + regulator-name = "USB30_VBUS"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + gpio = <&gpio K1_GPIO(97) GPIO_ACTIVE_HIGH>; + enable-active-high; + }; + + usb3_hub_5v: usb3-hub-5v { + compatible = "regulator-fixed"; + regulator-name = "USB30_HUB"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio K1_GPIO(123) GPIO_ACTIVE_HIGH>; + enable-active-high; + }; }; &combo_phy {
@@ -313,3 +332,30 @@ &uart0 { pinctrl-0 = <&uart0_2_cfg>; status = "okay"; }; + +&usbphy2 { + status = "okay"; +}; + +&usb_dwc3 { + dr_mode = "host"; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + hub_2_0: hub@1 { + compatible = "usb2109,2817"; + reg = <0x1>; + vdd-supply = <&usb3_hub_5v>; + peer-hub = <&hub_3_0>; + reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>; + }; + + hub_3_0: hub@2 { + compatible = "usb2109,817"; + reg = <0x2>; + vdd-supply = <&usb3_hub_5v>; + peer-hub = <&hub_2_0>; + reset-gpios = <&gpio K1_GPIO(124) GPIO_ACTIVE_LOW>; + }; +};
Signature · 1 line
2.52.0
Quoted 33 lines · Ze Huang
This patch series enables the DWC3 USB 3.0 host controller on the Spacemit K1 SoC and enables it for the Banana Pi F3 board.
For testing, the following kernel configurations should be enabled:
CONFIG_PHY_SPACEMIT_K1_USB2=yCONFIG_PHY_SPACEMIT_K1_PCIE=yCONFIG_USB_DWC3=yCONFIG_USB_ONBOARD_DEV=yThis series is based on the spacemit k1/for-next branch.
Signed-off-by Ze Huang <[email protected]>---
Changes in v3:
- rename vbus and hub regulator to match schematics
- reorder node reference to keep alphabet order
- drop regulator-always-on in usb hub regulator node
- drop unmanaged vbus-supply in usb host node
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- rebased on spacemit k1/for-next
- Link to v1: https://lore.kernel.org/all/[email protected]/---
Ze Huang (3):
riscv: dts: spacemit: Add USB2 PHY node for K1
riscv: dts: spacemit: Add DWC3 USB 3.0 controller node for K1
riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3
Quoted 3 lines
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 46 +++++++++++++++++++++++++ arch/riscv/boot/dts/spacemit/k1.dtsi | 32 +++++++++++++++++ 2 files changed, 78 insertions(+)
Thanks for this new version. The whole series is:
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://aurel32.net
Hi Ze,
Quoted 10 lines · Ze Huang
This patch series enables the DWC3 USB 3.0 host controller on the Spacemit K1 SoC and enables it for the Banana Pi F3 board.
For testing, the following kernel configurations should be enabled:
CONFIG_PHY_SPACEMIT_K1_USB2=yCONFIG_PHY_SPACEMIT_K1_PCIE=yCONFIG_USB_DWC3=yCONFIG_USB_ONBOARD_DEV=y
Quoted 5 lines
This series is based on the spacemit k1/for-next branch.
Signed-off-by Ze Huang <[email protected]>
looks good to me
Signature · 1 line
Yixun Lan (dlan)
Yixun Lan
AppliedQuoted 11 lines · Ze Huang
This patch series enables the DWC3 USB 3.0 host controller on the Spacemit K1 SoC and enables it for the Banana Pi F3 board.
For testing, the following kernel configurations should be enabled:
CONFIG_PHY_SPACEMIT_K1_USB2=yCONFIG_PHY_SPACEMIT_K1_PCIE=yCONFIG_USB_DWC3=yCONFIG_USB_ONBOARD_DEV=y[...]
Applied, thanks!
[1/3] riscv: dts: spacemit: Add USB2 PHY node for K1
https://github.com/spacemit-com/linux/commit/0346e7284c2a1a39befc8711e5bc7f0306df7bdc [2/3] riscv: dts: spacemit: Add DWC3 USB 3.0 controller node for K1 https://github.com/spacemit-com/linux/commit/4b8fd1c95f0dd0398da1ea373ab67dd3559afb31 [3/3] riscv: dts: spacemit: Enable USB3.0 on BananaPi-F3 https://github.com/spacemit-com/linux/commit/2c1c8ee2c30f90b2dc2d6629e364aaed622c98b6
Best regards,
Signature · 1 line
Yixun Lan <[email protected]>