All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux dev-5.4 0/2] aspeed-g6: enable usb support
@ 2020-01-16 23:25 rentao.bupt
  2020-01-16 23:25 ` [PATCH linux dev-5.4 1/2] usb: gadget: aspeed: add ast2600 vhub support rentao.bupt
  2020-01-16 23:25 ` [PATCH linux dev-5.4 2/2] ARM: dts: aspeed-g6: add usb functions rentao.bupt
  0 siblings, 2 replies; 8+ messages in thread
From: rentao.bupt @ 2020-01-16 23:25 UTC (permalink / raw)
  To: Joel Stanley, Andrew Jeffery, taoren, openbmc; +Cc: Tao Ren

From: Tao Ren <rentao.bupt@gmail.com>

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(-)

-- 
2.17.1

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

* [PATCH linux dev-5.4 1/2] usb: gadget: aspeed: add ast2600 vhub support
  2020-01-16 23:25 [PATCH linux dev-5.4 0/2] aspeed-g6: enable usb support rentao.bupt
@ 2020-01-16 23:25 ` rentao.bupt
  2020-01-16 23:43   ` Andrew Jeffery
  2020-01-16 23:25 ` [PATCH linux dev-5.4 2/2] ARM: dts: aspeed-g6: add usb functions rentao.bupt
  1 sibling, 1 reply; 8+ messages in thread
From: rentao.bupt @ 2020-01-16 23:25 UTC (permalink / raw)
  To: Joel Stanley, Andrew Jeffery, taoren, openbmc; +Cc: Tao Ren

From: Tao Ren <rentao.bupt@gmail.com>

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.

Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
---
 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(-)

diff --git a/drivers/usb/gadget/udc/aspeed-vhub/Kconfig b/drivers/usb/gadget/udc/aspeed-vhub/Kconfig
index 83ba8a2eb6af..605500b19cf3 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/Kconfig
+++ b/drivers/usb/gadget/udc/aspeed-vhub/Kconfig
@@ -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
diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c
index 90b134d5dca9..5fafe91d3619 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
@@ -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);
diff --git a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
index 761919e220d3..76935d02decf 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
+++ b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
@@ -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
-- 
2.17.1

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

* [PATCH linux dev-5.4 2/2] ARM: dts: aspeed-g6: add usb functions
  2020-01-16 23:25 [PATCH linux dev-5.4 0/2] aspeed-g6: enable usb support rentao.bupt
  2020-01-16 23:25 ` [PATCH linux dev-5.4 1/2] usb: gadget: aspeed: add ast2600 vhub support rentao.bupt
@ 2020-01-16 23:25 ` rentao.bupt
  2020-01-16 23:56   ` Andrew Jeffery
  1 sibling, 1 reply; 8+ messages in thread
From: rentao.bupt @ 2020-01-16 23:25 UTC (permalink / raw)
  To: Joel Stanley, Andrew Jeffery, taoren, openbmc; +Cc: Tao Ren

From: Tao Ren <rentao.bupt@gmail.com>

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

Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
---
 arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi | 25 ++++++++++++++
 arch/arm/boot/dts/aspeed-g6.dtsi         | 43 ++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

diff --git a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
index 045ce66ca876..7028e21bdd98 100644
--- a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
+++ b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
@@ -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";
diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi
index 99cc7d7ced4d..d344bb278bdb 100644
--- a/arch/arm/boot/dts/aspeed-g6.dtsi
+++ b/arch/arm/boot/dts/aspeed-g6.dtsi
@@ -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
+			 */
+		};
+
+		vhub: usb-vhub@1e6a0000 {
+			compatible = "aspeed,ast2600-usb-vhub";
+			reg = <0x1e6a0000 0x300>;
+			interrupts = <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&syscon ASPEED_CLK_GATE_USBPORT1CLK>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&pinctrl_usb2ad_default>;
+			status = "disabled";
+		};
+
 		apb {
 			compatible = "simple-bus";
 			#address-cells = <1>;
-- 
2.17.1

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

* Re: [PATCH linux dev-5.4 1/2] usb: gadget: aspeed: add ast2600 vhub support
  2020-01-16 23:25 ` [PATCH linux dev-5.4 1/2] usb: gadget: aspeed: add ast2600 vhub support rentao.bupt
@ 2020-01-16 23:43   ` Andrew Jeffery
  2020-01-16 23:57     ` Tao Ren
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Jeffery @ 2020-01-16 23:43 UTC (permalink / raw)
  To: Tao Ren, Joel Stanley, Tao Ren, openbmc



On Fri, 17 Jan 2020, at 09:55, rentao.bupt@gmail.com wrote:
> From: Tao Ren <rentao.bupt@gmail.com>
> 
> 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.
> 
> Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
> ---
>  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(-)
> 
> diff --git a/drivers/usb/gadget/udc/aspeed-vhub/Kconfig 
> b/drivers/usb/gadget/udc/aspeed-vhub/Kconfig
> index 83ba8a2eb6af..605500b19cf3 100644
> --- a/drivers/usb/gadget/udc/aspeed-vhub/Kconfig
> +++ b/drivers/usb/gadget/udc/aspeed-vhub/Kconfig
> @@ -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
> diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c 
> b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> index 90b134d5dca9..5fafe91d3619 100644
> --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
> +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> @@ -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);
> diff --git a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h 
> b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
> index 761919e220d3..76935d02decf 100644
> --- a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
> +++ b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
> @@ -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

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

* Re: [PATCH linux dev-5.4 2/2] ARM: dts: aspeed-g6: add usb functions
  2020-01-16 23:25 ` [PATCH linux dev-5.4 2/2] ARM: dts: aspeed-g6: add usb functions rentao.bupt
@ 2020-01-16 23:56   ` Andrew Jeffery
  2020-01-17  0:00     ` Tao Ren
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Jeffery @ 2020-01-16 23:56 UTC (permalink / raw)
  To: Tao Ren, Joel Stanley, Tao Ren, openbmc



On Fri, 17 Jan 2020, at 09:55, rentao.bupt@gmail.com wrote:
> From: Tao Ren <rentao.bupt@gmail.com>
> 
> Add USB function pins and devices in aspeed-g6 dtsi.
> 
> Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
> ---
>  arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi | 25 ++++++++++++++
>  arch/arm/boot/dts/aspeed-g6.dtsi         | 43 ++++++++++++++++++++++++
>  2 files changed, 68 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi 
> b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
> index 045ce66ca876..7028e21bdd98 100644
> --- a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
> +++ b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
> @@ -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";
> diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi
> index 99cc7d7ced4d..d344bb278bdb 100644
> --- a/arch/arm/boot/dts/aspeed-g6.dtsi
> +++ b/arch/arm/boot/dts/aspeed-g6.dtsi
> @@ -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
> +			 */
> +		};
> +
> +		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?

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

