Linux USB
 help / color / mirror / Atom feed
* [PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support
@ 2026-10-09  7:30 Junzhong Pan
  2026-10-09  7:30 ` [PATCH v4 1/8] dt-bindings: usb: ci-hdrc-usb2: add spacemit,k1-usb2 compatible Junzhong Pan
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Junzhong Pan @ 2026-10-09  7:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Yixun Lan, Xu Yang, Peng Fan, Peter Chen,
	Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti
  Cc: linux-usb, devicetree, linux-kernel, linux-riscv, spacemit,
	Junzhong Pan, Conor Dooley, Ze Huang, Troy Mitchell

The SpacemiT K1 SoC has two USB2.0 controllers, one has Dual-Role
support, but the hardware has no internal OTG registers, the other is
Host only. These controllers are compatible with Chipidea USB2 driver
with some flags set and reset control support.

This series is based on 7.3-rc1 and has been tested on Banana Pi F3
development board.

A self-powered USB device/hub is needed to test the host function of the
dual-role controller on Banana Pi F3, a MINI-PCIe USB2.0 module (a
cellular module e.g.) is needed to test the host only controller.

---
Changes in v4:
- drop irrelevant Tested-by tags collected by b4
- collect Reviewd-by from Yixun
- Link to v3: https://lore.kernel.org/r/20260927-b4-spacemit-k1-usb2-v3-0-ce7095896039@linux.spacemit.com

Changes in v3:
- collect tags
- merge the two dt-binding commits
- use local variables when acquiring devm managed clock/reset
- drop manual clk_disable_unprepare() from the remove path
- enable related drivers as modules in defconfig
- Link to v2: https://lore.kernel.org/r/20260908-b4-spacemit-k1-usb2-v2-0-f07342ffa051@linux.spacemit.com

Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>

---
Junzhong Pan (8):
      dt-bindings: usb: ci-hdrc-usb2: add spacemit,k1-usb2 compatible
      usb: chipidea: usb2: use devm_clk_get_optional_enabled()
      usb: chipidea: usb2: add optional reset support
      usb: chipidea: usb2: add SpacemiT K1 support
      riscv: dts: spacemit: add USB2.0 controller nodes for K1
      riscv: dts: spacemit: enable USB2.0 controllers on BananaPi F3
      riscv: dts: spacemit: enable USB2.0 controllers on OrangePi RV2
      riscv: defconfig: enable ChipIdea USB controller support

 .../devicetree/bindings/usb/ci-hdrc-usb2.yaml      | 15 ++++++++
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts    | 16 +++++++++
 arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts   | 28 +++++++++++++++
 arch/riscv/boot/dts/spacemit/k1.dtsi               | 40 ++++++++++++++++++++++
 arch/riscv/configs/defconfig                       |  4 +++
 drivers/usb/chipidea/ci_hdrc_usb2.c                | 35 +++++++++++--------
 6 files changed, 123 insertions(+), 15 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260812-b4-spacemit-k1-usb2-97adfc283d58

Best regards,
-- 
Junzhong Pan <panjunzhong@linux.spacemit.com>


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v4 1/8] dt-bindings: usb: ci-hdrc-usb2: add spacemit,k1-usb2 compatible
  2026-10-09  7:30 [PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support Junzhong Pan
@ 2026-10-09  7:30 ` Junzhong Pan
  2026-10-09  7:36   ` sashiko-bot
  2026-10-09  7:30 ` [PATCH v4 2/8] usb: chipidea: usb2: use devm_clk_get_optional_enabled() Junzhong Pan
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Junzhong Pan @ 2026-10-09  7:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Yixun Lan, Xu Yang, Peng Fan, Peter Chen,
	Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti
  Cc: linux-usb, devicetree, linux-kernel, linux-riscv, spacemit,
	Junzhong Pan, Conor Dooley

The USB2.0 controller on the SpacemiT K1 SoC is dual-role capable but
has no internal OTG registers, this requires flags which disable
related features set in platform data. Add a compatible string to match
the platform data.

Chipidea USB2 Controller on SpacemiT K1 requires 1 clock and 1 reset to
work, add constraints for it.

Reviewed-by: Yixun Lan <dlan@kernel.org>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
---
 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
index 620b564914d4..5c2b7eb1a6ff 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
@@ -25,6 +25,7 @@ properties:
           - nvidia,tegra124-udc
           - nxp,s32g2-usb
           - qcom,ci-hdrc
+          - spacemit,k1-usb2
       - items:
           - enum:
               - nvidia,tegra114-ehci
@@ -113,6 +114,20 @@ allOf:
           maxItems: 2
         clock-names:
           maxItems: 2
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: spacemit,k1-usb2
+    then:
+      properties:
+        clocks:
+          maxItems: 1
+        resets:
+          minItems: 1
+      required:
+        - clocks
+        - resets
 
 unevaluatedProperties: false
 

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v4 2/8] usb: chipidea: usb2: use devm_clk_get_optional_enabled()
  2026-10-09  7:30 [PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support Junzhong Pan
  2026-10-09  7:30 ` [PATCH v4 1/8] dt-bindings: usb: ci-hdrc-usb2: add spacemit,k1-usb2 compatible Junzhong Pan
@ 2026-10-09  7:30 ` Junzhong Pan
  2026-10-09  7:36   ` sashiko-bot
  2026-10-09  7:30 ` [PATCH v4 3/8] usb: chipidea: usb2: add optional reset support Junzhong Pan
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Junzhong Pan @ 2026-10-09  7:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Yixun Lan, Xu Yang, Peng Fan, Peter Chen,
	Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti
  Cc: linux-usb, devicetree, linux-kernel, linux-riscv, spacemit,
	Junzhong Pan, Ze Huang

Convert devm_clk_get_optional() and clk_prepare_enable() into a single
call devm_clk_get_optional_enabled().

Reviewed-by: Yixun Lan <dlan@kernel.org>
Tested-by: Ze Huang <huang.ze@linux.dev>
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
---
 drivers/usb/chipidea/ci_hdrc_usb2.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
index 8ffa1e95d8e86..9cef902f36b37 100644
--- a/drivers/usb/chipidea/ci_hdrc_usb2.c
+++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
@@ -20,7 +20,6 @@
 
 struct ci_hdrc_usb2_priv {
 	struct platform_device	*ci_pdev;
-	struct clk		*clk;
 };
 
 static const struct ci_hdrc_platform_data ci_default_pdata = {
@@ -52,6 +51,7 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 	struct ci_hdrc_usb2_priv *priv;
 	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev);
 	const struct ci_hdrc_platform_data *data;
+	struct clk *clk;
 	int ret;
 
 	if (!ci_pdata) {
@@ -70,15 +70,10 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
-	priv->clk = devm_clk_get_optional(dev, NULL);
-	if (IS_ERR(priv->clk))
-		return PTR_ERR(priv->clk);
-
-	ret = clk_prepare_enable(priv->clk);
-	if (ret) {
-		dev_err(dev, "failed to enable the clock: %d\n", ret);
-		return ret;
-	}
+	clk = devm_clk_get_optional_enabled(dev, NULL);
+	if (IS_ERR(clk))
+		return dev_err_probe(dev, PTR_ERR(clk),
+				     "failed to get or enable the clock\n");
 
 	ci_pdata->name = dev_name(dev);
 
@@ -90,7 +85,7 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 			dev_err(dev,
 				"failed to register ci_hdrc platform device: %d\n",
 				ret);
-		goto clk_err;
+		return ret;
 	}
 
 	platform_set_drvdata(pdev, priv);
@@ -99,10 +94,6 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 	pm_runtime_enable(dev);
 
 	return 0;
-
-clk_err:
-	clk_disable_unprepare(priv->clk);
-	return ret;
 }
 
 static void ci_hdrc_usb2_remove(struct platform_device *pdev)
