public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.u.boot@aribaud.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] USB Host not enumerating properly on AM335x-based board
Date: Sun, 23 Nov 2014 12:56:55 +0100	[thread overview]
Message-ID: <20141123125655.66f24592@lilith> (raw)
In-Reply-To: <20141122004058.093765b1@crub>

Hello Anatolij,

On Sat, 22 Nov 2014 00:40:58 +0100, Anatolij Gustschin <agust@denx.de>
wrote:
> Hi Maxime,
> 
> On Thu, 20 Nov 2014 17:49:17 +0100
> Maxime Ripard <maxime.ripard@free-electrons.com> wrote:
> 
> > Hi,
> > 
> > I'm currently working on 2014.07, on a custom TI AM335x based board.
> > 
> > Everything works great so far, except when we're trying to have USB
> > host working.
> > 
> > The board has the MUSB1 controller wired as USB Host only, with the
> > following configuration:
> > 
> > #define CONFIG_USB_MUSB_DSPS
> > #define CONFIG_ARCH_MISC_INIT
> > #define CONFIG_MUSB_PIO_ONLY
> > #define CONFIG_MUSB_DISABLE_BULK_COMBINE_SPLIT
> > #define CONFIG_MUSB_HOST
> > #define CONFIG_MUSB_DSPS
> > #define CONFIG_AM335X_USB1
> > #define CONFIG_AM335X_USB1_MODE MUSB_HOST
> > 
> > #ifdef CONFIG_MUSB_HOST
> > #define CONFIG_CMD_USB
> > #define CONFIG_USB_STORAGE
> > #define CONFIG_USB_HOST_ETHER
> > #define CONFIG_USB_ETHER_ASIX
> > #endif
> 
> I'm not familiar with AM335x, so I can't say if this configuration
> is okay.
> 
> > Whenever we try to scan the USB controller and that a device is
> > attached, we get the following output:
> > 
> > U-Boot# usb start
> > (Re)start USB...
> > USB0:   scanning bus 0 for devices... 1 USB Device(s) found
> >        scanning usb for storage devices... 0 Storage Device(s) found
> >        scanning usb for ethernet devices... 0 Ethernet Device(s) found
> > 
> > The device itself being a USB key, it's somewhat odd that it
> > enumerates the device, but doesn't find the storage device...
> 
> The device found is the controller's root hub device, not the
> USB storage device. "usb info" should show more about it.
> 
> > The same USB port with the same device works fine under Linux.
> > 
> > The VBUS pin is still up after running the command, so it's not really
> > a matter of power being shut down on the bus.
> > 
> > I'm kind of running out of idea on what to test next. The differences
> > between u-boot's musb-new and Linux' own musb driver seems thin and to
> > make sense, so I don't think the driver itself is to blame.
> > 
> > Anyone experienced such a thing?
> 
> We experienced similar thing this week, but on an imx6dl based board.
> Quite a lot of debugging and comparison with USB host operation under
> Linux didn't really help much. Finally we found the issue with the
> timer implementation, udelay(1) took too much time, about 35 usec.
> Whereas one would expect it to take about 1 usec, ideally.
> EHCI-HCD, USB-Hub and Storage drivers in U-Boot use udelay()/mdelay()
> quite extensively. Reworking the timer implementation for our
> platform resulted in udelay(1) times taking about 2.5 usec. This was
> enough for USB driver code to work again.

I think the USB code might be mis-using udelay(), then. Here's why I do:

- the semantics of udelay(n) are AFAIUI "delay at least n
  microseconds", but nothing says it won't delay more, especially for
  small wait times where the setup/cleanup part of udelay() will
  obviously get a bigger share of the execution time than the actual
  delaying. 

- OTOH, the problems you witness seem to imply that the USB code is
  expecting udelay(n) to "wait for at least n microseconds but no more
  than some unspecified limit", since if udelay /does/ take too long,
  the code fails because its expectation is not met.

Did you find out why a longer delay() causes the USB code to fail? For
instance, is udelay() used for synchronizing to an external event, and
delaying too much makes the code miss the event?

> HTH,
> 
> Anatolij

Amicalement,
-- 
Albert.

  reply	other threads:[~2014-11-23 11:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-20 16:49 [U-Boot] USB Host not enumerating properly on AM335x-based board Maxime Ripard
2014-11-21 10:20 ` Eric Bénard
2014-11-21 14:57   ` Maxime Ripard
2014-11-21 19:35     ` Marek Vasut
2014-11-21 23:40 ` Anatolij Gustschin
2014-11-23 11:56   ` Albert ARIBAUD [this message]
2014-11-24 22:23   ` Maxime Ripard
2014-12-08 13:59   ` Maxime Ripard
2014-12-10 15:23 ` Maxime Ripard
2014-12-11 13:09   ` Marek Vasut
2014-12-11 15:44     ` Maxime Ripard
2014-12-14 19:18       ` Marek Vasut

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=20141123125655.66f24592@lilith \
    --to=albert.u.boot@aribaud.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox