From 3770853bc0a25112b5f50811c75079a41cdb81da Mon Sep 17 00:00:00 2001 From: Ajay Kumar Gupta Date: Wed, 14 Apr 2010 16:08:37 +0530 Subject: [PATCH 42/48] musb: allow host io without gadget module Signed-off-by: Ajay Kumar Gupta --- drivers/usb/musb/musb_core.c | 14 +++++++++----- drivers/usb/musb/musb_gadget.c | 26 -------------------------- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 98874c5..a448fa6 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2101,10 +2101,12 @@ bad_config: * (We expect the ID pin to be forcibly grounded!!) * Otherwise, wait till the gadget driver hooks up. */ - if (!is_otg_enabled(musb) && is_host_enabled(musb)) { - MUSB_HST_MODE(musb); - musb->xceiv->default_a = 1; - musb->xceiv->state = OTG_STATE_A_IDLE; + if (is_host_enabled(musb)) { + if (!is_otg_enabled(musb)) { + MUSB_HST_MODE(musb); + musb->xceiv->default_a = 1; + musb->xceiv->state = OTG_STATE_A_IDLE; + } status = usb_add_hcd(musb_to_hcd(musb), -1, 0); @@ -2115,7 +2117,9 @@ bad_config: & MUSB_DEVCTL_BDEVICE ? 'B' : 'A')); - } else /* peripheral is enabled */ { + } + /* peripheral is enabled */ + if (is_peripheral_enabled(musb)) { MUSB_DEV_MODE(musb); musb->xceiv->default_a = 0; musb->xceiv->state = OTG_STATE_B_IDLE; diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index fd842af..b9ef9f3 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -1768,24 +1768,6 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) otg_set_peripheral(musb->xceiv, &musb->g); spin_unlock_irqrestore(&musb->lock, flags); - - if (is_otg_enabled(musb)) { - DBG(3, "OTG startup...\n"); - - /* REVISIT: funcall to other code, which also - * handles power budgeting ... this way also - * ensures HdrcStart is indirectly called. - */ - retval = usb_add_hcd(musb_to_hcd(musb), -1, 0); - if (retval < 0) { - DBG(1, "add_hcd failed, %d\n", retval); - spin_lock_irqsave(&musb->lock, flags); - otg_set_peripheral(musb->xceiv, NULL); - musb->gadget_driver = NULL; - musb->g.dev.driver = NULL; - spin_unlock_irqrestore(&musb->lock, flags); - } - } } return retval; @@ -1881,14 +1863,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) retval = -EINVAL; spin_unlock_irqrestore(&musb->lock, flags); - if (is_otg_enabled(musb) && retval == 0) { - usb_remove_hcd(musb_to_hcd(musb)); - /* FIXME we need to be able to register another - * gadget driver here and have everything work; - * that currently misbehaves. - */ - } - return retval; } EXPORT_SYMBOL(usb_gadget_unregister_driver); -- 1.6.6.1