]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/meta-ti-glsdk.git/blob - recipes-kernel/linux/linux-omap3-2.6.37-psp04.02.00.07/omap3/0002-usb-musb-am35x-fix-role-switching-issue.patch
machine configs: Add SGX to MACHINE_FEATURES
[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-omap3-2.6.37-psp04.02.00.07 / omap3 / 0002-usb-musb-am35x-fix-role-switching-issue.patch
1 From 96fa47d92d10382f4e0d9b6e3ab2c627e4671716 Mon Sep 17 00:00:00 2001
2 From: Bin Liu <b-liu@ti.com>
3 Date: Wed, 30 May 2012 18:28:07 -0500
4 Subject: [PATCH 2/2] usb: musb: am35x: fix role switching issue
6 Fixing the role switching issue seen when followed steps below:
8 a) Configure port in OTG mode
9 b) Connect MSC device through micro-A-plug to std-A-receptacle
10 c) MSC enumerated and works fine
11 d) Disconnect MSC device and let cable be connected to port
12 e) Now disconnect cable also
13 f) Connect port to host PC using micro-B plug to std-A plug
14 e) PC doesn't recognise the gadget driver
16 Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
17 Signed-off-by: Bin Liu <b-liu@ti.com>
18 ---
19  drivers/usb/musb/am35x.c |   25 ++++++++++++++++++++-----
20  1 files changed, 20 insertions(+), 5 deletions(-)
22 diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
23 index a59a5e7..d32fb77 100644
24 --- a/drivers/usb/musb/am35x.c
25 +++ b/drivers/usb/musb/am35x.c
26 @@ -368,6 +368,13 @@ static void otg_timer(unsigned long _musb)
27                 devctl = musb_readb(mregs, MUSB_DEVCTL);
28                 if (devctl & MUSB_DEVCTL_BDEVICE)
29                         mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
30 +               else if ((devctl & MUSB_DEVCTL_SESSION) &&
31 +                               !(devctl & MUSB_DEVCTL_BDEVICE)) {
32 +                       mod_timer(&otg_workaround,
33 +                                       jiffies + POLL_SECONDS * HZ);
34 +                       musb_writeb(musb->mregs, MUSB_DEVCTL, devctl &
35 +                                       ~MUSB_DEVCTL_SESSION);
36 +               }
37                 else
38                         musb->xceiv->state = OTG_STATE_A_IDLE;
39                 break;
40 @@ -502,11 +509,19 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci)
41                         mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ);
42                         WARNING("VBUS error workaround (delay coming)\n");
43                 } else if (is_host_enabled(musb) && drvvbus) {
44 -                       MUSB_HST_MODE(musb);
45 -                       musb->xceiv->default_a = 1;
46 -                       musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
47 -                       portstate(musb->port1_status |= USB_PORT_STAT_POWER);
48 -                       del_timer(&otg_workaround);
49 +                       if (!(devctl & MUSB_DEVCTL_SESSION) ||
50 +                          (devctl & MUSB_DEVCTL_BDEVICE) ||
51 +                          (devctl & MUSB_DEVCTL_HM)) {
52 +                               if (musb->is_active)
53 +                                       del_timer(&otg_workaround);
54 +                               else
55 +                                       musb->is_active = 1;
56 +
57 +                               MUSB_HST_MODE(musb);
58 +                               musb->xceiv->default_a = 1;
59 +                               musb->xceiv->state = OTG_STATE_A_WAIT_VRISE;
60 +                               portstate(musb->port1_status |= USB_PORT_STAT_POWER);
61 +                       }
62                 } else {
63                         musb->is_active = 0;
64                         MUSB_DEV_MODE(musb);
65 -- 
66 1.7.0.4