Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] Add Allwinner A733 USB 2.0 host support
@ 2026-11-27 10:08 Alastair D'Silva
  2026-11-27 10:08 ` [PATCH 1/6] dt-bindings: phy: allwinner,sun50i-a64-usb-phy: Add Allwinner A733 Alastair D'Silva
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Alastair D'Silva @ 2026-11-27 10:08 UTC (permalink / raw)
  To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman,
	Stephen Boyd, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Maxime Ripard, Andre Przywara, Brian Masney, Jerome Brunet,
	Junhui Liu, linux-phy, devicetree, linux-arm-kernel, linux-sunxi,
	linux-usb, linux-clk, linux-kernel, Alastair D'Silva

This series adds USB 2.0 host support (USB PHY, EHCI, and OHCI) for the
Allwinner A733 (sun60i-a733) SoC and enables USB1 on the Xunlong OrangePi
4 Pro. USB 3.0 (DWC3, u2phy, ComboPHY) is left for a separate series.

Expected result: the A733 USB 2.0 PHY, EHCI, and OHCI host controllers
probe without clk_ignore_unused, enable the USB1 VBUS regulator, and
enumerate USB 2.0 devices with full DMA transfers.

Tested on the Xunlong OrangePi 4 Pro with a USB 2.0 hub and a SanDisk
Ultra Fit flash drive (up to 32.0 MiB/s sequential reads via dd).

Prerequisites (on top of linux-next next-20261125):
- arm64: dts: allwinner: add A733 SoC description
  https://lore.kernel.org/r/20261126172253.1097838-2-andre.przywara@arm.com
- arm64: dts: allwinner: Add Xunlong OrangePi 4 Pro support
  https://lore.kernel.org/r/20261127065343.1449675-1-alastair@d-silva.org

Alastair D'Silva (6):
  dt-bindings: phy: allwinner,sun50i-a64-usb-phy: Add Allwinner A733
  dt-bindings: usb: generic-{ehci,ohci}: Add Allwinner A733
  clk: sunxi-ng: a733: Mark mbus-msi-lite2 clock as critical
  phy: allwinner: sun4i-usb: Add Allwinner A733 support
  arm64: dts: allwinner: sun60i-a733: Add USB 2.0 host nodes
  arm64: dts: allwinner: sun60i-a733-orangepi-4-pro: Enable USB 2.0 host

 .../phy/allwinner,sun50i-a64-usb-phy.yaml     |  24 ++++
 .../devicetree/bindings/usb/generic-ehci.yaml |   1 +
 .../devicetree/bindings/usb/generic-ohci.yaml |   1 +
 .../allwinner/sun60i-a733-orangepi-4-pro.dts  |  31 +++++
 .../arm64/boot/dts/allwinner/sun60i-a733.dtsi |  82 ++++++++++++
 drivers/clk/sunxi-ng/ccu-sun60i-a733.c        |   3 +-
 drivers/phy/allwinner/phy-sun4i-usb.c         | 119 +++++++++++++-----
 7 files changed, 229 insertions(+), 32 deletions(-)

base-commit: 9437046953b2fb3bf55b36582450ea0267df82a7
prerequisite-patch-id: 0279f281cd59cf54bceee39b0fa4d0b6a7b87c48
prerequisite-patch-id: 309a5a3ca5b216915907263dea7024263abf1d1c
prerequisite-patch-id: 55e543b9854c7ae2fa86969233d05ccadd3792e9
-- 
2.53.0



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

* [PATCH 1/6] dt-bindings: phy: allwinner,sun50i-a64-usb-phy: Add Allwinner A733
  2026-11-27 10:08 [PATCH 0/6] Add Allwinner A733 USB 2.0 host support Alastair D'Silva
@ 2026-11-27 10:08 ` Alastair D'Silva
  2026-11-27 10:08 ` [PATCH 2/6] dt-bindings: usb: generic-{ehci,ohci}: " Alastair D'Silva
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Alastair D'Silva @ 2026-11-27 10:08 UTC (permalink / raw)
  To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman,
	Stephen Boyd, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Maxime Ripard, Andre Przywara, Brian Masney, Jerome Brunet,
	Junhui Liu, linux-phy, devicetree, linux-arm-kernel, linux-sunxi,
	linux-usb, linux-clk, linux-kernel, Alastair D'Silva

Add the Allwinner A733 (sun60i-a733) USB 2.0 PHY compatible string.

The A733 USB PHY requires the OTG/PHY register bus clock (bus) in addition
to the two PHY reference clocks.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 .../phy/allwinner,sun50i-a64-usb-phy.yaml     | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/Documentation/devicetree/bindings/phy/allwinner,sun50i-a64-usb-phy.yaml b/Documentation/devicetree/bindings/phy/allwinner,sun50i-a64-usb-phy.yaml
index 580c3296a18d..4892c1766182 100644
--- a/Documentation/devicetree/bindings/phy/allwinner,sun50i-a64-usb-phy.yaml
+++ b/Documentation/devicetree/bindings/phy/allwinner,sun50i-a64-usb-phy.yaml
@@ -19,6 +19,7 @@ properties:
       - enum:
           - allwinner,sun20i-d1-usb-phy
           - allwinner,sun50i-a64-usb-phy
+          - allwinner,sun60i-a733-usb-phy
       - items:
           - enum:
               - allwinner,sun50i-a100-usb-phy
@@ -38,14 +39,18 @@ properties:
       - const: pmu1
 
   clocks:
+    minItems: 2
     items:
       - description: USB OTG PHY bus clock
       - description: USB Host 0 PHY bus clock
+      - description: USB OTG/PHY register bus clock
 
   clock-names:
+    minItems: 2
     items:
       - const: usb0_phy
       - const: usb1_phy
+      - const: bus
 
   resets:
     items:
@@ -84,6 +89,25 @@ required:
   - resets
   - reset-names
 
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: allwinner,sun60i-a733-usb-phy
+    then:
+      properties:
+        clocks:
+          minItems: 3
+        clock-names:
+          minItems: 3
+    else:
+      properties:
+        clocks:
+          maxItems: 2
+        clock-names:
+          maxItems: 2
+
 additionalProperties: false
 
 examples:
-- 
2.53.0



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

* [PATCH 2/6] dt-bindings: usb: generic-{ehci,ohci}: Add Allwinner A733
  2026-11-27 10:08 [PATCH 0/6] Add Allwinner A733 USB 2.0 host support Alastair D'Silva
  2026-11-27 10:08 ` [PATCH 1/6] dt-bindings: phy: allwinner,sun50i-a64-usb-phy: Add Allwinner A733 Alastair D'Silva
@ 2026-11-27 10:08 ` Alastair D'Silva
  2026-11-27 10:08 ` [PATCH 3/6] clk: sunxi-ng: a733: Mark mbus-msi-lite2 clock as critical Alastair D'Silva
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Alastair D'Silva @ 2026-11-27 10:08 UTC (permalink / raw)
  To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman,
	Stephen Boyd, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Maxime Ripard, Andre Przywara, Brian Masney, Jerome Brunet,
	Junhui Liu, linux-phy, devicetree, linux-arm-kernel, linux-sunxi,
	linux-usb, linux-clk, linux-kernel, Alastair D'Silva

Add the Allwinner A733 (sun60i-a733) EHCI and OHCI compatible strings.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 Documentation/devicetree/bindings/usb/generic-ehci.yaml | 1 +
 Documentation/devicetree/bindings/usb/generic-ohci.yaml | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/generic-ehci.yaml b/Documentation/devicetree/bindings/usb/generic-ehci.yaml
index 908b02d9175e..a63dc0eea80f 100644
--- a/Documentation/devicetree/bindings/usb/generic-ehci.yaml
+++ b/Documentation/devicetree/bindings/usb/generic-ehci.yaml
@@ -21,6 +21,7 @@ properties:
               - allwinner,sun50i-h616-ehci
               - allwinner,sun55i-a523-ehci
               - allwinner,sun5i-a13-ehci
+              - allwinner,sun60i-a733-ehci
               - allwinner,sun6i-a31-ehci
               - allwinner,sun7i-a20-ehci
               - allwinner,sun8i-a23-ehci
diff --git a/Documentation/devicetree/bindings/usb/generic-ohci.yaml b/Documentation/devicetree/bindings/usb/generic-ohci.yaml
index 7a8c3c231815..565f41eb33f7 100644
--- a/Documentation/devicetree/bindings/usb/generic-ohci.yaml
+++ b/Documentation/devicetree/bindings/usb/generic-ohci.yaml
@@ -21,6 +21,7 @@ properties:
               - allwinner,sun50i-h616-ohci
               - allwinner,sun55i-a523-ohci
               - allwinner,sun5i-a13-ohci
+              - allwinner,sun60i-a733-ohci
               - allwinner,sun6i-a31-ohci
               - allwinner,sun7i-a20-ohci
               - allwinner,sun8i-a23-ohci
-- 
2.53.0



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

* [PATCH 3/6] clk: sunxi-ng: a733: Mark mbus-msi-lite2 clock as critical
  2026-11-27 10:08 [PATCH 0/6] Add Allwinner A733 USB 2.0 host support Alastair D'Silva
  2026-11-27 10:08 ` [PATCH 1/6] dt-bindings: phy: allwinner,sun50i-a64-usb-phy: Add Allwinner A733 Alastair D'Silva
  2026-11-27 10:08 ` [PATCH 2/6] dt-bindings: usb: generic-{ehci,ohci}: " Alastair D'Silva
@ 2026-11-27 10:08 ` Alastair D'Silva
  2026-11-28 15:00   ` Daniel Golle
  2026-11-27 10:08 ` [PATCH 4/6] phy: allwinner: sun4i-usb: Add Allwinner A733 support Alastair D'Silva
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Alastair D'Silva @ 2026-11-27 10:08 UTC (permalink / raw)
  To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman,
	Stephen Boyd, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Maxime Ripard, Andre Przywara, Brian Masney, Jerome Brunet,
	Junhui Liu, linux-phy, devicetree, linux-arm-kernel, linux-sunxi,
	linux-usb, linux-clk, linux-kernel, Alastair D'Silva

The mbus-msi-lite2 clock gates the shared MSI-Lite2 DMA fabric used by the
USB controllers. Without CLK_IS_CRITICAL, clk_disable_unused() gates it off
and breaks USB 2.0 host DMA transfers.

Mark mbus-msi-lite2 as CLK_IS_CRITICAL, matching mbus-store in this driver.

Fixes: ed757071ac3d ("clk: sunxi-ng: a733: Add bus clock gates")
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 drivers/clk/sunxi-ng/ccu-sun60i-a733.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi-ng/ccu-sun60i-a733.c b/drivers/clk/sunxi-ng/ccu-sun60i-a733.c
index 958a2a2bcf76..fb4ca4ef3992 100644
--- a/drivers/clk/sunxi-ng/ccu-sun60i-a733.c
+++ b/drivers/clk/sunxi-ng/ccu-sun60i-a733.c
@@ -605,8 +605,9 @@ static SUNXI_CCU_GATE_HWS(mbus_store_clk, "mbus-store", mbus_hws,
 			  0x5e0, BIT(30), CLK_IS_CRITICAL);
 static const struct clk_hw *mbus_store_hws[] = { &mbus_store_clk.common.hw };
 
+/* Keep enabled for the MSI-Lite2 DMA fabric shared by USB controllers. */
 static SUNXI_CCU_GATE_HWS(mbus_msi_lite2_clk, "mbus-msi-lite2", mbus_hws,
-			  0x5e0, BIT(31), 0);
+			  0x5e0, BIT(31), CLK_IS_CRITICAL);
 
 static SUNXI_CCU_GATE_HWS(mbus_dma0_clk, "mbus-dma0", mbus_hws,
 			  0x5e4, BIT(0), 0);
-- 
2.53.0



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

* [PATCH 4/6] phy: allwinner: sun4i-usb: Add Allwinner A733 support
  2026-11-27 10:08 [PATCH 0/6] Add Allwinner A733 USB 2.0 host support Alastair D'Silva
                   ` (2 preceding siblings ...)
  2026-11-27 10:08 ` [PATCH 3/6] clk: sunxi-ng: a733: Mark mbus-msi-lite2 clock as critical Alastair D'Silva
@ 2026-11-27 10:08 ` Alastair D'Silva
  2026-11-27 10:08 ` [PATCH 5/6] arm64: dts: allwinner: sun60i-a733: Add USB 2.0 host nodes Alastair D'Silva
  2026-11-27 10:08 ` [PATCH 6/6] arm64: dts: allwinner: sun60i-a733-orangepi-4-pro: Enable USB 2.0 host Alastair D'Silva
  5 siblings, 0 replies; 8+ messages in thread
From: Alastair D'Silva @ 2026-11-27 10:08 UTC (permalink / raw)
  To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman,
	Stephen Boyd, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Maxime Ripard, Andre Przywara, Brian Masney, Jerome Brunet,
	Junhui Liu, linux-phy, devicetree, linux-arm-kernel, linux-sunxi,
	linux-usb, linux-clk, linux-kernel, Alastair D'Silva

Add support for the Allwinner A733 (sun60i-a733) USB 2.0 PHY.

Enable the PHY register bus clock (bus) during PHY init, and keep PHY0 out
of reset and SIDDQ while any PHY is active.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 drivers/phy/allwinner/phy-sun4i-usb.c | 119 +++++++++++++++++++-------
 1 file changed, 88 insertions(+), 31 deletions(-)

diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index f26eed0db17e..e1f20d00d593 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -102,7 +102,9 @@ struct sun4i_usb_phy_cfg {
 	u32 hci_phy_ctl_clear;
 	u8 phyctl_offset;
 	bool dedicated_clocks;
+	bool has_bus_clk;
 	bool phy0_dual_route;
+	bool needs_phy0_siddq;
 	bool needs_phy2_siddq;
 	bool siddq_in_base;
 	bool poll_vbusen;
@@ -111,9 +113,11 @@ struct sun4i_usb_phy_cfg {
 
 struct sun4i_usb_phy_data {
 	void __iomem *base;
+	struct clk *bus_clk;
 	const struct sun4i_usb_phy_cfg *cfg;
 	enum usb_dr_mode dr_mode;
 	spinlock_t reg_lock; /* guard access to phyctl reg */
+	unsigned int phy0_siddq_users;
 	int num_phys;
 	struct sun4i_usb_phy {
 		struct phy *phy;
@@ -257,24 +261,39 @@ static int sun4i_usb_phy_init(struct phy *_phy)
 {
 	struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
 	struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
+	unsigned long flags;
 	int ret;
 	u32 val;
 
-	ret = clk_prepare_enable(phy->clk);
+	ret = clk_prepare_enable(data->bus_clk);
 	if (ret)
 		return ret;
 
+	ret = clk_prepare_enable(phy->clk);
+	if (ret)
+		goto err_disable_bus_clk;
+
 	ret = clk_prepare_enable(phy->clk2);
-	if (ret) {
-		clk_disable_unprepare(phy->clk);
-		return ret;
-	}
+	if (ret)
+		goto err_disable_clk;
 
 	ret = reset_control_deassert(phy->reset);
-	if (ret) {
-		clk_disable_unprepare(phy->clk2);
-		clk_disable_unprepare(phy->clk);
-		return ret;
+	if (ret)
+		goto err_disable_clk2;
+
+	/* Some PHYs on some SoCs need the help of PHY0 to work. */
+	if (data->cfg->needs_phy0_siddq && phy->index != 0) {
+		struct sun4i_usb_phy *phy0 = &data->phys[0];
+
+		ret = clk_prepare_enable(phy0->clk);
+		if (ret)
+			goto err_assert_reset;
+
+		ret = reset_control_deassert(phy0->reset);
+		if (ret) {
+			clk_disable_unprepare(phy0->clk);
+			goto err_assert_reset;
+		}
 	}
 
 	/* Some PHYs on some SoCs need the help of PHY2 to work. */
@@ -282,20 +301,13 @@ static int sun4i_usb_phy_init(struct phy *_phy)
 		struct sun4i_usb_phy *phy2 = &data->phys[2];
 
 		ret = clk_prepare_enable(phy2->clk);
-		if (ret) {
-			reset_control_assert(phy->reset);
-			clk_disable_unprepare(phy->clk2);
-			clk_disable_unprepare(phy->clk);
-			return ret;
-		}
+		if (ret)
+			goto err_assert_reset;
 
 		ret = reset_control_deassert(phy2->reset);
 		if (ret) {
 			clk_disable_unprepare(phy2->clk);
-			reset_control_assert(phy->reset);
-			clk_disable_unprepare(phy->clk2);
-			clk_disable_unprepare(phy->clk);
-			return ret;
+			goto err_assert_reset;
 		}
 
 		/*
@@ -306,10 +318,7 @@ static int sun4i_usb_phy_init(struct phy *_phy)
 		if (ret) {
 			reset_control_assert(phy2->reset);
 			clk_disable_unprepare(phy2->clk);
-			reset_control_assert(phy->reset);
-			clk_disable_unprepare(phy->clk2);
-			clk_disable_unprepare(phy->clk);
-			return ret;
+			goto err_assert_reset;
 		}
 
 		if (phy2->pmu && data->cfg->hci_phy_ctl_clear) {
@@ -328,11 +337,16 @@ static int sun4i_usb_phy_init(struct phy *_phy)
 	}
 
 	if (data->cfg->siddq_in_base) {
-		if (phy->index == 0) {
+		if (phy->index == 0 || data->cfg->needs_phy0_siddq) {
+			spin_lock_irqsave(&data->reg_lock, flags);
 			val = readl(data->base + data->cfg->phyctl_offset);
-			val |= PHY_CTL_VBUSVLDEXT;
+			if (phy->index == 0)
+				val |= PHY_CTL_VBUSVLDEXT;
 			val &= ~PHY_CTL_SIDDQ;
 			writel(val, data->base + data->cfg->phyctl_offset);
+			if (data->cfg->needs_phy0_siddq)
+				data->phy0_siddq_users++;
+			spin_unlock_irqrestore(&data->reg_lock, flags);
 		}
 	} else {
 		/* Enable USB 45 Ohm resistor calibration */
@@ -363,27 +377,48 @@ static int sun4i_usb_phy_init(struct phy *_phy)
 	}
 
 	return 0;
+
+err_assert_reset:
+	reset_control_assert(phy->reset);
+err_disable_clk2:
+	clk_disable_unprepare(phy->clk2);
+err_disable_clk:
+	clk_disable_unprepare(phy->clk);
+err_disable_bus_clk:
+	clk_disable_unprepare(data->bus_clk);
+	return ret;
 }
 
 static int sun4i_usb_phy_exit(struct phy *_phy)
 {
 	struct sun4i_usb_phy *phy = phy_get_drvdata(_phy);
 	struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy);
+	unsigned long flags;
 
-	if (phy->index == 0) {
-		if (data->cfg->siddq_in_base) {
-			void __iomem *phyctl = data->base +
-				data->cfg->phyctl_offset;
+	if (data->cfg->siddq_in_base &&
+	    (phy->index == 0 || data->cfg->needs_phy0_siddq)) {
+		void __iomem *phyctl = data->base + data->cfg->phyctl_offset;
 
+		spin_lock_irqsave(&data->reg_lock, flags);
+		if (!data->cfg->needs_phy0_siddq || --data->phy0_siddq_users == 0)
 			writel(readl(phyctl) | PHY_CTL_SIDDQ, phyctl);
-		}
+		spin_unlock_irqrestore(&data->reg_lock, flags);
+	}
 
+	if (phy->index == 0) {
 		/* Disable pull-ups */
 		sun4i_usb_phy0_update_iscr(_phy, ISCR_DPDM_PULLUP_EN, 0);
 		sun4i_usb_phy0_update_iscr(_phy, ISCR_ID_PULLUP_EN, 0);
 		data->phy0_init = false;
 	}
 
+	if (data->cfg->needs_phy0_siddq && phy->index != 0) {
+		struct sun4i_usb_phy *phy0 = &data->phys[0];
+
+		reset_control_assert(phy0->reset);
+		clk_disable_unprepare(phy0->clk);
+	}
+
 	if (data->cfg->needs_phy2_siddq && phy->index != 2) {
 		struct sun4i_usb_phy *phy2 = &data->phys[2];
 
@@ -395,6 +430,7 @@ static int sun4i_usb_phy_exit(struct phy *_phy)
 	reset_control_assert(phy->reset);
 	clk_disable_unprepare(phy->clk2);
 	clk_disable_unprepare(phy->clk);
+	clk_disable_unprepare(data->bus_clk);
 
 	return 0;
 }
@@ -739,6 +775,13 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 	if (IS_ERR(data->base))
 		return PTR_ERR(data->base);
 
+	if (data->cfg->has_bus_clk) {
+		data->bus_clk = devm_clk_get(dev, "bus");
+		if (IS_ERR(data->bus_clk))
+			return dev_err_probe(dev, PTR_ERR(data->bus_clk),
+					     "failed to get bus clock\n");
+	}
+
 	data->id_det_gpio = devm_gpiod_get_optional(dev, "usb0_id_det",
 						    GPIOD_IN);
 	if (IS_ERR(data->id_det_gpio)) {
@@ -787,7 +830,10 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev)
 			continue;
 
 		snprintf(name, sizeof(name), "usb%d_reset", i);
-		phy->reset = devm_reset_control_get(dev, name);
+		if (i == 0 && data->cfg->needs_phy0_siddq)
+			phy->reset = devm_reset_control_get_shared(dev, name);
+		else
+			phy->reset = devm_reset_control_get(dev, name);
 		if (IS_ERR(phy->reset)) {
 			if (PTR_ERR(phy->reset) == -ENOENT)
 				break;
@@ -1013,6 +1059,16 @@ static const struct sun4i_usb_phy_cfg sun50i_h616_cfg = {
 	.siddq_in_base = true,
 };
 
+static const struct sun4i_usb_phy_cfg sun60i_a733_cfg = {
+	.phyctl_offset = REG_PHYCTL_A33,
+	.dedicated_clocks = true,
+	.has_bus_clk = true,
+	.hci_phy_ctl_clear = PHY_CTL_SIDDQ,
+	.phy0_dual_route = true,
+	.needs_phy0_siddq = true,
+	.siddq_in_base = true,
+};
+
 static const struct of_device_id sun4i_usb_phy_of_match[] = {
 	{ .compatible = "allwinner,sun4i-a10-usb-phy", .data = &sun4i_a10_cfg },
 	{ .compatible = "allwinner,sun5i-a13-usb-phy", .data = &sun5i_a13_cfg },
@@ -1029,6 +1085,7 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = {
 	  .data = &sun50i_a64_cfg},
 	{ .compatible = "allwinner,sun50i-h6-usb-phy", .data = &sun50i_h6_cfg },
 	{ .compatible = "allwinner,sun50i-h616-usb-phy", .data = &sun50i_h616_cfg },
+	{ .compatible = "allwinner,sun60i-a733-usb-phy", .data = &sun60i_a733_cfg },
 	{ .compatible = "allwinner,suniv-f1c100s-usb-phy",
 	  .data = &suniv_f1c100s_cfg },
 	{ },
-- 
2.53.0



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

* [PATCH 5/6] arm64: dts: allwinner: sun60i-a733: Add USB 2.0 host nodes
  2026-11-27 10:08 [PATCH 0/6] Add Allwinner A733 USB 2.0 host support Alastair D'Silva
                   ` (3 preceding siblings ...)
  2026-11-27 10:08 ` [PATCH 4/6] phy: allwinner: sun4i-usb: Add Allwinner A733 support Alastair D'Silva
@ 2026-11-27 10:08 ` Alastair D'Silva
  2026-11-27 10:08 ` [PATCH 6/6] arm64: dts: allwinner: sun60i-a733-orangepi-4-pro: Enable USB 2.0 host Alastair D'Silva
  5 siblings, 0 replies; 8+ messages in thread
From: Alastair D'Silva @ 2026-11-27 10:08 UTC (permalink / raw)
  To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman,
	Stephen Boyd, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Maxime Ripard, Andre Przywara, Brian Masney, Jerome Brunet,
	Junhui Liu, linux-phy, devicetree, linux-arm-kernel, linux-sunxi,
	linux-usb, linux-clk, linux-kernel, Alastair D'Silva

Add the usbphy, ehci0, ohci0, ehci1, and ohci1 nodes for the Allwinner
A733 SoC.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 .../arm64/boot/dts/allwinner/sun60i-a733.dtsi | 82 +++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi b/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi
index e062b08006da..96fe8c8c44ed 100644
--- a/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun60i-a733.dtsi
@@ -546,6 +546,88 @@ mmc2: mmc@4022000 {
 			status = "disabled";
 		};
 
+		usbphy: phy@4100400 {
+			compatible = "allwinner,sun60i-a733-usb-phy";
+			reg = <0x04100400 0x100>,
+			      <0x04101800 0x100>,
+			      <0x04200800 0x100>;
+			reg-names = "phy_ctrl",
+				    "pmu0",
+				    "pmu1";
+			clocks = <&ccu CLK_USB01_REF>,
+				 <&ccu CLK_USB01_REF>,
+				 <&ccu CLK_BUS_OTG>;
+			clock-names = "usb0_phy",
+				      "usb1_phy",
+				      "bus";
+			resets = <&ccu RST_USB_PHY0>,
+				 <&ccu RST_USB_PHY1>;
+			reset-names = "usb0_reset",
+				      "usb1_reset";
+			#phy-cells = <1>;
+			status = "disabled";
+		};
+
+		ehci0: usb@4101000 {
+			compatible = "allwinner,sun60i-a733-ehci",
+				     "generic-ehci";
+			reg = <0x04101000 0x100>;
+			interrupts = <GIC_SPI 157 IRQ_TYPE_LEVEL_HIGH 0>;
+			clocks = <&ccu CLK_AHB_USB_SYS>,
+				 <&ccu CLK_BUS_OHCI0>,
+				 <&ccu CLK_BUS_EHCI0>,
+				 <&ccu CLK_USB_OHCI0>;
+			resets = <&ccu RST_BUS_OHCI0>,
+				 <&ccu RST_BUS_EHCI0>;
+			phys = <&usbphy 0>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ohci0: usb@4101400 {
+			compatible = "allwinner,sun60i-a733-ohci",
+				     "generic-ohci";
+			reg = <0x04101400 0x100>;
+			interrupts = <GIC_SPI 158 IRQ_TYPE_LEVEL_HIGH 0>;
+			clocks = <&ccu CLK_AHB_USB_SYS>,
+				 <&ccu CLK_BUS_OHCI0>,
+				 <&ccu CLK_USB_OHCI0>;
+			resets = <&ccu RST_BUS_OHCI0>;
+			phys = <&usbphy 0>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ehci1: usb@4200000 {
+			compatible = "allwinner,sun60i-a733-ehci",
+				     "generic-ehci";
+			reg = <0x04200000 0x100>;
+			interrupts = <GIC_SPI 159 IRQ_TYPE_LEVEL_HIGH 0>;
+			clocks = <&ccu CLK_AHB_USB_SYS>,
+				 <&ccu CLK_BUS_OHCI1>,
+				 <&ccu CLK_BUS_EHCI1>,
+				 <&ccu CLK_USB_OHCI1>;
+			resets = <&ccu RST_BUS_OHCI1>,
+				 <&ccu RST_BUS_EHCI1>;
+			phys = <&usbphy 1>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
+		ohci1: usb@4200400 {
+			compatible = "allwinner,sun60i-a733-ohci",
+				     "generic-ohci";
+			reg = <0x04200400 0x100>;
+			interrupts = <GIC_SPI 160 IRQ_TYPE_LEVEL_HIGH 0>;
+			clocks = <&ccu CLK_AHB_USB_SYS>,
+				 <&ccu CLK_BUS_OHCI1>,
+				 <&ccu CLK_USB_OHCI1>;
+			resets = <&ccu RST_BUS_OHCI1>;
+			phys = <&usbphy 1>;
+			phy-names = "usb";
+			status = "disabled";
+		};
+
 		r_ccu: clock-controller@7010000 {
 			compatible = "allwinner,sun60i-a733-r-ccu";
 			reg = <0x07010000 0x250>;
-- 
2.53.0



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

* [PATCH 6/6] arm64: dts: allwinner: sun60i-a733-orangepi-4-pro: Enable USB 2.0 host
  2026-11-27 10:08 [PATCH 0/6] Add Allwinner A733 USB 2.0 host support Alastair D'Silva
                   ` (4 preceding siblings ...)
  2026-11-27 10:08 ` [PATCH 5/6] arm64: dts: allwinner: sun60i-a733: Add USB 2.0 host nodes Alastair D'Silva
@ 2026-11-27 10:08 ` Alastair D'Silva
  5 siblings, 0 replies; 8+ messages in thread
From: Alastair D'Silva @ 2026-11-27 10:08 UTC (permalink / raw)
  To: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman,
	Stephen Boyd, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland
  Cc: Maxime Ripard, Andre Przywara, Brian Masney, Jerome Brunet,
	Junhui Liu, linux-phy, devicetree, linux-arm-kernel, linux-sunxi,
	linux-usb, linux-clk, linux-kernel, Alastair D'Silva

Add the 5V system supply and USB1 VBUS regulator (PB8), and enable usbphy,
ehci1, and ohci1 on the Xunlong OrangePi 4 Pro.

Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
---
 .../allwinner/sun60i-a733-orangepi-4-pro.dts  | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts b/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts
index 374287d962a8..327c996c7e7b 100644
--- a/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts
+++ b/arch/arm64/boot/dts/allwinner/sun60i-a733-orangepi-4-pro.dts
@@ -21,6 +21,28 @@ aliases {
 	chosen {
 		stdout-path = "serial0:115200n8";
 	};
+
+	reg_usb1_vbus: regulator-usb1-vbus {
+		compatible = "regulator-fixed";
+		regulator-name = "usb1-vbus";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&reg_vcc5v>;
+		gpios = <&pio 1 8 GPIO_ACTIVE_HIGH>; /* PB8 */
+		enable-active-high;
+	};
+
+	reg_vcc5v: regulator-vcc5v {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc-5v";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		regulator-always-on;
+	};
+};
+
+&ehci1 {
+	status = "okay";
 };
 
 &hosc {
@@ -36,6 +58,10 @@ &mmc0 {
 	status = "okay";
 };
 
+&ohci1 {
+	status = "okay";
+};
+
 &r_i2c0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&r_i2c0_pl_pins>;
@@ -73,3 +99,8 @@ &uart0 {
 	pinctrl-0 = <&uart0_pb_pins>;
 	status = "okay";
 };
+
+&usbphy {
+	usb1_vbus-supply = <&reg_usb1_vbus>;
+	status = "okay";
+};
-- 
2.53.0



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

* Re: [PATCH 3/6] clk: sunxi-ng: a733: Mark mbus-msi-lite2 clock as critical
  2026-11-27 10:08 ` [PATCH 3/6] clk: sunxi-ng: a733: Mark mbus-msi-lite2 clock as critical Alastair D'Silva
@ 2026-11-28 15:00   ` Daniel Golle
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Golle @ 2026-11-28 15:00 UTC (permalink / raw)
  To: Alastair D'Silva
  Cc: Vinod Koul, Neil Armstrong, Manivannan Sadhasivam, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman,
	Stephen Boyd, Chen-Yu Tsai, Jernej Skrabec, Samuel Holland,
	Maxime Ripard, Andre Przywara, Brian Masney, Jerome Brunet,
	Junhui Liu, linux-phy, devicetree, linux-arm-kernel, linux-sunxi,
	linux-usb, linux-clk, linux-kernel, Vinicius Pedrosa

Hi Alastair,

On Fri, Nov 27, 2026 at 09:08:05PM +1100, Alastair D'Silva wrote:
> The mbus-msi-lite2 clock gates the shared MSI-Lite2 DMA fabric used by the
> USB controllers. Without CLK_IS_CRITICAL, clk_disable_unused() gates it off
> and breaks USB 2.0 host DMA transfers.
>
> Mark mbus-msi-lite2 as CLK_IS_CRITICAL, matching mbus-store in this driver.

I ran into the same on the Orange Pi 4 Pro: once the gate is off, the
OHCI frame counter in the HCCA stops and every EHCI transfer times
out, so the on-board hub fails enumeration with -110.

I would rather not make it critical, though, for the same reason as
for MSI-Lite0 in the CCU thread
(<20261125115320.3692954-1-alastair@d-silva.org>): the gate has
consumers, and they are known here. All four EHCI/OHCI controllers
(and the DWC3 of the USB 3 port) sit behind MSI-Lite2, so each of them
can list the gate as a clock, and the clock framework keeps it on
while any of them is in use. A board without USB in use then does not
keep the fabric clocked.

What that takes in this series:

- 5/6: add <&ccu CLK_MBUS_MSI_LITE2> to the clocks of ehci0/ohci0 and
  ehci1/ohci1;
- 2/6: the generic-ehci and generic-ohci bindings have to allow one
  more clock for the A733: five for EHCI (bus EHCI, bus OHCI, OHCI
  module clock, AHB USB SYS and the MSI-Lite2 gate) and four for OHCI;
- ehci-platform: EHCI_MAX_CLKS is 4 today, so it needs to become 5.

With that, and without this patch, all four ports work on the board
here, including the hub, and clk_summary shows mbus-msi-lite2 held by
the host controllers. I can send the binding and ehci-platform parts
for you to fold in, if that helps.

For transparency: an LLM coding assistant helped with the analysis and
with drafting this reply. I personally review every line before
submission and test manually on the hardware.

Cheers,
Daniel


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

end of thread, other threads:[~2026-11-28 15:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27 10:08 [PATCH 0/6] Add Allwinner A733 USB 2.0 host support Alastair D'Silva
2026-11-27 10:08 ` [PATCH 1/6] dt-bindings: phy: allwinner,sun50i-a64-usb-phy: Add Allwinner A733 Alastair D'Silva
2026-11-27 10:08 ` [PATCH 2/6] dt-bindings: usb: generic-{ehci,ohci}: " Alastair D'Silva
2026-11-27 10:08 ` [PATCH 3/6] clk: sunxi-ng: a733: Mark mbus-msi-lite2 clock as critical Alastair D'Silva
2026-11-28 15:00   ` Daniel Golle
2026-11-27 10:08 ` [PATCH 4/6] phy: allwinner: sun4i-usb: Add Allwinner A733 support Alastair D'Silva
2026-11-27 10:08 ` [PATCH 5/6] arm64: dts: allwinner: sun60i-a733: Add USB 2.0 host nodes Alastair D'Silva
2026-11-27 10:08 ` [PATCH 6/6] arm64: dts: allwinner: sun60i-a733-orangepi-4-pro: Enable USB 2.0 host Alastair D'Silva

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