diff options
author | Thirupathi Chippakurthy <thirupathi.chippakurthy@stericsson.com> | 2011-11-29 18:37:44 +0530 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-01-04 09:55:27 +0100 |
commit | 41d24d79a74bd0c0fbe7148063d38cd3f37cfeb6 (patch) | |
tree | 327591cc35ccdfc925a469d146fb413d332b5d7c | |
parent | 209fba2c643dddbbba0b1cb73f1ff75d86d2a70b (diff) |
ux500: usb:handle connection of microA to A cable
Connect Micro-A to phone first,Then connect device
usb session should be valid to detect the connected
device,Until host cable (micro-A) removal.
MUSB session bit is cleared when usb host cable
(Micro-A) removal from the phone,Not in case of
only device disconnection from the usb host cable.
ST-Ericsson ID: 364426
ST-Ericsson FOSS-OUT ID: NA
ST-Ericsson Linux next: NA
Signed-off-by: Thirupathi <thirupathi.chippakurthy@stericsson.com>
-rw-r--r-- | drivers/usb/musb/ux500.c | 14 | ||||
-rw-r--r-- | drivers/usb/otg/ab8500-usb.c | 9 |
2 files changed, 18 insertions, 5 deletions
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index 9eaa8b1a8df..2b63da5d48a 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c @@ -228,11 +228,15 @@ static void musb_notify_idle(unsigned long _musb) switch (musb->xceiv->state) { case OTG_STATE_A_WAIT_BCON: - devctl &= ~MUSB_DEVCTL_SESSION; - musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); - musb->xceiv->state = OTG_STATE_B_IDLE; - MUSB_DEV_MODE(musb); + if (devctl & MUSB_DEVCTL_BDEVICE) { + musb->xceiv->state = OTG_STATE_B_IDLE; + MUSB_DEV_MODE(musb); + } else { + musb->xceiv->state = OTG_STATE_A_IDLE; + MUSB_HST_MODE(musb); + } break; + case OTG_STATE_A_SUSPEND: default: break; @@ -261,6 +265,8 @@ static int musb_otg_notifications(struct notifier_block *nb, case USB_EVENT_NONE: dev_dbg(musb->controller, "VBUS Disconnect\n"); + if (is_otg_enabled(musb)) + ux500_musb_set_vbus(musb, 0); break; default: diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c index 735a6c51ff2..79065403261 100644 --- a/drivers/usb/otg/ab8500-usb.c +++ b/drivers/usb/otg/ab8500-usb.c @@ -388,10 +388,17 @@ static void ab8500_usb_delayed_work(struct work_struct *work) static irqreturn_t ab8500_usb_disconnect_irq(int irq, void *data) { struct ab8500_usb *ab = (struct ab8500_usb *) data; + enum usb_xceiv_events event; /* Link status will not be updated till phy is disabled. */ - if (ab->mode == USB_HOST) + if (ab->mode == USB_HOST) { + event = USB_EVENT_NONE; + ab->otg.default_a = false; + ab->vbus_draw = 0; + atomic_notifier_call_chain(&ab->otg.notifier, + event, &ab->vbus_draw); ab8500_usb_host_phy_dis(ab); + } else if (ab->mode == USB_PERIPHERAL) ab8500_usb_peri_phy_dis(ab); else if (ab->mode == USB_DEDICATED_CHG && ab->rev == 0x20) { |