@@ -111,7 +102,6 @@ static void ci_hdrc_usb2_remove(struct platform_device *pdev)
 
 	pm_runtime_disable(&pdev->dev);
 	ci_hdrc_remove_device(priv->ci_pdev);
-	clk_disable_unprepare(priv->clk);
 }
 
 static struct platform_driver ci_hdrc_usb2_driver = {

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v4 3/8] usb: chipidea: usb2: add optional reset support
  2026-10-09  7:30 [PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support Junzhong Pan
  2026-10-09  7:30 ` [PATCH v4 1/8] dt-bindings: usb: ci-hdrc-usb2: add spacemit,k1-usb2 compatible Junzhong Pan
  2026-10-09  7:30 ` [PATCH v4 2/8] usb: chipidea: usb2: use devm_clk_get_optional_enabled() Junzhong Pan
@ 2026-10-09  7:30 ` Junzhong Pan
  2026-10-09  7:36   ` sashiko-bot
  2026-10-09  7:30 ` [PATCH v4 4/8] usb: chipidea: usb2: add SpacemiT K1 support Junzhong Pan
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Junzhong Pan @ 2026-10-09  7:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Yixun Lan, Xu Yang, Peng Fan, Peter Chen,
	Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti
  Cc: linux-usb, devicetree, linux-kernel, linux-riscv, spacemit,
	Junzhong Pan, Ze Huang, Troy Mitchell

The USB2 controller of SpacemiT K1 SoC requires reset support, to keep
compatibility, add optional reset support.

Tested-by: Ze Huang <huang.ze@linux.dev>
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Reviewed-by: Yixun Lan <dlan@kernel.org>
Acked-by: Peter Chen <peter.chen@kernel.org>
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
---
 drivers/usb/chipidea/ci_hdrc_usb2.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
index 9cef902f36b3..85244e8bbc3f 100644
--- a/drivers/usb/chipidea/ci_hdrc_usb2.c
+++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
@@ -12,6 +12,7 @@
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
+#include <linux/reset.h>
 #include <linux/usb/chipidea.h>
 #include <linux/usb/hcd.h>
 #include <linux/usb/ulpi.h>
@@ -52,6 +53,7 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 	struct ci_hdrc_platform_data *ci_pdata = dev_get_platdata(dev);
 	const struct ci_hdrc_platform_data *data;
 	struct clk *clk;
+	struct reset_control *reset;
 	int ret;
 
 	if (!ci_pdata) {
@@ -75,6 +77,11 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
 		return dev_err_probe(dev, PTR_ERR(clk),
 				     "failed to get or enable the clock\n");
 
+	reset = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
+	if (IS_ERR(reset))
+		return dev_err_probe(dev, PTR_ERR(reset),
+				     "failed to get or deassert the reset control\n");
+
 	ci_pdata->name = dev_name(dev);
 
 	priv->ci_pdev = ci_hdrc_add_device(dev, pdev->resource,

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v4 4/8] usb: chipidea: usb2: add SpacemiT K1 support
  2026-10-09  7:30 [PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support Junzhong Pan
                   ` (2 preceding siblings ...)
  2026-10-09  7:30 ` [PATCH v4 3/8] usb: chipidea: usb2: add optional reset support Junzhong Pan
@ 2026-10-09  7:30 ` Junzhong Pan
  2026-10-09  7:34   ` sashiko-bot
  2026-10-09  7:30 ` [PATCH v4 5/8] riscv: dts: spacemit: add USB2.0 controller nodes for K1 Junzhong Pan
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Junzhong Pan @ 2026-10-09  7:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Yixun Lan, Xu Yang, Peng Fan, Peter Chen,
	Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti
  Cc: linux-usb, devicetree, linux-kernel, linux-riscv, spacemit,
	Junzhong Pan, Ze Huang, Troy Mitchell

Add a compatible for SpacemiT K1, and add platform data with correct
flag since the hardware doesn't have internal otg register support.

Acked-by: Peter Chen <peter.chen@kernel.org>
Tested-by: Ze Huang <huang.ze@linux.dev>
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Reviewed-by: Yixun Lan <dlan@kernel.org>
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
---
 drivers/usb/chipidea/ci_hdrc_usb2.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
index 85244e8bbc3f..a5ed2bad5573 100644
--- a/drivers/usb/chipidea/ci_hdrc_usb2.c
+++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
@@ -38,10 +38,18 @@ static const struct ci_hdrc_platform_data ci_zevio_pdata = {
 	.flags		= CI_HDRC_REGS_SHARED | CI_HDRC_FORCE_FULLSPEED,
 };
 
+static const struct ci_hdrc_platform_data ci_k1_pdata = {
+	.capoffset	= DEF_CAPOFFSET,
+	.flags		= CI_HDRC_DISABLE_STREAMING |
+			  CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS |
+			  CI_HDRC_DUAL_ROLE_NOT_OTG,
+};
+
 static const struct of_device_id ci_hdrc_usb2_of_match[] = {
 	{ .compatible = "chipidea,usb2" },
 	{ .compatible = "xlnx,zynq-usb-2.20a", .data = &ci_zynq_pdata },
 	{ .compatible = "lsi,zevio-usb", .data = &ci_zevio_pdata },
+	{ .compatible = "spacemit,k1-usb2", .data = &ci_k1_pdata },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, ci_hdrc_usb2_of_match);

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v4 5/8] riscv: dts: spacemit: add USB2.0 controller nodes for K1
  2026-10-09  7:30 [PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support Junzhong Pan
                   ` (3 preceding siblings ...)
  2026-10-09  7:30 ` [PATCH v4 4/8] usb: chipidea: usb2: add SpacemiT K1 support Junzhong Pan
@ 2026-10-09  7:30 ` Junzhong Pan
  2026-10-09  7:36   ` sashiko-bot
  2026-10-09  7:30 ` [PATCH v4 6/8] riscv: dts: spacemit: enable USB2.0 controllers on BananaPi F3 Junzhong Pan
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Junzhong Pan @ 2026-10-09  7:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Yixun Lan, Xu Yang, Peng Fan, Peter Chen,
	Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti
  Cc: linux-usb, devicetree, linux-kernel, linux-riscv, spacemit,
	Junzhong Pan, Ze Huang

The SpacemiT K1 SoC has two ChipIdea USB2.0 controllers.
- USB2.0 Dual-Role
- usb2.0 Host Only

Add the controller and PHY nodes.

Tested-by: Ze Huang <huang.ze@linux.dev>
Reviewed-by: Yixun Lan <dlan@kernel.org>
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
---
 arch/riscv/boot/dts/spacemit/k1.dtsi | 40 ++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
index 3fabfd34114b..22896e757dbb 100644
--- a/arch/riscv/boot/dts/spacemit/k1.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
@@ -459,6 +459,22 @@ syscon_rcpu2: system-controller@c0888000 {
 			#reset-cells = <1>;
 		};
 
+		usbphy0: phy@c0940000 {
+			compatible = "spacemit,k1-usb2-phy";
+			reg = <0x0 0xc0940000 0x0 0x200>;
+			clocks = <&syscon_apmu CLK_USB_AXI>;
+			#phy-cells = <0>;
+			status = "disabled";
+		};
+
+		usbphy1: phy@c09c0000 {
+			compatible = "spacemit,k1-usb2-phy";
+			reg = <0x0 0xc09c0000 0x0 0x200>;
+			clocks = <&syscon_apmu CLK_USB_P1>;
+			#phy-cells = <0>;
+			status = "disabled";
+		};
+
 		usbphy2: phy@c0a30000 {
 			compatible = "spacemit,k1-usb2-phy";
 			reg = <0x0 0xc0a30000 0x0 0x200>;
@@ -1301,6 +1317,30 @@ storage-bus {
 			#size-cells = <2>;
 			dma-ranges = <0x0 0x00000000 0x0 0x00000000 0x0 0x80000000>;
 
+			usb2_0: usb@c0900000 {
+				compatible = "spacemit,k1-usb2";
+				reg = <0x0 0xc0900000 0x0 0x4100>;
+				interrupts = <105>;
+				clocks = <&syscon_apmu CLK_USB_AXI>;
+				resets = <&syscon_apmu RESET_USB_AXI>;
+				phys = <&usbphy0>;
+				phy-names = "usb-phy";
+				dr_mode = "otg";
+				status = "disabled";
+			};
+
+			usb2_1: usb@c0980000 {
+				compatible = "spacemit,k1-usb2";
+				reg = <0x0 0xc0980000 0x0 0x4100>;
+				interrupts = <118>;
+				clocks = <&syscon_apmu CLK_USB_P1>;
+				resets = <&syscon_apmu RESET_USBP1_AXI>;
+				phys = <&usbphy1>;
+				phy-names = "usb-phy";
+				dr_mode = "host";
+				status = "disabled";
+			};
+
 			usb_dwc3: usb@c0a00000 {
 				compatible = "spacemit,k1-dwc3";
 				reg = <0x0 0xc0a00000 0x0 0x10000>;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v4 6/8] riscv: dts: spacemit: enable USB2.0 controllers on BananaPi F3
  2026-10-09  7:30 [PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support Junzhong Pan
                   ` (4 preceding siblings ...)
  2026-10-09  7:30 ` [PATCH v4 5/8] riscv: dts: spacemit: add USB2.0 controller nodes for K1 Junzhong Pan
@ 2026-10-09  7:30 ` Junzhong Pan
  2026-10-09  7:36   ` sashiko-bot
  2026-10-09  7:30 ` [PATCH v4 7/8] riscv: dts: spacemit: enable USB2.0 controllers on OrangePi RV2 Junzhong Pan
  2026-10-09  7:30 ` [PATCH v4 8/8] riscv: defconfig: enable ChipIdea USB controller support Junzhong Pan
  7 siblings, 1 reply; 17+ messages in thread
From: Junzhong Pan @ 2026-10-09  7:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Yixun Lan, Xu Yang, Peng Fan, Peter Chen,
	Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti
  Cc: linux-usb, devicetree, linux-kernel, linux-riscv, spacemit,
	Junzhong Pan, Troy Mitchell

On BananaPi F3, usb2_0 is connected to a Type-C connector at device
mode by default. This port have no VBUS supply capability, thus host
mode only works with self-powered device or hub. User could switch the
role in sysfs.

And the usb2_1 is connected to the USB2.0 pins of the Mini PCIe slot to
support cellular modules.

Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Reviewed-by: Yixun Lan <dlan@kernel.org>
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
---
 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
index 58035d886bf6..ce36250e2deb 100644
--- a/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts
@@ -383,10 +383,26 @@ &uart0 {
 	status = "okay";
 };
 
+&usbphy0 {
+	status = "okay";
+};
+
+&usbphy1 {
+	status = "okay";
+};
+
 &usbphy2 {
 	status = "okay";
 };
 
+&usb2_0 {
+	status = "okay";
+};
+
+&usb2_1 {
+	status = "okay";
+};
+
 &usb_dwc3 {
 	dr_mode = "host";
 	#address-cells = <1>;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v4 7/8] riscv: dts: spacemit: enable USB2.0 controllers on OrangePi RV2
  2026-10-09  7:30 [PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support Junzhong Pan
                   ` (5 preceding siblings ...)
  2026-10-09  7:30 ` [PATCH v4 6/8] riscv: dts: spacemit: enable USB2.0 controllers on BananaPi F3 Junzhong Pan
@ 2026-10-09  7:30 ` Junzhong Pan
  2026-10-09  7:35   ` sashiko-bot
  2026-10-09  7:30 ` [PATCH v4 8/8] riscv: defconfig: enable ChipIdea USB controller support Junzhong Pan
  7 siblings, 1 reply; 17+ messages in thread
From: Junzhong Pan @ 2026-10-09  7:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Yixun Lan, Xu Yang, Peng Fan, Peter Chen,
	Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti
  Cc: linux-usb, devicetree, linux-kernel, linux-riscv, spacemit,
	Junzhong Pan, Ze Huang

On OrangePi RV2, usb2_0 is connected to a Type-A connector at host
mode, its vbus output is controlled by gpio 126. And the usb2_1 is
connected to the USB2.0 connector pins onboard.

Tested-by: Ze Huang <huang.ze@linux.dev>
Reviewed-by: Yixun Lan <dlan@kernel.org>
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
---
 arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts | 28 ++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
index b907a1396b21..32d1aafc88f7 100644
--- a/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
+++ b/arch/riscv/boot/dts/spacemit/k1-orangepi-rv2.dts
@@ -64,6 +64,16 @@ vcc5v0_usb30: regulator-vcc5v0-usb30 {
 		vin-supply = <&vcc_5v0>;
 	};
 
+	vcc5v0_usb20: regulator-vcc5v0-usb20 {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpios = <&gpio K1_GPIO(126) GPIO_ACTIVE_HIGH>;
+		regulator-name = "vcc5v0_usb20";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc_5v0>;
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
@@ -341,10 +351,28 @@ &uart0 {
 	status = "okay";
 };
 
+&usbphy0 {
+	status = "okay";
+};
+
+&usbphy1 {
+	status = "okay";
+};
+
 &usbphy2 {
 	status = "okay";
 };
 
+&usb2_0 {
+	vbus-supply = <&vcc5v0_usb20>;
+	dr_mode = "host";
+	status = "okay";
+};
+
+&usb2_1 {
+	status = "okay";
+};
+
 &usb_dwc3 {
 	dr_mode = "host";
 	#address-cells = <1>;

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH v4 8/8] riscv: defconfig: enable ChipIdea USB controller support
  2026-10-09  7:30 [PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support Junzhong Pan
                   ` (6 preceding siblings ...)
  2026-10-09  7:30 ` [PATCH v4 7/8] riscv: dts: spacemit: enable USB2.0 controllers on OrangePi RV2 Junzhong Pan
@ 2026-10-09  7:30 ` Junzhong Pan
  2026-10-09  7:38   ` sashiko-bot
  7 siblings, 1 reply; 17+ messages in thread
From: Junzhong Pan @ 2026-10-09  7:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Yixun Lan, Xu Yang, Peng Fan, Peter Chen,
	Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti
  Cc: linux-usb, devicetree, linux-kernel, linux-riscv, spacemit,
	Junzhong Pan

Enable the ChipIdea USB2 controller and SpacemiT K1 USB2 PHY
as module to support USB2.0 controllers on the SpacemiT K1
SoC. The _UDC and _HOST are bools that decide which roles are
support.

Reviewed-by: Yixun Lan <dlan@kernel.org>
Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>
---
 arch/riscv/configs/defconfig | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index 04ae305d5511..9a0b3847ff43 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -222,6 +222,9 @@ CONFIG_USB_CDNS3_HOST=y
 CONFIG_USB_CDNS3_STARFIVE=m
 CONFIG_USB_MUSB_HDRC=m
 CONFIG_USB_MUSB_SUNXI=m
+CONFIG_USB_CHIPIDEA=m
+CONFIG_USB_CHIPIDEA_UDC=y
+CONFIG_USB_CHIPIDEA_HOST=y
 CONFIG_NOP_USB_XCEIV=m
 CONFIG_USB_GADGET=y
 CONFIG_USB_CONFIGFS=m
@@ -272,6 +275,7 @@ CONFIG_PWM=y
 CONFIG_PWM_PXA=m
 CONFIG_THEAD_C900_ACLINT_SSWI=y
 CONFIG_PHY_SUN4I_USB=m
+CONFIG_PHY_SPACEMIT_K1_USB2=m
 CONFIG_PHY_STARFIVE_JH7110_DPHY_RX=m
 CONFIG_PHY_STARFIVE_JH7110_PCIE=m
 CONFIG_PHY_STARFIVE_JH7110_USB=m

-- 
2.34.1


^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 4/8] usb: chipidea: usb2: add SpacemiT K1 support
  2026-10-09  7:30 ` [PATCH v4 4/8] usb: chipidea: usb2: add SpacemiT K1 support Junzhong Pan
@ 2026-10-09  7:34   ` sashiko-bot
  0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-10-09  7:34 UTC (permalink / raw)
  To: Junzhong Pan; +Cc: robh, conor+dt, devicetree, linux-usb

> Add a compatible for SpacemiT K1, and add platform data with correct
> flag since the hardware doesn't have internal otg register support.
> 
> Acked-by: Peter Chen <peter.chen@kernel.org>
> Tested-by: Ze Huang <huang.ze@linux.dev>
> Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
> Reviewed-by: Yixun Lan <dlan@kernel.org>
> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-b4-spacemit-k1-usb2-v4-0-2d98e5324d9a@linux.spacemit.com?part=4


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 7/8] riscv: dts: spacemit: enable USB2.0 controllers on OrangePi RV2
  2026-10-09  7:30 ` [PATCH v4 7/8] riscv: dts: spacemit: enable USB2.0 controllers on OrangePi RV2 Junzhong Pan
@ 2026-10-09  7:35   ` sashiko-bot
  0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-10-09  7:35 UTC (permalink / raw)
  To: Junzhong Pan; +Cc: devicetree, robh, linux-usb, conor+dt

> On OrangePi RV2, usb2_0 is connected to a Type-A connector at host
> mode, its vbus output is controlled by gpio 126. And the usb2_1 is
> connected to the USB2.0 connector pins onboard.
> 
> Tested-by: Ze Huang <huang.ze@linux.dev>
> Reviewed-by: Yixun Lan <dlan@kernel.org>
> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-b4-spacemit-k1-usb2-v4-0-2d98e5324d9a@linux.spacemit.com?part=7


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 2/8] usb: chipidea: usb2: use devm_clk_get_optional_enabled()
  2026-10-09  7:30 ` [PATCH v4 2/8] usb: chipidea: usb2: use devm_clk_get_optional_enabled() Junzhong Pan
@ 2026-10-09  7:36   ` sashiko-bot
  0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-10-09  7:36 UTC (permalink / raw)
  To: Junzhong Pan; +Cc: devicetree, linux-usb, conor+dt, robh

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] usb: chipidea: redundant struct and memory allocation for ci_hdrc_usb2_priv
--

