mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: "Michael D. Burkey" <mdburkey@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: Porting barebox (devicetree) to Variscite iMX6 SOM [USB FIX]
Date: Fri, 7 Feb 2014 12:07:03 +0100	[thread overview]
Message-ID: <20140207110703.GM16215@pengutronix.de> (raw)
In-Reply-To: <CAO6XYUtssrWFvmFZh8CUaaDwazt8apURKnyC04Rg4aRJF74_Bw@mail.gmail.com>

On Thu, Feb 06, 2014 at 10:24:43PM -0500, Michael D. Burkey wrote:
> Sascha,
> 
> Well, a bit of good news -- I know what the problem is, and it is
> probably one that has actually caused headaches for other people over
> the years (probably in the Linux kernel as well).
> 
> The problem is one that only shows up with a powered hub which uses
> external power switches to feed the ports. The hub reports back a
> PowerOn2PowerGood signal of 100ms. Unfortunately, standard MOSFET
> switches such as the MIC2076 add up to another 10ms of delay to the
> time it takes for the power lines to the ports to become stable.
> 
> This would also explain a few problems that I have seen people talking
> about online with BeagleBoards, etc under Linux where a USB device would
> work fine if hot-plugged later on, but would not work if it was plugged
> in at startup.
> 
> Also, looking at the more recent Linux kernels, they have hardcoded
> the value for the delay in usb_hub_power_on() to a minimum of 100ms,
> rather than just using the PwrOn2PwrGood value -- so it probably makes
> sense to do the same in barebox, except that we really should make the
> delay timing for both about 110ms or PwrOn2PwrGood+10ms.
> 
> I've (finally) gotten all my Variscite patches rolled together and
> merged on my end with all the DTS changes that got checked into the
> mainline over the last few days (you've been WAY too busy!!!) and I
> can post a real patch file including the USB update shortly.
> 
> That said, the change is to /drivers/usb/core/usb.c and the only
> function changed is:
> 
> static void usb_hub_power_on(struct usb_hub_device *hub)
> {
>         int i;
>         unsigned delay;
>         struct usb_device *dev;
> 
>         dev = hub->pusb_dev;
>         /* Enable power to the ports */
>         USB_HUB_PRINTF("enabling power on all ports\n");
>         for (i = 0; i < dev->maxchild; i++) {
>                 usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
>                 USB_HUB_PRINTF("port %d returns %lX\n", i + 1, dev->status);
>         }
> 
>         /* Wait at least 110 msec for power to become stable. */
>         /* PowerOn2PowerGood is encoded in 2ms increments -> times 2
> for the actual delay */
>         /* The additional 10ms is to allow for the turn-on/rise-time
> delay often induced  */
>         /* by MOSFET power distribution switches such as the Micrel
> MIC2076.              */
>         delay = max((unsigned)(hub->desc.bPwrOn2PwrGood*2), (unsigned) 100);
>         mdelay(delay+10);
> }
> 
> 
> This gets USB detection working properly on the Variscite -- and
> probably helps a few other boards too!

Indeed this function caused problems earlier, also on U-Boot. I thought
the way we do it is fine now. It might be worth running a git blame/git
log on this function in both barebox and U-Boot to get some background.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-02-07 11:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07  3:24 Michael D. Burkey
2014-02-07 11:07 ` Sascha Hauer [this message]
2014-02-07 15:50   ` Michael D. Burkey
2014-02-07 16:51     ` Michael D. Burkey
2014-02-08  8:58     ` Sascha Hauer

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=20140207110703.GM16215@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=mdburkey@gmail.com \
    /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