e1ad38f543e799d462bbba3284a0d6b8e896e3f3
[kernel-power] / kernel-power-2.6.28 / debian / patches / nokia-20103103+0m5_usb.diff
1 --- kernel-power-2.6.28.orig/drivers/usb/musb/musb_core.c
2 +++ kernel-power-2.6.28/drivers/usb/musb/musb_core.c
3 @@ -297,28 +297,23 @@
4                         break;
5         }
6  
7 -       if (vdat) {
8 -               /* REVISIT: This code works only with dedicated chargers!
9 -                * When support for HOST/HUB chargers is added, don't
10 -                * forget this.
11 -                */
12 +       /* enable interrupts */
13 +       musb_writeb(musb->mregs, MUSB_INTRUSBE, ctx.intrusbe);
14 +
15 +       /* Make sure the communication starts normally */
16 +       r = musb_readb(musb->mregs, MUSB_POWER);
17 +       musb_writeb(musb->mregs, MUSB_POWER,
18 +                       r | MUSB_POWER_RESUME);
19 +       msleep(10);
20 +       musb_writeb(musb->mregs, MUSB_POWER,
21 +                       r & ~MUSB_POWER_RESUME);
22 +       if (vdat && musb->xceiv->state != OTG_STATE_B_IDLE) {
23                 musb_stop(musb);
24                 /* Regulators off */
25                 otg_set_suspend(musb->xceiv, 1);
26 -               musb->is_charger = 1;
27 -       } else {
28 -               /* enable interrupts */
29 -               musb_writeb(musb->mregs, MUSB_INTRUSBE, ctx.intrusbe);
30 -
31 -               /* Make sure the communication starts normally */
32 -               r = musb_readb(musb->mregs, MUSB_POWER);
33 -               musb_writeb(musb->mregs, MUSB_POWER,
34 -                               r | MUSB_POWER_RESUME);
35 -               msleep(10);
36 -               musb_writeb(musb->mregs, MUSB_POWER,
37 -                               r & ~MUSB_POWER_RESUME);
38         }
39  
40 +       musb->is_charger = vdat;
41         check_charger = 0;
42  
43         return vdat;