* Re: [PATCH linux dev-5.4 1/2] usb: gadget: aspeed: add ast2600 vhub support
  2020-01-16 23:43   ` Andrew Jeffery
@ 2020-01-16 23:57     ` Tao Ren
  2020-01-17  0:15       ` Andrew Jeffery
  0 siblings, 1 reply; 8+ messages in thread
From: Tao Ren @ 2020-01-16 23:57 UTC (permalink / raw)
  To: Andrew Jeffery; +Cc: Joel Stanley, Tao Ren, openbmc

On Fri, Jan 17, 2020 at 10:13:57AM +1030, Andrew Jeffery wrote:
> 
> 
> On Fri, 17 Jan 2020, at 09:55, rentao.bupt@gmail.com wrote:
> > From: Tao Ren <rentao.bupt@gmail.com>
> > 
> > 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.
> > 
> > Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
> > ---
> >  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(-)
> > 
> > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/Kconfig 
> > b/drivers/usb/gadget/udc/aspeed-vhub/Kconfig
> > index 83ba8a2eb6af..605500b19cf3 100644
> > --- a/drivers/usb/gadget/udc/aspeed-vhub/Kconfig
> > +++ b/drivers/usb/gadget/udc/aspeed-vhub/Kconfig
> > @@ -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
> > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c 
> > b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > index 90b134d5dca9..5fafe91d3619 100644
> > --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > @@ -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);
> > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h 
> > b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
> > index 761919e220d3..76935d02decf 100644
> > --- a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
> > +++ b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h
> > @@ -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.

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

> 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

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

* Re: [PATCH linux dev-5.4 2/2] ARM: dts: aspeed-g6: add usb functions
  2020-01-16 23:56   ` Andrew Jeffery
@ 2020-01-17  0:00     ` Tao Ren
  0 siblings, 0 replies; 8+ messages in thread
From: Tao Ren @ 2020-01-17  0:00 UTC (permalink / raw)
  To: Andrew Jeffery; +Cc: Joel Stanley, Tao Ren, openbmc

On Fri, Jan 17, 2020 at 10:26:15AM +1030, Andrew Jeffery wrote:
> 
> 
> On Fri, 17 Jan 2020, at 09:55, rentao.bupt@gmail.com wrote:
> > From: Tao Ren <rentao.bupt@gmail.com>
> > 
> > Add USB function pins and devices in aspeed-g6 dtsi.
> > 
> > Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
> > ---
> >  arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi | 25 ++++++++++++++
> >  arch/arm/boot/dts/aspeed-g6.dtsi         | 43 ++++++++++++++++++++++++
> >  2 files changed, 68 insertions(+)
> > 
> > diff --git a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi 
> > b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
> > index 045ce66ca876..7028e21bdd98 100644
> > --- a/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
> > +++ b/arch/arm/boot/dts/aspeed-g6-pinctrl.dtsi
> > @@ -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";
> > diff --git a/arch/arm/boot/dts/aspeed-g6.dtsi b/arch/arm/boot/dts/aspeed-g6.dtsi
> > index 99cc7d7ced4d..d344bb278bdb 100644
> > --- a/arch/arm/boot/dts/aspeed-g6.dtsi
> > +++ b/arch/arm/boot/dts/aspeed-g6.dtsi
> > @@ -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
> > +			 */
> > +		};
> > +
> > +		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

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

* Re: [PATCH linux dev-5.4 1/2] usb: gadget: aspeed: add ast2600 vhub support
  2020-01-16 23:57     ` Tao Ren
@ 2020-01-17  0:15       ` Andrew Jeffery
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Jeffery @ 2020-01-17  0:15 UTC (permalink / raw)
  To: Tao Ren; +Cc: Joel Stanley, Tao Ren, openbmc


> > > +
> > > +#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.

> 
> > 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

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

end of thread, other threads:[~2020-01-17  0:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16 23:25 [PATCH linux dev-5.4 0/2] aspeed-g6: enable usb support rentao.bupt
2020-01-16 23:25 ` [PATCH linux dev-5.4 1/2] usb: gadget: aspeed: add ast2600 vhub support rentao.bupt
2020-01-16 23:43   ` Andrew Jeffery
2020-01-16 23:57     ` Tao Ren
2020-01-17  0:15       ` Andrew Jeffery
2020-01-16 23:25 ` [PATCH linux dev-5.4 2/2] ARM: dts: aspeed-g6: add usb functions rentao.bupt
2020-01-16 23:56   ` Andrew Jeffery
2020-01-17  0:00     ` Tao Ren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.