commit a1804027a297ffe7216fa43c74cdb463efa0f512
Author: Junzhong Pan <panjunzhong@linux.spacemit.com>

usb: chipidea: usb2: use devm_clk_get_optional_enabled()

Convert devm_clk_get_optional() and clk_prepare_enable() into a single
call devm_clk_get_optional_enabled().

> diff --git a/drivers/usb/chipidea/ci_hdrc_usb2.c b/drivers/usb/chipidea/ci_hdrc_usb2.c
> index 8ffa1e95d8e86..9cef902f36b37 100644
> --- a/drivers/usb/chipidea/ci_hdrc_usb2.c
> +++ b/drivers/usb/chipidea/ci_hdrc_usb2.c
> @@ -20,7 +20,6 @@
>  
>  struct ci_hdrc_usb2_priv {
>  	struct platform_device	*ci_pdev;
> -	struct clk		*clk;
>  };

[Severity: Low]
Does this code still need a wrapper struct now that it only contains a
single pointer?

[ ... ]

> @@ -70,15 +70,10 @@ static int ci_hdrc_usb2_probe(struct platform_device *pdev)
>  	if (!priv)
>  		return -ENOMEM;
>  
> -	priv->clk = devm_clk_get_optional(dev, NULL);
> -	if (IS_ERR(priv->clk))
> -		return PTR_ERR(priv->clk);
> -
> -	ret = clk_prepare_enable(priv->clk);
> -	if (ret) {
> -		dev_err(dev, "failed to enable the clock: %d\n", ret);
> -		return ret;
> -	}
> +	clk = devm_clk_get_optional_enabled(dev, NULL);
> +	if (IS_ERR(clk))
> +		return dev_err_probe(dev, PTR_ERR(clk),
> +				     "failed to get or enable the clock\n");

