diff mbox

[v2,2/4] board: ti: am57xx: Fix USB configuration

Message ID 5735CA6A.2070005@ti.com
State New
Headers show

Commit Message

Roger Quadros May 13, 2016, 12:36 p.m. UTC
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(+)

-- 
2.7.4
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Comments

Roger Quadros May 16, 2016, 9:06 a.m. UTC | #1
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

>>

> 

> 

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Roger Quadros May 16, 2016, 9:26 a.m. UTC | #2
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@lists.denx.de

> http://lists.denx.de/mailman/listinfo/u-boot

> 

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Roger Quadros May 16, 2016, 9:49 a.m. UTC | #3
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@lists.denx.de

>> http://lists.denx.de/mailman/listinfo/u-boot

>>

> _______________________________________________

> U-Boot mailing list

> U-Boot@lists.denx.de

> http://lists.denx.de/mailman/listinfo/u-boot

> 

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Kishon Vijay Abraham I May 16, 2016, 10:03 a.m. UTC | #4
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
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Roger Quadros May 16, 2016, 10:31 a.m. UTC | #5
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
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Kishon Vijay Abraham I May 16, 2016, 11:10 a.m. UTC | #6
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
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Roger Quadros May 16, 2016, 1:51 p.m. UTC | #7
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
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
diff mbox

Patch

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