All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/4] board: ti: am57xx: Fix USB configuration
Date: Mon, 16 May 2016 16:40:55 +0530	[thread overview]
Message-ID: <5739AABF.2090509@ti.com> (raw)
In-Reply-To: <5739A16F.2000403@ti.com>

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

  reply	other threads:[~2016-05-16 11:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5739AABF.2090509@ti.com \
    --to=kishon@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.