diff options
author | Hans de Goede <hdegoede@redhat.com> | 2015-06-17 21:33:54 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-07-21 17:39:37 -0600 |
commit | 15837236386191f2a26706b5ee56cdb4ab28e6d5 (patch) | |
tree | dd84bb180cbecfe09bbab7bd1950ba7d87485a1b /drivers/usb/musb-new/musb_core.h | |
parent | fd1bd21bf07d0770bff7b477d501b706dac9987d (diff) |
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.h')
-rw-r--r-- | drivers/usb/musb-new/musb_core.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/usb/musb-new/musb_core.h b/drivers/usb/musb-new/musb_core.h index 2695742098..8727f6415e 100644 --- a/drivers/usb/musb-new/musb_core.h +++ b/drivers/usb/musb-new/musb_core.h @@ -231,7 +231,11 @@ struct musb_platform_ops { int (*init)(struct musb *musb); int (*exit)(struct musb *musb); +#ifndef __UBOOT__ void (*enable)(struct musb *musb); +#else + int (*enable)(struct musb *musb); +#endif void (*disable)(struct musb *musb); int (*set_mode)(struct musb *musb, u8 mode); @@ -546,7 +550,11 @@ static inline void musb_configure_ep0(struct musb *musb) extern const char musb_driver_name[]; +#ifndef __UBOOT__ extern void musb_start(struct musb *musb); +#else +extern int musb_start(struct musb *musb); +#endif extern void musb_stop(struct musb *musb); extern void musb_write_fifo(struct musb_hw_ep *ep, u16 len, const u8 *src); @@ -564,11 +572,21 @@ static inline void musb_platform_set_vbus(struct musb *musb, int is_on) musb->ops->set_vbus(musb, is_on); } +#ifndef __UBOOT__ static inline void musb_platform_enable(struct musb *musb) { if (musb->ops->enable) musb->ops->enable(musb); } +#else +static inline int musb_platform_enable(struct musb *musb) +{ + if (!musb->ops->enable) + return 0; + + return musb->ops->enable(musb); +} +#endif static inline void musb_platform_disable(struct musb *musb) { |