summaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb-new/musb_core.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-06-17 21:33:54 +0200
committerSimon Glass <sjg@chromium.org>2015-07-21 17:39:37 -0600
commit15837236386191f2a26706b5ee56cdb4ab28e6d5 (patch)
treedd84bb180cbecfe09bbab7bd1950ba7d87485a1b /drivers/usb/musb-new/musb_core.c
parentfd1bd21bf07d0770bff7b477d501b706dac9987d (diff)
downloadtalos-obmc-uboot-15837236386191f2a26706b5ee56cdb4ab28e6d5.tar.gz
talos-obmc-uboot-15837236386191f2a26706b5ee56cdb4ab28e6d5.zip
musb: Allow musb_platform_enable to return an error code
Allow musb_platform_enable to return an error code and propagate it up to usb_lowlevel_init(). This allows moving the checks for an external vbus being present to be moved from platform_init to platform_enable, so that the user can unplug a charger, plug in a host adapter with a usb-device, do a "usb reset" and have things working. This also allows adding a check for the id-pin to platform_enable, so that it can short circuit the 1s delay in usb_lowlevel_init() when no host cable is plugged in and thus waiting for a device to show up is useless. Note that all the changes to code shared with the kernel are wrapped in the kernel. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/usb/musb-new/musb_core.c')
-rw-r--r--drivers/usb/musb-new/musb_core.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
index 242cc30b1c..f530af4fb7 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -926,10 +926,17 @@ b_host:
/*
* Program the HDRC to start (enable interrupts, dma, etc.).
*/
+#ifndef __UBOOT__
void musb_start(struct musb *musb)
+#else
+int musb_start(struct musb *musb)
+#endif
{
void __iomem *regs = musb->mregs;
u8 devctl = musb_readb(regs, MUSB_DEVCTL);
+#ifdef __UBOOT__
+ int ret;
+#endif
dev_dbg(musb->controller, "<== devctl %02x\n", devctl);
@@ -972,8 +979,21 @@ void musb_start(struct musb *musb)
if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS)
musb->is_active = 1;
}
+
+#ifndef __UBOOT__
musb_platform_enable(musb);
+#else
+ ret = musb_platform_enable(musb);
+ if (ret) {
+ musb->is_active = 0;
+ return ret;
+ }
+#endif
musb_writeb(regs, MUSB_DEVCTL, devctl);
+
+#ifdef __UBOOT__
+ return 0;
+#endif
}
OpenPOWER on IntegriCloud