public inbox for linux-aspeed@lists.ozlabs.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Add AST2700 support for Aspeed vhub
@ 2025-11-26  8:26 Ryan Chen
  2025-11-26  8:26 ` [PATCH 1/2] dt-bindings: usb: aspeed,usb-vhub: Add ast2700 support Ryan Chen
  2025-11-26  8:26 ` [PATCH 2/2] usb: gadget: aspeed-vhub: " Ryan Chen
  0 siblings, 2 replies; 5+ messages in thread
From: Ryan Chen @ 2025-11-26  8:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Joel Stanley, Andrew Jeffery,
	Benjamin Herrenschmidt, Philipp Zabel
  Cc: linux-usb, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, Ryan Chen

This series add Aspeed vhub support for AST2700.
The AST2700 vhub requires a reset and uses 64-bit DMA.
This series updates the binding and driver to support these two
requirements.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
---
Ryan Chen (2):
      dt-bindings: usb: aspeed,usb-vhub: Add ast2700 support
      usb: gadget: aspeed-vhub: Add ast2700 support

 .../devicetree/bindings/usb/aspeed,usb-vhub.yaml   | 14 ++++++++++
 drivers/usb/gadget/udc/aspeed-vhub/core.c          | 30 ++++++++++++++++++++++
 drivers/usb/gadget/udc/aspeed-vhub/vhub.h          |  1 +
 3 files changed, 45 insertions(+)
---
base-commit: ac3fd01e4c1efce8f2c054cdeb2ddd2fc0fb150d
change-id: 20251125-upstream_vhub-3e20483a455e

Best regards,
-- 
Ryan Chen <ryan_chen@aspeedtech.com>



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

* [PATCH 1/2] dt-bindings: usb: aspeed,usb-vhub: Add ast2700 support
  2025-11-26  8:26 [PATCH 0/2] Add AST2700 support for Aspeed vhub Ryan Chen
@ 2025-11-26  8:26 ` Ryan Chen
  2025-11-26 18:57   ` Conor Dooley
  2025-11-26  8:26 ` [PATCH 2/2] usb: gadget: aspeed-vhub: " Ryan Chen
  1 sibling, 1 reply; 5+ messages in thread
From: Ryan Chen @ 2025-11-26  8:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Joel Stanley, Andrew Jeffery,
	Benjamin Herrenschmidt, Philipp Zabel
  Cc: linux-usb, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, Ryan Chen

Add the "aspeed,ast2700-usb-vhub" compatible. The ast2700 vhub
controller requires an reset, so make the "resets" property
mandatory for this compatible to reflect the hardware requirement.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
---
 Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml b/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml
index 7f22f9c031b2..c9ebb6e004d1 100644
--- a/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml
+++ b/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml
@@ -26,6 +26,7 @@ properties:
       - aspeed,ast2400-usb-vhub
       - aspeed,ast2500-usb-vhub
       - aspeed,ast2600-usb-vhub
+      - aspeed,ast2700-usb-vhub
 
   reg:
     maxItems: 1
@@ -33,6 +34,9 @@ properties:
   clocks:
     maxItems: 1
 
+  resets:
+    maxItems: 1
+
   interrupts:
     maxItems: 1
 
@@ -107,6 +111,16 @@ required:
   - aspeed,vhub-downstream-ports
   - aspeed,vhub-generic-endpoints
 
+if:
+  properties:
+    compatible:
+      contains:
+        const: aspeed,ast2700-usb-vhub
+
+then:
+  required:
+    - resets
+
 additionalProperties: false
 
 examples:

-- 
2.34.1



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

* [PATCH 2/2] usb: gadget: aspeed-vhub: Add ast2700 support
  2025-11-26  8:26 [PATCH 0/2] Add AST2700 support for Aspeed vhub Ryan Chen
  2025-11-26  8:26 ` [PATCH 1/2] dt-bindings: usb: aspeed,usb-vhub: Add ast2700 support Ryan Chen
@ 2025-11-26  8:26 ` Ryan Chen
  1 sibling, 0 replies; 5+ messages in thread
From: Ryan Chen @ 2025-11-26  8:26 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Joel Stanley, Andrew Jeffery,
	Benjamin Herrenschmidt, Philipp Zabel
  Cc: linux-usb, devicetree, linux-arm-kernel, linux-aspeed,
	linux-kernel, Ryan Chen

Add support for the AST2700 SOC in the vhub gadget driver. AST2700
uses a 64-bit DMA addressing capability, so select 64-bit DMA mask
for compatible. AST2700 vhub also requires an reset line, so hook
up the optional reset control and assert/deassert it during probe
and remove.

Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
---
 drivers/usb/gadget/udc/aspeed-vhub/core.c | 30 ++++++++++++++++++++++++++++++
 drivers/usb/gadget/udc/aspeed-vhub/vhub.h |  1 +
 2 files changed, 31 insertions(+)

diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c
index f2685f89b3e5..19c1849ae665 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
@@ -23,6 +23,7 @@
 #include <linux/of.h>
 #include <linux/regmap.h>
 #include <linux/dma-mapping.h>
+#include <linux/reset.h>
 
 #include "vhub.h"
 
@@ -280,6 +281,8 @@ static void ast_vhub_remove(struct platform_device *pdev)
 	if (vhub->clk)
 		clk_disable_unprepare(vhub->clk);
 
+	reset_control_assert(vhub->rst);
+
 	spin_unlock_irqrestore(&vhub->lock, flags);
 
 	if (vhub->ep0_bufs)
@@ -294,6 +297,7 @@ static void ast_vhub_remove(struct platform_device *pdev)
 static int ast_vhub_probe(struct platform_device *pdev)
 {
 	enum usb_device_speed max_speed;
+	const u64 *dma_mask_ptr;
 	struct ast_vhub *vhub;
 	struct resource *res;
 	int i, rc = 0;
@@ -348,6 +352,16 @@ static int ast_vhub_probe(struct platform_device *pdev)
 		goto err;
 	}
 
+	vhub->rst = devm_reset_control_get_optional_shared(&pdev->dev, NULL);
+	if (IS_ERR(vhub->rst)) {
+		rc = PTR_ERR(vhub->rst);
+		goto err;
+	}
+
+	rc = reset_control_deassert(vhub->rst);
+	if (rc)
+		goto err;
+
 	/* Check if we need to limit the HW to USB1 */
 	max_speed = usb_get_maximum_speed(&pdev->dev);
 	if (max_speed != USB_SPEED_UNKNOWN && max_speed < USB_SPEED_HIGH)
@@ -370,6 +384,12 @@ static int ast_vhub_probe(struct platform_device *pdev)
 		goto err;
 	}
 
+	dma_mask_ptr = (u64 *)of_device_get_match_data(&pdev->dev);
+	if (dma_mask_ptr) {
+		rc = dma_coerce_mask_and_coherent(&pdev->dev, *dma_mask_ptr);
+		if (rc)
+			goto err;
+	}
 	/*
 	 * Allocate DMA buffers for all EP0s in one chunk,
 	 * one per port and one for the vHub itself
@@ -412,15 +432,25 @@ static int ast_vhub_probe(struct platform_device *pdev)
 	return rc;
 }
 
+static const u64 dma_mask_32 =	DMA_BIT_MASK(32);
+static const u64 dma_mask_64 =	DMA_BIT_MASK(64);
+
 static const struct of_device_id ast_vhub_dt_ids[] = {
 	{
 		.compatible = "aspeed,ast2400-usb-vhub",
+		.data = &dma_mask_32,
 	},
 	{
 		.compatible = "aspeed,ast2500-usb-vhub",
+		.data = &dma_mask_32,
 	},
 	{
 		.compatible = "aspeed,ast2600-usb-vhub",
+		.data = &dma_mask_32,
+	},
+	{
+		.compatible = "aspeed,ast2700-usb-vhub",
+		.data = &dma_mask_64,
 	},
 	{ }
 };
diff --git a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
index 6b9dfa6e10eb..aca2050e2db0 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
+++ b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
@@ -388,6 +388,7 @@ struct ast_vhub {
 	spinlock_t			lock;
 	struct work_struct		wake_work;
 	struct clk			*clk;
+	struct reset_control		*rst;
 
 	/* EP0 DMA buffers allocated in one chunk */
 	void				*ep0_bufs;

-- 
2.34.1



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

* Re: [PATCH 1/2] dt-bindings: usb: aspeed,usb-vhub: Add ast2700 support
  2025-11-26  8:26 ` [PATCH 1/2] dt-bindings: usb: aspeed,usb-vhub: Add ast2700 support Ryan Chen
@ 2025-11-26 18:57   ` Conor Dooley
  2025-11-27  0:42     ` Ryan Chen
  0 siblings, 1 reply; 5+ messages in thread
From: Conor Dooley @ 2025-11-26 18:57 UTC (permalink / raw)
  To: Ryan Chen
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Joel Stanley, Andrew Jeffery,
	Benjamin Herrenschmidt, Philipp Zabel, linux-usb, devicetree,
	linux-arm-kernel, linux-aspeed, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1597 bytes --]

On Wed, Nov 26, 2025 at 04:26:30PM +0800, Ryan Chen wrote:
> Add the "aspeed,ast2700-usb-vhub" compatible. The ast2700 vhub
> controller requires an reset, so make the "resets" property
> mandatory for this compatible to reflect the hardware requirement.
> 
> Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
> ---
>  Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml b/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml
> index 7f22f9c031b2..c9ebb6e004d1 100644
> --- a/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml
> +++ b/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml
> @@ -26,6 +26,7 @@ properties:
>        - aspeed,ast2400-usb-vhub
>        - aspeed,ast2500-usb-vhub
>        - aspeed,ast2600-usb-vhub
> +      - aspeed,ast2700-usb-vhub
>  
>    reg:
>      maxItems: 1
> @@ -33,6 +34,9 @@ properties:
>    clocks:
>      maxItems: 1
>  
> +  resets:
> +    maxItems: 1
> +
>    interrupts:
>      maxItems: 1
>  
> @@ -107,6 +111,16 @@ required:
>    - aspeed,vhub-downstream-ports
>    - aspeed,vhub-generic-endpoints
>  
> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        const: aspeed,ast2700-usb-vhub
> +
> +then:
> +  required:
> +    - resets

Do other aspeed platforms have resets? If not, please add an else here
to block its use on other platforms.

> +
>  additionalProperties: false
>  
>  examples:
> 
> -- 
> 2.34.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

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

* RE: [PATCH 1/2] dt-bindings: usb: aspeed,usb-vhub: Add ast2700 support
  2025-11-26 18:57   ` Conor Dooley
@ 2025-11-27  0:42     ` Ryan Chen
  0 siblings, 0 replies; 5+ messages in thread
From: Ryan Chen @ 2025-11-27  0:42 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Joel Stanley, Andrew Jeffery,
	Benjamin Herrenschmidt, Philipp Zabel, linux-usb@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org

> Subject: Re: [PATCH 1/2] dt-bindings: usb: aspeed,usb-vhub: Add ast2700
> support
> 
> On Wed, Nov 26, 2025 at 04:26:30PM +0800, Ryan Chen wrote:
> > Add the "aspeed,ast2700-usb-vhub" compatible. The ast2700 vhub
> > controller requires an reset, so make the "resets" property mandatory
> > for this compatible to reflect the hardware requirement.
> >
> > Signed-off-by: Ryan Chen <ryan_chen@aspeedtech.com>
> > ---
> >  Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml | 14
> > ++++++++++++++
> >  1 file changed, 14 insertions(+)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml
> > b/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml
> > index 7f22f9c031b2..c9ebb6e004d1 100644
> > --- a/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml
> > +++ b/Documentation/devicetree/bindings/usb/aspeed,usb-vhub.yaml
> > @@ -26,6 +26,7 @@ properties:
> >        - aspeed,ast2400-usb-vhub
> >        - aspeed,ast2500-usb-vhub
> >        - aspeed,ast2600-usb-vhub
> > +      - aspeed,ast2700-usb-vhub
> >
> >    reg:
> >      maxItems: 1
> > @@ -33,6 +34,9 @@ properties:
> >    clocks:
> >      maxItems: 1
> >
> > +  resets:
> > +    maxItems: 1
> > +
> >    interrupts:
> >      maxItems: 1
> >
> > @@ -107,6 +111,16 @@ required:
> >    - aspeed,vhub-downstream-ports
> >    - aspeed,vhub-generic-endpoints
> >
> > +if:
> > +  properties:
> > +    compatible:
> > +      contains:
> > +        const: aspeed,ast2700-usb-vhub
> > +
> > +then:
> > +  required:
> > +    - resets
> 
> Do other aspeed platforms have resets? If not, please add an else here to block
> its use on other platforms.

I will update to following. 

   if:
      properties:
        compatible:
          contains:
            const: aspeed,ast2700-usb-vhub
    then:
      required:
        - resets

    else:
      properties:
        resets: false

Thanks your review.
> 
> > +
> >  additionalProperties: false
> >
> >  examples:
> >
> > --
> > 2.34.1
> >


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

end of thread, other threads:[~2025-11-27  0:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-26  8:26 [PATCH 0/2] Add AST2700 support for Aspeed vhub Ryan Chen
2025-11-26  8:26 ` [PATCH 1/2] dt-bindings: usb: aspeed,usb-vhub: Add ast2700 support Ryan Chen
2025-11-26 18:57   ` Conor Dooley
2025-11-27  0:42     ` Ryan Chen
2025-11-26  8:26 ` [PATCH 2/2] usb: gadget: aspeed-vhub: " Ryan Chen

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