[Severity: Low]
Could this devm_kzalloc() for the priv struct be eliminated? Since the clk
pointer was removed from ci_hdrc_usb2_priv, the single ci_pdev pointer
could be stored directly using platform_set_drvdata() in
ci_hdrc_usb2_probe(), avoiding the unnecessary heap allocation.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-b4-spacemit-k1-usb2-v4-0-2d98e5324d9a@linux.spacemit.com?part=2

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 1/8] dt-bindings: usb: ci-hdrc-usb2: add spacemit,k1-usb2 compatible
  2026-10-09  7:30 ` [PATCH v4 1/8] dt-bindings: usb: ci-hdrc-usb2: add spacemit,k1-usb2 compatible Junzhong Pan
@ 2026-10-09  7:36   ` sashiko-bot
  0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-10-09  7:36 UTC (permalink / raw)
  To: Junzhong Pan; +Cc: devicetree, robh, conor+dt, linux-usb

> The USB2.0 controller on the SpacemiT K1 SoC is dual-role capable but
> has no internal OTG registers, this requires flags which disable
> related features set in platform data. Add a compatible string to match
> the platform data.
> 
> Chipidea USB2 Controller on SpacemiT K1 requires 1 clock and 1 reset to
> work, add constraints for it.
> 
> Reviewed-by: Yixun Lan <dlan@kernel.org>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-b4-spacemit-k1-usb2-v4-0-2d98e5324d9a@linux.spacemit.com?part=1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 5/8] riscv: dts: spacemit: add USB2.0 controller nodes for K1
  2026-10-09  7:30 ` [PATCH v4 5/8] riscv: dts: spacemit: add USB2.0 controller nodes for K1 Junzhong Pan
@ 2026-10-09  7:36   ` sashiko-bot
  0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-10-09  7:36 UTC (permalink / raw)
  To: Junzhong Pan; +Cc: conor+dt, devicetree, linux-usb, robh

