Skip to contentSkip to conversation

rockchip: Fix RK3328 USB support

PATCH In review Jagan Teki 4 participants 20 messages Jun 6, 2023 – Jul 26, 2023

Subsystems (6)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

v2 cover rockchip: Fix RK3328 USB support

This series support fixes for RK3328 USB.

Changes for v2:
- collect Marek RB
- update phy driver clockout_ctl for rk3328
- retest on Xavier patches.

Any inputs?
Jagan.

Jagan Teki (7):
arm64: dts: rockchip: Drop unused rk3328-xhci node
configs: Drop unused XHCI_DWC3 for RK3328 boards
usb: dwc3-generic: Restrict single ctrl node for RK3328
configs: Enable DWC3 USB 3.0 on RK3328 boards
phy: rockchip-inno-usb2: Add USB2 PHY for RK3328
clk: rockchip: rk3328: Handle usb480m phy clock
configs: rockchip: Enable USB2PHY for RK3328 boards

 arch/arm/dts/rk3328-evb-u-boot.dtsi           |  5 ---
 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi        | 14 --------
 arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi     |  5 ---
 arch/arm/dts/rk3328-rock64-u-boot.dtsi        | 15 --------
 arch/arm/dts/rk3328-u-boot.dtsi               | 11 ------
 configs/evb-rk3328_defconfig                  |  4 ++-
 configs/nanopi-r2c-rk3328_defconfig           |  4 ++-
 configs/nanopi-r2s-rk3328_defconfig           |  4 ++-
 configs/roc-cc-rk3328_defconfig               |  4 ++-
 configs/rock-pi-e-rk3328_defconfig            |  4 ++-
 configs/rock64-rk3328_defconfig               |  4 ++-
 drivers/clk/rockchip/clk_rk3328.c             |  2 ++
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 34 +++++++++++++++++++
 drivers/usb/dwc3/dwc3-generic.c               |  2 +-
 14 files changed, 55 insertions(+), 57 deletions(-)
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 1/7 arm64: dts: rockchip: Drop unused rk3328-xhci node

rk3328-xhci has been added due to the fact that the upstream dwc3 is unsupported. Moreover, the driver for rk3328-xhci is not added to the code tree.

By considering these facts and unsupported rk3328-xhci this patch is dropping all related code from DT. However, the DWC3 is fixed now in dwc3-generic and RK3328 USB 3.0 is functional in upcoming patches.

Let's drop it.

---
Changes for v2:
- none

 arch/arm/dts/rk3328-evb-u-boot.dtsi       |  5 -----
 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi    | 14 --------------
 arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi |  5 -----
 arch/arm/dts/rk3328-rock64-u-boot.dtsi    | 15 ---------------
 arch/arm/dts/rk3328-u-boot.dtsi           | 11 -----------
 5 files changed, 50 deletions(-)
arch/arm/dts/rk3328-evb-u-boot.dtsi +0 -5
index 4bfa0c2330..f9c729d3bd 100644
@@ -44,8 +44,3 @@
 	/* Integrated PHY unsupported by U-boot */
 	status = "broken";
 };
-
-&usb_host0_xhci {
-	vbus-supply = <&vcc5v0_host_xhci>;
-	status = "okay";
-};
arch/arm/dts/rk3328-roc-cc-u-boot.dtsi +0 -14
index 27a454f017..2062f34bf8 100644
@@ -48,20 +48,6 @@
 	bootph-pre-ram;
 };
 
-&usb_host0_xhci {
-	vbus-supply = <&vcc_host1_5v>;
-	status = "okay";
-};
-
-/*
- * This makes XHCI responsible for toggling VBUS. This is needed to work
- * around an issue where either XHCI only works with USB 2.0 or OTG doesn't
- * work, depending on how VBUS is configured. Having USB 3.0 seems better.
- */
-&vcc_host1_5v {
-	/delete-property/ regulator-always-on;
-};
-
 /* Need this and all the pinctrl/gpio stuff above to set pinmux */
 &vcc_sd {
 	bootph-pre-ram;
arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi +0 -5
index 088e21c76a..1f220c6dcd 100644
@@ -45,11 +45,6 @@
 	bootph-pre-ram;
 };
 
-&usb_host0_xhci {
-	vbus-supply = <&vcc_host_5v>;
-	status = "okay";
-};
-
 /* Need this and all the pinctrl/gpio stuff above to set pinmux */
 &vcc_sd {
 	bootph-pre-ram;
arch/arm/dts/rk3328-rock64-u-boot.dtsi +0 -15
index c20a99a620..849854302e 100644
@@ -48,21 +48,6 @@
 	bootph-pre-ram;
 };
 
-&usb_host0_xhci {
-	vbus-supply = <&vcc_host_5v>;
-	status = "okay";
-};
-
-/*
- * This makes XHCI responsible for toggling VBUS. This is needed to work
- * around an issue where either XHCI only works with USB 2.0 or OTG doesn't
- * work, depending on how VBUS is configured. Having USB 3.0 seems better.
- */
-&vcc_host_5v {
-	/delete-property/ regulator-always-on;
-	/delete-property/ regulator-boot-on;
-};
-
 /* Need this and all the pinctrl/gpio stuff above to set pinmux */
 &vcc_sd {
 	bootph-pre-ram;
arch/arm/dts/rk3328-u-boot.dtsi +0 -11
index 668f8ca29d..ce96ce40a7 100644
@@ -26,17 +26,6 @@
 		       0x0 0xff720000 0x0 0x1000
 		       0x0 0xff798000 0x0 0x1000>;
 	};
-
-	usb_host0_xhci: usb@ff600000 {
-		compatible = "rockchip,rk3328-xhci";
-		reg = <0x0 0xff600000 0x0 0x100000>;
-		interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
-		snps,dis-enblslpm-quirk;
-		snps,phyif-utmi-bits = <16>;
-		snps,dis-u2-freeclk-exists-quirk;
-		snps,dis-u2-susphy-quirk;
-		status = "disabled";
-	};
 };
 
 &cru {
Signature · 1 line
2.25.1
Reviewed-by on v2 1/7
#2 lore raw

Re: [PATCH v2 1/7] arm64: dts: rockchip: Drop unused rk3328-xhci node

Quoted 4 lines · Jagan Teki

rk3328-xhci has been added due to the fact that the upstream dwc3 is unsupported. Moreover, the driver for rk3328-xhci is not added to the code tree.

Quoted 8 lines

By considering these facts and unsupported rk3328-xhci this patch is dropping all related code from DT. However, the DWC3 is fixed now in dwc3-generic and RK3328 USB 3.0 is functional in upcoming patches.

Let's drop it.

Thanks,
- Kever

Quoted 113 lines

---
Changes for v2:
- none

  arch/arm/dts/rk3328-evb-u-boot.dtsi       |  5 -----
  arch/arm/dts/rk3328-roc-cc-u-boot.dtsi    | 14 --------------
  arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi |  5 -----
  arch/arm/dts/rk3328-rock64-u-boot.dtsi    | 15 ---------------
  arch/arm/dts/rk3328-u-boot.dtsi           | 11 -----------
  5 files changed, 50 deletions(-)
arch/arm/dts/rk3328-evb-u-boot.dtsi +0 -5
index 4bfa0c2330..f9c729d3bd 100644
@@ -44,8 +44,3 @@
  	/* Integrated PHY unsupported by U-boot */
  	status = "broken";
  };
