aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/musb/omap2430.c
diff options
context:
space:
mode:
authorAntoine Tenart <antoine.tenart@free-electrons.com>2014-10-30 13:41:13 -0400
committerFelipe Balbi <balbi@ti.com>2014-11-03 11:01:25 -0500
commite47d92545c2972bcf3711e7db80f481e402163c7 (patch)
treea84db324fbd565aaa371bc0ef5677456541877e3 /drivers/usb/musb/omap2430.c
parenta2655e4a8edb66d21b0967940172e83a51d30ef3 (diff)
usb: move the OTG state from the USB PHY to the OTG structure
Before using the PHY framework instead of the USB PHY one, we need to move the OTG state into another place, since it won't be available when USB PHY isn't used. This patch moves the OTG state into the OTG structure, and makes all the needed modifications in the drivers using the OTG state. [ balbi@ti.com : fix build regressions with phy-tahvo.c, musb_dsps.c, phy-isp1301-omap, and chipidea's debug.c ] Acked-by: Kishon Vijay Abraham I <kishon@ti.com> Acked-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/musb/omap2430.c')
-rw-r--r--drivers/usb/musb/omap2430.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 20fc2a532a24..763649eb4987 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -65,15 +65,15 @@ static void musb_do_idle(unsigned long _musb)
65 65
66 spin_lock_irqsave(&musb->lock, flags); 66 spin_lock_irqsave(&musb->lock, flags);
67 67
68 switch (musb->xceiv->state) { 68 switch (musb->xceiv->otg->state) {
69 case OTG_STATE_A_WAIT_BCON: 69 case OTG_STATE_A_WAIT_BCON:
70 70
71 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); 71 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
72 if (devctl & MUSB_DEVCTL_BDEVICE) { 72 if (devctl & MUSB_DEVCTL_BDEVICE) {
73 musb->xceiv->state = OTG_STATE_B_IDLE; 73 musb->xceiv->otg->state = OTG_STATE_B_IDLE;
74 MUSB_DEV_MODE(musb); 74 MUSB_DEV_MODE(musb);
75 } else { 75 } else {
76 musb->xceiv->state = OTG_STATE_A_IDLE; 76 musb->xceiv->otg->state = OTG_STATE_A_IDLE;
77 MUSB_HST_MODE(musb); 77 MUSB_HST_MODE(musb);
78 } 78 }
79 break; 79 break;
@@ -90,15 +90,15 @@ static void musb_do_idle(unsigned long _musb)
90 musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16; 90 musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16;
91 usb_hcd_poll_rh_status(musb->hcd); 91 usb_hcd_poll_rh_status(musb->hcd);
92 /* NOTE: it might really be A_WAIT_BCON ... */ 92 /* NOTE: it might really be A_WAIT_BCON ... */
93 musb->xceiv->state = OTG_STATE_A_HOST; 93 musb->xceiv->otg->state = OTG_STATE_A_HOST;
94 } 94 }
95 break; 95 break;
96 case OTG_STATE_A_HOST: 96 case OTG_STATE_A_HOST:
97 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); 97 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
98 if (devctl & MUSB_DEVCTL_BDEVICE) 98 if (devctl & MUSB_DEVCTL_BDEVICE)
99 musb->xceiv->state = OTG_STATE_B_IDLE; 99 musb->xceiv->otg->state = OTG_STATE_B_IDLE;
100 else 100 else
101 musb->xceiv->state = OTG_STATE_A_WAIT_BCON; 101 musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
102 default: 102 default:
103 break; 103 break;
104 } 104 }
@@ -116,9 +116,9 @@ static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
116 116
117 /* Never idle if active, or when VBUS timeout is not set as host */ 117 /* Never idle if active, or when VBUS timeout is not set as host */
118 if (musb->is_active || ((musb->a_wait_bcon == 0) 118 if (musb->is_active || ((musb->a_wait_bcon == 0)
119 && (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) { 119 && (musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON))) {
120 dev_dbg(musb->controller, "%s active, deleting timer\n", 120 dev_dbg(musb->controller, "%s active, deleting timer\n",
121 usb_otg_state_string(musb->xceiv->state)); 121 usb_otg_state_string(musb->xceiv->otg->state));
122 del_timer(&musb_idle_timer); 122 del_timer(&musb_idle_timer);
123 last_timer = jiffies; 123 last_timer = jiffies;
124 return; 124 return;
@@ -135,7 +135,7 @@ static void omap2430_musb_try_idle(struct musb *musb, unsigned long timeout)
135 last_timer = timeout; 135 last_timer = timeout;
136 136
137 dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n", 137 dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n",
138 usb_otg_state_string(musb->xceiv->state), 138 usb_otg_state_string(musb->xceiv->otg->state),
139 (unsigned long)jiffies_to_msecs(timeout - jiffies)); 139 (unsigned long)jiffies_to_msecs(timeout - jiffies));
140 mod_timer(&musb_idle_timer, timeout); 140 mod_timer(&musb_idle_timer, timeout);
141} 141}
@@ -153,7 +153,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
153 devctl = musb_readb(musb->mregs, MUSB_DEVCTL); 153 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
154 154
155 if (is_on) { 155 if (is_on) {
156 if (musb->xceiv->state == OTG_STATE_A_IDLE) { 156 if (musb->xceiv->otg->state == OTG_STATE_A_IDLE) {
157 int loops = 100; 157 int loops = 100;
158 /* start the session */ 158 /* start the session */
159 devctl |= MUSB_DEVCTL_SESSION; 159 devctl |= MUSB_DEVCTL_SESSION;
@@ -180,7 +180,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
180 } else { 180 } else {
181 musb->is_active = 1; 181 musb->is_active = 1;
182 otg->default_a = 1; 182 otg->default_a = 1;
183 musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; 183 musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
184 devctl |= MUSB_DEVCTL_SESSION; 184 devctl |= MUSB_DEVCTL_SESSION;
185 MUSB_HST_MODE(musb); 185 MUSB_HST_MODE(musb);
186 } 186 }
@@ -192,7 +192,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
192 */ 192 */
193 193
194 otg->default_a = 0; 194 otg->default_a = 0;
195 musb->xceiv->state = OTG_STATE_B_IDLE; 195 musb->xceiv->otg->state = OTG_STATE_B_IDLE;
196 devctl &= ~MUSB_DEVCTL_SESSION; 196 devctl &= ~MUSB_DEVCTL_SESSION;
197 197
198 MUSB_DEV_MODE(musb); 198 MUSB_DEV_MODE(musb);
@@ -201,7 +201,7 @@ static void omap2430_musb_set_vbus(struct musb *musb, int is_on)
201 201
202 dev_dbg(musb->controller, "VBUS %s, devctl %02x " 202 dev_dbg(musb->controller, "VBUS %s, devctl %02x "
203 /* otg %3x conf %08x prcm %08x */ "\n", 203 /* otg %3x conf %08x prcm %08x */ "\n",
204 usb_otg_state_string(musb->xceiv->state), 204 usb_otg_state_string(musb->xceiv->otg->state),
205 musb_readb(musb->mregs, MUSB_DEVCTL)); 205 musb_readb(musb->mregs, MUSB_DEVCTL));
206} 206}
207 207
@@ -266,7 +266,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
266 dev_dbg(dev, "ID GND\n"); 266 dev_dbg(dev, "ID GND\n");
267 267
268 otg->default_a = true; 268 otg->default_a = true;
269 musb->xceiv->state = OTG_STATE_A_IDLE; 269 musb->xceiv->otg->state = OTG_STATE_A_IDLE;
270 musb->xceiv->last_event = USB_EVENT_ID; 270 musb->xceiv->last_event = USB_EVENT_ID;
271 if (musb->gadget_driver) { 271 if (musb->gadget_driver) {
272 pm_runtime_get_sync(dev); 272 pm_runtime_get_sync(dev);
@@ -280,7 +280,7 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
280 dev_dbg(dev, "VBUS Connect\n"); 280 dev_dbg(dev, "VBUS Connect\n");
281 281
282 otg->default_a = false; 282 otg->default_a = false;
283 musb->xceiv->state = OTG_STATE_B_IDLE; 283 musb->xceiv->otg->state = OTG_STATE_B_IDLE;
284 musb->xceiv->last_event = USB_EVENT_VBUS; 284 musb->xceiv->last_event = USB_EVENT_VBUS;
285 if (musb->gadget_driver) 285 if (musb->gadget_driver)
286 pm_runtime_get_sync(dev); 286 pm_runtime_get_sync(dev);