All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Kocialkowski <contact@paulk.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: musb-new: omap2430: Reset the MUSB controller early
Date: Mon, 19 Jan 2015 14:29:29 +0100	[thread overview]
Message-ID: <1421674169.2414.4.camel@collins> (raw)
In-Reply-To: <201501182351.53881.marex@denx.de>

Le dimanche 18 janvier 2015 ? 23:51 +0100, Marek Vasut a ?crit :
> On Sunday, January 18, 2015 at 05:44:45 PM, Paul Kocialkowski wrote:
> > When booting from USB peripheral boot, the bootrom will not properly deinit
> > the MUSB controller, which doesn't clearly indicate an USB disconnection
> > to the host and leaves U-Boot to deal with the state of the previous USB
> > session.
> > 
> > On some host controller drivers (e.g. xhci_hcd), this ends up in a failure
> > during set address, caused by the lack of proper disconnection
> > notification.
> > 
> > Resetting the controller early in U-Boot notifies the host of the
> > disconnection and doesn't hurt other use cases.
> > 
> > Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
> > ---
> >  drivers/usb/musb-new/omap2430.c | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> > 
> > diff --git a/drivers/usb/musb-new/omap2430.c
> > b/drivers/usb/musb-new/omap2430.c index 98f4830..6b256bb 100644
> > --- a/drivers/usb/musb-new/omap2430.c
> > +++ b/drivers/usb/musb-new/omap2430.c
> > @@ -321,6 +321,7 @@ static int omap2430_musb_init(struct musb *musb)
> >  {
> >  	u32 l;
> >  	int status = 0;
> > +	int timeout = 10;
> >  #ifndef __UBOOT__
> >  	struct device *dev = musb->controller;
> >  	struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
> > @@ -331,6 +332,22 @@ static int omap2430_musb_init(struct musb *musb)
> >  		(struct omap_musb_board_data *)musb->controller;
> >  #endif
> > 
> > +	/* Reset the controller */
> > +	musb_writel(musb->mregs, OTG_SYSCONFIG, SOFTRST);
> > +
> > +	while (timeout--) {
> 
> Hi!
> 
> Just a minor nitpick, you might want to replace the timeout with get_timer(0) 
> and friends, see for example drivers/spi/altera_spi.c:161 (the inner loop in 
> spi_xfer() ).

Well to be honest here, I added that timeout code "just because" and
every time I tried, the bit was cleared on the first read right after
instructing the reset, so I doubt there is a real need for "doing it
right". Let me know if you really think this would be better with
timers.

> +CC Hans, can you test on sunxi please ?

I could test on sunxi as well if that helps, but isn't that part of the
code specific to the OMAP?

Thanks for the review!

-- 
Paul Kocialkowski, Replicant developer

Replicant is a fully free Android distribution running on several
devices, a free software mobile operating system putting the emphasis on
freedom and privacy/security.

Website: http://www.replicant.us/
Blog: http://blog.replicant.us/
Wiki/tracker/forums: http://redmine.replicant.us/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150119/3fec1bf4/attachment.pgp>

  reply	other threads:[~2015-01-19 13:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-18 16:44 [U-Boot] [PATCH] usb: musb-new: omap2430: Reset the MUSB controller early Paul Kocialkowski
2015-01-18 22:51 ` Marek Vasut
2015-01-19 13:29   ` Paul Kocialkowski [this message]
2015-01-19 15:12     ` Marek Vasut
2015-01-19 17:33       ` [U-Boot] [PATCH v2] " Paul Kocialkowski
2015-01-20 15:23         ` Tom Rini
2015-01-22  7:19           ` 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=1421674169.2414.4.camel@collins \
    --to=contact@paulk.fr \
    --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.