-
-&usb_host0_xhci {
-	vbus-supply = <&vcc5v0_host_xhci>;
-	status = "okay";
-};
arch/arm/dts/rk3328-roc-cc-u-boot.dtsi +0 -14
index 27a454f017..2062f34bf8 100644
@@ -48,20 +48,6 @@
  	bootph-pre-ram;
  };
 
-&usb_host0_xhci {
-	vbus-supply = <&vcc_host1_5v>;
-	status = "okay";
-};
-
-/*
- * This makes XHCI responsible for toggling VBUS. This is needed to work
- * around an issue where either XHCI only works with USB 2.0 or OTG doesn't
- * work, depending on how VBUS is configured. Having USB 3.0 seems better.
- */
-&vcc_host1_5v {
-	/delete-property/ regulator-always-on;
-};
-
  /* Need this and all the pinctrl/gpio stuff above to set pinmux */
  &vcc_sd {
  	bootph-pre-ram;
arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi +0 -5
index 088e21c76a..1f220c6dcd 100644
@@ -45,11 +45,6 @@
  	bootph-pre-ram;
  };
 
-&usb_host0_xhci {
-	vbus-supply = <&vcc_host_5v>;
-	status = "okay";
-};
-
  /* Need this and all the pinctrl/gpio stuff above to set pinmux */
  &vcc_sd {
  	bootph-pre-ram;
arch/arm/dts/rk3328-rock64-u-boot.dtsi +0 -15
index c20a99a620..849854302e 100644
@@ -48,21 +48,6 @@
  	bootph-pre-ram;
  };
 
-&usb_host0_xhci {
-	vbus-supply = <&vcc_host_5v>;
-	status = "okay";
-};
-
-/*
- * This makes XHCI responsible for toggling VBUS. This is needed to work
- * around an issue where either XHCI only works with USB 2.0 or OTG doesn't
- * work, depending on how VBUS is configured. Having USB 3.0 seems better.
- */
-&vcc_host_5v {
-	/delete-property/ regulator-always-on;
-	/delete-property/ regulator-boot-on;
-};
-
  /* Need this and all the pinctrl/gpio stuff above to set pinmux */
  &vcc_sd {
  	bootph-pre-ram;
arch/arm/dts/rk3328-u-boot.dtsi +0 -11
index 668f8ca29d..ce96ce40a7 100644
@@ -26,17 +26,6 @@
  		       0x0 0xff720000 0x0 0x1000
  		       0x0 0xff798000 0x0 0x1000>;
  	};
-
-	usb_host0_xhci: usb@ff600000 {
-		compatible = "rockchip,rk3328-xhci";
-		reg = <0x0 0xff600000 0x0 0x100000>;
-		interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
-		snps,dis-enblslpm-quirk;
-		snps,phyif-utmi-bits = <16>;
-		snps,dis-u2-freeclk-exists-quirk;
-		snps,dis-u2-susphy-quirk;
-		status = "disabled";
-	};
  };
 
  &cru {
author
#3 lore raw

PATCH v2 2/7 configs: Drop unused XHCI_DWC3 for RK3328 boards

In reply to Jagan Teki

Driver support for rk3328 is not supported so drop this unused XHCI_DWC3.

Cc Tianling Shen <[email protected]>
Cc David Bauer <[email protected]>
Cc Loic Devulder <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Banglang Huang <[email protected]>
Cc Matwey V. Kornilov <[email protected]>

---
Changes for v2:
- none

 configs/evb-rk3328_defconfig        | 1 -
 configs/nanopi-r2c-rk3328_defconfig | 1 -
 configs/nanopi-r2s-rk3328_defconfig | 1 -
 configs/roc-cc-rk3328_defconfig     | 1 -
 configs/rock-pi-e-rk3328_defconfig  | 1 -
 configs/rock64-rk3328_defconfig     | 1 -
 6 files changed, 6 deletions(-)
configs/evb-rk3328_defconfig +0 -1
index 580ee502dc..5ab7abff9e 100644
@@ -93,7 +93,6 @@ CONFIG_SYSRESET=y
 # CONFIG_TPL_SYSRESET is not set
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
 CONFIG_USB_OHCI_HCD=y
configs/nanopi-r2c-rk3328_defconfig +0 -1
index 84710c185b..6af874ca2c 100644
@@ -97,7 +97,6 @@ CONFIG_SYSRESET=y
 # CONFIG_TPL_SYSRESET is not set
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
 CONFIG_USB_OHCI_HCD=y
configs/nanopi-r2s-rk3328_defconfig +0 -1
index 21d7a073e2..7b0fadbce9 100644
@@ -97,7 +97,6 @@ CONFIG_SYSRESET=y
 # CONFIG_TPL_SYSRESET is not set
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
 CONFIG_USB_OHCI_HCD=y
configs/roc-cc-rk3328_defconfig +0 -1
index 6b3bc75ae9..477179e80e 100644
@@ -102,7 +102,6 @@ CONFIG_SYSRESET=y
 # CONFIG_TPL_SYSRESET is not set
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
 CONFIG_USB_OHCI_HCD=y
configs/rock-pi-e-rk3328_defconfig +0 -1
index 9c67d0c5fe..633d5417a9 100644
@@ -103,7 +103,6 @@ CONFIG_SYSRESET=y
 # CONFIG_TPL_SYSRESET is not set
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
 CONFIG_USB_OHCI_HCD=y
configs/rock64-rk3328_defconfig +0 -1
index 74a9cc0a7d..ae761d08a1 100644
@@ -100,7 +100,6 @@ CONFIG_SYSRESET=y
 # CONFIG_TPL_SYSRESET is not set
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_EHCI_GENERIC=y
 CONFIG_USB_OHCI_HCD=y
Signature · 1 line
2.25.1
Reviewed-by on v2 2/7
#4 lore raw

Re: [PATCH v2 2/7] configs: Drop unused XHCI_DWC3 for RK3328 boards

Quoted 10 lines · Jagan Teki

Driver support for rk3328 is not supported so drop this unused XHCI_DWC3.

Cc Tianling Shen <[email protected]>
Cc David Bauer <[email protected]>
Cc Loic Devulder <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Banglang Huang <[email protected]>
Cc Matwey V. Kornilov <[email protected]>

Thanks,
- Kever

Quoted 84 lines

---
Changes for v2:
- none

  configs/evb-rk3328_defconfig        | 1 -
  configs/nanopi-r2c-rk3328_defconfig | 1 -
  configs/nanopi-r2s-rk3328_defconfig | 1 -
  configs/roc-cc-rk3328_defconfig     | 1 -
  configs/rock-pi-e-rk3328_defconfig  | 1 -
  configs/rock64-rk3328_defconfig     | 1 -
  6 files changed, 6 deletions(-)
configs/evb-rk3328_defconfig +0 -1
index 580ee502dc..5ab7abff9e 100644
@@ -93,7 +93,6 @@ CONFIG_SYSRESET=y
  # CONFIG_TPL_SYSRESET is not set
  CONFIG_USB=y
  CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_EHCI_GENERIC=y
  CONFIG_USB_OHCI_HCD=y
configs/nanopi-r2c-rk3328_defconfig +0 -1
index 84710c185b..6af874ca2c 100644
@@ -97,7 +97,6 @@ CONFIG_SYSRESET=y
  # CONFIG_TPL_SYSRESET is not set
  CONFIG_USB=y
  CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_EHCI_GENERIC=y
  CONFIG_USB_OHCI_HCD=y
configs/nanopi-r2s-rk3328_defconfig +0 -1
index 21d7a073e2..7b0fadbce9 100644
@@ -97,7 +97,6 @@ CONFIG_SYSRESET=y
  # CONFIG_TPL_SYSRESET is not set
  CONFIG_USB=y
  CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_EHCI_GENERIC=y
  CONFIG_USB_OHCI_HCD=y
configs/roc-cc-rk3328_defconfig +0 -1
index 6b3bc75ae9..477179e80e 100644
@@ -102,7 +102,6 @@ CONFIG_SYSRESET=y
  # CONFIG_TPL_SYSRESET is not set
  CONFIG_USB=y
  CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_EHCI_GENERIC=y
  CONFIG_USB_OHCI_HCD=y
configs/rock-pi-e-rk3328_defconfig +0 -1
index 9c67d0c5fe..633d5417a9 100644
@@ -103,7 +103,6 @@ CONFIG_SYSRESET=y
  # CONFIG_TPL_SYSRESET is not set
  CONFIG_USB=y
  CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_EHCI_GENERIC=y
  CONFIG_USB_OHCI_HCD=y
configs/rock64-rk3328_defconfig +0 -1
index 74a9cc0a7d..ae761d08a1 100644
@@ -100,7 +100,6 @@ CONFIG_SYSRESET=y
  # CONFIG_TPL_SYSRESET is not set
  CONFIG_USB=y
  CONFIG_USB_XHCI_HCD=y
-CONFIG_USB_XHCI_DWC3=y
  CONFIG_USB_EHCI_HCD=y
  CONFIG_USB_EHCI_GENERIC=y
  CONFIG_USB_OHCI_HCD=y
author
#5 lore raw

PATCH v2 3/7 usb: dwc3-generic: Restrict single ctrl node for RK3328

In reply to Jagan Teki

Like Rockchip RK3568, the RK3328 also have single node to represent the glue and ctrl for USB 3.0.

So, use the driver data to use single ctrl for RK3328 DWC3.

---
Changes for v2:
- collect Marek RB

 drivers/usb/dwc3/dwc3-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-generic.c +1 -1
index 5f8c2613a4..dcf420bafd 100644
@@ -621,7 +621,7 @@ static const struct udevice_id dwc3_glue_ids[] = {
 	{ .compatible = "ti,dwc3", .data = (ulong)&ti_ops },
 	{ .compatible = "ti,am437x-dwc3", .data = (ulong)&ti_ops },
 	{ .compatible = "ti,am654-dwc3" },
-	{ .compatible = "rockchip,rk3328-dwc3" },
+	{ .compatible = "rockchip,rk3328-dwc3", .data = (ulong)&rk_ops },
 	{ .compatible = "rockchip,rk3399-dwc3" },
 	{ .compatible = "rockchip,rk3568-dwc3", .data = (ulong)&rk_ops },
 	{ .compatible = "qcom,dwc3" },
Signature · 1 line
2.25.1
#6 lore raw

Re: [PATCH v2 3/7] usb: dwc3-generic: Restrict single ctrl node for RK3328

Quoted 20 lines · Jagan Teki

Like Rockchip RK3568, the RK3328 also have single node to represent the glue and ctrl for USB 3.0.

So, use the driver data to use single ctrl for RK3328 DWC3.

---
Changes for v2:
- collect Marek RB

 drivers/usb/dwc3/dwc3-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-generic.c +0 -0
index 5f8c2613a4..dcf420bafd 100644

drivers/usb/dwc3/dwc3-generic.c static const struct udevice_id dwc3_glue_ids[] = { · line 624

Quoted 5 lines
drivers/usb/dwc3/dwc3-generic.c +1 -1
@@ -621,7 +621,7 @@ static const struct udevice_id dwc3_glue_ids[] = {
        { .compatible = "ti,dwc3", .data = (ulong)&ti_ops },
        { .compatible = "ti,am437x-dwc3", .data = (ulong)&ti_ops },
        { .compatible = "ti,am654-dwc3" },
-       { .compatible = "rockchip,rk3328-dwc3" },
+       { .compatible = "rockchip,rk3328-dwc3", .data = (ulong)&rk_ops },

This doesn't build for me against master due to rk_ops not being defined, is this against another branch or builds upon another patch set?

Quoted 6 lines
drivers/usb/dwc3/dwc3-generic.c +0 -1
        { .compatible = "rockchip,rk3399-dwc3" },
        { .compatible = "rockchip,rk3568-dwc3", .data = (ulong)&rk_ops },
        { .compatible = "qcom,dwc3" },
--

2.25.1

author
#7 lore raw

Re: [PATCH v2 3/7] usb: dwc3-generic: Restrict single ctrl node for RK3328

Quoted 17 lines · Peter Robinson
Quoted 15 lines · Jagan Teki

Like Rockchip RK3568, the RK3328 also have single node to represent the glue and ctrl for USB 3.0.

So, use the driver data to use single ctrl for RK3328 DWC3.

---
Changes for v2:
- collect Marek RB

 drivers/usb/dwc3/dwc3-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines

drivers/usb/dwc3/dwc3-generic.c static const struct udevice_id dwc3_glue_ids[] = { · line 624

Quoted 10 lines
drivers/usb/dwc3/dwc3-generic.c +1 -1
index 5f8c2613a4..dcf420bafd 100644
@@ -621,7 +621,7 @@ static const struct udevice_id dwc3_glue_ids[] = {
        { .compatible = "ti,dwc3", .data = (ulong)&ti_ops },
        { .compatible = "ti,am437x-dwc3", .data = (ulong)&ti_ops },
        { .compatible = "ti,am654-dwc3" },
-       { .compatible = "rockchip,rk3328-dwc3" },
+       { .compatible = "rockchip,rk3328-dwc3", .data = (ulong)&rk_ops },

This doesn't build for me against master due to rk_ops not being defined, is this against another branch or builds upon another patch set?

This, on top of
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

Jagan.

Reviewed-by on v2 3/7
#8 lore raw

Re: [PATCH v2 3/7] usb: dwc3-generic: Restrict single ctrl node for RK3328

In reply to Jagan Teki
Quoted 7 lines · Jagan Teki

Like Rockchip RK3568, the RK3328 also have single node to represent the glue and ctrl for USB 3.0.

So, use the driver data to use single ctrl for RK3328 DWC3.

Thanks,
- Kever

Quoted 20 lines

---
Changes for v2:
- collect Marek RB

  drivers/usb/dwc3/dwc3-generic.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/dwc3/dwc3-generic.c +1 -1
index 5f8c2613a4..dcf420bafd 100644
@@ -621,7 +621,7 @@ static const struct udevice_id dwc3_glue_ids[] = {
  	{ .compatible = "ti,dwc3", .data = (ulong)&ti_ops },
  	{ .compatible = "ti,am437x-dwc3", .data = (ulong)&ti_ops },
  	{ .compatible = "ti,am654-dwc3" },
-	{ .compatible = "rockchip,rk3328-dwc3" },
+	{ .compatible = "rockchip,rk3328-dwc3", .data = (ulong)&rk_ops },
  	{ .compatible = "rockchip,rk3399-dwc3" },
  	{ .compatible = "rockchip,rk3568-dwc3", .data = (ulong)&rk_ops },
  	{ .compatible = "qcom,dwc3" },
author
#9 lore raw

PATCH v2 4/7 configs: Enable DWC3 USB 3.0 on RK3328 boards

In reply to Jagan Teki

Enable USB 3.0 in all RK3328 boards.

=> usb start
starting USB...
Bus usb@ff5c0000: ehci_generic usb@ff5c0000: Failed to get clocks (ret=-19) Port not available.
Bus usb@ff5d0000: USB OHCI 1.0
Bus usb@ff600000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@ff580000: 1 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
=> usb tree
USB device tree:
1 Hub (12 Mb/s, 0mA)
U-Boot Root Hub

1 Hub (5 Gb/s, 0mA)
| U-Boot XHCI Host Controller
|
+-2 Mass Storage (5 Gb/s, 224mA)

       SanDisk Dual Drive 040130e3ee554b7078843f4eb331646

1 Hub (480 Mb/s, 0mA)
U-Boot Root Hub

Cc Tianling Shen <[email protected]>
Cc David Bauer <[email protected]>
Cc Loic Devulder <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Banglang Huang <[email protected]>
Cc Matwey V. Kornilov <[email protected]>

---
Changes for v2:
- none

 configs/evb-rk3328_defconfig        | 2 ++
 configs/nanopi-r2c-rk3328_defconfig | 2 ++
 configs/nanopi-r2s-rk3328_defconfig | 2 ++
 configs/roc-cc-rk3328_defconfig     | 2 ++
 configs/rock-pi-e-rk3328_defconfig  | 2 ++
 configs/rock64-rk3328_defconfig     | 2 ++
 6 files changed, 12 insertions(+)
configs/evb-rk3328_defconfig +2 -0
index 5ab7abff9e..5183d65451 100644
@@ -69,6 +69,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_ETH_DESIGNWARE=y
@@ -100,6 +101,7 @@ CONFIG_USB_OHCI_GENERIC=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_DWC3=y
 # CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_GENERIC=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_SPL_TINY_MEMSET=y
configs/nanopi-r2c-rk3328_defconfig +2 -0
index 6af874ca2c..fb0b8719fb 100644
@@ -71,6 +71,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_ETH_DESIGNWARE=y
@@ -104,6 +105,7 @@ CONFIG_USB_OHCI_GENERIC=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_DWC3=y
 # CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_GENERIC=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_SPL_TINY_MEMSET=y
configs/nanopi-r2s-rk3328_defconfig +2 -0
index 7b0fadbce9..79cb17d751 100644
@@ -71,6 +71,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_ETH_DESIGNWARE=y
@@ -104,6 +105,7 @@ CONFIG_USB_OHCI_GENERIC=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_DWC3=y
 # CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_GENERIC=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_SPL_TINY_MEMSET=y
configs/roc-cc-rk3328_defconfig +2 -0
index 477179e80e..f5912ceca9 100644
@@ -72,6 +72,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_PHY_REALTEK=y
@@ -109,6 +110,7 @@ CONFIG_USB_OHCI_GENERIC=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_DWC3=y
 # CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_GENERIC=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_SPL_TINY_MEMSET=y
configs/rock-pi-e-rk3328_defconfig +2 -0
index 633d5417a9..e86a6f7b1a 100644
@@ -73,6 +73,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_ETH_DESIGNWARE=y
@@ -101,6 +102,7 @@ CONFIG_SYSINFO=y
 CONFIG_SYSINFO_SMBIOS=y
 CONFIG_SYSRESET=y
 # CONFIG_TPL_SYSRESET is not set
+CONFIG_USB_DWC3_GENERIC=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
 CONFIG_USB_EHCI_HCD=y
configs/rock64-rk3328_defconfig +2 -0
index ae761d08a1..4acbca0140 100644
@@ -71,6 +71,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_SPI_FLASH_GIGADEVICE=y
@@ -107,6 +108,7 @@ CONFIG_USB_OHCI_GENERIC=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_DWC3=y
 # CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_GENERIC=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_SPL_TINY_MEMSET=y
Signature · 1 line
2.25.1
Reviewed-by on v2 4/7
#10 lore raw

Re: [PATCH v2 4/7] configs: Enable DWC3 USB 3.0 on RK3328 boards

Quoted 26 lines · Jagan Teki

Enable USB 3.0 in all RK3328 boards.

=> usb start
starting USB...
Bus usb@ff5c0000: ehci_generic usb@ff5c0000: Failed to get clocks (ret=-19) Port not available.
Bus usb@ff5d0000: USB OHCI 1.0
Bus usb@ff600000: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@ff580000: 1 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
=> usb tree
USB device tree:

   1  Hub (12 Mb/s, 0mA)
       U-Boot Root Hub

   1  Hub (5 Gb/s, 0mA)
   |  U-Boot XHCI Host Controller
   |
   +-2  Mass Storage (5 Gb/s, 224mA)
        SanDisk Dual Drive 040130e3ee554b7078843f4eb331646

   1  Hub (480 Mb/s, 0mA)
       U-Boot Root Hub
Quoted 7 lines
Cc Tianling Shen <[email protected]>
Cc David Bauer <[email protected]>
Cc Loic Devulder <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Banglang Huang <[email protected]>
Cc Matwey V. Kornilov <[email protected]>

Thanks,
- Kever

Quoted 132 lines

---
Changes for v2:
- none

  configs/evb-rk3328_defconfig        | 2 ++
  configs/nanopi-r2c-rk3328_defconfig | 2 ++
  configs/nanopi-r2s-rk3328_defconfig | 2 ++
  configs/roc-cc-rk3328_defconfig     | 2 ++
  configs/rock-pi-e-rk3328_defconfig  | 2 ++
  configs/rock64-rk3328_defconfig     | 2 ++
  6 files changed, 12 insertions(+)
configs/evb-rk3328_defconfig +2 -0
index 5ab7abff9e..5183d65451 100644
@@ -69,6 +69,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
  CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
  CONFIG_ROCKCHIP_GPIO=y
  CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
  CONFIG_MMC_DW=y
  CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_ETH_DESIGNWARE=y
@@ -100,6 +101,7 @@ CONFIG_USB_OHCI_GENERIC=y
  CONFIG_USB_DWC2=y
  CONFIG_USB_DWC3=y
  # CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_GENERIC=y
  CONFIG_USB_GADGET=y
  CONFIG_USB_GADGET_DWC2_OTG=y
  CONFIG_SPL_TINY_MEMSET=y
configs/nanopi-r2c-rk3328_defconfig +2 -0
index 6af874ca2c..fb0b8719fb 100644
@@ -71,6 +71,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
  CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
  CONFIG_ROCKCHIP_GPIO=y
  CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
  CONFIG_MMC_DW=y
  CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_ETH_DESIGNWARE=y
@@ -104,6 +105,7 @@ CONFIG_USB_OHCI_GENERIC=y
  CONFIG_USB_DWC2=y
  CONFIG_USB_DWC3=y
  # CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_GENERIC=y
  CONFIG_USB_GADGET=y
  CONFIG_USB_GADGET_DWC2_OTG=y
  CONFIG_SPL_TINY_MEMSET=y
configs/nanopi-r2s-rk3328_defconfig +2 -0
index 7b0fadbce9..79cb17d751 100644
@@ -71,6 +71,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
  CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
  CONFIG_ROCKCHIP_GPIO=y
  CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
  CONFIG_MMC_DW=y
  CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_ETH_DESIGNWARE=y
@@ -104,6 +105,7 @@ CONFIG_USB_OHCI_GENERIC=y
  CONFIG_USB_DWC2=y
  CONFIG_USB_DWC3=y
  # CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_GENERIC=y
  CONFIG_USB_GADGET=y
  CONFIG_USB_GADGET_DWC2_OTG=y
  CONFIG_SPL_TINY_MEMSET=y
configs/roc-cc-rk3328_defconfig +2 -0
index 477179e80e..f5912ceca9 100644
@@ -72,6 +72,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
  CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
  CONFIG_ROCKCHIP_GPIO=y
  CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
  CONFIG_MMC_DW=y
  CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_PHY_REALTEK=y
@@ -109,6 +110,7 @@ CONFIG_USB_OHCI_GENERIC=y
  CONFIG_USB_DWC2=y
  CONFIG_USB_DWC3=y
  # CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_GENERIC=y
  CONFIG_USB_GADGET=y
  CONFIG_USB_GADGET_DWC2_OTG=y
  CONFIG_SPL_TINY_MEMSET=y
configs/rock-pi-e-rk3328_defconfig +2 -0
index 633d5417a9..e86a6f7b1a 100644
@@ -73,6 +73,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
  CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
  CONFIG_ROCKCHIP_GPIO=y
  CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
  CONFIG_MMC_DW=y
  CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_ETH_DESIGNWARE=y
@@ -101,6 +102,7 @@ CONFIG_SYSINFO=y
  CONFIG_SYSINFO_SMBIOS=y
  CONFIG_SYSRESET=y
  # CONFIG_TPL_SYSRESET is not set
+CONFIG_USB_DWC3_GENERIC=y
  CONFIG_USB=y
  CONFIG_USB_XHCI_HCD=y
  CONFIG_USB_EHCI_HCD=y
configs/rock64-rk3328_defconfig +2 -0
index ae761d08a1..4acbca0140 100644
@@ -71,6 +71,7 @@ CONFIG_FASTBOOT_BUF_ADDR=0x800800
  CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
  CONFIG_ROCKCHIP_GPIO=y
  CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
  CONFIG_MMC_DW=y
  CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_SPI_FLASH_GIGADEVICE=y
@@ -107,6 +108,7 @@ CONFIG_USB_OHCI_GENERIC=y
  CONFIG_USB_DWC2=y
  CONFIG_USB_DWC3=y
  # CONFIG_USB_DWC3_GADGET is not set
+CONFIG_USB_DWC3_GENERIC=y
  CONFIG_USB_GADGET=y
  CONFIG_USB_GADGET_DWC2_OTG=y
  CONFIG_SPL_TINY_MEMSET=y
author
#11 lore raw

PATCH v2 5/7 phy: rockchip-inno-usb2: Add USB2 PHY for RK3328

In reply to Jagan Teki

USB2.0 Host and OTG controllers in RK3328 are using USB2PHY.

Add support for it.

---
Changes for v2:
- add clkout_ctl

 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +34 -0
index e43a5ba9b5..d8738f891d 100644
@@ -345,6 +345,36 @@ bind_fail:
 	return ret;
 }
 
+static const struct rockchip_usb2phy_cfg rk3328_usb2phy_cfgs[] = {
+	{
+		.reg = 0x100,
+		.clkout_ctl	= { 0x108, 4, 4, 1, 0 },
+		.port_cfgs	= {
+			[USB2PHY_PORT_OTG] = {
+				.phy_sus	= { 0x0100, 15, 0, 0, 0x1d1 },
+				.bvalid_det_en	= { 0x0110, 3, 2, 0, 3 },
+				.bvalid_det_st	= { 0x0114, 3, 2, 0, 3 },
+				.bvalid_det_clr = { 0x0118, 3, 2, 0, 3 },
+				.ls_det_en	= { 0x0110, 0, 0, 0, 1 },
+				.ls_det_st	= { 0x0114, 0, 0, 0, 1 },
+				.ls_det_clr	= { 0x0118, 0, 0, 0, 1 },
+				.utmi_avalid	= { 0x0120, 10, 10, 0, 1 },
+				.utmi_bvalid	= { 0x0120, 9, 9, 0, 1 },
+				.utmi_ls	= { 0x0120, 5, 4, 0, 1 },
+			},
+			[USB2PHY_PORT_HOST] = {
+				.phy_sus	= { 0x104, 15, 0, 0, 0x1d1 },
+				.ls_det_en	= { 0x110, 1, 1, 0, 1 },
+				.ls_det_st	= { 0x114, 1, 1, 0, 1 },
+				.ls_det_clr	= { 0x118, 1, 1, 0, 1 },
+				.utmi_ls	= { 0x120, 17, 16, 0, 1 },
+				.utmi_hstdet	= { 0x120, 19, 19, 0, 1 }
+			}
+		},
+	},
+	{ /* sentinel */ }
+};
+
 static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = {
 	{
 		.reg		= 0xe450,
@@ -498,6 +528,10 @@ static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = {
 };
 
 static const struct udevice_id rockchip_usb2phy_ids[] = {
+	{
+		.compatible = "rockchip,rk3328-usb2phy",
+		.data = (ulong)&rk3328_usb2phy_cfgs,
+	},
 	{
 		.compatible = "rockchip,rk3399-usb2phy",
 		.data = (ulong)&rk3399_usb2phy_cfgs,
Signature · 1 line
2.25.1
Reviewed-by on v2 5/7
#12 lore raw

Re: [PATCH v2 5/7] phy: rockchip-inno-usb2: Add USB2 PHY for RK3328

El Tue, Jun 06, 2023 at 10:39:16PM +0530, Jagan Teki deia:

Quoted 5 lines

USB2.0 Host and OTG controllers in RK3328 are using USB2PHY.

Add support for it.

(fwiw, I just compared it with linux)

I just wanted to note this patch as written most likely depends on
https://patchwork.ozlabs.org/project/uboot/patch/464111fca83008503022e8ada5305e69ffd1afbd.1685974993.git.xdrudis@tinet.cat/

which introduces the struct member clkout_ctl used here.

Quoted 19 lines

---
Changes for v2:
- add clkout_ctl

 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +4 -0
index e43a5ba9b5..d8738f891d 100644
@@ -345,6 +345,36 @@ bind_fail:
 	return ret;
 }
 
+static const struct rockchip_usb2phy_cfg rk3328_usb2phy_cfgs[] = {
+	{
+		.reg = 0x100,
+		.clkout_ctl	= { 0x108, 4, 4, 1, 0 },

[...]

Reviewed-by on v2 5/7
#13 lore raw

Re: [PATCH v2 5/7] phy: rockchip-inno-usb2: Add USB2 PHY for RK3328

In reply to Jagan Teki
Quoted 5 lines · Jagan Teki

USB2.0 Host and OTG controllers in RK3328 are using USB2PHY.

Add support for it.

Thanks,
- Kever

Quoted 59 lines

---
Changes for v2:
- add clkout_ctl

  drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 34 +++++++++++++++++++
  1 file changed, 34 insertions(+)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +34 -0
index e43a5ba9b5..d8738f891d 100644
@@ -345,6 +345,36 @@ bind_fail:
  	return ret;
  }
 
+static const struct rockchip_usb2phy_cfg rk3328_usb2phy_cfgs[] = {
+	{
+		.reg = 0x100,
+		.clkout_ctl	= { 0x108, 4, 4, 1, 0 },
+		.port_cfgs	= {
+			[USB2PHY_PORT_OTG] = {
+				.phy_sus	= { 0x0100, 15, 0, 0, 0x1d1 },
+				.bvalid_det_en	= { 0x0110, 3, 2, 0, 3 },
+				.bvalid_det_st	= { 0x0114, 3, 2, 0, 3 },
+				.bvalid_det_clr = { 0x0118, 3, 2, 0, 3 },
+				.ls_det_en	= { 0x0110, 0, 0, 0, 1 },
+				.ls_det_st	= { 0x0114, 0, 0, 0, 1 },
+				.ls_det_clr	= { 0x0118, 0, 0, 0, 1 },
+				.utmi_avalid	= { 0x0120, 10, 10, 0, 1 },
+				.utmi_bvalid	= { 0x0120, 9, 9, 0, 1 },
+				.utmi_ls	= { 0x0120, 5, 4, 0, 1 },
+			},
+			[USB2PHY_PORT_HOST] = {
+				.phy_sus	= { 0x104, 15, 0, 0, 0x1d1 },
+				.ls_det_en	= { 0x110, 1, 1, 0, 1 },
+				.ls_det_st	= { 0x114, 1, 1, 0, 1 },
+				.ls_det_clr	= { 0x118, 1, 1, 0, 1 },
+				.utmi_ls	= { 0x120, 17, 16, 0, 1 },
+				.utmi_hstdet	= { 0x120, 19, 19, 0, 1 }
+			}
+		},
+	},
+	{ /* sentinel */ }
+};
+
  static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = {
  	{
  		.reg		= 0xe450,
@@ -498,6 +528,10 @@ static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = {
  };
 
  static const struct udevice_id rockchip_usb2phy_ids[] = {
+	{
+		.compatible = "rockchip,rk3328-usb2phy",
+		.data = (ulong)&rk3328_usb2phy_cfgs,
+	},
  	{
  		.compatible = "rockchip,rk3399-usb2phy",
  		.data = (ulong)&rk3399_usb2phy_cfgs,
author
#14 lore raw

PATCH v2 6/7 clk: rockchip: rk3328: Handle usb480m phy clock

In reply to Jagan Teki

Handle USB480M clock ID in set_rate() and set_parent() to allow the dt assigned-clocks and assigned-clock-parents work on rk3328.dtsi

Cc Lukasz Majewski <[email protected]>
Cc Sean Anderson <[email protected]>

---
Changes for v2:
- add USB480M to set_parent

 drivers/clk/rockchip/clk_rk3328.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/rockchip/clk_rk3328.c +2 -0
index 969b7a8581..ef97381f0e 100644
@@ -681,6 +681,7 @@ static ulong rk3328_clk_set_rate(struct clk *clk, ulong rate)
 	case ACLK_GMAC:
 	case PCLK_GMAC:
 	case SCLK_USB3OTG_SUSPEND:
+	case USB480M:
 		return 0;
 	default:
 		return -ENOENT;
@@ -771,6 +772,7 @@ static int rk3328_clk_set_parent(struct clk *clk, struct clk *parent)
 	case SCLK_MAC2IO_EXT:
 		return rk3328_gmac2io_ext_set_parent(clk, parent);
 	case DCLK_LCDC:
+	case USB480M:
 	case SCLK_PDM:
 	case SCLK_RTC32K:
 	case SCLK_UART0:
Signature · 1 line
2.25.1
Reviewed-by on v2 6/7
#15 lore raw

Re: [PATCH v2 6/7] clk: rockchip: rk3328: Handle usb480m phy clock

Quoted 7 lines · Jagan Teki

Handle USB480M clock ID in set_rate() and set_parent() to allow the dt assigned-clocks and assigned-clock-parents work on rk3328.dtsi

Cc Lukasz Majewski <[email protected]>
Cc Sean Anderson <[email protected]>

Thanks,
- Kever

Quoted 27 lines

---
Changes for v2:
- add USB480M to set_parent

  drivers/clk/rockchip/clk_rk3328.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/clk/rockchip/clk_rk3328.c +2 -0
index 969b7a8581..ef97381f0e 100644
@@ -681,6 +681,7 @@ static ulong rk3328_clk_set_rate(struct clk *clk, ulong rate)
  	case ACLK_GMAC:
  	case PCLK_GMAC:
  	case SCLK_USB3OTG_SUSPEND:
+	case USB480M:
  		return 0;
  	default:
  		return -ENOENT;
@@ -771,6 +772,7 @@ static int rk3328_clk_set_parent(struct clk *clk, struct clk *parent)
  	case SCLK_MAC2IO_EXT:
  		return rk3328_gmac2io_ext_set_parent(clk, parent);
  	case DCLK_LCDC:
+	case USB480M:
  	case SCLK_PDM:
  	case SCLK_RTC32K:
  	case SCLK_UART0:
author
#16 lore raw

PATCH v2 7/7 configs: rockchip: Enable USB2PHY for RK3328 boards

In reply to Jagan Teki

Enable USB2PHY for all RK3328 boards.

=> usb start
starting USB...
Bus usb@ff5c0000: USB EHCI 1.00
Bus usb@ff5d0000: USB OHCI 1.0
Bus usb@ff600000: generic_phy_get_bulk : no phys property Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@ff580000: USB DWC2
scanning bus usb@ff5c0000 for devices... 2 USB Device(s) found scanning bus usb@ff5d0000 for devices... 1 USB Device(s) found scanning bus usb@ff600000 for devices... 2 USB Device(s) found scanning bus usb@ff580000 for devices... 2 USB Device(s) found
scanning usb for storage devices... 2 Storage Device(s) found
=> usb tree
USB device tree:
1 Hub (480 Mb/s, 0mA)
| u-boot EHCI Host Controller
|
+-2 Mass Storage (480 Mb/s, 500mA)

       TS-RDF5A Transcend 000000000009

1 Hub (12 Mb/s, 0mA)
U-Boot Root Hub

1 Hub (5 Gb/s, 0mA)
| U-Boot XHCI Host Controller
|
+-2 Mass Storage (5 Gb/s, 224mA)

       SanDisk Dual Drive 040130e3ee554b7078843f4eb331646

1 Hub (480 Mb/s, 0mA)
| U-Boot Root Hub
|
+-2 Human Interface (12 Mb/s, 98mA)
Logitech USB Receiver

=> dm tree -s
Class Index Probed Driver Name
-----------------------------------------------------------

 syscon        1  [ + ]   syscon                |-- syscon@ff450000
 phy           0  [ + ]   rockchip_usb2phy      |   `-- usb2phy@100
 clk           2  [ + ]   rockchip_usb2phy_clo  |       |-- usb480m_phy
 phy           1  [ + ]   rockchip_usb2phy_por  |       |-- otg-port
 phy           2  [ + ]   rockchip_usb2phy_por  |       `-- host-port
 sysinfo       0  [ + ]   sysinfo_smbios        |-- smbios
 usb           3  [ + ]   dwc2_usb              |-- usb@ff580000
 usb_hub       3  [ + ]   usb_hub               |   `-- usb_hub
 usb_dev_ge    0  [ + ]   usb_dev_generic_drv   |       `-- generic_bus_3_dev_2
 usb           0  [ + ]   ehci_generic          |-- usb@ff5c0000
 usb_hub       0  [ + ]   usb_hub               |   `-- usb_hub
 usb_mass_s    0  [ + ]   usb_mass_storage      |       `-- usb_mass_storage
 blk           2  [ + ]   usb_storage_blk       |           |-- usb_mass_storage.lun0
 partition     4  [ + ]   blk_partition         |           |   |-- usb_mass_storage.lun0:1
 partition     5  [ + ]   blk_partition         |           |   `-- usb_mass_storage.lun0:2
 bootdev       3  [   ]   usb_bootdev           |           `-- usb_mass_storage.lun0.bootdev
 usb           1  [ + ]   ohci_generic          `-- usb@ff5d0000
 usb_hub       1  [ + ]   usb_hub                   `-- usb_hub
Cc Tianling Shen <[email protected]>
Cc David Bauer <[email protected]>
Cc Loic Devulder <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Banglang Huang <[email protected]>
Cc Matwey V. Kornilov <[email protected]>

---
Changes for v2:
- update commit message.

 configs/evb-rk3328_defconfig        | 1 +
 configs/nanopi-r2c-rk3328_defconfig | 1 +
 configs/nanopi-r2s-rk3328_defconfig | 1 +
 configs/roc-cc-rk3328_defconfig     | 1 +
 configs/rock-pi-e-rk3328_defconfig  | 1 +
 configs/rock64-rk3328_defconfig     | 1 +
 6 files changed, 6 insertions(+)
configs/evb-rk3328_defconfig +1 -0
index 5183d65451..8f53aadbb6 100644
@@ -74,6 +74,7 @@ CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_DM_PMIC=y
configs/nanopi-r2c-rk3328_defconfig +1 -0
index fb0b8719fb..583179d7c5 100644
@@ -76,6 +76,7 @@ CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_DM_PMIC=y
configs/nanopi-r2s-rk3328_defconfig +1 -0
index 79cb17d751..f7ed71e412 100644
@@ -76,6 +76,7 @@ CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_DM_PMIC=y
configs/roc-cc-rk3328_defconfig +1 -0
index f5912ceca9..4ac3c9403b 100644
@@ -79,6 +79,7 @@ CONFIG_PHY_REALTEK=y
 CONFIG_PHY_GIGE=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_DM_PMIC=y
configs/rock-pi-e-rk3328_defconfig +1 -0
index e86a6f7b1a..277f691d4d 100644
@@ -78,6 +78,7 @@ CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PHY=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
configs/rock64-rk3328_defconfig +1 -0
index 4acbca0140..5e36612bb8 100644
@@ -77,6 +77,7 @@ CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_SPI_FLASH_GIGADEVICE=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_DM_PMIC=y
Signature · 1 line
2.25.1
Reviewed-by on v2 7/7
#17 lore raw

Re: [PATCH v2 7/7] configs: rockchip: Enable USB2PHY for RK3328 boards

Quoted 61 lines · Jagan Teki

Enable USB2PHY for all RK3328 boards.

=> usb start
starting USB...
Bus usb@ff5c0000: USB EHCI 1.00
Bus usb@ff5d0000: USB OHCI 1.0
Bus usb@ff600000: generic_phy_get_bulk : no phys property Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus usb@ff580000: USB DWC2
scanning bus usb@ff5c0000 for devices... 2 USB Device(s) found scanning bus usb@ff5d0000 for devices... 1 USB Device(s) found scanning bus usb@ff600000 for devices... 2 USB Device(s) found scanning bus usb@ff580000 for devices... 2 USB Device(s) found
scanning usb for storage devices... 2 Storage Device(s) found
=> usb tree
USB device tree:

   1  Hub (480 Mb/s, 0mA)
   |  u-boot EHCI Host Controller
   |
   +-2  Mass Storage (480 Mb/s, 500mA)
        TS-RDF5A Transcend 000000000009
      
   1  Hub (12 Mb/s, 0mA)
       U-Boot Root Hub
    
   1  Hub (5 Gb/s, 0mA)
   |  U-Boot XHCI Host Controller
   |
   +-2  Mass Storage (5 Gb/s, 224mA)
        SanDisk Dual Drive 040130e3ee554b7078843f4eb331646
      
   1  Hub (480 Mb/s, 0mA)
   |   U-Boot Root Hub
   |
   +-2  Human Interface (12 Mb/s, 98mA)
        Logitech USB Receiver

=> dm tree -s
Class Index Probed Driver Name
-----------------------------------------------------------

  syscon        1  [ + ]   syscon                |-- syscon@ff450000
  phy           0  [ + ]   rockchip_usb2phy      |   `-- usb2phy@100
  clk           2  [ + ]   rockchip_usb2phy_clo  |       |-- usb480m_phy
  phy           1  [ + ]   rockchip_usb2phy_por  |       |-- otg-port
  phy           2  [ + ]   rockchip_usb2phy_por  |       `-- host-port
  sysinfo       0  [ + ]   sysinfo_smbios        |-- smbios
  usb           3  [ + ]   dwc2_usb              |-- usb@ff580000
  usb_hub       3  [ + ]   usb_hub               |   `-- usb_hub
  usb_dev_ge    0  [ + ]   usb_dev_generic_drv   |       `-- generic_bus_3_dev_2
  usb           0  [ + ]   ehci_generic          |-- usb@ff5c0000
  usb_hub       0  [ + ]   usb_hub               |   `-- usb_hub
  usb_mass_s    0  [ + ]   usb_mass_storage      |       `-- usb_mass_storage
  blk           2  [ + ]   usb_storage_blk       |           |-- usb_mass_storage.lun0
  partition     4  [ + ]   blk_partition         |           |   |-- usb_mass_storage.lun0:1
  partition     5  [ + ]   blk_partition         |           |   `-- usb_mass_storage.lun0:2
  bootdev       3  [   ]   usb_bootdev           |           `-- usb_mass_storage.lun0.bootdev
  usb           1  [ + ]   ohci_generic          `-- usb@ff5d0000
  usb_hub       1  [ + ]   usb_hub                   `-- usb_hub
Quoted 7 lines
Cc Tianling Shen <[email protected]>
Cc David Bauer <[email protected]>
Cc Loic Devulder <[email protected]>
Cc Chen-Yu Tsai <[email protected]>
Cc Banglang Huang <[email protected]>
Cc Matwey V. Kornilov <[email protected]>

Thanks,
- Kever

Quoted 84 lines

---
Changes for v2:
- update commit message.

  configs/evb-rk3328_defconfig        | 1 +
  configs/nanopi-r2c-rk3328_defconfig | 1 +
  configs/nanopi-r2s-rk3328_defconfig | 1 +
  configs/roc-cc-rk3328_defconfig     | 1 +
  configs/rock-pi-e-rk3328_defconfig  | 1 +
  configs/rock64-rk3328_defconfig     | 1 +
  6 files changed, 6 insertions(+)
configs/evb-rk3328_defconfig +1 -0
index 5183d65451..8f53aadbb6 100644
@@ -74,6 +74,7 @@ CONFIG_MMC_DW=y
  CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
  CONFIG_PINCTRL=y
  CONFIG_SPL_PINCTRL=y
  CONFIG_DM_PMIC=y
configs/nanopi-r2c-rk3328_defconfig +1 -0
index fb0b8719fb..583179d7c5 100644
@@ -76,6 +76,7 @@ CONFIG_MMC_DW=y
  CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
  CONFIG_PINCTRL=y
  CONFIG_SPL_PINCTRL=y
  CONFIG_DM_PMIC=y
configs/nanopi-r2s-rk3328_defconfig +1 -0
index 79cb17d751..f7ed71e412 100644
@@ -76,6 +76,7 @@ CONFIG_MMC_DW=y
  CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
  CONFIG_PINCTRL=y
  CONFIG_SPL_PINCTRL=y
  CONFIG_DM_PMIC=y
configs/roc-cc-rk3328_defconfig +1 -0
index f5912ceca9..4ac3c9403b 100644
@@ -79,6 +79,7 @@ CONFIG_PHY_REALTEK=y
  CONFIG_PHY_GIGE=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
  CONFIG_PINCTRL=y
  CONFIG_SPL_PINCTRL=y
  CONFIG_DM_PMIC=y
configs/rock-pi-e-rk3328_defconfig +1 -0
index e86a6f7b1a..277f691d4d 100644
@@ -78,6 +78,7 @@ CONFIG_MMC_DW=y
  CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
  CONFIG_PHY=y
  CONFIG_PINCTRL=y
  CONFIG_SPL_PINCTRL=y
configs/rock64-rk3328_defconfig +1 -0
index 4acbca0140..5e36612bb8 100644
@@ -77,6 +77,7 @@ CONFIG_MMC_DW_ROCKCHIP=y
  CONFIG_SPI_FLASH_GIGADEVICE=y
  CONFIG_ETH_DESIGNWARE=y
  CONFIG_GMAC_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
  CONFIG_PINCTRL=y
  CONFIG_SPL_PINCTRL=y
  CONFIG_DM_PMIC=y
Tested-by on the v2 series
#18 lore raw
In reply to Jagan Teki
Quoted 9 lines · Jagan Teki

This series support fixes for RK3328 USB.

Changes for v2:
- collect Marek RB
- update phy driver clockout_ctl for rk3328
- retest on Xavier patches.

Any inputs?

I've done some basic testing of thing on a Rock64 and it looks good to me so for the series:

Quoted 30 lines

Jagan.

Jagan Teki (7):
arm64: dts: rockchip: Drop unused rk3328-xhci node
configs: Drop unused XHCI_DWC3 for RK3328 boards
usb: dwc3-generic: Restrict single ctrl node for RK3328
configs: Enable DWC3 USB 3.0 on RK3328 boards
phy: rockchip-inno-usb2: Add USB2 PHY for RK3328
clk: rockchip: rk3328: Handle usb480m phy clock
configs: rockchip: Enable USB2PHY for RK3328 boards

 arch/arm/dts/rk3328-evb-u-boot.dtsi           |  5 ---
 arch/arm/dts/rk3328-roc-cc-u-boot.dtsi        | 14 --------
 arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi     |  5 ---
 arch/arm/dts/rk3328-rock64-u-boot.dtsi        | 15 --------
 arch/arm/dts/rk3328-u-boot.dtsi               | 11 ------
 configs/evb-rk3328_defconfig                  |  4 ++-
 configs/nanopi-r2c-rk3328_defconfig           |  4 ++-
 configs/nanopi-r2s-rk3328_defconfig           |  4 ++-
 configs/roc-cc-rk3328_defconfig               |  4 ++-
 configs/rock-pi-e-rk3328_defconfig            |  4 ++-
 configs/rock64-rk3328_defconfig               |  4 ++-
 drivers/clk/rockchip/clk_rk3328.c             |  2 ++
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 34 +++++++++++++++++++
 drivers/usb/dwc3/dwc3-generic.c               |  2 +-
 14 files changed, 55 insertions(+), 57 deletions(-)

--
2.25.1

author
#19 lore raw
In reply to Jagan Teki

Hi Kever,

Quoted 11 lines · Jagan Teki

This series support fixes for RK3328 USB.

Changes for v2:
- collect Marek RB
- update phy driver clockout_ctl for rk3328
- retest on Xavier patches.

Any inputs?
Jagan.

Quoted 8 lines

Jagan Teki (7):
arm64: dts: rockchip: Drop unused rk3328-xhci node
configs: Drop unused XHCI_DWC3 for RK3328 boards
usb: dwc3-generic: Restrict single ctrl node for RK3328
configs: Enable DWC3 USB 3.0 on RK3328 boards
phy: rockchip-inno-usb2: Add USB2 PHY for RK3328
clk: rockchip: rk3328: Handle usb480m phy clock
configs: rockchip: Enable USB2PHY for RK3328 boards

Merge them in MW if you don't have any comments.

Thanks,
Jagan.