public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working
@ 2016-05-13 12:17 Roger Quadros
  2016-05-13 12:17 ` [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig Roger Quadros
                   ` (5 more replies)
  0 siblings, 6 replies; 34+ messages in thread
From: Roger Quadros @ 2016-05-13 12:17 UTC (permalink / raw)
  To: u-boot

Hi,

This series fixes dwc3 usb config issues and am57xx-evm USB configuration
to get USB host ports working properly on am57xx-evm and beagle-x15.

--
cheers,
-roger

Roger Quadros (4):
  usb: dwc3: fix kconfig
  board: ti: am57xx: Fix USB configuration
  usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled
  usb: gadget: udc: Build on USB_GADGET

 drivers/usb/dwc3/Kconfig        | 9 +++++----
 drivers/usb/dwc3/Makefile       | 2 +-
 drivers/usb/gadget/udc/Makefile | 2 +-
 include/configs/am57xx_evm.h    | 3 +++
 4 files changed, 10 insertions(+), 6 deletions(-)

-- 
2.7.4

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

* [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig
  2016-05-13 12:17 [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working Roger Quadros
@ 2016-05-13 12:17 ` Roger Quadros
  2016-05-13 12:23   ` Marek Vasut
                     ` (2 more replies)
  2016-05-13 12:17 ` [U-Boot] [PATCH 2/4] board: ti: am57xx: Fix USB configuration Roger Quadros
                   ` (4 subsequent siblings)
  5 siblings, 3 replies; 34+ messages in thread
From: Roger Quadros @ 2016-05-13 12:17 UTC (permalink / raw)
  To: u-boot

DWC3 can be used in host only or gadget only mode.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/dwc3/Kconfig | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index e93398f..caf695b 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -1,15 +1,16 @@
 config USB_DWC3
 	bool "DesignWare USB3 DRD Core Support"
-	depends on (USB && USB_GADGET)
-	select USB_GADGET_DUALSPEED
+	depends on (USB || USB_GADGET)
+	select USB_GADGET_DUALSPEED if USB_GADGET
 	help
-	  Say Y here if your system has a Dual Role SuperSpeed
-	  USB controller based on the DesignWare USB3 IP Core.
+	  Say Y here if your system has DesignWare USB3 IP Core.
 
 if USB_DWC3
 
 choice
 	bool "DWC3 Mode Selection"
+	default USB_DWC3_HOST if (USB && !USB_GADGET)
+	default USB_DWC3_GADGET if (!USB && USB_GADGET)
 
 config USB_DWC3_HOST
 	bool "Host only mode"
-- 
2.7.4

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

* [U-Boot] [PATCH 2/4] board: ti: am57xx: Fix USB configuration
  2016-05-13 12:17 [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working Roger Quadros
  2016-05-13 12:17 ` [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig Roger Quadros
@ 2016-05-13 12:17 ` Roger Quadros
  2016-05-13 12:23   ` Marek Vasut
                     ` (2 more replies)
  2016-05-13 12:17 ` [U-Boot] [PATCH 3/4] usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled Roger Quadros
                   ` (3 subsequent siblings)
  5 siblings, 3 replies; 34+ messages in thread
From: Roger Quadros @ 2016-05-13 12:17 UTC (permalink / raw)
  To: u-boot

This fixes build.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 include/configs/am57xx_evm.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index 32d7d4d..939057c 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -63,6 +63,7 @@
 #define CONFIG_SUPPORT_EMMC_BOOT
 
 /* USB xHCI HOST */
+#define CONFIG_USB_DWC3
 #define CONFIG_USB_HOST
 #define CONFIG_USB_XHCI_DWC3
 #define CONFIG_USB_XHCI
@@ -72,6 +73,8 @@
 
 #define CONFIG_OMAP_USB_PHY
 #define CONFIG_OMAP_USB3PHY1_HOST
+#define CONFIG_USB_DWC3_PHY_OMAP
+#define CONFIG_USB_DWC3_OMAP
 
 /* SATA */
 #define CONFIG_BOARD_LATE_INIT
-- 
2.7.4

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

* [U-Boot] [PATCH 3/4] usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled
  2016-05-13 12:17 [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working Roger Quadros
  2016-05-13 12:17 ` [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig Roger Quadros
  2016-05-13 12:17 ` [U-Boot] [PATCH 2/4] board: ti: am57xx: Fix USB configuration Roger Quadros
@ 2016-05-13 12:17 ` Roger Quadros
  2016-05-13 12:24   ` Marek Vasut
  2016-05-30 17:58   ` [U-Boot] [U-Boot, " Tom Rini
  2016-05-13 12:17 ` [U-Boot] [PATCH 4/4] usb: gadget: udc: Build on USB_GADGET Roger Quadros
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 34+ messages in thread
From: Roger Quadros @ 2016-05-13 12:17 UTC (permalink / raw)
  To: u-boot

It is pointless to build gadget driver if USB_GADGET is disabled.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/dwc3/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index 0cd7302..2964bae 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -6,7 +6,7 @@ obj-$(CONFIG_USB_DWC3)			+= dwc3.o
 
 dwc3-y					:= core.o
 
-dwc3-y					+= gadget.o ep0.o
+obj-$(CONFIG_USB_DWC3_GADGET)		+= gadget.o ep0.o
 
 obj-$(CONFIG_USB_DWC3_OMAP)		+= dwc3-omap.o
 obj-$(CONFIG_USB_DWC3_PHY_OMAP)		+= ti_usb_phy.o
-- 
2.7.4

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

* [U-Boot] [PATCH 4/4] usb: gadget: udc: Build on USB_GADGET
  2016-05-13 12:17 [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working Roger Quadros
                   ` (2 preceding siblings ...)
  2016-05-13 12:17 ` [U-Boot] [PATCH 3/4] usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled Roger Quadros
@ 2016-05-13 12:17 ` Roger Quadros
  2016-05-13 12:24   ` Marek Vasut
  2016-05-13 12:22 ` [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working Marek Vasut
  2016-05-13 12:39 ` Roger Quadros
  5 siblings, 1 reply; 34+ messages in thread
From: Roger Quadros @ 2016-05-13 12:17 UTC (permalink / raw)
  To: u-boot

udc-core is a generic framework and not specific to dwc3.
So build it based on USB_GADGET.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/usb/gadget/udc/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/Makefile b/drivers/usb/gadget/udc/Makefile
index 1699ccd..68766c5 100644
--- a/drivers/usb/gadget/udc/Makefile
+++ b/drivers/usb/gadget/udc/Makefile
@@ -4,4 +4,4 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
-obj-$(CONFIG_USB_DWC3_GADGET)	+= udc-core.o
+obj-$(CONFIG_USB_GADGET)	+= udc-core.o
-- 
2.7.4

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

* [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working
  2016-05-13 12:17 [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working Roger Quadros
                   ` (3 preceding siblings ...)
  2016-05-13 12:17 ` [U-Boot] [PATCH 4/4] usb: gadget: udc: Build on USB_GADGET Roger Quadros
@ 2016-05-13 12:22 ` Marek Vasut
  2016-05-13 12:39 ` Roger Quadros
  5 siblings, 0 replies; 34+ messages in thread
From: Marek Vasut @ 2016-05-13 12:22 UTC (permalink / raw)
  To: u-boot

On 05/13/2016 02:17 PM, Roger Quadros wrote:
> Hi,

Hi!

> This series fixes dwc3 usb config issues and am57xx-evm USB configuration
> to get USB host ports working properly on am57xx-evm and beagle-x15.

CCing Masahiro as he also did some DWC3 work and submitted some patches.

> --
> cheers,
> -roger
> 
> Roger Quadros (4):
>   usb: dwc3: fix kconfig
>   board: ti: am57xx: Fix USB configuration
>   usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled
>   usb: gadget: udc: Build on USB_GADGET
> 
>  drivers/usb/dwc3/Kconfig        | 9 +++++----
>  drivers/usb/dwc3/Makefile       | 2 +-
>  drivers/usb/gadget/udc/Makefile | 2 +-
>  include/configs/am57xx_evm.h    | 3 +++
>  4 files changed, 10 insertions(+), 6 deletions(-)
> 


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig
  2016-05-13 12:17 ` [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig Roger Quadros
@ 2016-05-13 12:23   ` Marek Vasut
  2016-05-13 12:27     ` Roger Quadros
  2016-05-17 10:37     ` Masahiro Yamada
  2016-05-17 10:33   ` Masahiro Yamada
  2016-05-19 14:15   ` [U-Boot] [PATCH v2 " Roger Quadros
  2 siblings, 2 replies; 34+ messages in thread
From: Marek Vasut @ 2016-05-13 12:23 UTC (permalink / raw)
  To: u-boot

On 05/13/2016 02:17 PM, Roger Quadros wrote:
> DWC3 can be used in host only or gadget only mode.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/usb/dwc3/Kconfig | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
> index e93398f..caf695b 100644
> --- a/drivers/usb/dwc3/Kconfig
> +++ b/drivers/usb/dwc3/Kconfig
> @@ -1,15 +1,16 @@
>  config USB_DWC3
>  	bool "DesignWare USB3 DRD Core Support"
> -	depends on (USB && USB_GADGET)
> -	select USB_GADGET_DUALSPEED
> +	depends on (USB || USB_GADGET)
> +	select USB_GADGET_DUALSPEED if USB_GADGET
>  	help
> -	  Say Y here if your system has a Dual Role SuperSpeed
> -	  USB controller based on the DesignWare USB3 IP Core.
> +	  Say Y here if your system has DesignWare USB3 IP Core.
>  
>  if USB_DWC3
>  
>  choice
>  	bool "DWC3 Mode Selection"
> +	default USB_DWC3_HOST if (USB && !USB_GADGET)
> +	default USB_DWC3_GADGET if (!USB && USB_GADGET)

What happens if I select both USB and USB_GADGET ?

>  config USB_DWC3_HOST
>  	bool "Host only mode"
> 


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 2/4] board: ti: am57xx: Fix USB configuration
  2016-05-13 12:17 ` [U-Boot] [PATCH 2/4] board: ti: am57xx: Fix USB configuration Roger Quadros
@ 2016-05-13 12:23   ` Marek Vasut
  2016-05-13 12:36   ` [U-Boot] [PATCH v2 " Roger Quadros
  2016-05-20 22:32   ` [U-Boot] [U-Boot,2/4] " Tom Rini
  2 siblings, 0 replies; 34+ messages in thread
From: Marek Vasut @ 2016-05-13 12:23 UTC (permalink / raw)
  To: u-boot

On 05/13/2016 02:17 PM, Roger Quadros wrote:
> This fixes build.

This commit message needs a fix.

> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  include/configs/am57xx_evm.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
> index 32d7d4d..939057c 100644
> --- a/include/configs/am57xx_evm.h
> +++ b/include/configs/am57xx_evm.h
> @@ -63,6 +63,7 @@
>  #define CONFIG_SUPPORT_EMMC_BOOT
>  
>  /* USB xHCI HOST */
> +#define CONFIG_USB_DWC3
>  #define CONFIG_USB_HOST
>  #define CONFIG_USB_XHCI_DWC3
>  #define CONFIG_USB_XHCI
> @@ -72,6 +73,8 @@
>  
>  #define CONFIG_OMAP_USB_PHY
>  #define CONFIG_OMAP_USB3PHY1_HOST
> +#define CONFIG_USB_DWC3_PHY_OMAP
> +#define CONFIG_USB_DWC3_OMAP
>  
>  /* SATA */
>  #define CONFIG_BOARD_LATE_INIT
> 


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 3/4] usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled
  2016-05-13 12:17 ` [U-Boot] [PATCH 3/4] usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled Roger Quadros
@ 2016-05-13 12:24   ` Marek Vasut
  2016-05-30 17:58   ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 0 replies; 34+ messages in thread
From: Marek Vasut @ 2016-05-13 12:24 UTC (permalink / raw)
  To: u-boot

On 05/13/2016 02:17 PM, Roger Quadros wrote:
> It is pointless to build gadget driver if USB_GADGET is disabled.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>

Acked-by: Marek Vasut <marex@denx.de>

> ---
>  drivers/usb/dwc3/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
> index 0cd7302..2964bae 100644
> --- a/drivers/usb/dwc3/Makefile
> +++ b/drivers/usb/dwc3/Makefile
> @@ -6,7 +6,7 @@ obj-$(CONFIG_USB_DWC3)			+= dwc3.o
>  
>  dwc3-y					:= core.o
>  
> -dwc3-y					+= gadget.o ep0.o
> +obj-$(CONFIG_USB_DWC3_GADGET)		+= gadget.o ep0.o
>  
>  obj-$(CONFIG_USB_DWC3_OMAP)		+= dwc3-omap.o
>  obj-$(CONFIG_USB_DWC3_PHY_OMAP)		+= ti_usb_phy.o
> 


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 4/4] usb: gadget: udc: Build on USB_GADGET
  2016-05-13 12:17 ` [U-Boot] [PATCH 4/4] usb: gadget: udc: Build on USB_GADGET Roger Quadros
@ 2016-05-13 12:24   ` Marek Vasut
  2016-05-13 12:29     ` Roger Quadros
  0 siblings, 1 reply; 34+ messages in thread
From: Marek Vasut @ 2016-05-13 12:24 UTC (permalink / raw)
  To: u-boot

On 05/13/2016 02:17 PM, Roger Quadros wrote:
> udc-core is a generic framework and not specific to dwc3.
> So build it based on USB_GADGET.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/usb/gadget/udc/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/Makefile b/drivers/usb/gadget/udc/Makefile
> index 1699ccd..68766c5 100644
> --- a/drivers/usb/gadget/udc/Makefile
> +++ b/drivers/usb/gadget/udc/Makefile
> @@ -4,4 +4,4 @@
>  # SPDX-License-Identifier:	GPL-2.0+
>  #
>  
> -obj-$(CONFIG_USB_DWC3_GADGET)	+= udc-core.o
> +obj-$(CONFIG_USB_GADGET)	+= udc-core.o
> 
Did you buildman this against all boards ?

-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig
  2016-05-13 12:23   ` Marek Vasut
@ 2016-05-13 12:27     ` Roger Quadros
  2016-05-13 12:43       ` Marek Vasut
  2016-05-17 10:37     ` Masahiro Yamada
  1 sibling, 1 reply; 34+ messages in thread
From: Roger Quadros @ 2016-05-13 12:27 UTC (permalink / raw)
  To: u-boot

On 13/05/16 15:23, Marek Vasut wrote:
> On 05/13/2016 02:17 PM, Roger Quadros wrote:
>> DWC3 can be used in host only or gadget only mode.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  drivers/usb/dwc3/Kconfig | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
>> index e93398f..caf695b 100644
>> --- a/drivers/usb/dwc3/Kconfig
>> +++ b/drivers/usb/dwc3/Kconfig
>> @@ -1,15 +1,16 @@
>>  config USB_DWC3
>>  	bool "DesignWare USB3 DRD Core Support"
>> -	depends on (USB && USB_GADGET)
>> -	select USB_GADGET_DUALSPEED
>> +	depends on (USB || USB_GADGET)
>> +	select USB_GADGET_DUALSPEED if USB_GADGET
>>  	help
>> -	  Say Y here if your system has a Dual Role SuperSpeed
>> -	  USB controller based on the DesignWare USB3 IP Core.
>> +	  Say Y here if your system has DesignWare USB3 IP Core.
>>  
>>  if USB_DWC3
>>  
>>  choice
>>  	bool "DWC3 Mode Selection"
>> +	default USB_DWC3_HOST if (USB && !USB_GADGET)
>> +	default USB_DWC3_GADGET if (!USB && USB_GADGET)
> 
> What happens if I select both USB and USB_GADGET ?

Ideally we want to have dual role operation but that code seems
to have been stripped off from the dwc3/core.c.

So till dual-role is added back it will work in HOST mode by default
but user can still choose GADGET mode.
> 
>>  config USB_DWC3_HOST
>>  	bool "Host only mode"
>>
> 
> 

cheers,
-roger

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

* [U-Boot] [PATCH 4/4] usb: gadget: udc: Build on USB_GADGET
  2016-05-13 12:24   ` Marek Vasut
@ 2016-05-13 12:29     ` Roger Quadros
  2016-05-13 12:47       ` Marek Vasut
  0 siblings, 1 reply; 34+ messages in thread
From: Roger Quadros @ 2016-05-13 12:29 UTC (permalink / raw)
  To: u-boot

On 13/05/16 15:24, Marek Vasut wrote:
> On 05/13/2016 02:17 PM, Roger Quadros wrote:
>> udc-core is a generic framework and not specific to dwc3.
>> So build it based on USB_GADGET.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  drivers/usb/gadget/udc/Makefile | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/gadget/udc/Makefile b/drivers/usb/gadget/udc/Makefile
>> index 1699ccd..68766c5 100644
>> --- a/drivers/usb/gadget/udc/Makefile
>> +++ b/drivers/usb/gadget/udc/Makefile
>> @@ -4,4 +4,4 @@
>>  # SPDX-License-Identifier:	GPL-2.0+
>>  #
>>  
>> -obj-$(CONFIG_USB_DWC3_GADGET)	+= udc-core.o
>> +obj-$(CONFIG_USB_GADGET)	+= udc-core.o
>>
> Did you buildman this against all boards ?
> 
Nope, I've never used it before but I'll give it a shot.

cheers,
-roger

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

* [U-Boot] [PATCH v2 2/4] board: ti: am57xx: Fix USB configuration
  2016-05-13 12:17 ` [U-Boot] [PATCH 2/4] board: ti: am57xx: Fix USB configuration Roger Quadros
  2016-05-13 12:23   ` Marek Vasut
@ 2016-05-13 12:36   ` Roger Quadros
  2016-05-13 12:45     ` Marek Vasut
  2016-05-20 22:32   ` [U-Boot] [U-Boot,2/4] " Tom Rini
  2 siblings, 1 reply; 34+ messages in thread
From: Roger Quadros @ 2016-05-13 12:36 UTC (permalink / raw)
  To: u-boot

Currently CONFIG_USB_DWC3 is not selected so doing a usb start
command results in a serious error [1].

Fix that by enabling CONFIG_USB_DWC3 and other related options
CONFIG_USB_DWC3_PHY_OMAP and CONFIG_USB_DWC3_OMAP.

[1]
=> usb start
starting USB...
USB0:   data abort
pc : [<fff7ed10>]          lr : [<fff7ebbf>]
reloc pc : [<8081dd10>]    lr : [<8081dbbf>]
sp : fef3d260  ip : 00000000     fp : fef3d2a8
r10: fffa4610  r9 : fef50ed0     r8 : 00000000
r7 : fef3d280  r6 : fef3d284     r5 : fffbc380  r4 : 00000000
r3 : 48880000  r2 : 00000000     r1 : 00000000  r0 : fffbc380
Flags: nzcv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 include/configs/am57xx_evm.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
index 32d7d4d..939057c 100644
--- a/include/configs/am57xx_evm.h
+++ b/include/configs/am57xx_evm.h
@@ -63,6 +63,7 @@
 #define CONFIG_SUPPORT_EMMC_BOOT
 
 /* USB xHCI HOST */
+#define CONFIG_USB_DWC3
 #define CONFIG_USB_HOST
 #define CONFIG_USB_XHCI_DWC3
 #define CONFIG_USB_XHCI
@@ -72,6 +73,8 @@
 
 #define CONFIG_OMAP_USB_PHY
 #define CONFIG_OMAP_USB3PHY1_HOST
+#define CONFIG_USB_DWC3_PHY_OMAP
+#define CONFIG_USB_DWC3_OMAP
 
 /* SATA */
 #define CONFIG_BOARD_LATE_INIT
-- 
2.7.4

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

* [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working
  2016-05-13 12:17 [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working Roger Quadros
                   ` (4 preceding siblings ...)
  2016-05-13 12:22 ` [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working Marek Vasut
@ 2016-05-13 12:39 ` Roger Quadros
  2016-05-13 12:47   ` Marek Vasut
  5 siblings, 1 reply; 34+ messages in thread
From: Roger Quadros @ 2016-05-13 12:39 UTC (permalink / raw)
  To: u-boot

On 13/05/16 15:17, Roger Quadros wrote:
> Hi,
> 
> This series fixes dwc3 usb config issues and am57xx-evm USB configuration
> to get USB host ports working properly on am57xx-evm and beagle-x15.

Small update. Super-Speed devices are still not working, but that is a different issue
which seems to have been existed since long ago. I will debug this issue in the coming days.

cheers,
-roger

> 
> Roger Quadros (4):
>   usb: dwc3: fix kconfig
>   board: ti: am57xx: Fix USB configuration
>   usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled
>   usb: gadget: udc: Build on USB_GADGET
> 
>  drivers/usb/dwc3/Kconfig        | 9 +++++----
>  drivers/usb/dwc3/Makefile       | 2 +-
>  drivers/usb/gadget/udc/Makefile | 2 +-
>  include/configs/am57xx_evm.h    | 3 +++
>  4 files changed, 10 insertions(+), 6 deletions(-)
> 

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

* [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig
  2016-05-13 12:27     ` Roger Quadros
@ 2016-05-13 12:43       ` Marek Vasut
  0 siblings, 0 replies; 34+ messages in thread
From: Marek Vasut @ 2016-05-13 12:43 UTC (permalink / raw)
  To: u-boot

On 05/13/2016 02:27 PM, Roger Quadros wrote:
> On 13/05/16 15:23, Marek Vasut wrote:
>> On 05/13/2016 02:17 PM, Roger Quadros wrote:
>>> DWC3 can be used in host only or gadget only mode.
>>>
>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>> ---
>>>  drivers/usb/dwc3/Kconfig | 9 +++++----
>>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
>>> index e93398f..caf695b 100644
>>> --- a/drivers/usb/dwc3/Kconfig
>>> +++ b/drivers/usb/dwc3/Kconfig
>>> @@ -1,15 +1,16 @@
>>>  config USB_DWC3
>>>  	bool "DesignWare USB3 DRD Core Support"
>>> -	depends on (USB && USB_GADGET)
>>> -	select USB_GADGET_DUALSPEED
>>> +	depends on (USB || USB_GADGET)
>>> +	select USB_GADGET_DUALSPEED if USB_GADGET
>>>  	help
>>> -	  Say Y here if your system has a Dual Role SuperSpeed
>>> -	  USB controller based on the DesignWare USB3 IP Core.
>>> +	  Say Y here if your system has DesignWare USB3 IP Core.
>>>  
>>>  if USB_DWC3
>>>  
>>>  choice
>>>  	bool "DWC3 Mode Selection"
>>> +	default USB_DWC3_HOST if (USB && !USB_GADGET)
>>> +	default USB_DWC3_GADGET if (!USB && USB_GADGET)
>>
>> What happens if I select both USB and USB_GADGET ?
> 
> Ideally we want to have dual role operation but that code seems
> to have been stripped off from the dwc3/core.c.
> 
> So till dual-role is added back it will work in HOST mode by default
> but user can still choose GADGET mode.

All right, not great, but let's go with this.
Thanks

-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v2 2/4] board: ti: am57xx: Fix USB configuration
  2016-05-13 12:36   ` [U-Boot] [PATCH v2 " Roger Quadros
@ 2016-05-13 12:45     ` Marek Vasut
  2016-05-16  9:06       ` Roger Quadros
  0 siblings, 1 reply; 34+ messages in thread
From: Marek Vasut @ 2016-05-13 12:45 UTC (permalink / raw)
  To: u-boot

On 05/13/2016 02:36 PM, Roger Quadros wrote:
> Currently CONFIG_USB_DWC3 is not selected so doing a usb start
> command results in a serious error [1].

Why does this error happen ? That is what should be fixed. Selecting
some random options seems like papering over a bug.

> Fix that by enabling CONFIG_USB_DWC3 and other related options
> CONFIG_USB_DWC3_PHY_OMAP and CONFIG_USB_DWC3_OMAP.
> 
> [1]
> => usb start
> starting USB...
> USB0:   data abort
> pc : [<fff7ed10>]          lr : [<fff7ebbf>]
> reloc pc : [<8081dd10>]    lr : [<8081dbbf>]
> sp : fef3d260  ip : 00000000     fp : fef3d2a8
> r10: fffa4610  r9 : fef50ed0     r8 : 00000000
> r7 : fef3d280  r6 : fef3d284     r5 : fffbc380  r4 : 00000000
> r3 : 48880000  r2 : 00000000     r1 : 00000000  r0 : fffbc380
> Flags: nzcv  IRQs off  FIQs off  Mode SVC_32
> Resetting CPU ...
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  include/configs/am57xx_evm.h | 3 +++
>  1 file changed, 3 insertions(+)

Changelog is missing ;-)

> diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
> index 32d7d4d..939057c 100644
> --- a/include/configs/am57xx_evm.h
> +++ b/include/configs/am57xx_evm.h
> @@ -63,6 +63,7 @@
>  #define CONFIG_SUPPORT_EMMC_BOOT
>  
>  /* USB xHCI HOST */
> +#define CONFIG_USB_DWC3
>  #define CONFIG_USB_HOST
>  #define CONFIG_USB_XHCI_DWC3
>  #define CONFIG_USB_XHCI
> @@ -72,6 +73,8 @@
>  
>  #define CONFIG_OMAP_USB_PHY
>  #define CONFIG_OMAP_USB3PHY1_HOST
> +#define CONFIG_USB_DWC3_PHY_OMAP
> +#define CONFIG_USB_DWC3_OMAP
>  
>  /* SATA */
>  #define CONFIG_BOARD_LATE_INIT
> 


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 4/4] usb: gadget: udc: Build on USB_GADGET
  2016-05-13 12:29     ` Roger Quadros
@ 2016-05-13 12:47       ` Marek Vasut
  2016-05-16  9:03         ` Roger Quadros
  0 siblings, 1 reply; 34+ messages in thread
From: Marek Vasut @ 2016-05-13 12:47 UTC (permalink / raw)
  To: u-boot

On 05/13/2016 02:29 PM, Roger Quadros wrote:
> On 13/05/16 15:24, Marek Vasut wrote:
>> On 05/13/2016 02:17 PM, Roger Quadros wrote:
>>> udc-core is a generic framework and not specific to dwc3.
>>> So build it based on USB_GADGET.
>>>
>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>> ---
>>>  drivers/usb/gadget/udc/Makefile | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/usb/gadget/udc/Makefile b/drivers/usb/gadget/udc/Makefile
>>> index 1699ccd..68766c5 100644
>>> --- a/drivers/usb/gadget/udc/Makefile
>>> +++ b/drivers/usb/gadget/udc/Makefile
>>> @@ -4,4 +4,4 @@
>>>  # SPDX-License-Identifier:	GPL-2.0+
>>>  #
>>>  
>>> -obj-$(CONFIG_USB_DWC3_GADGET)	+= udc-core.o
>>> +obj-$(CONFIG_USB_GADGET)	+= udc-core.o
>>>
>> Did you buildman this against all boards ?
>>
> Nope, I've never used it before but I'll give it a shot.
> 
> cheers,
> -roger
> 
I use this script to do my buildmanning:

# U-Boot: Quick build test
bubm()
{(
        branch=`git branch | grep '^*' | sed "s/^..//"`
        dir=/tmp/bm-$1
        arch="arm aarch64 mips powerpc nios2"
        shift 1
        ./tools/buildman/buildman -o ${dir} -b ${branch} --step=0 ${arch} $@
)}

-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working
  2016-05-13 12:39 ` Roger Quadros
@ 2016-05-13 12:47   ` Marek Vasut
  2016-05-18 14:27     ` Roger Quadros
  0 siblings, 1 reply; 34+ messages in thread
From: Marek Vasut @ 2016-05-13 12:47 UTC (permalink / raw)
  To: u-boot

On 05/13/2016 02:39 PM, Roger Quadros wrote:
> On 13/05/16 15:17, Roger Quadros wrote:
>> Hi,
>>
>> This series fixes dwc3 usb config issues and am57xx-evm USB configuration
>> to get USB host ports working properly on am57xx-evm and beagle-x15.
> 
> Small update. Super-Speed devices are still not working, but that is a different issue
> which seems to have been existed since long ago. I will debug this issue in the coming days.

Cool. You have a whole MW for that ;-)

> cheers,
> -roger
> 
>>
>> Roger Quadros (4):
>>   usb: dwc3: fix kconfig
>>   board: ti: am57xx: Fix USB configuration
>>   usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled
>>   usb: gadget: udc: Build on USB_GADGET
>>
>>  drivers/usb/dwc3/Kconfig        | 9 +++++----
>>  drivers/usb/dwc3/Makefile       | 2 +-
>>  drivers/usb/gadget/udc/Makefile | 2 +-
>>  include/configs/am57xx_evm.h    | 3 +++
>>  4 files changed, 10 insertions(+), 6 deletions(-)
>>


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 4/4] usb: gadget: udc: Build on USB_GADGET
  2016-05-13 12:47       ` Marek Vasut
@ 2016-05-16  9:03         ` Roger Quadros
  0 siblings, 0 replies; 34+ messages in thread
From: Roger Quadros @ 2016-05-16  9:03 UTC (permalink / raw)
  To: u-boot

On 13/05/16 15:47, Marek Vasut wrote:
> On 05/13/2016 02:29 PM, Roger Quadros wrote:
>> On 13/05/16 15:24, Marek Vasut wrote:
>>> On 05/13/2016 02:17 PM, Roger Quadros wrote:
>>>> udc-core is a generic framework and not specific to dwc3.
>>>> So build it based on USB_GADGET.
>>>>
>>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>>> ---
>>>>  drivers/usb/gadget/udc/Makefile | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/usb/gadget/udc/Makefile b/drivers/usb/gadget/udc/Makefile
>>>> index 1699ccd..68766c5 100644
>>>> --- a/drivers/usb/gadget/udc/Makefile
>>>> +++ b/drivers/usb/gadget/udc/Makefile
>>>> @@ -4,4 +4,4 @@
>>>>  # SPDX-License-Identifier:	GPL-2.0+
>>>>  #
>>>>  
>>>> -obj-$(CONFIG_USB_DWC3_GADGET)	+= udc-core.o
>>>> +obj-$(CONFIG_USB_GADGET)	+= udc-core.o
>>>>
>>> Did you buildman this against all boards ?
>>>
>> Nope, I've never used it before but I'll give it a shot.
>>
>> cheers,
>> -roger
>>
> I use this script to do my buildmanning:
> 
> # U-Boot: Quick build test
> bubm()
> {(
>         branch=`git branch | grep '^*' | sed "s/^..//"`
>         dir=/tmp/bm-$1
>         arch="arm aarch64 mips powerpc nios2"
>         shift 1
>         ./tools/buildman/buildman -o ${dir} -b ${branch} --step=0 ${arch} $@
> )}
> 
Thanks Marek.

This patch sure breaks all non DWC3 USB platforms. So let's drop this.
I wasn't aware that every other gadget driver is implementing its own
usb core API.

cheers,
-roger

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

* [U-Boot] [PATCH v2 2/4] board: ti: am57xx: Fix USB configuration
  2016-05-13 12:45     ` Marek Vasut
@ 2016-05-16  9:06       ` Roger Quadros
  2016-05-16  9:26         ` Roger Quadros
  0 siblings, 1 reply; 34+ messages in thread
From: Roger Quadros @ 2016-05-16  9:06 UTC (permalink / raw)
  To: u-boot

On 13/05/16 15:45, Marek Vasut wrote:
> On 05/13/2016 02:36 PM, Roger Quadros wrote:
>> Currently CONFIG_USB_DWC3 is not selected so doing a usb start
>> command results in a serious error [1].
> 
> Why does this error happen ? That is what should be fixed. Selecting
> some random options seems like papering over a bug.

Agreed. I was lazy :P.

cheers,
-roger

> 
>> Fix that by enabling CONFIG_USB_DWC3 and other related options
>> CONFIG_USB_DWC3_PHY_OMAP and CONFIG_USB_DWC3_OMAP.
>>
>> [1]
>> => usb start
>> starting USB...
>> USB0:   data abort
>> pc : [<fff7ed10>]          lr : [<fff7ebbf>]
>> reloc pc : [<8081dd10>]    lr : [<8081dbbf>]
>> sp : fef3d260  ip : 00000000     fp : fef3d2a8
>> r10: fffa4610  r9 : fef50ed0     r8 : 00000000
>> r7 : fef3d280  r6 : fef3d284     r5 : fffbc380  r4 : 00000000
>> r3 : 48880000  r2 : 00000000     r1 : 00000000  r0 : fffbc380
>> Flags: nzcv  IRQs off  FIQs off  Mode SVC_32
>> Resetting CPU ...
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  include/configs/am57xx_evm.h | 3 +++
>>  1 file changed, 3 insertions(+)
> 
> Changelog is missing ;-)
> 
>> diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
>> index 32d7d4d..939057c 100644
>> --- a/include/configs/am57xx_evm.h
>> +++ b/include/configs/am57xx_evm.h
>> @@ -63,6 +63,7 @@
>>  #define CONFIG_SUPPORT_EMMC_BOOT
>>  
>>  /* USB xHCI HOST */
>> +#define CONFIG_USB_DWC3
>>  #define CONFIG_USB_HOST
>>  #define CONFIG_USB_XHCI_DWC3
>>  #define CONFIG_USB_XHCI
>> @@ -72,6 +73,8 @@
>>  
>>  #define CONFIG_OMAP_USB_PHY
>>  #define CONFIG_OMAP_USB3PHY1_HOST
>> +#define CONFIG_USB_DWC3_PHY_OMAP
>> +#define CONFIG_USB_DWC3_OMAP
>>  
>>  /* SATA */
>>  #define CONFIG_BOARD_LATE_INIT
>>
> 
> 

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

* [U-Boot] [PATCH v2 2/4] board: ti: am57xx: Fix USB configuration
  2016-05-16  9:06       ` Roger Quadros
@ 2016-05-16  9:26         ` Roger Quadros
  2016-05-16  9:49           ` Roger Quadros
  0 siblings, 1 reply; 34+ messages in thread
From: Roger Quadros @ 2016-05-16  9:26 UTC (permalink / raw)
  To: u-boot

On 16/05/16 12:06, Roger Quadros wrote:
> On 13/05/16 15:45, Marek Vasut wrote:
>> On 05/13/2016 02:36 PM, Roger Quadros wrote:
>>> Currently CONFIG_USB_DWC3 is not selected so doing a usb start
>>> command results in a serious error [1].
>>
>> Why does this error happen ? That is what should be fixed. Selecting
>> some random options seems like papering over a bug.
> 
> Agreed. I was lazy :P.

OK. The issue is like this.

CONFIG_CMD_USB and CONFIG_USB_XHCI is defined, so usb_init() calls
usb_lowlevel_init() in xhci.c which calls xhci_hcd_init in xhci-omap.c which calls
board_usb_init().

But board_usb_init() in am57xx/board.c is defined only if CONFIG_USB_DWC3 is defined
and that is missing in am57xx_evm.h leading to the serious error. We're trying to
access the IP without turning on the necessary clocks.

So it looks like we need to define it based on CONFIG_USB_XHCI_OMAP or something else.

But then again looking into the future, what if we want only gadget operation?
That would not define XHCI, but we still need board_usb_init(). So board_usb_init()
should be defined based on CONFIG_CMD_USB=y?

What do you suggest?

cheers,
-roger

> 
> cheers,
> -roger
> 
>>
>>> Fix that by enabling CONFIG_USB_DWC3 and other related options
>>> CONFIG_USB_DWC3_PHY_OMAP and CONFIG_USB_DWC3_OMAP.
>>>
>>> [1]
>>> => usb start
>>> starting USB...
>>> USB0:   data abort
>>> pc : [<fff7ed10>]          lr : [<fff7ebbf>]
>>> reloc pc : [<8081dd10>]    lr : [<8081dbbf>]
>>> sp : fef3d260  ip : 00000000     fp : fef3d2a8
>>> r10: fffa4610  r9 : fef50ed0     r8 : 00000000
>>> r7 : fef3d280  r6 : fef3d284     r5 : fffbc380  r4 : 00000000
>>> r3 : 48880000  r2 : 00000000     r1 : 00000000  r0 : fffbc380
>>> Flags: nzcv  IRQs off  FIQs off  Mode SVC_32
>>> Resetting CPU ...
>>>
>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>> ---
>>>  include/configs/am57xx_evm.h | 3 +++
>>>  1 file changed, 3 insertions(+)
>>
>> Changelog is missing ;-)
>>
>>> diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
>>> index 32d7d4d..939057c 100644
>>> --- a/include/configs/am57xx_evm.h
>>> +++ b/include/configs/am57xx_evm.h
>>> @@ -63,6 +63,7 @@
>>>  #define CONFIG_SUPPORT_EMMC_BOOT
>>>  
>>>  /* USB xHCI HOST */
>>> +#define CONFIG_USB_DWC3
>>>  #define CONFIG_USB_HOST
>>>  #define CONFIG_USB_XHCI_DWC3
>>>  #define CONFIG_USB_XHCI
>>> @@ -72,6 +73,8 @@
>>>  
>>>  #define CONFIG_OMAP_USB_PHY
>>>  #define CONFIG_OMAP_USB3PHY1_HOST
>>> +#define CONFIG_USB_DWC3_PHY_OMAP
>>> +#define CONFIG_USB_DWC3_OMAP
>>>  
>>>  /* SATA */
>>>  #define CONFIG_BOARD_LATE_INIT
>>>
>>
>>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 

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

* [U-Boot] [PATCH v2 2/4] board: ti: am57xx: Fix USB configuration
  2016-05-16  9:26         ` Roger Quadros
@ 2016-05-16  9:49           ` Roger Quadros
  2016-05-16 10:03             ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 34+ messages in thread
From: Roger Quadros @ 2016-05-16  9:49 UTC (permalink / raw)
  To: u-boot

On 16/05/16 12:26, Roger Quadros wrote:
> On 16/05/16 12:06, Roger Quadros wrote:
>> On 13/05/16 15:45, Marek Vasut wrote:
>>> On 05/13/2016 02:36 PM, Roger Quadros wrote:
>>>> Currently CONFIG_USB_DWC3 is not selected so doing a usb start
>>>> command results in a serious error [1].
>>>
>>> Why does this error happen ? That is what should be fixed. Selecting
>>> some random options seems like papering over a bug.
>>
>> Agreed. I was lazy :P.
> 
> OK. The issue is like this.
> 
> CONFIG_CMD_USB and CONFIG_USB_XHCI is defined, so usb_init() calls
> usb_lowlevel_init() in xhci.c which calls xhci_hcd_init in xhci-omap.c which calls
> board_usb_init().
> 
> But board_usb_init() in am57xx/board.c is defined only if CONFIG_USB_DWC3 is defined
> and that is missing in am57xx_evm.h leading to the serious error. We're trying to
> access the IP without turning on the necessary clocks.
> 
> So it looks like we need to define it based on CONFIG_USB_XHCI_OMAP or something else.
> 
> But then again looking into the future, what if we want only gadget operation?
> That would not define XHCI, but we still need board_usb_init(). So board_usb_init()
> should be defined based on CONFIG_CMD_USB=y?
> 
> What do you suggest?

But board_usb_init() calls 

                ti_usb_phy_uboot_init(&usb_phy1_device);
                dwc3_omap_uboot_init(&usb_otg_ss1_glue);
                dwc3_uboot_init(&usb_otg_ss1);

which depend on CONFIG_USB_DWC3_PHY_OMAP, CONFIG_USB_DWC3_OMAP and CONFIG_USB_DWC3
respectively.

So I really don't know how to fix all this.


--
cheers,
-roger

>>
>>>
>>>> Fix that by enabling CONFIG_USB_DWC3 and other related options
>>>> CONFIG_USB_DWC3_PHY_OMAP and CONFIG_USB_DWC3_OMAP.
>>>>
>>>> [1]
>>>> => usb start
>>>> starting USB...
>>>> USB0:   data abort
>>>> pc : [<fff7ed10>]          lr : [<fff7ebbf>]
>>>> reloc pc : [<8081dd10>]    lr : [<8081dbbf>]
>>>> sp : fef3d260  ip : 00000000     fp : fef3d2a8
>>>> r10: fffa4610  r9 : fef50ed0     r8 : 00000000
>>>> r7 : fef3d280  r6 : fef3d284     r5 : fffbc380  r4 : 00000000
>>>> r3 : 48880000  r2 : 00000000     r1 : 00000000  r0 : fffbc380
>>>> Flags: nzcv  IRQs off  FIQs off  Mode SVC_32
>>>> Resetting CPU ...
>>>>
>>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>>> ---
>>>>  include/configs/am57xx_evm.h | 3 +++
>>>>  1 file changed, 3 insertions(+)
>>>
>>> Changelog is missing ;-)
>>>
>>>> diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
>>>> index 32d7d4d..939057c 100644
>>>> --- a/include/configs/am57xx_evm.h
>>>> +++ b/include/configs/am57xx_evm.h
>>>> @@ -63,6 +63,7 @@
>>>>  #define CONFIG_SUPPORT_EMMC_BOOT
>>>>  
>>>>  /* USB xHCI HOST */
>>>> +#define CONFIG_USB_DWC3
>>>>  #define CONFIG_USB_HOST
>>>>  #define CONFIG_USB_XHCI_DWC3
>>>>  #define CONFIG_USB_XHCI
>>>> @@ -72,6 +73,8 @@
>>>>  
>>>>  #define CONFIG_OMAP_USB_PHY
>>>>  #define CONFIG_OMAP_USB3PHY1_HOST
>>>> +#define CONFIG_USB_DWC3_PHY_OMAP
>>>> +#define CONFIG_USB_DWC3_OMAP
>>>>  
>>>>  /* SATA */
>>>>  #define CONFIG_BOARD_LATE_INIT
>>>>
>>>
>>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 

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

* [U-Boot] [PATCH v2 2/4] board: ti: am57xx: Fix USB configuration
  2016-05-16  9:49           ` Roger Quadros
@ 2016-05-16 10:03             ` Kishon Vijay Abraham I
  2016-05-16 10:31               ` Roger Quadros
  0 siblings, 1 reply; 34+ messages in thread
From: Kishon Vijay Abraham I @ 2016-05-16 10:03 UTC (permalink / raw)
  To: u-boot

Hi Roger,

On Monday 16 May 2016 03:19 PM, Roger Quadros wrote:
> On 16/05/16 12:26, Roger Quadros wrote:
>> On 16/05/16 12:06, Roger Quadros wrote:
>>> On 13/05/16 15:45, Marek Vasut wrote:
>>>> On 05/13/2016 02:36 PM, Roger Quadros wrote:
>>>>> Currently CONFIG_USB_DWC3 is not selected so doing a usb start
>>>>> command results in a serious error [1].
>>>>
>>>> Why does this error happen ? That is what should be fixed. Selecting
>>>> some random options seems like papering over a bug.
>>>
>>> Agreed. I was lazy :P.
>>
>> OK. The issue is like this.
>>
>> CONFIG_CMD_USB and CONFIG_USB_XHCI is defined, so usb_init() calls
>> usb_lowlevel_init() in xhci.c which calls xhci_hcd_init in xhci-omap.c which calls
>> board_usb_init().

IIRC, board_usb_init for xhci (omap) is mostly a NOP.
>>
>> But board_usb_init() in am57xx/board.c is defined only if CONFIG_USB_DWC3 is defined
>> and that is missing in am57xx_evm.h leading to the serious error. We're trying to
>> access the IP without turning on the necessary clocks.

clocks are not turned on in board_usb_init() right? The board_usb_init() in
am57xx/board.c is used only for gadget mode.
>>
>> So it looks like we need to define it based on CONFIG_USB_XHCI_OMAP or something else.

right, but before that we might have to cleanup xhci-omap.
>>
>> But then again looking into the future, what if we want only gadget operation?
>> That would not define XHCI, but we still need board_usb_init(). So board_usb_init()
>> should be defined based on CONFIG_CMD_USB=y?
>>
>> What do you suggest?
> 
> But board_usb_init() calls 
> 
>                 ti_usb_phy_uboot_init(&usb_phy1_device);
>                 dwc3_omap_uboot_init(&usb_otg_ss1_glue);
>                 dwc3_uboot_init(&usb_otg_ss1);
> 
> which depend on CONFIG_USB_DWC3_PHY_OMAP, CONFIG_USB_DWC3_OMAP and CONFIG_USB_DWC3
> respectively.

IMO we should cleanup xhci-omap so that all the initializations are done using
ti_usb_phy_uboot_init, dwc3_omap_uboot_init and dwc3_uboot_init. Then modify
dwc3_uboot_init to initialize host or device based on CONFIG_*.

Thanks
Kishon

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

* [U-Boot] [PATCH v2 2/4] board: ti: am57xx: Fix USB configuration
  2016-05-16 10:03             ` Kishon Vijay Abraham I
@ 2016-05-16 10:31               ` Roger Quadros
  2016-05-16 11:10                 ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 34+ messages in thread
From: Roger Quadros @ 2016-05-16 10:31 UTC (permalink / raw)
  To: u-boot

On 16/05/16 13:03, Kishon Vijay Abraham I wrote:
> Hi Roger,
> 
> On Monday 16 May 2016 03:19 PM, Roger Quadros wrote:
>> On 16/05/16 12:26, Roger Quadros wrote:
>>> On 16/05/16 12:06, Roger Quadros wrote:
>>>> On 13/05/16 15:45, Marek Vasut wrote:
>>>>> On 05/13/2016 02:36 PM, Roger Quadros wrote:
>>>>>> Currently CONFIG_USB_DWC3 is not selected so doing a usb start
>>>>>> command results in a serious error [1].
>>>>>
>>>>> Why does this error happen ? That is what should be fixed. Selecting
>>>>> some random options seems like papering over a bug.
>>>>
>>>> Agreed. I was lazy :P.
>>>
>>> OK. The issue is like this.
>>>
>>> CONFIG_CMD_USB and CONFIG_USB_XHCI is defined, so usb_init() calls
>>> usb_lowlevel_init() in xhci.c which calls xhci_hcd_init in xhci-omap.c which calls
>>> board_usb_init().
> 
> IIRC, board_usb_init for xhci (omap) is mostly a NOP.

Then who will call board_usb_init() for host case?

>>>
>>> But board_usb_init() in am57xx/board.c is defined only if CONFIG_USB_DWC3 is defined
>>> and that is missing in am57xx_evm.h leading to the serious error. We're trying to
>>> access the IP without turning on the necessary clocks.
> 
> clocks are not turned on in board_usb_init() right? The board_usb_init() in
> am57xx/board.c is used only for gadget mode.
>>>
>>> So it looks like we need to define it based on CONFIG_USB_XHCI_OMAP or something else.
> 
> right, but before that we might have to cleanup xhci-omap.
>>>
>>> But then again looking into the future, what if we want only gadget operation?
>>> That would not define XHCI, but we still need board_usb_init(). So board_usb_init()
>>> should be defined based on CONFIG_CMD_USB=y?
>>>
>>> What do you suggest?
>>
>> But board_usb_init() calls 
>>
>>                 ti_usb_phy_uboot_init(&usb_phy1_device);
>>                 dwc3_omap_uboot_init(&usb_otg_ss1_glue);
>>                 dwc3_uboot_init(&usb_otg_ss1);
>>
>> which depend on CONFIG_USB_DWC3_PHY_OMAP, CONFIG_USB_DWC3_OMAP and CONFIG_USB_DWC3
>> respectively.
> 
> IMO we should cleanup xhci-omap so that all the initializations are done using
> ti_usb_phy_uboot_init, dwc3_omap_uboot_init and dwc3_uboot_init. Then modify
> dwc3_uboot_init to initialize host or device based on CONFIG_*.
> 

I'm still trying to get a grip of how USB works in u-boot.
Is CONFIG_CMD_USB only meant for host mode or gadget mode as well?
Is dual-role even required in u-boot? probably it is not a good idea and we just
ignore it for simplicity.

What determines whether a USB port is meant for Host or device operation? Is it
the CONFIG_ or caller of board_usb_init()?
I see board_usb_init() being used by gadget drivers, host drivers, dfu.c, etc.

cheers,
-roger

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

* [U-Boot] [PATCH v2 2/4] board: ti: am57xx: Fix USB configuration
  2016-05-16 10:31               ` Roger Quadros
@ 2016-05-16 11:10                 ` Kishon Vijay Abraham I
  2016-05-16 13:51                   ` Roger Quadros
  0 siblings, 1 reply; 34+ messages in thread
From: Kishon Vijay Abraham I @ 2016-05-16 11:10 UTC (permalink / raw)
  To: u-boot

Hi Roger,

On Monday 16 May 2016 04:01 PM, Roger Quadros wrote:
> On 16/05/16 13:03, Kishon Vijay Abraham I wrote:
>> Hi Roger,
>>
>> On Monday 16 May 2016 03:19 PM, Roger Quadros wrote:
>>> On 16/05/16 12:26, Roger Quadros wrote:
>>>> On 16/05/16 12:06, Roger Quadros wrote:
>>>>> On 13/05/16 15:45, Marek Vasut wrote:
>>>>>> On 05/13/2016 02:36 PM, Roger Quadros wrote:
>>>>>>> Currently CONFIG_USB_DWC3 is not selected so doing a usb start
>>>>>>> command results in a serious error [1].
>>>>>>
>>>>>> Why does this error happen ? That is what should be fixed. Selecting
>>>>>> some random options seems like papering over a bug.
>>>>>
>>>>> Agreed. I was lazy :P.
>>>>
>>>> OK. The issue is like this.
>>>>
>>>> CONFIG_CMD_USB and CONFIG_USB_XHCI is defined, so usb_init() calls
>>>> usb_lowlevel_init() in xhci.c which calls xhci_hcd_init in xhci-omap.c which calls
>>>> board_usb_init().
>>
>> IIRC, board_usb_init for xhci (omap) is mostly a NOP.
> 
> Then who will call board_usb_init() for host case?
> 
>>>>
>>>> But board_usb_init() in am57xx/board.c is defined only if CONFIG_USB_DWC3 is defined
>>>> and that is missing in am57xx_evm.h leading to the serious error. We're trying to
>>>> access the IP without turning on the necessary clocks.
>>
>> clocks are not turned on in board_usb_init() right? The board_usb_init() in
>> am57xx/board.c is used only for gadget mode.
>>>>
>>>> So it looks like we need to define it based on CONFIG_USB_XHCI_OMAP or something else.
>>
>> right, but before that we might have to cleanup xhci-omap.
>>>>
>>>> But then again looking into the future, what if we want only gadget operation?
>>>> That would not define XHCI, but we still need board_usb_init(). So board_usb_init()
>>>> should be defined based on CONFIG_CMD_USB=y?
>>>>
>>>> What do you suggest?
>>>
>>> But board_usb_init() calls 
>>>
>>>                 ti_usb_phy_uboot_init(&usb_phy1_device);
>>>                 dwc3_omap_uboot_init(&usb_otg_ss1_glue);
>>>                 dwc3_uboot_init(&usb_otg_ss1);
>>>
>>> which depend on CONFIG_USB_DWC3_PHY_OMAP, CONFIG_USB_DWC3_OMAP and CONFIG_USB_DWC3
>>> respectively.
>>
>> IMO we should cleanup xhci-omap so that all the initializations are done using
>> ti_usb_phy_uboot_init, dwc3_omap_uboot_init and dwc3_uboot_init. Then modify
>> dwc3_uboot_init to initialize host or device based on CONFIG_*.
>>
> 
> I'm still trying to get a grip of how USB works in u-boot.
> Is CONFIG_CMD_USB only meant for host mode or gadget mode as well?

IIRC it is only for host. Commands like usb start, usb stop are used to start
and stop host.
> Is dual-role even required in u-boot? probably it is not a good idea and we just
> ignore it for simplicity.

yeah.
> 
> What determines whether a USB port is meant for Host or device operation? Is it
> the CONFIG_ or caller of board_usb_init()?
It should be the caller of board_usb_init(). The same port can be used as
device or host based on command used (the command determines the caller of
board_usb_init).

Thanks
Kishon

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

* [U-Boot] [PATCH v2 2/4] board: ti: am57xx: Fix USB configuration
  2016-05-16 11:10                 ` Kishon Vijay Abraham I
@ 2016-05-16 13:51                   ` Roger Quadros
  0 siblings, 0 replies; 34+ messages in thread
From: Roger Quadros @ 2016-05-16 13:51 UTC (permalink / raw)
  To: u-boot

On 16/05/16 14:10, Kishon Vijay Abraham I wrote:
> Hi Roger,
> 
> On Monday 16 May 2016 04:01 PM, Roger Quadros wrote:
>> On 16/05/16 13:03, Kishon Vijay Abraham I wrote:
>>> Hi Roger,
>>>
>>> On Monday 16 May 2016 03:19 PM, Roger Quadros wrote:
>>>> On 16/05/16 12:26, Roger Quadros wrote:
>>>>> On 16/05/16 12:06, Roger Quadros wrote:
>>>>>> On 13/05/16 15:45, Marek Vasut wrote:
>>>>>>> On 05/13/2016 02:36 PM, Roger Quadros wrote:
>>>>>>>> Currently CONFIG_USB_DWC3 is not selected so doing a usb start
>>>>>>>> command results in a serious error [1].
>>>>>>>
>>>>>>> Why does this error happen ? That is what should be fixed. Selecting
>>>>>>> some random options seems like papering over a bug.
>>>>>>
>>>>>> Agreed. I was lazy :P.
>>>>>
>>>>> OK. The issue is like this.
>>>>>
>>>>> CONFIG_CMD_USB and CONFIG_USB_XHCI is defined, so usb_init() calls
>>>>> usb_lowlevel_init() in xhci.c which calls xhci_hcd_init in xhci-omap.c which calls
>>>>> board_usb_init().
>>>
>>> IIRC, board_usb_init for xhci (omap) is mostly a NOP.
>>
>> Then who will call board_usb_init() for host case?
>>
>>>>>
>>>>> But board_usb_init() in am57xx/board.c is defined only if CONFIG_USB_DWC3 is defined
>>>>> and that is missing in am57xx_evm.h leading to the serious error. We're trying to
>>>>> access the IP without turning on the necessary clocks.
>>>
>>> clocks are not turned on in board_usb_init() right? The board_usb_init() in
>>> am57xx/board.c is used only for gadget mode.
>>>>>
>>>>> So it looks like we need to define it based on CONFIG_USB_XHCI_OMAP or something else.
>>>
>>> right, but before that we might have to cleanup xhci-omap.
>>>>>
>>>>> But then again looking into the future, what if we want only gadget operation?
>>>>> That would not define XHCI, but we still need board_usb_init(). So board_usb_init()
>>>>> should be defined based on CONFIG_CMD_USB=y?
>>>>>
>>>>> What do you suggest?
>>>>
>>>> But board_usb_init() calls 
>>>>
>>>>                 ti_usb_phy_uboot_init(&usb_phy1_device);
>>>>                 dwc3_omap_uboot_init(&usb_otg_ss1_glue);
>>>>                 dwc3_uboot_init(&usb_otg_ss1);
>>>>
>>>> which depend on CONFIG_USB_DWC3_PHY_OMAP, CONFIG_USB_DWC3_OMAP and CONFIG_USB_DWC3
>>>> respectively.
>>>
>>> IMO we should cleanup xhci-omap so that all the initializations are done using
>>> ti_usb_phy_uboot_init, dwc3_omap_uboot_init and dwc3_uboot_init. Then modify
>>> dwc3_uboot_init to initialize host or device based on CONFIG_*.
>>>
>>
>> I'm still trying to get a grip of how USB works in u-boot.
>> Is CONFIG_CMD_USB only meant for host mode or gadget mode as well?
> 
> IIRC it is only for host. Commands like usb start, usb stop are used to start
> and stop host.
>> Is dual-role even required in u-boot? probably it is not a good idea and we just
>> ignore it for simplicity.
> 
> yeah.
>>
>> What determines whether a USB port is meant for Host or device operation? Is it
>> the CONFIG_ or caller of board_usb_init()?
> It should be the caller of board_usb_init(). The same port can be used as
> device or host based on command used (the command determines the caller of
> board_usb_init).

Then it is upto board_usb_init() to complain if it is called for some mode
and the respective drivers are not enabled.

board_usb_init() must be defined in the board if CONFIG_CMD_USB || USB_GADGET

But there is no single config option for USB_GADGET. people seem to be calling
board_usb_init() from all over the place without any dependency on USB_GADGET.
e.g. dfu.c, ether.c, fastboot.c, thordown.c, usb_mass_storage.c, ether.c

So things will break with various configurations.
So probably for now board_usb_init() has to be always defined.

cheers,
-roger

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

* [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig
  2016-05-13 12:17 ` [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig Roger Quadros
  2016-05-13 12:23   ` Marek Vasut
@ 2016-05-17 10:33   ` Masahiro Yamada
  2016-05-18 12:47     ` Roger Quadros
  2016-05-19 14:15   ` [U-Boot] [PATCH v2 " Roger Quadros
  2 siblings, 1 reply; 34+ messages in thread
From: Masahiro Yamada @ 2016-05-17 10:33 UTC (permalink / raw)
  To: u-boot

Hi.


2016-05-13 21:17 GMT+09:00 Roger Quadros <rogerq@ti.com>:
> DWC3 can be used in host only or gadget only mode.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  drivers/usb/dwc3/Kconfig | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
> index e93398f..caf695b 100644
> --- a/drivers/usb/dwc3/Kconfig
> +++ b/drivers/usb/dwc3/Kconfig
> @@ -1,15 +1,16 @@
>  config USB_DWC3
>         bool "DesignWare USB3 DRD Core Support"
> -       depends on (USB && USB_GADGET)
> -       select USB_GADGET_DUALSPEED
> +       depends on (USB || USB_GADGET)
> +       select USB_GADGET_DUALSPEED if USB_GADGET
>         help
> -         Say Y here if your system has a Dual Role SuperSpeed
> -         USB controller based on the DesignWare USB3 IP Core.
> +         Say Y here if your system has DesignWare USB3 IP Core.
>
>  if USB_DWC3
>
>  choice
>         bool "DWC3 Mode Selection"
> +       default USB_DWC3_HOST if (USB && !USB_GADGET)
> +       default USB_DWC3_GADGET if (!USB && USB_GADGET)
>
>  config USB_DWC3_HOST
>         bool "Host only mode"
> --
> 2.7.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


Please note the following commit changed
the meaning of CONFIG_USB.


commit 68f7c5db2d1e714c15b49b0759ddef8f8344f184
Author:     Paul Kocialkowski <contact@paulk.fr>
AuthorDate: Tue Aug 4 17:04:05 2015 +0200
Commit:     Marek Vasut <marex@denx.de>
CommitDate: Wed Aug 5 17:20:34 2015 +0200

    usb: Generic USB Kconfig option, that fits both host and gadget and comments

    There is no particular reason why the USB Kconfig option should be specific
    host mode. In prevision of adding MUSB host and gadget to Kconfig, this move
    the title and help message of the USB Kconfig option to a more generic forma

    Adding comments to the usb Kconfig allows for a better separation and more
    readability in generated configs and in menuconfig.

    Signed-off-by: Paul Kocialkowski <contact@paulk.fr>



In Linux, CONFIG_USB enables the host mode of USB.
So, "depends on (USB || USB_GADGET)" makes sense.


In U-Boot, since the commit above, CONFIG_USB enables
the whole of USB frame-work, including host, gadget.

USB_DWC3 already resides inside of if USB ... endif
so, depends on (USB || USB_GADGET) does not make sense.



-- 
Best Regards
Masahiro Yamada

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

* [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig
  2016-05-13 12:23   ` Marek Vasut
  2016-05-13 12:27     ` Roger Quadros
@ 2016-05-17 10:37     ` Masahiro Yamada
  1 sibling, 0 replies; 34+ messages in thread
From: Masahiro Yamada @ 2016-05-17 10:37 UTC (permalink / raw)
  To: u-boot

2016-05-13 21:23 GMT+09:00 Marek Vasut <marex@denx.de>:
> On 05/13/2016 02:17 PM, Roger Quadros wrote:
>> DWC3 can be used in host only or gadget only mode.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  drivers/usb/dwc3/Kconfig | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
>> index e93398f..caf695b 100644
>> --- a/drivers/usb/dwc3/Kconfig
>> +++ b/drivers/usb/dwc3/Kconfig
>> @@ -1,15 +1,16 @@
>>  config USB_DWC3
>>       bool "DesignWare USB3 DRD Core Support"
>> -     depends on (USB && USB_GADGET)
>> -     select USB_GADGET_DUALSPEED
>> +     depends on (USB || USB_GADGET)
>> +     select USB_GADGET_DUALSPEED if USB_GADGET
>>       help
>> -       Say Y here if your system has a Dual Role SuperSpeed
>> -       USB controller based on the DesignWare USB3 IP Core.
>> +       Say Y here if your system has DesignWare USB3 IP Core.
>>
>>  if USB_DWC3
>>
>>  choice
>>       bool "DWC3 Mode Selection"
>> +     default USB_DWC3_HOST if (USB && !USB_GADGET)
>> +     default USB_DWC3_GADGET if (!USB && USB_GADGET)
>
> What happens if I select both USB and USB_GADGET ?
>

Unlike Linux, CONFIG_USB_GADGET depends on CONFIG_USB in U-Boot.

So, (!USB && USB_GADGET) never happens.


-- 
Best Regards
Masahiro Yamada

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

* [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig
  2016-05-17 10:33   ` Masahiro Yamada
@ 2016-05-18 12:47     ` Roger Quadros
  2016-05-18 12:52       ` Marek Vasut
  0 siblings, 1 reply; 34+ messages in thread
From: Roger Quadros @ 2016-05-18 12:47 UTC (permalink / raw)
  To: u-boot

On 17/05/16 13:33, Masahiro Yamada wrote:
> Hi.
> 
> 
> 2016-05-13 21:17 GMT+09:00 Roger Quadros <rogerq@ti.com>:
>> DWC3 can be used in host only or gadget only mode.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  drivers/usb/dwc3/Kconfig | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
>> index e93398f..caf695b 100644
>> --- a/drivers/usb/dwc3/Kconfig
>> +++ b/drivers/usb/dwc3/Kconfig
>> @@ -1,15 +1,16 @@
>>  config USB_DWC3
>>         bool "DesignWare USB3 DRD Core Support"
>> -       depends on (USB && USB_GADGET)
>> -       select USB_GADGET_DUALSPEED
>> +       depends on (USB || USB_GADGET)
>> +       select USB_GADGET_DUALSPEED if USB_GADGET
>>         help
>> -         Say Y here if your system has a Dual Role SuperSpeed
>> -         USB controller based on the DesignWare USB3 IP Core.
>> +         Say Y here if your system has DesignWare USB3 IP Core.
>>
>>  if USB_DWC3
>>
>>  choice
>>         bool "DWC3 Mode Selection"
>> +       default USB_DWC3_HOST if (USB && !USB_GADGET)
>> +       default USB_DWC3_GADGET if (!USB && USB_GADGET)
>>
>>  config USB_DWC3_HOST
>>         bool "Host only mode"
>> --
>> 2.7.4
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
> 
> 
> Please note the following commit changed
> the meaning of CONFIG_USB.
> 
> 
> commit 68f7c5db2d1e714c15b49b0759ddef8f8344f184
> Author:     Paul Kocialkowski <contact@paulk.fr>
> AuthorDate: Tue Aug 4 17:04:05 2015 +0200
> Commit:     Marek Vasut <marex@denx.de>
> CommitDate: Wed Aug 5 17:20:34 2015 +0200
> 
>     usb: Generic USB Kconfig option, that fits both host and gadget and comments
> 
>     There is no particular reason why the USB Kconfig option should be specific
>     host mode. In prevision of adding MUSB host and gadget to Kconfig, this move
>     the title and help message of the USB Kconfig option to a more generic forma
> 
>     Adding comments to the usb Kconfig allows for a better separation and more
>     readability in generated configs and in menuconfig.
> 
>     Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> 
> 
> 
> In Linux, CONFIG_USB enables the host mode of USB.
> So, "depends on (USB || USB_GADGET)" makes sense.
> 
> 
> In U-Boot, since the commit above, CONFIG_USB enables
> the whole of USB frame-work, including host, gadget.
> 
> USB_DWC3 already resides inside of if USB ... endif
> so, depends on (USB || USB_GADGET) does not make sense.
> 
> 
> 
OK, thanks for pointing this out.

But USB doesn't mean Host is active and USB_GADGET means gadget
framework is available.

So I think we have incomplete information for deciding about Host role
based on just Kconfig.

cheers,
-roger

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

* [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig
  2016-05-18 12:47     ` Roger Quadros
@ 2016-05-18 12:52       ` Marek Vasut
  0 siblings, 0 replies; 34+ messages in thread
From: Marek Vasut @ 2016-05-18 12:52 UTC (permalink / raw)
  To: u-boot

On 05/18/2016 02:47 PM, Roger Quadros wrote:
> On 17/05/16 13:33, Masahiro Yamada wrote:
>> Hi.
>>
>>
>> 2016-05-13 21:17 GMT+09:00 Roger Quadros <rogerq@ti.com>:
>>> DWC3 can be used in host only or gadget only mode.
>>>
>>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>>> ---
>>>  drivers/usb/dwc3/Kconfig | 9 +++++----
>>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
>>> index e93398f..caf695b 100644
>>> --- a/drivers/usb/dwc3/Kconfig
>>> +++ b/drivers/usb/dwc3/Kconfig
>>> @@ -1,15 +1,16 @@
>>>  config USB_DWC3
>>>         bool "DesignWare USB3 DRD Core Support"
>>> -       depends on (USB && USB_GADGET)
>>> -       select USB_GADGET_DUALSPEED
>>> +       depends on (USB || USB_GADGET)
>>> +       select USB_GADGET_DUALSPEED if USB_GADGET
>>>         help
>>> -         Say Y here if your system has a Dual Role SuperSpeed
>>> -         USB controller based on the DesignWare USB3 IP Core.
>>> +         Say Y here if your system has DesignWare USB3 IP Core.
>>>
>>>  if USB_DWC3
>>>
>>>  choice
>>>         bool "DWC3 Mode Selection"
>>> +       default USB_DWC3_HOST if (USB && !USB_GADGET)
>>> +       default USB_DWC3_GADGET if (!USB && USB_GADGET)
>>>
>>>  config USB_DWC3_HOST
>>>         bool "Host only mode"
>>> --
>>> 2.7.4
>>>
>>> _______________________________________________
>>> U-Boot mailing list
>>> U-Boot at lists.denx.de
>>> http://lists.denx.de/mailman/listinfo/u-boot
>>
>>
>> Please note the following commit changed
>> the meaning of CONFIG_USB.
>>
>>
>> commit 68f7c5db2d1e714c15b49b0759ddef8f8344f184
>> Author:     Paul Kocialkowski <contact@paulk.fr>
>> AuthorDate: Tue Aug 4 17:04:05 2015 +0200
>> Commit:     Marek Vasut <marex@denx.de>
>> CommitDate: Wed Aug 5 17:20:34 2015 +0200
>>
>>     usb: Generic USB Kconfig option, that fits both host and gadget and comments
>>
>>     There is no particular reason why the USB Kconfig option should be specific
>>     host mode. In prevision of adding MUSB host and gadget to Kconfig, this move
>>     the title and help message of the USB Kconfig option to a more generic forma
>>
>>     Adding comments to the usb Kconfig allows for a better separation and more
>>     readability in generated configs and in menuconfig.
>>
>>     Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
>>
>>
>>
>> In Linux, CONFIG_USB enables the host mode of USB.
>> So, "depends on (USB || USB_GADGET)" makes sense.
>>
>>
>> In U-Boot, since the commit above, CONFIG_USB enables
>> the whole of USB frame-work, including host, gadget.
>>
>> USB_DWC3 already resides inside of if USB ... endif
>> so, depends on (USB || USB_GADGET) does not make sense.
>>
>>
>>
> OK, thanks for pointing this out.
> 
> But USB doesn't mean Host is active and USB_GADGET means gadget
> framework is available.
> 
> So I think we have incomplete information for deciding about Host role
> based on just Kconfig.

On an OTG controller, you should check the ID pin at runtime to
determine which mode the controller should work in. The Kconfig
options should select the supported modes, not enforce particular
one. If the ID pin is not available or you want to force the controller
into particular mode, do it via DT or platdata.


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working
  2016-05-13 12:47   ` Marek Vasut
@ 2016-05-18 14:27     ` Roger Quadros
  0 siblings, 0 replies; 34+ messages in thread
From: Roger Quadros @ 2016-05-18 14:27 UTC (permalink / raw)
  To: u-boot

On 13/05/16 15:47, Marek Vasut wrote:
> On 05/13/2016 02:39 PM, Roger Quadros wrote:
>> On 13/05/16 15:17, Roger Quadros wrote:
>>> Hi,
>>>
>>> This series fixes dwc3 usb config issues and am57xx-evm USB configuration
>>> to get USB host ports working properly on am57xx-evm and beagle-x15.
>>
>> Small update. Super-Speed devices are still not working, but that is a different issue
>> which seems to have been existed since long ago. I will debug this issue in the coming days.
> 
> Cool. You have a whole MW for that ;-)

Still stuck with this issue. It seems like it finds both high-speed and
super-speed hubs but fails getting descriptor of the super-speed hub.

Is super-speed host known to work on any platform on u-boot?
Any ideas how to debug this further? The hub chip is on the board
so I can't connect a USB bus analyzer there.

cheers,
-roger

=> usb start
starting USB...
USB0:   board_usb_init 0
adding phy 0 to list
dwc3_core_soft_reset
ti_usb3_phy_power 1
usb3 power up done
dwc3_set_mode 1
config1 0x7d00e
config1 0x7d00e
config1 0x7d00e
Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.00
scanning bus 0 for devices... USB hub found
2 ports detected
individual port power switching
standalone hub
individual port over-current protection
power on to power good time: 20ms
hub controller current requirement: 0mA
port 1 is removable
port 2 is removable
get_hub_status returned status 1, change 902
local power source is lost (inactive)
no over-current condition exists
enabling power on all ports
port 1 returns 0
port 2 returns 0
pgood_delay=20ms
devnum=1 poweron: query_delay=100 connect_timeout=1100
Port 1 Status 101 Change 1
devnum=1 port=1: USB dev found
portstatus 101, change 1, 12 Mb/s
legacy_hub_port_reset: resetting port 1...
portstatus 111, change 0, 12 Mb/s
STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  USB_PORT_STAT_ENABLE 0
portstatus 503, change 10, 480 Mb/s
STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  USB_PORT_STAT_ENABLE 1
req=6 (0x6), type=128 (0x80), value=256 (0x100), index=0
start_trb fef56940, start_cycle 1
req->requesttype = 128, req->request = 6,le16_to_cpu(req->value) = 256,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 18
XHCI done. status 0x0
req=6 (0x6), type=128 (0x80), value=512 (0x200), index=0
start_trb fef56970, start_cycle 1
req->requesttype = 128, req->request = 6,le16_to_cpu(req->value) = 512,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 9
XHCI done. status 0x0
req=6 (0x6), type=128 (0x80), value=512 (0x200), index=0
start_trb fef569a0, start_cycle 1
req->requesttype = 128, req->request = 6,le16_to_cpu(req->value) = 512,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 41
XHCI done. status 0x0
req=9 (0x9), type=0 (0x0), value=1 (0x1), index=0
start_trb fef569d0, start_cycle 1
req->requesttype = 0, req->request = 9,le16_to_cpu(req->value) = 1,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 0
XHCI done. status 0x0
req=6 (0x6), type=128 (0x80), value=768 (0x300), index=0
start_trb fef569f0, start_cycle 1
req->requesttype = 128, req->request = 6,le16_to_cpu(req->value) = 768,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 255
XHCI done. status 0x0
req=6 (0x6), type=128 (0x80), value=769 (0x301), index=1033
start_trb fef56a20, start_cycle 1
req->requesttype = 128, req->request = 6,le16_to_cpu(req->value) = 769,le16_to_cpu(req->index) = 1033,le16_to_cpu(req->length) = 255
XHCI done. status 0x0
USB hub found
req=6 (0x6), type=160 (0xa0), value=10496 (0x2900), index=0
start_trb fef56a50, start_cycle 1
req->requesttype = 160, req->request = 6,le16_to_cpu(req->value) = 10496,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
req=6 (0x6), type=160 (0xa0), value=10496 (0x2900), index=0
start_trb fef56a80, start_cycle 1
req->requesttype = 160, req->request = 6,le16_to_cpu(req->value) = 10496,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 9
XHCI done. status 0x0
4 ports detected
individual port power switching
standalone hub
individual port over-current protection
power on to power good time: 100ms
hub controller current requirement: 0mA
port 1 is removable
port 2 is removable
port 3 is removable
port 4 is removable
req=0 (0x0), type=160 (0xa0), value=0 (0x0), index=0
start_trb fef56ab0, start_cycle 1
req->requesttype = 160, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
get_hub_status returned status 0, change 0
local power source is good
no over-current condition exists
enabling power on all ports
req=3 (0x3), type=35 (0x23), value=8 (0x8), index=1
start_trb fef56ae0, start_cycle 1
req->requesttype = 35, req->request = 3,le16_to_cpu(req->value) = 8,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 0
XHCI done. status 0x0
port 1 returns 0
req=3 (0x3), type=35 (0x23), value=8 (0x8), index=2
start_trb fef56b00, start_cycle 1
req->requesttype = 35, req->request = 3,le16_to_cpu(req->value) = 8,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 0
XHCI done. status 0x0
port 2 returns 0
req=3 (0x3), type=35 (0x23), value=8 (0x8), index=3
start_trb fef56b20, start_cycle 1
req->requesttype = 35, req->request = 3,le16_to_cpu(req->value) = 8,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 0
XHCI done. status 0x0
port 3 returns 0
req=3 (0x3), type=35 (0x23), value=8 (0x8), index=4
start_trb fef56b40, start_cycle 1
req->requesttype = 35, req->request = 3,le16_to_cpu(req->value) = 8,le16_to_cpu(req->index) = 4,le16_to_cpu(req->length) = 0
XHCI done. status 0x0
port 4 returns 0
pgood_delay=100ms
devnum=2 poweron: query_delay=100 connect_timeout=1100
Port 2 Status 703 Change 1
devnum=1 port=2: USB dev found
portstatus 703, change 1, 5 Gb/s
legacy_hub_port_reset: resetting port 2...
portstatus 703, change 10, 5 Gb/s
STAT_C_CONNECTION = 0 STAT_CONNECTION = 1  USB_PORT_STAT_ENABLE 1
req=6 (0x6), type=128 (0x80), value=256 (0x100), index=0
start_trb fef587c0, start_cycle 1
req->requesttype = 128, req->request = 6,le16_to_cpu(req->value) = 256,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 18
XHCI done. status 0x0
req=6 (0x6), type=128 (0x80), value=512 (0x200), index=0
start_trb fef587f0, start_cycle 1
req->requesttype = 128, req->request = 6,le16_to_cpu(req->value) = 512,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 9
XHCI done. status 0x0
req=6 (0x6), type=128 (0x80), value=512 (0x200), index=0
start_trb fef58820, start_cycle 1
req->requesttype = 128, req->request = 6,le16_to_cpu(req->value) = 512,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 31
XHCI done. status 0x0
req=9 (0x9), type=0 (0x0), value=1 (0x1), index=0
start_trb fef58850, start_cycle 1
req->requesttype = 0, req->request = 9,le16_to_cpu(req->value) = 1,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 0
XHCI done. status 0x0

*-------interesting part-------*
USB hub found
req=6 (0x6), type=160 (0xa0), value=10496 (0x2900), index=0
start_trb fef58870, start_cycle 1
req->requesttype = 160, req->request = 6,le16_to_cpu(req->value) = 10496,le16_to_cpu(req->index) = 0,le16_to_cpu(req->length) = 4
XHCI done. status 0x2
usb_hub_configure: failed to get hub descriptor, giving up 2
hub: disabling port 2
*-------end interesting part---*

req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=1
start_trb fef56b60, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 1 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=2
start_trb fef56b90, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 2 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=3
start_trb fef56bc0, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 3 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=4
start_trb fef56bf0, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 4,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 4 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=1
start_trb fef56c20, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 1 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=2
start_trb fef56c50, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 2 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=3
start_trb fef56c80, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 3 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=4
start_trb fef56cb0, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 4,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 4 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=1
start_trb fef56ce0, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 1 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=2
start_trb fef56d10, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 2 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=3
start_trb fef56950, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 3 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=4
start_trb fef56980, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 4,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 4 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=1
start_trb fef569b0, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 1 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=2
start_trb fef569e0, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 2 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=3
start_trb fef56a10, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 3 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=4
start_trb fef56a40, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 4,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 4 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=1
start_trb fef56a70, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 1 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=2
start_trb fef56aa0, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 2 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=3
start_trb fef56ad0, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 3 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=4
start_trb fef56b00, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 4,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 4 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=1
start_trb fef56b30, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 1 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=2
start_trb fef56b60, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 2 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=3
start_trb fef56b90, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 3 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=4
start_trb fef56bc0, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 4,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 4 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=1
start_trb fef56bf0, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 1 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=2
start_trb fef56c20, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 2 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=3
start_trb fef56c50, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 3 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=4
start_trb fef56c80, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 4,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 4 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=1
start_trb fef56cb0, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 1 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=2
start_trb fef56ce0, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 2 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=3
start_trb fef56d10, start_cycle 0
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 3 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=4
start_trb fef56950, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 4,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 4 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=1
start_trb fef56980, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 1 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=2
start_trb fef569b0, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 2 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=3
start_trb fef569e0, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 3 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=4
start_trb fef56a10, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 4,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 4 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=1
start_trb fef56a40, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 1 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=2
start_trb fef56a70, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 2 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=3
start_trb fef56aa0, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 3 Status 100 Change 0
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=4
start_trb fef56ad0, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 4,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 4 Status 100 Change 0
devnum=2 port=4: timeout
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=1
start_trb fef56b00, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 1,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 1 Status 100 Change 0
devnum=2 port=1: timeout
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=2
start_trb fef56b30, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 2,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 2 Status 100 Change 0
devnum=2 port=2: timeout
req=0 (0x0), type=163 (0xa3), value=0 (0x0), index=3
start_trb fef56b60, start_cycle 1
req->requesttype = 163, req->request = 0,le16_to_cpu(req->value) = 0,le16_to_cpu(req->index) = 3,le16_to_cpu(req->length) = 4
XHCI done. status 0x0
Port 3 Status 100 Change 0
devnum=2 port=3: timeout
2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
=> 

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

* [U-Boot] [PATCH v2 1/4] usb: dwc3: fix kconfig
  2016-05-13 12:17 ` [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig Roger Quadros
  2016-05-13 12:23   ` Marek Vasut
  2016-05-17 10:33   ` Masahiro Yamada
@ 2016-05-19 14:15   ` Roger Quadros
  2 siblings, 0 replies; 34+ messages in thread
From: Roger Quadros @ 2016-05-19 14:15 UTC (permalink / raw)
  To: u-boot

DWC3 can be used as host or as gadget controller and the actual mode
is determined at runtime so USB_DWC3_DUAL_ROLE must be the default
mode when both host and gadget drivers are available.

As DWC3 core implements an XHCI host controller, we use USB_XHCI_HCD to
check if host driver is available.

USB_DWC3_HOST and USB_DWC3_GADGET are only set if a particular mode
needs to be forced or if both host and gadget drivers are not available.

Build the dwc3 gadget drivers only if gadget mode can be used at runtime.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
v2:
- don't depend on USB as dwc3/kconfig already depends on that
- use USB_XHCI_HCD to decide whether host operation is available.
- Add USB_DWC3_DUAL_ROLE, which means that controller can operate
either in host or gadget mode. The actual mode is decided at runtime
based on dwc3->dr_mode.

 drivers/usb/dwc3/Kconfig  | 18 +++++++++++++-----
 drivers/usb/dwc3/Makefile |  4 +++-
 drivers/usb/dwc3/core.h   |  4 ++--
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
index e93398f..0db536e 100644
--- a/drivers/usb/dwc3/Kconfig
+++ b/drivers/usb/dwc3/Kconfig
@@ -1,19 +1,20 @@
 config USB_DWC3
 	bool "DesignWare USB3 DRD Core Support"
-	depends on (USB && USB_GADGET)
-	select USB_GADGET_DUALSPEED
+	select USB_GADGET_DUALSPEED if USB_GADGET
 	help
-	  Say Y here if your system has a Dual Role SuperSpeed
-	  USB controller based on the DesignWare USB3 IP Core.
+	  Say Y here if your system has DesignWare USB3 IP Core.
 
 if USB_DWC3
 
 choice
 	bool "DWC3 Mode Selection"
+	default USB_DWC3_DUAL_ROLE if (USB_GADGET && USB_XHCI_HCD)
+	default USB_DWC3_HOST if (!USB_GADGET && USB_XHCI_HCD)
+	default USB_DWC3_GADGET if (USB_GADGET && !USB_XHCI_HCD)
 
 config USB_DWC3_HOST
 	bool "Host only mode"
-	depends on USB
+	depends on USB_XHCI_HCD
 	help
 	  Select this when you want to use DWC3 in host mode only,
 	  thereby the gadget feature will be regressed.
@@ -25,6 +26,13 @@ config USB_DWC3_GADGET
 	  Select this when you want to use DWC3 in gadget mode only,
 	  thereby the host feature will be regressed.
 
+config USB_DWC3_DUAL_ROLE
+	bool "Dual role mode"
+	depends on (USB_XHCI_HCD && USB_GADGET)
+	help
+	 This is the default mode of working of DWC3 controller where
+	 both host and gadget features are enabled.
+
 endchoice
 
 comment "Platform Glue Driver Support"
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index 0cd7302..d2ad2e9 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -6,7 +6,9 @@ obj-$(CONFIG_USB_DWC3)			+= dwc3.o
 
 dwc3-y					:= core.o
 
-dwc3-y					+= gadget.o ep0.o
+ifneq ($(filter y,$(CONFIG_USB_DWC3_GADGET) $(CONFIG_USB_DWC3_DUAL_ROLE)),)
+dwc3-yi					+= gadget.o ep0.o
+endif
 
 obj-$(CONFIG_USB_DWC3_OMAP)		+= dwc3-omap.o
 obj-$(CONFIG_USB_DWC3_PHY_OMAP)		+= ti_usb_phy.o
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 72d2fcd..faf0c0f 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -989,7 +989,7 @@ struct dwc3_gadget_ep_cmd_params {
 /* prototypes */
 int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc);
 
-#ifdef CONFIG_USB_DWC3_HOST
+#if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)
 int dwc3_host_init(struct dwc3 *dwc);
 void dwc3_host_exit(struct dwc3 *dwc);
 #else
@@ -999,7 +999,7 @@ static inline void dwc3_host_exit(struct dwc3 *dwc)
 { }
 #endif
 
-#ifdef CONFIG_USB_DWC3_GADGET
+#if IS_ENABLED(CONFIG_USB_DWC3_GADGET) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)
 int dwc3_gadget_init(struct dwc3 *dwc);
 void dwc3_gadget_exit(struct dwc3 *dwc);
 int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode);
-- 
2.7.4

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

* [U-Boot] [U-Boot,2/4] board: ti: am57xx: Fix USB configuration
  2016-05-13 12:17 ` [U-Boot] [PATCH 2/4] board: ti: am57xx: Fix USB configuration Roger Quadros
  2016-05-13 12:23   ` Marek Vasut
  2016-05-13 12:36   ` [U-Boot] [PATCH v2 " Roger Quadros
@ 2016-05-20 22:32   ` Tom Rini
  2 siblings, 0 replies; 34+ messages in thread
From: Tom Rini @ 2016-05-20 22:32 UTC (permalink / raw)
  To: u-boot

On Fri, May 13, 2016 at 03:17:51PM +0300, Roger Quadros wrote:

> This fixes build.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
>  include/configs/am57xx_evm.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/configs/am57xx_evm.h b/include/configs/am57xx_evm.h
> index 32d7d4d..939057c 100644
> --- a/include/configs/am57xx_evm.h
> +++ b/include/configs/am57xx_evm.h
> @@ -63,6 +63,7 @@
>  #define CONFIG_SUPPORT_EMMC_BOOT
>  
>  /* USB xHCI HOST */
> +#define CONFIG_USB_DWC3
>  #define CONFIG_USB_HOST
>  #define CONFIG_USB_XHCI_DWC3
>  #define CONFIG_USB_XHCI
> @@ -72,6 +73,8 @@
>  
>  #define CONFIG_OMAP_USB_PHY
>  #define CONFIG_OMAP_USB3PHY1_HOST
> +#define CONFIG_USB_DWC3_PHY_OMAP
> +#define CONFIG_USB_DWC3_OMAP

This needs to be done in the defconfig.  And you're leaving other boards
broken: pcm051_rev1 and others, please do at least an am33xx build,
thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160520/9866f367/attachment.sig>

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

* [U-Boot] [U-Boot, 3/4] usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled
  2016-05-13 12:17 ` [U-Boot] [PATCH 3/4] usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled Roger Quadros
  2016-05-13 12:24   ` Marek Vasut
@ 2016-05-30 17:58   ` Tom Rini
  1 sibling, 0 replies; 34+ messages in thread
From: Tom Rini @ 2016-05-30 17:58 UTC (permalink / raw)
  To: u-boot

On Fri, May 13, 2016 at 03:17:52PM +0300, Roger Quadros wrote:

> It is pointless to build gadget driver if USB_GADGET is disabled.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160530/a2542802/attachment.sig>

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

end of thread, other threads:[~2016-05-30 17:58 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-13 12:17 [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working Roger Quadros
2016-05-13 12:17 ` [U-Boot] [PATCH 1/4] usb: dwc3: fix kconfig Roger Quadros
2016-05-13 12:23   ` Marek Vasut
2016-05-13 12:27     ` Roger Quadros
2016-05-13 12:43       ` Marek Vasut
2016-05-17 10:37     ` Masahiro Yamada
2016-05-17 10:33   ` Masahiro Yamada
2016-05-18 12:47     ` Roger Quadros
2016-05-18 12:52       ` Marek Vasut
2016-05-19 14:15   ` [U-Boot] [PATCH v2 " Roger Quadros
2016-05-13 12:17 ` [U-Boot] [PATCH 2/4] board: ti: am57xx: Fix USB configuration Roger Quadros
2016-05-13 12:23   ` Marek Vasut
2016-05-13 12:36   ` [U-Boot] [PATCH v2 " Roger Quadros
2016-05-13 12:45     ` Marek Vasut
2016-05-16  9:06       ` Roger Quadros
2016-05-16  9:26         ` Roger Quadros
2016-05-16  9:49           ` Roger Quadros
2016-05-16 10:03             ` Kishon Vijay Abraham I
2016-05-16 10:31               ` Roger Quadros
2016-05-16 11:10                 ` Kishon Vijay Abraham I
2016-05-16 13:51                   ` Roger Quadros
2016-05-20 22:32   ` [U-Boot] [U-Boot,2/4] " Tom Rini
2016-05-13 12:17 ` [U-Boot] [PATCH 3/4] usb: dwc3: Makefile: Don't build gadget code if USB_GADGET is disabled Roger Quadros
2016-05-13 12:24   ` Marek Vasut
2016-05-30 17:58   ` [U-Boot] [U-Boot, " Tom Rini
2016-05-13 12:17 ` [U-Boot] [PATCH 4/4] usb: gadget: udc: Build on USB_GADGET Roger Quadros
2016-05-13 12:24   ` Marek Vasut
2016-05-13 12:29     ` Roger Quadros
2016-05-13 12:47       ` Marek Vasut
2016-05-16  9:03         ` Roger Quadros
2016-05-13 12:22 ` [U-Boot] [PATCH 0/4] am57xx: beagle-x15: get usb host working Marek Vasut
2016-05-13 12:39 ` Roger Quadros
2016-05-13 12:47   ` Marek Vasut
2016-05-18 14:27     ` Roger Quadros

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