From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Sun, 18 Jan 2015 23:51:53 +0100 Subject: [U-Boot] [PATCH] usb: musb-new: omap2430: Reset the MUSB controller early In-Reply-To: <1421599485-31486-1-git-send-email-contact@paulk.fr> References: <1421599485-31486-1-git-send-email-contact@paulk.fr> Message-ID: <201501182351.53881.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > --- > 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() ). +CC Hans, can you test on sunxi please ? Thank you ! Best regards, Marek Vasut