> The SpacemiT K1 SoC has two ChipIdea USB2.0 controllers.
> - USB2.0 Dual-Role
> - usb2.0 Host Only
> 
> Add the controller and PHY nodes.
> 
> Tested-by: Ze Huang <huang.ze@linux.dev>
> Reviewed-by: Yixun Lan <dlan@kernel.org>
> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-b4-spacemit-k1-usb2-v4-0-2d98e5324d9a@linux.spacemit.com?part=5


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 3/8] usb: chipidea: usb2: add optional reset support
  2026-10-09  7:30 ` [PATCH v4 3/8] usb: chipidea: usb2: add optional reset support Junzhong Pan
@ 2026-10-09  7:36   ` sashiko-bot
  0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-10-09  7:36 UTC (permalink / raw)
  To: Junzhong Pan; +Cc: devicetree, conor+dt, linux-usb, robh

> The USB2 controller of SpacemiT K1 SoC requires reset support, to keep
> compatibility, add optional reset support.
> 
> Tested-by: Ze Huang <huang.ze@linux.dev>
> Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
> Reviewed-by: Yixun Lan <dlan@kernel.org>
> Acked-by: Peter Chen <peter.chen@kernel.org>
> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-b4-spacemit-k1-usb2-v4-0-2d98e5324d9a@linux.spacemit.com?part=3


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 6/8] riscv: dts: spacemit: enable USB2.0 controllers on BananaPi F3
  2026-10-09  7:30 ` [PATCH v4 6/8] riscv: dts: spacemit: enable USB2.0 controllers on BananaPi F3 Junzhong Pan
@ 2026-10-09  7:36   ` sashiko-bot
  0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-10-09  7:36 UTC (permalink / raw)
  To: Junzhong Pan; +Cc: linux-usb, conor+dt, devicetree, robh

> On BananaPi F3, usb2_0 is connected to a Type-C connector at device
> mode by default. This port have no VBUS supply capability, thus host
> mode only works with self-powered device or hub. User could switch the
> role in sysfs.
> 
> And the usb2_1 is connected to the USB2.0 pins of the Mini PCIe slot to
> support cellular modules.
> 
> Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
> Reviewed-by: Yixun Lan <dlan@kernel.org>
> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-b4-spacemit-k1-usb2-v4-0-2d98e5324d9a@linux.spacemit.com?part=6


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v4 8/8] riscv: defconfig: enable ChipIdea USB controller support
  2026-10-09  7:30 ` [PATCH v4 8/8] riscv: defconfig: enable ChipIdea USB controller support Junzhong Pan
@ 2026-10-09  7:38   ` sashiko-bot
  0 siblings, 0 replies; 17+ messages in thread
From: sashiko-bot @ 2026-10-09  7:38 UTC (permalink / raw)
  To: Junzhong Pan; +Cc: conor+dt, linux-usb, devicetree, robh

> Enable the ChipIdea USB2 controller and SpacemiT K1 USB2 PHY
> as module to support USB2.0 controllers on the SpacemiT K1
> SoC. The _UDC and _HOST are bools that decide which roles are
> support.
> 
> Reviewed-by: Yixun Lan <dlan@kernel.org>
> Signed-off-by: Junzhong Pan <panjunzhong@linux.spacemit.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009-b4-spacemit-k1-usb2-v4-0-2d98e5324d9a@linux.spacemit.com?part=8


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-10-09  7:38 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09  7:30 [PATCH v4 0/8] Add SpacemiT K1 USB2.0 controllers support Junzhong Pan
2026-10-09  7:30 ` [PATCH v4 1/8] dt-bindings: usb: ci-hdrc-usb2: add spacemit,k1-usb2 compatible Junzhong Pan
2026-10-09  7:36   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 2/8] usb: chipidea: usb2: use devm_clk_get_optional_enabled() Junzhong Pan
2026-10-09  7:36   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 3/8] usb: chipidea: usb2: add optional reset support Junzhong Pan
2026-10-09  7:36   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 4/8] usb: chipidea: usb2: add SpacemiT K1 support Junzhong Pan
2026-10-09  7:34   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 5/8] riscv: dts: spacemit: add USB2.0 controller nodes for K1 Junzhong Pan
2026-10-09  7:36   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 6/8] riscv: dts: spacemit: enable USB2.0 controllers on BananaPi F3 Junzhong Pan
2026-10-09  7:36   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 7/8] riscv: dts: spacemit: enable USB2.0 controllers on OrangePi RV2 Junzhong Pan
2026-10-09  7:35   ` sashiko-bot
2026-10-09  7:30 ` [PATCH v4 8/8] riscv: defconfig: enable ChipIdea USB controller support Junzhong Pan
2026-10-09  7:38   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox