Skip to contentSkip to conversation

aspeed-g6: enable usb support

PATCH Superseded [email protected] 2 participants 8 messages Jan 16, 2020 – Jan 17, 2020

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover aspeed-g6: enable usb support

From: Tao Ren <[email protected]>

The patch series aims at enabling USB Host and Gadget support on AST2600 platforms.

Patch #1 enables AST2600 support in aspeed-vhub gadget driver, and patch #2 add USB function pins and devices in aspeed-g6 dtsi files.

The patch series has been sanity tested on AST2600-A0 eval board by:
a) setting USB port A as vhub and creating 7 gadget devices: all the 7 devices can be enumerated from another Linux USB Host.
b) setting USB port B as EHCI and connecting a USB flash drive: the USB flash drive can be enumerated successfully.

Tao Ren (2):
usb: gadget: aspeed: add ast2600 vhub support
ARM: dts: aspeed-g6: add usb functions

 arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi   | 25 +++++++++++++
 arch/arm/boot/dts/aspeed-g6.dtsi           | 43 ++++++++++++++++++++++
 drivers/usb/gadget/udc/aspeed-vhub/Kconfig |  4 +-
 drivers/usb/gadget/udc/aspeed-vhub/core.c  | 25 +++++--------
 drivers/usb/gadget/udc/aspeed-vhub/vhub.h  | 32 ++++++++++++----
 5 files changed, 103 insertions(+), 26 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 usb: gadget: aspeed: add ast2600 vhub support

From: Tao Ren <[email protected]>

Add AST2600 support in aspeed-vhub driver.

There are 3 major differences between AST2500 and AST2600 vhub:
- AST2600 supports 7 downstream devices while AST2500 supports 5.
- AST2600 supports 21 programmable endpoints while AST2500 supports 15.
- EP0 data buffer's 8-byte DMA alignment restriction is removed from

    AST2600.
---
 drivers/usb/gadget/udc/aspeed-vhub/Kconfig |  4 +--
 drivers/usb/gadget/udc/aspeed-vhub/core.c  | 25 ++++++-----------
 drivers/usb/gadget/udc/aspeed-vhub/vhub.h  | 32 ++++++++++++++++------
 3 files changed, 35 insertions(+), 26 deletions(-)
drivers/usb/gadget/udc/aspeed-vhub/Kconfig +2 -2
index 83ba8a2eb6af..605500b19cf3 100644
@@ -4,5 +4,5 @@ config USB_ASPEED_VHUB
 	depends on ARCH_ASPEED || COMPILE_TEST
 	depends on USB_LIBCOMPOSITE
 	help
-	  USB peripheral controller for the Aspeed AST2500 family
-	  SoCs supporting the "vHub" functionality and USB2.0
+	  USB peripheral controller for the Aspeed AST2400, AST2500 and
+	  AST2600 family SoCs supporting the "vHub" functionality and USB2.0
drivers/usb/gadget/udc/aspeed-vhub/core.c +9 -16
index 90b134d5dca9..5fafe91d3619 100644
@@ -97,6 +97,7 @@ void ast_vhub_free_request(struct usb_ep *u_ep, struct usb_request *u_req)
 
 static irqreturn_t ast_vhub_irq(int irq, void *data)
 {
+	u32 i;
 	struct ast_vhub *vhub = data;
 	irqreturn_t iret = IRQ_NONE;
 	u32 istat;
@@ -121,7 +122,7 @@ static irqreturn_t ast_vhub_irq(int irq, void *data)
 
 	/* Handle generic EPs first */
 	if (istat & VHUB_IRQ_EP_POOL_ACK_STALL) {
-		u32 i, ep_acks = readl(vhub->regs + AST_VHUB_EP_ACK_ISR);
+		u32 ep_acks = readl(vhub->regs + AST_VHUB_EP_ACK_ISR);
 		writel(ep_acks, vhub->regs + AST_VHUB_EP_ACK_ISR);
 
 		for (i = 0; ep_acks && i < AST_VHUB_NUM_GEN_EPs; i++) {
@@ -134,21 +135,10 @@ static irqreturn_t ast_vhub_irq(int irq, void *data)
 	}
 
 	/* Handle device interrupts */
-	if (istat & (VHUB_IRQ_DEVICE1 |
-		     VHUB_IRQ_DEVICE2 |
-		     VHUB_IRQ_DEVICE3 |
-		     VHUB_IRQ_DEVICE4 |
-		     VHUB_IRQ_DEVICE5)) {
-		if (istat & VHUB_IRQ_DEVICE1)
-			ast_vhub_dev_irq(&vhub->ports[0].dev);
-		if (istat & VHUB_IRQ_DEVICE2)
-			ast_vhub_dev_irq(&vhub->ports[1].dev);
-		if (istat & VHUB_IRQ_DEVICE3)
-			ast_vhub_dev_irq(&vhub->ports[2].dev);
-		if (istat & VHUB_IRQ_DEVICE4)
-			ast_vhub_dev_irq(&vhub->ports[3].dev);
-		if (istat & VHUB_IRQ_DEVICE5)
-			ast_vhub_dev_irq(&vhub->ports[4].dev);
+	for (i = 0; i < AST_VHUB_NUM_PORTS; i++) {
+		u32 dev_irq = VHUB_IRQ_DEVICE1 << i;
+		if (istat & dev_irq)
+			ast_vhub_dev_irq(&vhub->ports[i].dev);
 	}
 
 	/* Handle top-level vHub EP0 interrupts */
@@ -407,6 +397,9 @@ static const struct of_device_id ast_vhub_dt_ids[] = {
 	{
 		.compatible = "aspeed,ast2500-usb-vhub",
 	},
+	{
+		.compatible = "aspeed,ast2600-usb-vhub",
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, ast_vhub_dt_ids);
drivers/usb/gadget/udc/aspeed-vhub/vhub.h +24 -8
index 761919e220d3..76935d02decf 100644
@@ -2,6 +2,23 @@
 #ifndef __ASPEED_VHUB_H
 #define __ASPEED_VHUB_H
 
+/*****************************
+ *                           *
+ * Maximum devices/endpoints *
+ *                           *
+ *****************************/
+
+#ifdef CONFIG_MACH_ASPEED_G6
+#define AST_VHUB_NUM_GEN_EPs	21	/* Generic non-0 EPs */
+#define AST_VHUB_NUM_PORTS	7	/* vHub ports */
+#else
+#define AST_VHUB_NUM_GEN_EPs	15	/* Generic non-0 EPs */
+#define AST_VHUB_NUM_PORTS	5	/* vHub ports */
+#endif
+
+#define AST_VHUB_GEN_EPS_MASK	((1 << AST_VHUB_NUM_GEN_EPs) - 1)
+#define AST_VHUB_PORTS_MASK	((1 << AST_VHUB_NUM_PORTS) - 1)
+
 /*****************************
  *                           *
  * VHUB register definitions *
@@ -51,6 +68,8 @@
 #define VHUB_IRQ_USB_CMD_DEADLOCK		(1 << 18)
 #define VHUB_IRQ_EP_POOL_NAK			(1 << 17)
 #define VHUB_IRQ_EP_POOL_ACK_STALL		(1 << 16)
+#define VHUB_IRQ_DEVICE7			(1 << 15)
+#define VHUB_IRQ_DEVICE6			(1 << 14)
 #define VHUB_IRQ_DEVICE5			(1 << 13)
 #define VHUB_IRQ_DEVICE4			(1 << 12)
 #define VHUB_IRQ_DEVICE3			(1 << 11)
@@ -70,23 +89,22 @@
 /* SW reset reg */
 #define VHUB_SW_RESET_EP_POOL			(1 << 9)
 #define VHUB_SW_RESET_DMA_CONTROLLER		(1 << 8)
+#define VHUB_SW_RESET_DEVICE7			(1 << 7)
+#define VHUB_SW_RESET_DEVICE6			(1 << 6)
 #define VHUB_SW_RESET_DEVICE5			(1 << 5)
 #define VHUB_SW_RESET_DEVICE4			(1 << 4)
 #define VHUB_SW_RESET_DEVICE3			(1 << 3)
 #define VHUB_SW_RESET_DEVICE2			(1 << 2)
 #define VHUB_SW_RESET_DEVICE1			(1 << 1)
 #define VHUB_SW_RESET_ROOT_HUB			(1 << 0)
+#define VHUB_SW_RESET_DEV_MASK			(AST_VHUB_PORTS_MASK << 1)
 #define VHUB_SW_RESET_ALL			(VHUB_SW_RESET_EP_POOL | \
 						 VHUB_SW_RESET_DMA_CONTROLLER | \
-						 VHUB_SW_RESET_DEVICE5 | \
-						 VHUB_SW_RESET_DEVICE4 | \
-						 VHUB_SW_RESET_DEVICE3 | \
-						 VHUB_SW_RESET_DEVICE2 | \
-						 VHUB_SW_RESET_DEVICE1 | \
+						 VHUB_SW_RESET_DEV_MASK | \
 						 VHUB_SW_RESET_ROOT_HUB)
 /* EP ACK/NACK IRQ masks */
 #define VHUB_EP_IRQ(n)				(1 << (n))
-#define VHUB_EP_IRQ_ALL				0x7fff	/* 15 EPs */
+#define VHUB_EP_IRQ_ALL				AST_VHUB_GEN_EPS_MASK
 
 /* USB status reg */
 #define VHUB_USBSTS_HISPEED			(1 << 27)
@@ -210,8 +228,6 @@
  *                                      *
  ****************************************/
 
-#define AST_VHUB_NUM_GEN_EPs	15	/* Generic non-0 EPs */
-#define AST_VHUB_NUM_PORTS	5	/* vHub ports */
 #define AST_VHUB_EP0_MAX_PACKET	64	/* EP0's max packet size */
 #define AST_VHUB_EPn_MAX_PACKET	1024	/* Generic EPs max packet size */
 #define AST_VHUB_DESCS_COUNT	256	/* Use 256 descriptor mode (valid
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH linux dev-5.4 1/2] usb: gadget: aspeed: add ast2600 vhub support

Quoted 96 lines · On Fri, 17 Jan 2020, at 09:55, [email protected] wrote:

From: Tao Ren <[email protected]>

Add AST2600 support in aspeed-vhub driver.

There are 3 major differences between AST2500 and AST2600 vhub:
- AST2600 supports 7 downstream devices while AST2500 supports 5.
- AST2600 supports 21 programmable endpoints while AST2500 supports 15.
- EP0 data buffer's 8-byte DMA alignment restriction is removed from

    AST2600.
---
 drivers/usb/gadget/udc/aspeed-vhub/Kconfig |  4 +--
 drivers/usb/gadget/udc/aspeed-vhub/core.c  | 25 ++++++-----------
 drivers/usb/gadget/udc/aspeed-vhub/vhub.h  | 32 ++++++++++++++++------
 3 files changed, 35 insertions(+), 26 deletions(-)
drivers/usb/gadget/udc/aspeed-vhub/Kconfig +2 -2
index 83ba8a2eb6af..605500b19cf3 100644
@@ -4,5 +4,5 @@ config USB_ASPEED_VHUB
 	depends on ARCH_ASPEED || COMPILE_TEST
 	depends on USB_LIBCOMPOSITE
 	help
-	  USB peripheral controller for the Aspeed AST2500 family
-	  SoCs supporting the "vHub" functionality and USB2.0
+	  USB peripheral controller for the Aspeed AST2400, AST2500 and
+	  AST2600 family SoCs supporting the "vHub" functionality and USB2.0
drivers/usb/gadget/udc/aspeed-vhub/core.c +1 -0
index 90b134d5dca9..5fafe91d3619 100644
@@ -97,6 +97,7 @@ void ast_vhub_free_request(struct usb_ep *u_ep, 
 struct usb_request *u_req)
 
 static irqreturn_t ast_vhub_irq(int irq, void *data)
 {
+	u32 i;
 	struct ast_vhub *vhub = data;
 	irqreturn_t iret = IRQ_NONE;
drivers/usb/gadget/udc/aspeed-vhub/core.c +8 -16
 	u32 istat;
@@ -121,7 +122,7 @@ static irqreturn_t ast_vhub_irq(int irq, void *data)
 
 	/* Handle generic EPs first */
 	if (istat & VHUB_IRQ_EP_POOL_ACK_STALL) {
-		u32 i, ep_acks = readl(vhub->regs + AST_VHUB_EP_ACK_ISR);
+		u32 ep_acks = readl(vhub->regs + AST_VHUB_EP_ACK_ISR);
 		writel(ep_acks, vhub->regs + AST_VHUB_EP_ACK_ISR);
 
 		for (i = 0; ep_acks && i < AST_VHUB_NUM_GEN_EPs; i++) {
@@ -134,21 +135,10 @@ static irqreturn_t ast_vhub_irq(int irq, void *data)
 	}
 
 	/* Handle device interrupts */
-	if (istat & (VHUB_IRQ_DEVICE1 |
-		     VHUB_IRQ_DEVICE2 |
-		     VHUB_IRQ_DEVICE3 |
-		     VHUB_IRQ_DEVICE4 |
-		     VHUB_IRQ_DEVICE5)) {
-		if (istat & VHUB_IRQ_DEVICE1)
-			ast_vhub_dev_irq(&vhub->ports[0].dev);
-		if (istat & VHUB_IRQ_DEVICE2)
-			ast_vhub_dev_irq(&vhub->ports[1].dev);
-		if (istat & VHUB_IRQ_DEVICE3)
-			ast_vhub_dev_irq(&vhub->ports[2].dev);
-		if (istat & VHUB_IRQ_DEVICE4)
-			ast_vhub_dev_irq(&vhub->ports[3].dev);
-		if (istat & VHUB_IRQ_DEVICE5)
-			ast_vhub_dev_irq(&vhub->ports[4].dev);
+	for (i = 0; i < AST_VHUB_NUM_PORTS; i++) {
+		u32 dev_irq = VHUB_IRQ_DEVICE1 << i;
+		if (istat & dev_irq)
+			ast_vhub_dev_irq(&vhub->ports[i].dev);
 	}
 
 	/* Handle top-level vHub EP0 interrupts */
@@ -407,6 +397,9 @@ static const struct of_device_id ast_vhub_dt_ids[] 
 = {
 	{
 		.compatible = "aspeed,ast2500-usb-vhub",
 	},
+	{
+		.compatible = "aspeed,ast2600-usb-vhub",
+	},
 	{ }
 };

MODULE_DEVICE_TABLE(of, ast_vhub_dt_ids);

drivers/usb/gadget/udc/aspeed-vhub/vhub.h +0 -0
index 761919e220d3..76935d02decf 100644

drivers/usb/gadget/udc/aspeed-vhub/vhub.h line 11

Quoted 10 lines
drivers/usb/gadget/udc/aspeed-vhub/vhub.h +7 -0
@@ -2,6 +2,23 @@
 #ifndef __ASPEED_VHUB_H
 #define __ASPEED_VHUB_H
 
+/*****************************
+ *                           *
+ * Maximum devices/endpoints *
+ *                           *
+ *****************************/
+
+#ifdef CONFIG_MACH_ASPEED_G6

No, this prevents building a kernel supporting multiple AST generations. Please describe the differences in a platform data struct attached to struct of_device_id.

Also, what's the plan for upstreaming these changes? It's okay to send them for inclusion in the openbmc tree if you're wanting them to bake there for some more widespread testing, but it's not clear what the intent is.

Cheers,

Andrew

author
#3 lore raw

Re: [PATCH linux dev-5.4 1/2] usb: gadget: aspeed: add ast2600 vhub support

Quoted 102 lines · Andrew Jeffery
Quoted 99 lines · On Fri, 17 Jan 2020, at 09:55, [email protected] wrote:

From: Tao Ren <[email protected]>

Add AST2600 support in aspeed-vhub driver.

There are 3 major differences between AST2500 and AST2600 vhub:
- AST2600 supports 7 downstream devices while AST2500 supports 5.
- AST2600 supports 21 programmable endpoints while AST2500 supports 15.
- EP0 data buffer's 8-byte DMA alignment restriction is removed from

    AST2600.
---
 drivers/usb/gadget/udc/aspeed-vhub/Kconfig |  4 +--
 drivers/usb/gadget/udc/aspeed-vhub/core.c  | 25 ++++++-----------
 drivers/usb/gadget/udc/aspeed-vhub/vhub.h  | 32 ++++++++++++++++------
 3 files changed, 35 insertions(+), 26 deletions(-)
drivers/usb/gadget/udc/aspeed-vhub/Kconfig +2 -2
index 83ba8a2eb6af..605500b19cf3 100644
@@ -4,5 +4,5 @@ config USB_ASPEED_VHUB
 	depends on ARCH_ASPEED || COMPILE_TEST
 	depends on USB_LIBCOMPOSITE
 	help
-	  USB peripheral controller for the Aspeed AST2500 family
-	  SoCs supporting the "vHub" functionality and USB2.0
+	  USB peripheral controller for the Aspeed AST2400, AST2500 and
+	  AST2600 family SoCs supporting the "vHub" functionality and USB2.0
drivers/usb/gadget/udc/aspeed-vhub/core.c +1 -0
index 90b134d5dca9..5fafe91d3619 100644
@@ -97,6 +97,7 @@ void ast_vhub_free_request(struct usb_ep *u_ep, 
 struct usb_request *u_req)
 
 static irqreturn_t ast_vhub_irq(int irq, void *data)
 {
+	u32 i;
 	struct ast_vhub *vhub = data;
 	irqreturn_t iret = IRQ_NONE;
drivers/usb/gadget/udc/aspeed-vhub/core.c +8 -16
 	u32 istat;
@@ -121,7 +122,7 @@ static irqreturn_t ast_vhub_irq(int irq, void *data)
 
 	/* Handle generic EPs first */
 	if (istat & VHUB_IRQ_EP_POOL_ACK_STALL) {
-		u32 i, ep_acks = readl(vhub->regs + AST_VHUB_EP_ACK_ISR);
+		u32 ep_acks = readl(vhub->regs + AST_VHUB_EP_ACK_ISR);
 		writel(ep_acks, vhub->regs + AST_VHUB_EP_ACK_ISR);
 
 		for (i = 0; ep_acks && i < AST_VHUB_NUM_GEN_EPs; i++) {
@@ -134,21 +135,10 @@ static irqreturn_t ast_vhub_irq(int irq, void *data)
 	}
 
 	/* Handle device interrupts */
-	if (istat & (VHUB_IRQ_DEVICE1 |
-		     VHUB_IRQ_DEVICE2 |
-		     VHUB_IRQ_DEVICE3 |
-		     VHUB_IRQ_DEVICE4 |
-		     VHUB_IRQ_DEVICE5)) {
-		if (istat & VHUB_IRQ_DEVICE1)
-			ast_vhub_dev_irq(&vhub->ports[0].dev);
-		if (istat & VHUB_IRQ_DEVICE2)
-			ast_vhub_dev_irq(&vhub->ports[1].dev);
-		if (istat & VHUB_IRQ_DEVICE3)
-			ast_vhub_dev_irq(&vhub->ports[2].dev);
-		if (istat & VHUB_IRQ_DEVICE4)
-			ast_vhub_dev_irq(&vhub->ports[3].dev);
-		if (istat & VHUB_IRQ_DEVICE5)
-			ast_vhub_dev_irq(&vhub->ports[4].dev);
+	for (i = 0; i < AST_VHUB_NUM_PORTS; i++) {
+		u32 dev_irq = VHUB_IRQ_DEVICE1 << i;
+		if (istat & dev_irq)
+			ast_vhub_dev_irq(&vhub->ports[i].dev);
 	}
 
 	/* Handle top-level vHub EP0 interrupts */
@@ -407,6 +397,9 @@ static const struct of_device_id ast_vhub_dt_ids[] 
 = {
 	{
 		.compatible = "aspeed,ast2500-usb-vhub",
 	},
+	{
+		.compatible = "aspeed,ast2600-usb-vhub",
+	},
 	{ }
 };

MODULE_DEVICE_TABLE(of, ast_vhub_dt_ids);

drivers/usb/gadget/udc/aspeed-vhub/vhub.h +0 -0
index 761919e220d3..76935d02decf 100644
@@ -2,6 +2,23 @@
 #ifndef __ASPEED_VHUB_H
 #define __ASPEED_VHUB_H
 
Quoted 10 lines

drivers/usb/gadget/udc/aspeed-vhub/vhub.h line 11

Quoted 7 lines
drivers/usb/gadget/udc/aspeed-vhub/vhub.h +7 -0
+/*****************************
+ *                           *
+ * Maximum devices/endpoints *
+ *                           *
+ *****************************/
+
+#ifdef CONFIG_MACH_ASPEED_G6

No, this prevents building a kernel supporting multiple AST generations. Please describe the differences in a platform data struct attached to struct of_device_id.

Got it. I took "#ifdef" approach just because it involves little changes. Let me move to of_device_id direction then.

Quoted 7 lines

Also, what's the plan for upstreaming these changes? It's okay to send them for inclusion in the openbmc tree if you're wanting them to bake there for some more widespread testing, but it's not clear what the intent is.

Cheers,

Andrew

My major goal was to get more testing and early feedback. Given we've decided to go with of_device_id approach, let's ignore the patchs then.

Cheers,

Tao

#4 lore raw

Re: [PATCH linux dev-5.4 1/2] usb: gadget: aspeed: add ast2600 vhub support

Quoted 9 lines
Quoted 6 lines

drivers/usb/gadget/udc/aspeed-vhub/vhub.h line 11

Quoted 3 lines
drivers/usb/gadget/udc/aspeed-vhub/vhub.h +2 -0
+
+#ifdef CONFIG_MACH_ASPEED_G6

No, this prevents building a kernel supporting multiple AST generations. Please describe the differences in a platform data struct attached to struct of_device_id.

Got it. I took "#ifdef" approach just because it involves little changes. Let me move to of_device_id direction then.

Thanks.

Quoted 11 lines
Quoted 8 lines

Also, what's the plan for upstreaming these changes? It's okay to send them for inclusion in the openbmc tree if you're wanting them to bake there for some more widespread testing, but it's not clear what the intent is.

Cheers,

Andrew

My major goal was to get more testing and early feedback. Given we've decided to go with of_device_id approach, let's ignore the patchs then.

No worries, in the future just let us know in the cover letter :)

Andrew

#5 lore raw

PATCH 2/2 ARM: dts: aspeed-g6: add usb functions

In reply to [email protected]

From: Tao Ren <[email protected]>

Add USB function pins and devices in aspeed-g6 dtsi.

---
 arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi | 25 ++++++++++++++
 arch/arm/boot/dts/aspeed-g6.dtsi         | 43 ++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi +25 -0
index 045ce66ca876..7028e21bdd98 100644
@@ -1112,6 +1112,31 @@
 		groups = "UART9";
 	};
 
+	pinctrl_usb2ah_default: usb2ah_default {
+		function = "USB2AH";
+		groups = "USBA";
+	};
+
+	pinctrl_usb2ad_default: usb2ad_default {
+		function = "USB2AD";
+		groups = "USBA";
+	};
+
+	pinctrl_usb2bh_default: usb2bh_default {
+		function = "USB2BH";
+		groups = "USBB";
+	};
+
+	pinctrl_usb2bd_default: usb2bd_default {
+		function = "USB2BD";
+		groups = "USBB";
+	};
+
+	pinctrl_usb11bhid_default: usb11bhid_default {
+		function = "USB11BHID";
+		groups = "USBB";
+	};
+
 	pinctrl_vb_default: vb_default {
 		function = "VB";
 		groups = "VB";
arch/arm/boot/dts/aspeed-g6.dtsi +43 -0

49 lines not on this page · raw message

Signature · 1 line
2.17.1
#6 lore raw

Re: [PATCH linux dev-5.4 2/2] ARM: dts: aspeed-g6: add usb functions

Quoted 81 lines · On Fri, 17 Jan 2020, at 09:55, [email protected] wrote:

From: Tao Ren <[email protected]>

Add USB function pins and devices in aspeed-g6 dtsi.

---
 arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi | 25 ++++++++++++++
 arch/arm/boot/dts/aspeed-g6.dtsi         | 43 ++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi +25 -0
index 045ce66ca876..7028e21bdd98 100644
@@ -1112,6 +1112,31 @@
 		groups = "UART9";
 	};
 
+	pinctrl_usb2ah_default: usb2ah_default {
+		function = "USB2AH";
+		groups = "USBA";
+	};
+
+	pinctrl_usb2ad_default: usb2ad_default {
+		function = "USB2AD";
+		groups = "USBA";
+	};
+
+	pinctrl_usb2bh_default: usb2bh_default {
+		function = "USB2BH";
+		groups = "USBB";
+	};
+
+	pinctrl_usb2bd_default: usb2bd_default {
+		function = "USB2BD";
+		groups = "USBB";
+	};
+
+	pinctrl_usb11bhid_default: usb11bhid_default {
+		function = "USB11BHID";
+		groups = "USBB";
+	};
+
 	pinctrl_vb_default: vb_default {
 		function = "VB";
 		groups = "VB";
arch/arm/boot/dts/aspeed-g6.dtsi +26 -0
index 99cc7d7ced4d..d344bb278bdb 100644
@@ -245,6 +245,49 @@
 			status = "disabled";
 		};
 
+		ehci0: usb@1e6a1000 {
+			compatible = "aspeed,ast2600-ehci", "generic-ehci";
+			reg = <0x1e6a1000 0x100>;
+			interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&pinctrl_usb2ah_default>;
+			status = "disabled";
+		};
+
+		ehci1: usb@1e6a3000 {
+			compatible = "aspeed,ast2600-ehci", "generic-ehci";
+			reg = <0x1e6a3000 0x100>;
+			interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&syscon ASPEED_CLK_GATE_USBPORT2CLK>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&pinctrl_usb2bh_default>;
+			status = "disabled";
+		};
+
+		uhci: usb@1e6b0000 {
+			compatible = "aspeed,ast2600-uhci", "generic-uhci";
+			reg = <0x1e6b0000 0x100>;
+			interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
+			#ports = <2>;
+			clocks = <&syscon ASPEED_CLK_GATE_USBUHCICLK>;

arch/arm/boot/dts/aspeed-g6.dtsi line 283

Quoted 10 lines
arch/arm/boot/dts/aspeed-g6.dtsi +10 -0
+			status = "disabled";
+			/*
+			 * No default pinmux, it will follow EHCI, use an explicit pinmux
+			 * override if you don't enable EHCI
+			 */
+		};
+
+		vhub: usb-vhub@1e6a0000 {
+			compatible = "aspeed,ast2600-usb-vhub";
+			reg = <0x1e6a0000 0x300>;

Shouldn't this be at least 0x350 long for all 20 programmable endpoints?

author
#7 lore raw

Re: [PATCH linux dev-5.4 2/2] ARM: dts: aspeed-g6: add usb functions

Quoted 88 lines · Andrew Jeffery
Quoted 85 lines · On Fri, 17 Jan 2020, at 09:55, [email protected] wrote:

From: Tao Ren <[email protected]>

Add USB function pins and devices in aspeed-g6 dtsi.

---
 arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi | 25 ++++++++++++++
 arch/arm/boot/dts/aspeed-g6.dtsi         | 43 ++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi +25 -0
index 045ce66ca876..7028e21bdd98 100644
@@ -1112,6 +1112,31 @@
 		groups = "UART9";
 	};
 
+	pinctrl_usb2ah_default: usb2ah_default {
+		function = "USB2AH";
+		groups = "USBA";
+	};
+
+	pinctrl_usb2ad_default: usb2ad_default {
+		function = "USB2AD";
+		groups = "USBA";
+	};
+
+	pinctrl_usb2bh_default: usb2bh_default {
+		function = "USB2BH";
+		groups = "USBB";
+	};
+
+	pinctrl_usb2bd_default: usb2bd_default {
+		function = "USB2BD";
+		groups = "USBB";
+	};
+
+	pinctrl_usb11bhid_default: usb11bhid_default {
+		function = "USB11BHID";
+		groups = "USBB";
+	};
+
 	pinctrl_vb_default: vb_default {
 		function = "VB";
 		groups = "VB";
arch/arm/boot/dts/aspeed-g6.dtsi +30 -0
index 99cc7d7ced4d..d344bb278bdb 100644
@@ -245,6 +245,49 @@
 			status = "disabled";
 		};
 
+		ehci0: usb@1e6a1000 {
+			compatible = "aspeed,ast2600-ehci", "generic-ehci";
+			reg = <0x1e6a1000 0x100>;
+			interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&pinctrl_usb2ah_default>;
+			status = "disabled";
+		};
+
+		ehci1: usb@1e6a3000 {
+			compatible = "aspeed,ast2600-ehci", "generic-ehci";
+			reg = <0x1e6a3000 0x100>;
+			interrupts = <GIC_SPI 9 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&syscon ASPEED_CLK_GATE_USBPORT2CLK>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&pinctrl_usb2bh_default>;
+			status = "disabled";
+		};
+
+		uhci: usb@1e6b0000 {
+			compatible = "aspeed,ast2600-uhci", "generic-uhci";
+			reg = <0x1e6b0000 0x100>;
+			interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
+			#ports = <2>;
+			clocks = <&syscon ASPEED_CLK_GATE_USBUHCICLK>;
+			status = "disabled";
+			/*
+			 * No default pinmux, it will follow EHCI, use an explicit pinmux
+			 * override if you don't enable EHCI
Quoted 8 lines

arch/arm/boot/dts/aspeed-g6.dtsi line 283

Quoted 6 lines
arch/arm/boot/dts/aspeed-g6.dtsi +6 -0
+			 */
+		};
+
+		vhub: usb-vhub@1e6a0000 {
+			compatible = "aspeed,ast2600-usb-vhub";
+			reg = <0x1e6a0000 0x300>;

Shouldn't this be at least 0x350 long for all 20 programmable endpoints?

Good catch. Will fix it in patch v2. Thank you for the quick review.

Cheers,

Tao