* [PATCH v3 1/3] dt-bindings: usb: starfive,jhb100-dwc3: Add adapter register region
2026-11-25 8:37 [PATCH v3 0/3] Add StarFive JHB100 host field USB device controller driver Minda Chen
@ 2026-11-25 8:37 ` Minda Chen
2026-11-25 8:37 ` [PATCH v3 2/3] dt-bindings: usb: starfive,jhb100-dwc3: Add clock number limit Minda Chen
2026-11-25 8:37 ` [PATCH v3 3/3] usb: dwc3: starfive: Add JHB100 USB device adapter port enable quirk Minda Chen
2 siblings, 0 replies; 4+ messages in thread
From: Minda Chen @ 2026-11-25 8:37 UTC (permalink / raw)
To: Greg Kroah-Hartman, Thinh Nguyen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-usb
Cc: linux-kernel, devicetree, Minda Chen
Besides the DRD controllers, the JHB100 BMC SoC has DWC3 device-only
controllers which are not connected to a USB PHY. Each of them is
connected through a PHY adapter to a port of an xHCI controller that
is exported to the server host over PCIe. The adapter has its own
register region that software has to program.
Describe the adapter register region as an optional second "reg"
entry and add "reg-names". The DRD controllers keep a single
register region.
The adapter is only present on the device-only controllers, so
restrict dr_mode to "peripheral" when the adapter region is described.
Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
.../bindings/usb/starfive,jhb100-dwc3.yaml | 37 ++++++++++++++++++-
1 file changed, 35 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/starfive,jhb100-dwc3.yaml b/Documentation/devicetree/bindings/usb/starfive,jhb100-dwc3.yaml
index fbabe99e9d5c..3ebf39616bd1 100644
--- a/Documentation/devicetree/bindings/usb/starfive,jhb100-dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/starfive,jhb100-dwc3.yaml
@@ -10,17 +10,50 @@ maintainers:
- Minda Chen <minda.chen@starfivetech.com>
description:
- The USB DRD controller on JHB100 BMC SoC.
+ The USB DRD controllers and the USB device-only controllers on the
+ JHB100 BMC SoC. The device-only controllers are not connected to a USB
+ PHY. Each one is connected through a PHY adapter to an xHCI port that
+ is exported to the server host.
allOf:
- $ref: snps,dwc3-common.yaml#
+ - if:
+ required:
+ - reg-names
+ properties:
+ reg-names:
+ contains:
+ const: adapter
+ then:
+ properties:
+ reg:
+ minItems: 2
+ reg-names:
+ minItems: 2
+ dr_mode:
+ const: peripheral
+ else:
+ properties:
+ reg:
+ maxItems: 1
+ reg-names:
+ maxItems: 1
properties:
compatible:
const: starfive,jhb100-dwc3
reg:
- maxItems: 1
+ minItems: 1
+ items:
+ - description: DWC3 core registers
+ - description: DWC3 device controller PHY adapter registers
+
+ reg-names:
+ minItems: 1
+ items:
+ - const: core
+ - const: adapter
interrupts:
maxItems: 1
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v3 2/3] dt-bindings: usb: starfive,jhb100-dwc3: Add clock number limit
2026-11-25 8:37 [PATCH v3 0/3] Add StarFive JHB100 host field USB device controller driver Minda Chen
2026-11-25 8:37 ` [PATCH v3 1/3] dt-bindings: usb: starfive,jhb100-dwc3: Add adapter register region Minda Chen
@ 2026-11-25 8:37 ` Minda Chen
2026-11-25 8:37 ` [PATCH v3 3/3] usb: dwc3: starfive: Add JHB100 USB device adapter port enable quirk Minda Chen
2 siblings, 0 replies; 4+ messages in thread
From: Minda Chen @ 2026-11-25 8:37 UTC (permalink / raw)
To: Greg Kroah-Hartman, Thinh Nguyen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-usb
Cc: linux-kernel, devicetree, Minda Chen
The JHB100 device-only controllers are connected to a digital PHY
adapter instead of a USB PHY, so they have no reference clock. Only
the "main" and "bus_early" clocks are present.
Allow two clocks for the controllers with the adapter region, keep
requiring all three clocks for the DRD controllers, and add an
example of a device-only controller.
Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
.../bindings/usb/starfive,jhb100-dwc3.yaml | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/starfive,jhb100-dwc3.yaml b/Documentation/devicetree/bindings/usb/starfive,jhb100-dwc3.yaml
index 3ebf39616bd1..9ed439c112c7 100644
--- a/Documentation/devicetree/bindings/usb/starfive,jhb100-dwc3.yaml
+++ b/Documentation/devicetree/bindings/usb/starfive,jhb100-dwc3.yaml
@@ -30,6 +30,10 @@ allOf:
minItems: 2
reg-names:
minItems: 2
+ clocks:
+ maxItems: 2
+ clock-names:
+ maxItems: 2
dr_mode:
const: peripheral
else:
@@ -38,6 +42,10 @@ allOf:
maxItems: 1
reg-names:
maxItems: 1
+ clocks:
+ minItems: 3
+ clock-names:
+ minItems: 3
properties:
compatible:
@@ -59,12 +67,14 @@ properties:
maxItems: 1
clocks:
+ minItems: 2
items:
- description: USB main enable clk
- description: DWC3 bus early clock
- description: DWC3 ref clock
clock-names:
+ minItems: 2
items:
- const: main
- const: bus_early
@@ -95,3 +105,15 @@ examples:
interrupts = <105>;
dr_mode = "host";
};
+ - |
+ usb@10600000 {
+ compatible = "starfive,jhb100-dwc3";
+ reg = <0x10600000 0x10000>, <0x10695800 0x100>;
+ reg-names = "core", "adapter";
+ clocks = <&usbdcrg 30>,
+ <&usbdcrg 31>;
+ clock-names = "main", "bus_early";
+ resets = <&usbdcrg 12>;
+ interrupts = <106>;
+ dr_mode = "peripheral";
+ };
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v3 3/3] usb: dwc3: starfive: Add JHB100 USB device adapter port enable quirk
2026-11-25 8:37 [PATCH v3 0/3] Add StarFive JHB100 host field USB device controller driver Minda Chen
2026-11-25 8:37 ` [PATCH v3 1/3] dt-bindings: usb: starfive,jhb100-dwc3: Add adapter register region Minda Chen
2026-11-25 8:37 ` [PATCH v3 2/3] dt-bindings: usb: starfive,jhb100-dwc3: Add clock number limit Minda Chen
@ 2026-11-25 8:37 ` Minda Chen
2 siblings, 0 replies; 4+ messages in thread
From: Minda Chen @ 2026-11-25 8:37 UTC (permalink / raw)
To: Greg Kroah-Hartman, Thinh Nguyen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, linux-usb
Cc: linux-kernel, devicetree, Minda Chen
On the JHB100 BMC SoC, each DWC3 device controller is connected to a
port of the xHCI controller that is exported to the server host over
PCIe, through a PHY adapter. Setting the adapter USB 2.0 port enable
bit asserts the connect status in the xHCI PORTSC register, so it must
only be set once the gadget is ready to be enumerated, otherwise the
host fails to enumerate the device.
Map the optional "adapter" register region from the JHB100 init
callback, and set or clear the port enable bit from the pre_run_stop
glue callback.
Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
drivers/usb/dwc3/dwc3-generic-plat.c | 48 +++++++++++++++++++++++++++-
1 file changed, 47 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/dwc3/dwc3-generic-plat.c b/drivers/usb/dwc3/dwc3-generic-plat.c
index ca69ac0eb07c..ebcd43442fc4 100644
--- a/drivers/usb/dwc3/dwc3-generic-plat.c
+++ b/drivers/usb/dwc3/dwc3-generic-plat.c
@@ -22,12 +22,15 @@
#define EIC7700_HSP_AXI_LP_XM_CSYSREQ BIT(0)
#define EIC7700_HSP_AXI_LP_XS_CSYSREQ BIT(16)
+#define STARFIVE_JHB100_ADAPTER_PORT_EN BIT(20)
+
struct dwc3_generic {
struct device *dev;
struct dwc3 dwc;
struct clk_bulk_data *clks;
int num_clocks;
struct reset_control *resets;
+ void __iomem *regs;
};
struct dwc3_generic_config {
@@ -42,6 +45,44 @@ static void dwc3_generic_reset_control_assert(void *data)
reset_control_assert(data);
}
+static void dwc3_starfive_jhb100_pre_run_stop(struct dwc3 *dwc3, bool start)
+{
+ struct dwc3_generic *data = to_dwc3_generic(dwc3);
+ u32 val;
+
+ val = readl(data->regs);
+
+ if (start)
+ val |= STARFIVE_JHB100_ADAPTER_PORT_EN;
+ else
+ val &= ~STARFIVE_JHB100_ADAPTER_PORT_EN;
+
+ writel(val, data->regs);
+}
+
+static const struct dwc3_glue_ops starfive_jhb100_glue_ops = {
+ .pre_run_stop = dwc3_starfive_jhb100_pre_run_stop,
+};
+
+static int starfive_dwc3_jhb100_init(struct dwc3_generic *dwc3g)
+{
+ struct platform_device *pdev = to_platform_device(dwc3g->dev);
+ struct resource *res;
+
+ res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "adapter");
+ if (res) {
+ /* usb device controller with adapter */
+ dwc3g->regs = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(dwc3g->regs))
+ return dev_err_probe(&pdev->dev, PTR_ERR(dwc3g->regs),
+ "failed to get adapter regs\n");
+
+ dwc3g->dwc.glue_ops = &starfive_jhb100_glue_ops;
+ }
+
+ return 0;
+}
+
static int dwc3_eic7700_init(struct dwc3_generic *dwc3g)
{
struct device *dev = dwc3g->dev;
@@ -231,12 +272,17 @@ static const struct dwc3_generic_config eic7700_dwc3 = {
.properties = DWC3_DEFAULT_PROPERTIES,
};
+static const struct dwc3_generic_config starfive_jhb100_dwc3 = {
+ .init = starfive_dwc3_jhb100_init,
+ .properties = DWC3_DEFAULT_PROPERTIES,
+};
+
static const struct of_device_id dwc3_generic_of_match[] = {
{ .compatible = "spacemit,k1-dwc3", &spacemit_k1_dwc3},
{ .compatible = "spacemit,k3-dwc3", },
{ .compatible = "fsl,ls1028a-dwc3", &fsl_ls1028_dwc3},
{ .compatible = "eswin,eic7700-dwc3", &eic7700_dwc3},
- { .compatible = "starfive,jhb100-dwc3", },
+ { .compatible = "starfive,jhb100-dwc3", &starfive_jhb100_dwc3},
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, dwc3_generic_of_match);
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread