diff options
27 files changed, 312 insertions, 315 deletions
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 8c842980834a..9f4093590f4c 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c | |||
@@ -80,11 +80,9 @@ static int omap_usb_start_srp(struct usb_otg *otg) | |||
80 | 80 | ||
81 | static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host) | 81 | static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host) |
82 | { | 82 | { |
83 | struct usb_phy *phy = otg->phy; | ||
84 | |||
85 | otg->host = host; | 83 | otg->host = host; |
86 | if (!host) | 84 | if (!host) |
87 | phy->state = OTG_STATE_UNDEFINED; | 85 | otg->state = OTG_STATE_UNDEFINED; |
88 | 86 | ||
89 | return 0; | 87 | return 0; |
90 | } | 88 | } |
@@ -92,11 +90,9 @@ static int omap_usb_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
92 | static int omap_usb_set_peripheral(struct usb_otg *otg, | 90 | static int omap_usb_set_peripheral(struct usb_otg *otg, |
93 | struct usb_gadget *gadget) | 91 | struct usb_gadget *gadget) |
94 | { | 92 | { |
95 | struct usb_phy *phy = otg->phy; | ||
96 | |||
97 | otg->gadget = gadget; | 93 | otg->gadget = gadget; |
98 | if (!gadget) | 94 | if (!gadget) |
99 | phy->state = OTG_STATE_UNDEFINED; | 95 | otg->state = OTG_STATE_UNDEFINED; |
100 | 96 | ||
101 | return 0; | 97 | return 0; |
102 | } | 98 | } |
diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index 795d6538d630..f038804d13dd 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c | |||
@@ -220,7 +220,7 @@ static int ci_otg_show(struct seq_file *s, void *unused) | |||
220 | 220 | ||
221 | /* ------ State ----- */ | 221 | /* ------ State ----- */ |
222 | seq_printf(s, "OTG state: %s\n\n", | 222 | seq_printf(s, "OTG state: %s\n\n", |
223 | usb_otg_state_string(ci->transceiver->state)); | 223 | usb_otg_state_string(ci->transceiver->otg->state)); |
224 | 224 | ||
225 | /* ------ State Machine Variables ----- */ | 225 | /* ------ State Machine Variables ----- */ |
226 | seq_printf(s, "a_bus_drop: %d\n", fsm->a_bus_drop); | 226 | seq_printf(s, "a_bus_drop: %d\n", fsm->a_bus_drop); |
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c index caaabc58021e..8cb2508a6b71 100644 --- a/drivers/usb/chipidea/otg_fsm.c +++ b/drivers/usb/chipidea/otg_fsm.c | |||
@@ -328,7 +328,7 @@ static void b_ssend_srp_tmout_func(void *ptr, unsigned long indicator) | |||
328 | set_tmout(ci, indicator); | 328 | set_tmout(ci, indicator); |
329 | 329 | ||
330 | /* only vbus fall below B_sess_vld in b_idle state */ | 330 | /* only vbus fall below B_sess_vld in b_idle state */ |
331 | if (ci->transceiver->state == OTG_STATE_B_IDLE) | 331 | if (ci->fsm.otg->state == OTG_STATE_B_IDLE) |
332 | ci_otg_queue_work(ci); | 332 | ci_otg_queue_work(ci); |
333 | } | 333 | } |
334 | 334 | ||
@@ -582,11 +582,11 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) | |||
582 | * when there is no gadget class driver | 582 | * when there is no gadget class driver |
583 | */ | 583 | */ |
584 | if (ci->fsm.id && !(ci->driver) && | 584 | if (ci->fsm.id && !(ci->driver) && |
585 | ci->transceiver->state < OTG_STATE_A_IDLE) | 585 | ci->fsm.otg->state < OTG_STATE_A_IDLE) |
586 | return 0; | 586 | return 0; |
587 | 587 | ||
588 | if (otg_statemachine(&ci->fsm)) { | 588 | if (otg_statemachine(&ci->fsm)) { |
589 | if (ci->transceiver->state == OTG_STATE_A_IDLE) { | 589 | if (ci->fsm.otg->state == OTG_STATE_A_IDLE) { |
590 | /* | 590 | /* |
591 | * Further state change for cases: | 591 | * Further state change for cases: |
592 | * a_idle to b_idle; or | 592 | * a_idle to b_idle; or |
@@ -600,7 +600,7 @@ int ci_otg_fsm_work(struct ci_hdrc *ci) | |||
600 | ci_otg_queue_work(ci); | 600 | ci_otg_queue_work(ci); |
601 | if (ci->id_event) | 601 | if (ci->id_event) |
602 | ci->id_event = false; | 602 | ci->id_event = false; |
603 | } else if (ci->transceiver->state == OTG_STATE_B_IDLE) { | 603 | } else if (ci->fsm.otg->state == OTG_STATE_B_IDLE) { |
604 | if (ci->fsm.b_sess_vld) { | 604 | if (ci->fsm.b_sess_vld) { |
605 | ci->fsm.power_up = 0; | 605 | ci->fsm.power_up = 0; |
606 | /* | 606 | /* |
@@ -627,7 +627,7 @@ static void ci_otg_fsm_event(struct ci_hdrc *ci) | |||
627 | otg_bsess_vld = hw_read_otgsc(ci, OTGSC_BSV); | 627 | otg_bsess_vld = hw_read_otgsc(ci, OTGSC_BSV); |
628 | port_conn = hw_read(ci, OP_PORTSC, PORTSC_CCS); | 628 | port_conn = hw_read(ci, OP_PORTSC, PORTSC_CCS); |
629 | 629 | ||
630 | switch (ci->transceiver->state) { | 630 | switch (ci->fsm.otg->state) { |
631 | case OTG_STATE_A_WAIT_BCON: | 631 | case OTG_STATE_A_WAIT_BCON: |
632 | if (port_conn) { | 632 | if (port_conn) { |
633 | fsm->b_conn = 1; | 633 | fsm->b_conn = 1; |
@@ -794,7 +794,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) | |||
794 | ci->transceiver->otg = ci->fsm.otg; | 794 | ci->transceiver->otg = ci->fsm.otg; |
795 | ci->fsm.power_up = 1; | 795 | ci->fsm.power_up = 1; |
796 | ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0; | 796 | ci->fsm.id = hw_read_otgsc(ci, OTGSC_ID) ? 1 : 0; |
797 | ci->transceiver->state = OTG_STATE_UNDEFINED; | 797 | ci->fsm.otg->state = OTG_STATE_UNDEFINED; |
798 | ci->fsm.ops = &ci_otg_ops; | 798 | ci->fsm.ops = &ci_otg_ops; |
799 | 799 | ||
800 | mutex_init(&ci->fsm.lock); | 800 | mutex_init(&ci->fsm.lock); |
diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c index 98e8340a5bb1..c6b35b77dab7 100644 --- a/drivers/usb/common/usb-otg-fsm.c +++ b/drivers/usb/common/usb-otg-fsm.c | |||
@@ -124,10 +124,10 @@ static void otg_leave_state(struct otg_fsm *fsm, enum usb_otg_state old_state) | |||
124 | static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) | 124 | static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) |
125 | { | 125 | { |
126 | state_changed = 1; | 126 | state_changed = 1; |
127 | if (fsm->otg->phy->state == new_state) | 127 | if (fsm->otg->state == new_state) |
128 | return 0; | 128 | return 0; |
129 | VDBG("Set state: %s\n", usb_otg_state_string(new_state)); | 129 | VDBG("Set state: %s\n", usb_otg_state_string(new_state)); |
130 | otg_leave_state(fsm, fsm->otg->phy->state); | 130 | otg_leave_state(fsm, fsm->otg->state); |
131 | switch (new_state) { | 131 | switch (new_state) { |
132 | case OTG_STATE_B_IDLE: | 132 | case OTG_STATE_B_IDLE: |
133 | otg_drv_vbus(fsm, 0); | 133 | otg_drv_vbus(fsm, 0); |
@@ -236,7 +236,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state) | |||
236 | break; | 236 | break; |
237 | } | 237 | } |
238 | 238 | ||
239 | fsm->otg->phy->state = new_state; | 239 | fsm->otg->state = new_state; |
240 | return 0; | 240 | return 0; |
241 | } | 241 | } |
242 | 242 | ||
@@ -247,7 +247,7 @@ int otg_statemachine(struct otg_fsm *fsm) | |||
247 | 247 | ||
248 | mutex_lock(&fsm->lock); | 248 | mutex_lock(&fsm->lock); |
249 | 249 | ||
250 | state = fsm->otg->phy->state; | 250 | state = fsm->otg->state; |
251 | state_changed = 0; | 251 | state_changed = 0; |
252 | /* State machine state change judgement */ | 252 | /* State machine state change judgement */ |
253 | 253 | ||
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index 0231606d47c2..cf89b4b17f14 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c | |||
@@ -183,7 +183,7 @@ static void start_hnp(struct ohci_hcd *ohci) | |||
183 | otg_start_hnp(hcd->usb_phy->otg); | 183 | otg_start_hnp(hcd->usb_phy->otg); |
184 | 184 | ||
185 | local_irq_save(flags); | 185 | local_irq_save(flags); |
186 | hcd->usb_phy->state = OTG_STATE_A_SUSPEND; | 186 | hcd->usb_phy->otg.state = OTG_STATE_A_SUSPEND; |
187 | writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]); | 187 | writel (RH_PS_PSS, &ohci->regs->roothub.portstatus [port]); |
188 | l = omap_readl(OTG_CTRL); | 188 | l = omap_readl(OTG_CTRL); |
189 | l &= ~OTG_A_BUSREQ; | 189 | l &= ~OTG_A_BUSREQ; |
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c index a2735df24cc6..d836a3e1f8ec 100644 --- a/drivers/usb/musb/am35x.c +++ b/drivers/usb/musb/am35x.c | |||
@@ -149,25 +149,25 @@ static void otg_timer(unsigned long _musb) | |||
149 | */ | 149 | */ |
150 | devctl = musb_readb(mregs, MUSB_DEVCTL); | 150 | devctl = musb_readb(mregs, MUSB_DEVCTL); |
151 | dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, | 151 | dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, |
152 | usb_otg_state_string(musb->xceiv->state)); | 152 | usb_otg_state_string(musb->xceiv->otg->state)); |
153 | 153 | ||
154 | spin_lock_irqsave(&musb->lock, flags); | 154 | spin_lock_irqsave(&musb->lock, flags); |
155 | switch (musb->xceiv->state) { | 155 | switch (musb->xceiv->otg->state) { |
156 | case OTG_STATE_A_WAIT_BCON: | 156 | case OTG_STATE_A_WAIT_BCON: |
157 | devctl &= ~MUSB_DEVCTL_SESSION; | 157 | devctl &= ~MUSB_DEVCTL_SESSION; |
158 | musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); | 158 | musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); |
159 | 159 | ||
160 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | 160 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); |
161 | if (devctl & MUSB_DEVCTL_BDEVICE) { | 161 | if (devctl & MUSB_DEVCTL_BDEVICE) { |
162 | musb->xceiv->state = OTG_STATE_B_IDLE; | 162 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
163 | MUSB_DEV_MODE(musb); | 163 | MUSB_DEV_MODE(musb); |
164 | } else { | 164 | } else { |
165 | musb->xceiv->state = OTG_STATE_A_IDLE; | 165 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
166 | MUSB_HST_MODE(musb); | 166 | MUSB_HST_MODE(musb); |
167 | } | 167 | } |
168 | break; | 168 | break; |
169 | case OTG_STATE_A_WAIT_VFALL: | 169 | case OTG_STATE_A_WAIT_VFALL: |
170 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 170 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
171 | musb_writel(musb->ctrl_base, CORE_INTR_SRC_SET_REG, | 171 | musb_writel(musb->ctrl_base, CORE_INTR_SRC_SET_REG, |
172 | MUSB_INTR_VBUSERROR << AM35X_INTR_USB_SHIFT); | 172 | MUSB_INTR_VBUSERROR << AM35X_INTR_USB_SHIFT); |
173 | break; | 173 | break; |
@@ -176,7 +176,7 @@ static void otg_timer(unsigned long _musb) | |||
176 | if (devctl & MUSB_DEVCTL_BDEVICE) | 176 | if (devctl & MUSB_DEVCTL_BDEVICE) |
177 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 177 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
178 | else | 178 | else |
179 | musb->xceiv->state = OTG_STATE_A_IDLE; | 179 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
180 | break; | 180 | break; |
181 | default: | 181 | default: |
182 | break; | 182 | break; |
@@ -193,9 +193,9 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout) | |||
193 | 193 | ||
194 | /* Never idle if active, or when VBUS timeout is not set as host */ | 194 | /* Never idle if active, or when VBUS timeout is not set as host */ |
195 | if (musb->is_active || (musb->a_wait_bcon == 0 && | 195 | if (musb->is_active || (musb->a_wait_bcon == 0 && |
196 | musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) { | 196 | musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON)) { |
197 | dev_dbg(musb->controller, "%s active, deleting timer\n", | 197 | dev_dbg(musb->controller, "%s active, deleting timer\n", |
198 | usb_otg_state_string(musb->xceiv->state)); | 198 | usb_otg_state_string(musb->xceiv->otg->state)); |
199 | del_timer(&otg_workaround); | 199 | del_timer(&otg_workaround); |
200 | last_timer = jiffies; | 200 | last_timer = jiffies; |
201 | return; | 201 | return; |
@@ -208,7 +208,7 @@ static void am35x_musb_try_idle(struct musb *musb, unsigned long timeout) | |||
208 | last_timer = timeout; | 208 | last_timer = timeout; |
209 | 209 | ||
210 | dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n", | 210 | dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n", |
211 | usb_otg_state_string(musb->xceiv->state), | 211 | usb_otg_state_string(musb->xceiv->otg->state), |
212 | jiffies_to_msecs(timeout - jiffies)); | 212 | jiffies_to_msecs(timeout - jiffies)); |
213 | mod_timer(&otg_workaround, timeout); | 213 | mod_timer(&otg_workaround, timeout); |
214 | } | 214 | } |
@@ -278,27 +278,27 @@ static irqreturn_t am35x_musb_interrupt(int irq, void *hci) | |||
278 | * devctl. | 278 | * devctl. |
279 | */ | 279 | */ |
280 | musb->int_usb &= ~MUSB_INTR_VBUSERROR; | 280 | musb->int_usb &= ~MUSB_INTR_VBUSERROR; |
281 | musb->xceiv->state = OTG_STATE_A_WAIT_VFALL; | 281 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL; |
282 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 282 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
283 | WARNING("VBUS error workaround (delay coming)\n"); | 283 | WARNING("VBUS error workaround (delay coming)\n"); |
284 | } else if (drvvbus) { | 284 | } else if (drvvbus) { |
285 | MUSB_HST_MODE(musb); | 285 | MUSB_HST_MODE(musb); |
286 | otg->default_a = 1; | 286 | otg->default_a = 1; |
287 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 287 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
288 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); | 288 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); |
289 | del_timer(&otg_workaround); | 289 | del_timer(&otg_workaround); |
290 | } else { | 290 | } else { |
291 | musb->is_active = 0; | 291 | musb->is_active = 0; |
292 | MUSB_DEV_MODE(musb); | 292 | MUSB_DEV_MODE(musb); |
293 | otg->default_a = 0; | 293 | otg->default_a = 0; |
294 | musb->xceiv->state = OTG_STATE_B_IDLE; | 294 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
295 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); | 295 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); |
296 | } | 296 | } |
297 | 297 | ||
298 | /* NOTE: this must complete power-on within 100 ms. */ | 298 | /* NOTE: this must complete power-on within 100 ms. */ |
299 | dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", | 299 | dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", |
300 | drvvbus ? "on" : "off", | 300 | drvvbus ? "on" : "off", |
301 | usb_otg_state_string(musb->xceiv->state), | 301 | usb_otg_state_string(musb->xceiv->otg->state), |
302 | err ? " ERROR" : "", | 302 | err ? " ERROR" : "", |
303 | devctl); | 303 | devctl); |
304 | ret = IRQ_HANDLED; | 304 | ret = IRQ_HANDLED; |
@@ -324,7 +324,7 @@ eoi: | |||
324 | } | 324 | } |
325 | 325 | ||
326 | /* Poll for ID change */ | 326 | /* Poll for ID change */ |
327 | if (musb->xceiv->state == OTG_STATE_B_IDLE) | 327 | if (musb->xceiv->otg->state == OTG_STATE_B_IDLE) |
328 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 328 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
329 | 329 | ||
330 | spin_unlock_irqrestore(&musb->lock, flags); | 330 | spin_unlock_irqrestore(&musb->lock, flags); |
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index 8554c6f7ab72..f23ce40b4d64 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
@@ -185,8 +185,8 @@ static irqreturn_t blackfin_interrupt(int irq, void *__hci) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | /* Start sampling ID pin, when plug is removed from MUSB */ | 187 | /* Start sampling ID pin, when plug is removed from MUSB */ |
188 | if ((musb->xceiv->state == OTG_STATE_B_IDLE | 188 | if ((musb->xceiv->otg->state == OTG_STATE_B_IDLE |
189 | || musb->xceiv->state == OTG_STATE_A_WAIT_BCON) || | 189 | || musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON) || |
190 | (musb->int_usb & MUSB_INTR_DISCONNECT && is_host_active(musb))) { | 190 | (musb->int_usb & MUSB_INTR_DISCONNECT && is_host_active(musb))) { |
191 | mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY); | 191 | mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY); |
192 | musb->a_wait_bcon = TIMER_DELAY; | 192 | musb->a_wait_bcon = TIMER_DELAY; |
@@ -205,7 +205,7 @@ static void musb_conn_timer_handler(unsigned long _musb) | |||
205 | static u8 toggle; | 205 | static u8 toggle; |
206 | 206 | ||
207 | spin_lock_irqsave(&musb->lock, flags); | 207 | spin_lock_irqsave(&musb->lock, flags); |
208 | switch (musb->xceiv->state) { | 208 | switch (musb->xceiv->otg->state) { |
209 | case OTG_STATE_A_IDLE: | 209 | case OTG_STATE_A_IDLE: |
210 | case OTG_STATE_A_WAIT_BCON: | 210 | case OTG_STATE_A_WAIT_BCON: |
211 | /* Start a new session */ | 211 | /* Start a new session */ |
@@ -219,7 +219,7 @@ static void musb_conn_timer_handler(unsigned long _musb) | |||
219 | 219 | ||
220 | if (!(val & MUSB_DEVCTL_BDEVICE)) { | 220 | if (!(val & MUSB_DEVCTL_BDEVICE)) { |
221 | gpio_set_value(musb->config->gpio_vrsel, 1); | 221 | gpio_set_value(musb->config->gpio_vrsel, 1); |
222 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; | 222 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; |
223 | } else { | 223 | } else { |
224 | gpio_set_value(musb->config->gpio_vrsel, 0); | 224 | gpio_set_value(musb->config->gpio_vrsel, 0); |
225 | /* Ignore VBUSERROR and SUSPEND IRQ */ | 225 | /* Ignore VBUSERROR and SUSPEND IRQ */ |
@@ -229,7 +229,7 @@ static void musb_conn_timer_handler(unsigned long _musb) | |||
229 | 229 | ||
230 | val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR; | 230 | val = MUSB_INTR_SUSPEND | MUSB_INTR_VBUSERROR; |
231 | musb_writeb(musb->mregs, MUSB_INTRUSB, val); | 231 | musb_writeb(musb->mregs, MUSB_INTRUSB, val); |
232 | musb->xceiv->state = OTG_STATE_B_IDLE; | 232 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
233 | } | 233 | } |
234 | mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY); | 234 | mod_timer(&musb_conn_timer, jiffies + TIMER_DELAY); |
235 | break; | 235 | break; |
@@ -245,7 +245,7 @@ static void musb_conn_timer_handler(unsigned long _musb) | |||
245 | 245 | ||
246 | if (!(val & MUSB_DEVCTL_BDEVICE)) { | 246 | if (!(val & MUSB_DEVCTL_BDEVICE)) { |
247 | gpio_set_value(musb->config->gpio_vrsel, 1); | 247 | gpio_set_value(musb->config->gpio_vrsel, 1); |
248 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; | 248 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; |
249 | } else { | 249 | } else { |
250 | gpio_set_value(musb->config->gpio_vrsel, 0); | 250 | gpio_set_value(musb->config->gpio_vrsel, 0); |
251 | 251 | ||
@@ -280,13 +280,13 @@ static void musb_conn_timer_handler(unsigned long _musb) | |||
280 | break; | 280 | break; |
281 | default: | 281 | default: |
282 | dev_dbg(musb->controller, "%s state not handled\n", | 282 | dev_dbg(musb->controller, "%s state not handled\n", |
283 | usb_otg_state_string(musb->xceiv->state)); | 283 | usb_otg_state_string(musb->xceiv->otg->state)); |
284 | break; | 284 | break; |
285 | } | 285 | } |
286 | spin_unlock_irqrestore(&musb->lock, flags); | 286 | spin_unlock_irqrestore(&musb->lock, flags); |
287 | 287 | ||
288 | dev_dbg(musb->controller, "state is %s\n", | 288 | dev_dbg(musb->controller, "state is %s\n", |
289 | usb_otg_state_string(musb->xceiv->state)); | 289 | usb_otg_state_string(musb->xceiv->otg->state)); |
290 | } | 290 | } |
291 | 291 | ||
292 | static void bfin_musb_enable(struct musb *musb) | 292 | static void bfin_musb_enable(struct musb *musb) |
@@ -307,7 +307,7 @@ static void bfin_musb_set_vbus(struct musb *musb, int is_on) | |||
307 | 307 | ||
308 | dev_dbg(musb->controller, "VBUS %s, devctl %02x " | 308 | dev_dbg(musb->controller, "VBUS %s, devctl %02x " |
309 | /* otg %3x conf %08x prcm %08x */ "\n", | 309 | /* otg %3x conf %08x prcm %08x */ "\n", |
310 | usb_otg_state_string(musb->xceiv->state), | 310 | usb_otg_state_string(musb->xceiv->otg->state), |
311 | musb_readb(musb->mregs, MUSB_DEVCTL)); | 311 | musb_readb(musb->mregs, MUSB_DEVCTL)); |
312 | } | 312 | } |
313 | 313 | ||
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 058775e647ad..527c7fe60ece 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c | |||
@@ -198,20 +198,20 @@ static void otg_timer(unsigned long _musb) | |||
198 | */ | 198 | */ |
199 | devctl = musb_readb(mregs, MUSB_DEVCTL); | 199 | devctl = musb_readb(mregs, MUSB_DEVCTL); |
200 | dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, | 200 | dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, |
201 | usb_otg_state_string(musb->xceiv->state)); | 201 | usb_otg_state_string(musb->xceiv->otg->state)); |
202 | 202 | ||
203 | spin_lock_irqsave(&musb->lock, flags); | 203 | spin_lock_irqsave(&musb->lock, flags); |
204 | switch (musb->xceiv->state) { | 204 | switch (musb->xceiv->otg->state) { |
205 | case OTG_STATE_A_WAIT_BCON: | 205 | case OTG_STATE_A_WAIT_BCON: |
206 | devctl &= ~MUSB_DEVCTL_SESSION; | 206 | devctl &= ~MUSB_DEVCTL_SESSION; |
207 | musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); | 207 | musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); |
208 | 208 | ||
209 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | 209 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); |
210 | if (devctl & MUSB_DEVCTL_BDEVICE) { | 210 | if (devctl & MUSB_DEVCTL_BDEVICE) { |
211 | musb->xceiv->state = OTG_STATE_B_IDLE; | 211 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
212 | MUSB_DEV_MODE(musb); | 212 | MUSB_DEV_MODE(musb); |
213 | } else { | 213 | } else { |
214 | musb->xceiv->state = OTG_STATE_A_IDLE; | 214 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
215 | MUSB_HST_MODE(musb); | 215 | MUSB_HST_MODE(musb); |
216 | } | 216 | } |
217 | break; | 217 | break; |
@@ -226,7 +226,7 @@ static void otg_timer(unsigned long _musb) | |||
226 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 226 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
227 | break; | 227 | break; |
228 | } | 228 | } |
229 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 229 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
230 | musb_writel(musb->ctrl_base, DA8XX_USB_INTR_SRC_SET_REG, | 230 | musb_writel(musb->ctrl_base, DA8XX_USB_INTR_SRC_SET_REG, |
231 | MUSB_INTR_VBUSERROR << DA8XX_INTR_USB_SHIFT); | 231 | MUSB_INTR_VBUSERROR << DA8XX_INTR_USB_SHIFT); |
232 | break; | 232 | break; |
@@ -248,7 +248,7 @@ static void otg_timer(unsigned long _musb) | |||
248 | if (devctl & MUSB_DEVCTL_BDEVICE) | 248 | if (devctl & MUSB_DEVCTL_BDEVICE) |
249 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 249 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
250 | else | 250 | else |
251 | musb->xceiv->state = OTG_STATE_A_IDLE; | 251 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
252 | break; | 252 | break; |
253 | default: | 253 | default: |
254 | break; | 254 | break; |
@@ -265,9 +265,9 @@ static void da8xx_musb_try_idle(struct musb *musb, unsigned long timeout) | |||
265 | 265 | ||
266 | /* Never idle if active, or when VBUS timeout is not set as host */ | 266 | /* Never idle if active, or when VBUS timeout is not set as host */ |
267 | if (musb->is_active || (musb->a_wait_bcon == 0 && | 267 | if (musb->is_active || (musb->a_wait_bcon == 0 && |
268 | musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) { | 268 | musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON)) { |
269 | dev_dbg(musb->controller, "%s active, deleting timer\n", | 269 | dev_dbg(musb->controller, "%s active, deleting timer\n", |
270 | usb_otg_state_string(musb->xceiv->state)); | 270 | usb_otg_state_string(musb->xceiv->otg->state)); |
271 | del_timer(&otg_workaround); | 271 | del_timer(&otg_workaround); |
272 | last_timer = jiffies; | 272 | last_timer = jiffies; |
273 | return; | 273 | return; |
@@ -280,7 +280,7 @@ static void da8xx_musb_try_idle(struct musb *musb, unsigned long timeout) | |||
280 | last_timer = timeout; | 280 | last_timer = timeout; |
281 | 281 | ||
282 | dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n", | 282 | dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n", |
283 | usb_otg_state_string(musb->xceiv->state), | 283 | usb_otg_state_string(musb->xceiv->otg->state), |
284 | jiffies_to_msecs(timeout - jiffies)); | 284 | jiffies_to_msecs(timeout - jiffies)); |
285 | mod_timer(&otg_workaround, timeout); | 285 | mod_timer(&otg_workaround, timeout); |
286 | } | 286 | } |
@@ -341,26 +341,26 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) | |||
341 | * devctl. | 341 | * devctl. |
342 | */ | 342 | */ |
343 | musb->int_usb &= ~MUSB_INTR_VBUSERROR; | 343 | musb->int_usb &= ~MUSB_INTR_VBUSERROR; |
344 | musb->xceiv->state = OTG_STATE_A_WAIT_VFALL; | 344 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL; |
345 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 345 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
346 | WARNING("VBUS error workaround (delay coming)\n"); | 346 | WARNING("VBUS error workaround (delay coming)\n"); |
347 | } else if (drvvbus) { | 347 | } else if (drvvbus) { |
348 | MUSB_HST_MODE(musb); | 348 | MUSB_HST_MODE(musb); |
349 | otg->default_a = 1; | 349 | otg->default_a = 1; |
350 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 350 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
351 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); | 351 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); |
352 | del_timer(&otg_workaround); | 352 | del_timer(&otg_workaround); |
353 | } else { | 353 | } else { |
354 | musb->is_active = 0; | 354 | musb->is_active = 0; |
355 | MUSB_DEV_MODE(musb); | 355 | MUSB_DEV_MODE(musb); |
356 | otg->default_a = 0; | 356 | otg->default_a = 0; |
357 | musb->xceiv->state = OTG_STATE_B_IDLE; | 357 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
358 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); | 358 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); |
359 | } | 359 | } |
360 | 360 | ||
361 | dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", | 361 | dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", |
362 | drvvbus ? "on" : "off", | 362 | drvvbus ? "on" : "off", |
363 | usb_otg_state_string(musb->xceiv->state), | 363 | usb_otg_state_string(musb->xceiv->otg->state), |
364 | err ? " ERROR" : "", | 364 | err ? " ERROR" : "", |
365 | devctl); | 365 | devctl); |
366 | ret = IRQ_HANDLED; | 366 | ret = IRQ_HANDLED; |
@@ -375,7 +375,7 @@ static irqreturn_t da8xx_musb_interrupt(int irq, void *hci) | |||
375 | musb_writel(reg_base, DA8XX_USB_END_OF_INTR_REG, 0); | 375 | musb_writel(reg_base, DA8XX_USB_END_OF_INTR_REG, 0); |
376 | 376 | ||
377 | /* Poll for ID change */ | 377 | /* Poll for ID change */ |
378 | if (musb->xceiv->state == OTG_STATE_B_IDLE) | 378 | if (musb->xceiv->otg->state == OTG_STATE_B_IDLE) |
379 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 379 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
380 | 380 | ||
381 | spin_unlock_irqrestore(&musb->lock, flags); | 381 | spin_unlock_irqrestore(&musb->lock, flags); |
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 04de3aca938d..3c1d9b211b51 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -214,10 +214,10 @@ static void otg_timer(unsigned long _musb) | |||
214 | */ | 214 | */ |
215 | devctl = musb_readb(mregs, MUSB_DEVCTL); | 215 | devctl = musb_readb(mregs, MUSB_DEVCTL); |
216 | dev_dbg(musb->controller, "poll devctl %02x (%s)\n", devctl, | 216 | dev_dbg(musb->controller, "poll devctl %02x (%s)\n", devctl, |
217 | usb_otg_state_string(musb->xceiv->state)); | 217 | usb_otg_state_string(musb->xceiv->otg->state)); |
218 | 218 | ||
219 | spin_lock_irqsave(&musb->lock, flags); | 219 | spin_lock_irqsave(&musb->lock, flags); |
220 | switch (musb->xceiv->state) { | 220 | switch (musb->xceiv->otg->state) { |
221 | case OTG_STATE_A_WAIT_VFALL: | 221 | case OTG_STATE_A_WAIT_VFALL: |
222 | /* Wait till VBUS falls below SessionEnd (~0.2V); the 1.3 RTL | 222 | /* Wait till VBUS falls below SessionEnd (~0.2V); the 1.3 RTL |
223 | * seems to mis-handle session "start" otherwise (or in our | 223 | * seems to mis-handle session "start" otherwise (or in our |
@@ -228,7 +228,7 @@ static void otg_timer(unsigned long _musb) | |||
228 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 228 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
229 | break; | 229 | break; |
230 | } | 230 | } |
231 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 231 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
232 | musb_writel(musb->ctrl_base, DAVINCI_USB_INT_SET_REG, | 232 | musb_writel(musb->ctrl_base, DAVINCI_USB_INT_SET_REG, |
233 | MUSB_INTR_VBUSERROR << DAVINCI_USB_USBINT_SHIFT); | 233 | MUSB_INTR_VBUSERROR << DAVINCI_USB_USBINT_SHIFT); |
234 | break; | 234 | break; |
@@ -251,7 +251,7 @@ static void otg_timer(unsigned long _musb) | |||
251 | if (devctl & MUSB_DEVCTL_BDEVICE) | 251 | if (devctl & MUSB_DEVCTL_BDEVICE) |
252 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 252 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
253 | else | 253 | else |
254 | musb->xceiv->state = OTG_STATE_A_IDLE; | 254 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
255 | break; | 255 | break; |
256 | default: | 256 | default: |
257 | break; | 257 | break; |
@@ -325,20 +325,20 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci) | |||
325 | * to stop registering in devctl. | 325 | * to stop registering in devctl. |
326 | */ | 326 | */ |
327 | musb->int_usb &= ~MUSB_INTR_VBUSERROR; | 327 | musb->int_usb &= ~MUSB_INTR_VBUSERROR; |
328 | musb->xceiv->state = OTG_STATE_A_WAIT_VFALL; | 328 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL; |
329 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 329 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
330 | WARNING("VBUS error workaround (delay coming)\n"); | 330 | WARNING("VBUS error workaround (delay coming)\n"); |
331 | } else if (drvvbus) { | 331 | } else if (drvvbus) { |
332 | MUSB_HST_MODE(musb); | 332 | MUSB_HST_MODE(musb); |
333 | otg->default_a = 1; | 333 | otg->default_a = 1; |
334 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 334 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
335 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); | 335 | portstate(musb->port1_status |= USB_PORT_STAT_POWER); |
336 | del_timer(&otg_workaround); | 336 | del_timer(&otg_workaround); |
337 | } else { | 337 | } else { |
338 | musb->is_active = 0; | 338 | musb->is_active = 0; |
339 | MUSB_DEV_MODE(musb); | 339 | MUSB_DEV_MODE(musb); |
340 | otg->default_a = 0; | 340 | otg->default_a = 0; |
341 | musb->xceiv->state = OTG_STATE_B_IDLE; | 341 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
342 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); | 342 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); |
343 | } | 343 | } |
344 | 344 | ||
@@ -348,7 +348,7 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci) | |||
348 | davinci_musb_source_power(musb, drvvbus, 0); | 348 | davinci_musb_source_power(musb, drvvbus, 0); |
349 | dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", | 349 | dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", |
350 | drvvbus ? "on" : "off", | 350 | drvvbus ? "on" : "off", |
351 | usb_otg_state_string(musb->xceiv->state), | 351 | usb_otg_state_string(musb->xceiv->otg->state), |
352 | err ? " ERROR" : "", | 352 | err ? " ERROR" : "", |
353 | devctl); | 353 | devctl); |
354 | retval = IRQ_HANDLED; | 354 | retval = IRQ_HANDLED; |
@@ -361,7 +361,7 @@ static irqreturn_t davinci_musb_interrupt(int irq, void *__hci) | |||
361 | musb_writel(tibase, DAVINCI_USB_EOI_REG, 0); | 361 | musb_writel(tibase, DAVINCI_USB_EOI_REG, 0); |
362 | 362 | ||
363 | /* poll for ID change */ | 363 | /* poll for ID change */ |
364 | if (musb->xceiv->state == OTG_STATE_B_IDLE) | 364 | if (musb->xceiv->otg->state == OTG_STATE_B_IDLE) |
365 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 365 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
366 | 366 | ||
367 | spin_unlock_irqrestore(&musb->lock, flags); | 367 | spin_unlock_irqrestore(&musb->lock, flags); |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index e46e295a383a..df9c5fa2772e 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -360,23 +360,23 @@ static void musb_otg_timer_func(unsigned long data) | |||
360 | unsigned long flags; | 360 | unsigned long flags; |
361 | 361 | ||
362 | spin_lock_irqsave(&musb->lock, flags); | 362 | spin_lock_irqsave(&musb->lock, flags); |
363 | switch (musb->xceiv->state) { | 363 | switch (musb->xceiv->otg->state) { |
364 | case OTG_STATE_B_WAIT_ACON: | 364 | case OTG_STATE_B_WAIT_ACON: |
365 | dev_dbg(musb->controller, "HNP: b_wait_acon timeout; back to b_peripheral\n"); | 365 | dev_dbg(musb->controller, "HNP: b_wait_acon timeout; back to b_peripheral\n"); |
366 | musb_g_disconnect(musb); | 366 | musb_g_disconnect(musb); |
367 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; | 367 | musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; |
368 | musb->is_active = 0; | 368 | musb->is_active = 0; |
369 | break; | 369 | break; |
370 | case OTG_STATE_A_SUSPEND: | 370 | case OTG_STATE_A_SUSPEND: |
371 | case OTG_STATE_A_WAIT_BCON: | 371 | case OTG_STATE_A_WAIT_BCON: |
372 | dev_dbg(musb->controller, "HNP: %s timeout\n", | 372 | dev_dbg(musb->controller, "HNP: %s timeout\n", |
373 | usb_otg_state_string(musb->xceiv->state)); | 373 | usb_otg_state_string(musb->xceiv->otg->state)); |
374 | musb_platform_set_vbus(musb, 0); | 374 | musb_platform_set_vbus(musb, 0); |
375 | musb->xceiv->state = OTG_STATE_A_WAIT_VFALL; | 375 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL; |
376 | break; | 376 | break; |
377 | default: | 377 | default: |
378 | dev_dbg(musb->controller, "HNP: Unhandled mode %s\n", | 378 | dev_dbg(musb->controller, "HNP: Unhandled mode %s\n", |
379 | usb_otg_state_string(musb->xceiv->state)); | 379 | usb_otg_state_string(musb->xceiv->otg->state)); |
380 | } | 380 | } |
381 | spin_unlock_irqrestore(&musb->lock, flags); | 381 | spin_unlock_irqrestore(&musb->lock, flags); |
382 | } | 382 | } |
@@ -391,19 +391,19 @@ void musb_hnp_stop(struct musb *musb) | |||
391 | u8 reg; | 391 | u8 reg; |
392 | 392 | ||
393 | dev_dbg(musb->controller, "HNP: stop from %s\n", | 393 | dev_dbg(musb->controller, "HNP: stop from %s\n", |
394 | usb_otg_state_string(musb->xceiv->state)); | 394 | usb_otg_state_string(musb->xceiv->otg->state)); |
395 | 395 | ||
396 | switch (musb->xceiv->state) { | 396 | switch (musb->xceiv->otg->state) { |
397 | case OTG_STATE_A_PERIPHERAL: | 397 | case OTG_STATE_A_PERIPHERAL: |
398 | musb_g_disconnect(musb); | 398 | musb_g_disconnect(musb); |
399 | dev_dbg(musb->controller, "HNP: back to %s\n", | 399 | dev_dbg(musb->controller, "HNP: back to %s\n", |
400 | usb_otg_state_string(musb->xceiv->state)); | 400 | usb_otg_state_string(musb->xceiv->otg->state)); |
401 | break; | 401 | break; |
402 | case OTG_STATE_B_HOST: | 402 | case OTG_STATE_B_HOST: |
403 | dev_dbg(musb->controller, "HNP: Disabling HR\n"); | 403 | dev_dbg(musb->controller, "HNP: Disabling HR\n"); |
404 | if (hcd) | 404 | if (hcd) |
405 | hcd->self.is_b_host = 0; | 405 | hcd->self.is_b_host = 0; |
406 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; | 406 | musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; |
407 | MUSB_DEV_MODE(musb); | 407 | MUSB_DEV_MODE(musb); |
408 | reg = musb_readb(mbase, MUSB_POWER); | 408 | reg = musb_readb(mbase, MUSB_POWER); |
409 | reg |= MUSB_POWER_SUSPENDM; | 409 | reg |= MUSB_POWER_SUSPENDM; |
@@ -412,7 +412,7 @@ void musb_hnp_stop(struct musb *musb) | |||
412 | break; | 412 | break; |
413 | default: | 413 | default: |
414 | dev_dbg(musb->controller, "HNP: Stopping in unknown state %s\n", | 414 | dev_dbg(musb->controller, "HNP: Stopping in unknown state %s\n", |
415 | usb_otg_state_string(musb->xceiv->state)); | 415 | usb_otg_state_string(musb->xceiv->otg->state)); |
416 | } | 416 | } |
417 | 417 | ||
418 | /* | 418 | /* |
@@ -449,13 +449,13 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
449 | */ | 449 | */ |
450 | if (int_usb & MUSB_INTR_RESUME) { | 450 | if (int_usb & MUSB_INTR_RESUME) { |
451 | handled = IRQ_HANDLED; | 451 | handled = IRQ_HANDLED; |
452 | dev_dbg(musb->controller, "RESUME (%s)\n", usb_otg_state_string(musb->xceiv->state)); | 452 | dev_dbg(musb->controller, "RESUME (%s)\n", usb_otg_state_string(musb->xceiv->otg->state)); |
453 | 453 | ||
454 | if (devctl & MUSB_DEVCTL_HM) { | 454 | if (devctl & MUSB_DEVCTL_HM) { |
455 | void __iomem *mbase = musb->mregs; | 455 | void __iomem *mbase = musb->mregs; |
456 | u8 power; | 456 | u8 power; |
457 | 457 | ||
458 | switch (musb->xceiv->state) { | 458 | switch (musb->xceiv->otg->state) { |
459 | case OTG_STATE_A_SUSPEND: | 459 | case OTG_STATE_A_SUSPEND: |
460 | /* remote wakeup? later, GetPortStatus | 460 | /* remote wakeup? later, GetPortStatus |
461 | * will stop RESUME signaling | 461 | * will stop RESUME signaling |
@@ -482,25 +482,25 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
482 | &musb->finish_resume_work, | 482 | &musb->finish_resume_work, |
483 | msecs_to_jiffies(20)); | 483 | msecs_to_jiffies(20)); |
484 | 484 | ||
485 | musb->xceiv->state = OTG_STATE_A_HOST; | 485 | musb->xceiv->otg->state = OTG_STATE_A_HOST; |
486 | musb->is_active = 1; | 486 | musb->is_active = 1; |
487 | musb_host_resume_root_hub(musb); | 487 | musb_host_resume_root_hub(musb); |
488 | break; | 488 | break; |
489 | case OTG_STATE_B_WAIT_ACON: | 489 | case OTG_STATE_B_WAIT_ACON: |
490 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; | 490 | musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; |
491 | musb->is_active = 1; | 491 | musb->is_active = 1; |
492 | MUSB_DEV_MODE(musb); | 492 | MUSB_DEV_MODE(musb); |
493 | break; | 493 | break; |
494 | default: | 494 | default: |
495 | WARNING("bogus %s RESUME (%s)\n", | 495 | WARNING("bogus %s RESUME (%s)\n", |
496 | "host", | 496 | "host", |
497 | usb_otg_state_string(musb->xceiv->state)); | 497 | usb_otg_state_string(musb->xceiv->otg->state)); |
498 | } | 498 | } |
499 | } else { | 499 | } else { |
500 | switch (musb->xceiv->state) { | 500 | switch (musb->xceiv->otg->state) { |
501 | case OTG_STATE_A_SUSPEND: | 501 | case OTG_STATE_A_SUSPEND: |
502 | /* possibly DISCONNECT is upcoming */ | 502 | /* possibly DISCONNECT is upcoming */ |
503 | musb->xceiv->state = OTG_STATE_A_HOST; | 503 | musb->xceiv->otg->state = OTG_STATE_A_HOST; |
504 | musb_host_resume_root_hub(musb); | 504 | musb_host_resume_root_hub(musb); |
505 | break; | 505 | break; |
506 | case OTG_STATE_B_WAIT_ACON: | 506 | case OTG_STATE_B_WAIT_ACON: |
@@ -523,7 +523,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
523 | default: | 523 | default: |
524 | WARNING("bogus %s RESUME (%s)\n", | 524 | WARNING("bogus %s RESUME (%s)\n", |
525 | "peripheral", | 525 | "peripheral", |
526 | usb_otg_state_string(musb->xceiv->state)); | 526 | usb_otg_state_string(musb->xceiv->otg->state)); |
527 | } | 527 | } |
528 | } | 528 | } |
529 | } | 529 | } |
@@ -539,7 +539,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
539 | } | 539 | } |
540 | 540 | ||
541 | dev_dbg(musb->controller, "SESSION_REQUEST (%s)\n", | 541 | dev_dbg(musb->controller, "SESSION_REQUEST (%s)\n", |
542 | usb_otg_state_string(musb->xceiv->state)); | 542 | usb_otg_state_string(musb->xceiv->otg->state)); |
543 | 543 | ||
544 | /* IRQ arrives from ID pin sense or (later, if VBUS power | 544 | /* IRQ arrives from ID pin sense or (later, if VBUS power |
545 | * is removed) SRP. responses are time critical: | 545 | * is removed) SRP. responses are time critical: |
@@ -550,7 +550,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
550 | */ | 550 | */ |
551 | musb_writeb(mbase, MUSB_DEVCTL, MUSB_DEVCTL_SESSION); | 551 | musb_writeb(mbase, MUSB_DEVCTL, MUSB_DEVCTL_SESSION); |
552 | musb->ep0_stage = MUSB_EP0_START; | 552 | musb->ep0_stage = MUSB_EP0_START; |
553 | musb->xceiv->state = OTG_STATE_A_IDLE; | 553 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
554 | MUSB_HST_MODE(musb); | 554 | MUSB_HST_MODE(musb); |
555 | musb_platform_set_vbus(musb, 1); | 555 | musb_platform_set_vbus(musb, 1); |
556 | 556 | ||
@@ -576,7 +576,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
576 | * REVISIT: do delays from lots of DEBUG_KERNEL checks | 576 | * REVISIT: do delays from lots of DEBUG_KERNEL checks |
577 | * make trouble here, keeping VBUS < 4.4V ? | 577 | * make trouble here, keeping VBUS < 4.4V ? |
578 | */ | 578 | */ |
579 | switch (musb->xceiv->state) { | 579 | switch (musb->xceiv->otg->state) { |
580 | case OTG_STATE_A_HOST: | 580 | case OTG_STATE_A_HOST: |
581 | /* recovery is dicey once we've gotten past the | 581 | /* recovery is dicey once we've gotten past the |
582 | * initial stages of enumeration, but if VBUS | 582 | * initial stages of enumeration, but if VBUS |
@@ -605,7 +605,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
605 | 605 | ||
606 | dev_printk(ignore ? KERN_DEBUG : KERN_ERR, musb->controller, | 606 | dev_printk(ignore ? KERN_DEBUG : KERN_ERR, musb->controller, |
607 | "VBUS_ERROR in %s (%02x, %s), retry #%d, port1 %08x\n", | 607 | "VBUS_ERROR in %s (%02x, %s), retry #%d, port1 %08x\n", |
608 | usb_otg_state_string(musb->xceiv->state), | 608 | usb_otg_state_string(musb->xceiv->otg->state), |
609 | devctl, | 609 | devctl, |
610 | ({ char *s; | 610 | ({ char *s; |
611 | switch (devctl & MUSB_DEVCTL_VBUS) { | 611 | switch (devctl & MUSB_DEVCTL_VBUS) { |
@@ -630,10 +630,10 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
630 | 630 | ||
631 | if (int_usb & MUSB_INTR_SUSPEND) { | 631 | if (int_usb & MUSB_INTR_SUSPEND) { |
632 | dev_dbg(musb->controller, "SUSPEND (%s) devctl %02x\n", | 632 | dev_dbg(musb->controller, "SUSPEND (%s) devctl %02x\n", |
633 | usb_otg_state_string(musb->xceiv->state), devctl); | 633 | usb_otg_state_string(musb->xceiv->otg->state), devctl); |
634 | handled = IRQ_HANDLED; | 634 | handled = IRQ_HANDLED; |
635 | 635 | ||
636 | switch (musb->xceiv->state) { | 636 | switch (musb->xceiv->otg->state) { |
637 | case OTG_STATE_A_PERIPHERAL: | 637 | case OTG_STATE_A_PERIPHERAL: |
638 | /* We also come here if the cable is removed, since | 638 | /* We also come here if the cable is removed, since |
639 | * this silicon doesn't report ID-no-longer-grounded. | 639 | * this silicon doesn't report ID-no-longer-grounded. |
@@ -657,7 +657,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
657 | musb_g_suspend(musb); | 657 | musb_g_suspend(musb); |
658 | musb->is_active = musb->g.b_hnp_enable; | 658 | musb->is_active = musb->g.b_hnp_enable; |
659 | if (musb->is_active) { | 659 | if (musb->is_active) { |
660 | musb->xceiv->state = OTG_STATE_B_WAIT_ACON; | 660 | musb->xceiv->otg->state = OTG_STATE_B_WAIT_ACON; |
661 | dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n"); | 661 | dev_dbg(musb->controller, "HNP: Setting timer for b_ase0_brst\n"); |
662 | mod_timer(&musb->otg_timer, jiffies | 662 | mod_timer(&musb->otg_timer, jiffies |
663 | + msecs_to_jiffies( | 663 | + msecs_to_jiffies( |
@@ -670,7 +670,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
670 | + msecs_to_jiffies(musb->a_wait_bcon)); | 670 | + msecs_to_jiffies(musb->a_wait_bcon)); |
671 | break; | 671 | break; |
672 | case OTG_STATE_A_HOST: | 672 | case OTG_STATE_A_HOST: |
673 | musb->xceiv->state = OTG_STATE_A_SUSPEND; | 673 | musb->xceiv->otg->state = OTG_STATE_A_SUSPEND; |
674 | musb->is_active = musb->hcd->self.b_hnp_enable; | 674 | musb->is_active = musb->hcd->self.b_hnp_enable; |
675 | break; | 675 | break; |
676 | case OTG_STATE_B_HOST: | 676 | case OTG_STATE_B_HOST: |
@@ -713,7 +713,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
713 | musb->port1_status |= USB_PORT_STAT_LOW_SPEED; | 713 | musb->port1_status |= USB_PORT_STAT_LOW_SPEED; |
714 | 714 | ||
715 | /* indicate new connection to OTG machine */ | 715 | /* indicate new connection to OTG machine */ |
716 | switch (musb->xceiv->state) { | 716 | switch (musb->xceiv->otg->state) { |
717 | case OTG_STATE_B_PERIPHERAL: | 717 | case OTG_STATE_B_PERIPHERAL: |
718 | if (int_usb & MUSB_INTR_SUSPEND) { | 718 | if (int_usb & MUSB_INTR_SUSPEND) { |
719 | dev_dbg(musb->controller, "HNP: SUSPEND+CONNECT, now b_host\n"); | 719 | dev_dbg(musb->controller, "HNP: SUSPEND+CONNECT, now b_host\n"); |
@@ -725,7 +725,7 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 int_usb, | |||
725 | case OTG_STATE_B_WAIT_ACON: | 725 | case OTG_STATE_B_WAIT_ACON: |
726 | dev_dbg(musb->controller, "HNP: CONNECT, now b_host\n"); | 726 | dev_dbg(musb->controller, "HNP: CONNECT, now b_host\n"); |
727 | b_host: | 727 | b_host: |
728 | musb->xceiv->state = OTG_STATE_B_HOST; | 728 | musb->xceiv->otg->state = OTG_STATE_B_HOST; |
729 | if (musb->hcd) | 729 | if (musb->hcd) |
730 | musb->hcd->self.is_b_host = 1; | 730 | musb->hcd->self.is_b_host = 1; |
731 | del_timer(&musb->otg_timer); | 731 | del_timer(&musb->otg_timer); |
@@ -733,7 +733,7 @@ b_host: | |||
733 | default: | 733 | default: |
734 | if ((devctl & MUSB_DEVCTL_VBUS) | 734 | if ((devctl & MUSB_DEVCTL_VBUS) |
735 | == (3 << MUSB_DEVCTL_VBUS_SHIFT)) { | 735 | == (3 << MUSB_DEVCTL_VBUS_SHIFT)) { |
736 | musb->xceiv->state = OTG_STATE_A_HOST; | 736 | musb->xceiv->otg->state = OTG_STATE_A_HOST; |
737 | if (hcd) | 737 | if (hcd) |
738 | hcd->self.is_b_host = 0; | 738 | hcd->self.is_b_host = 0; |
739 | } | 739 | } |
@@ -743,16 +743,16 @@ b_host: | |||
743 | musb_host_poke_root_hub(musb); | 743 | musb_host_poke_root_hub(musb); |
744 | 744 | ||
745 | dev_dbg(musb->controller, "CONNECT (%s) devctl %02x\n", | 745 | dev_dbg(musb->controller, "CONNECT (%s) devctl %02x\n", |
746 | usb_otg_state_string(musb->xceiv->state), devctl); | 746 | usb_otg_state_string(musb->xceiv->otg->state), devctl); |
747 | } | 747 | } |
748 | 748 | ||
749 | if (int_usb & MUSB_INTR_DISCONNECT) { | 749 | if (int_usb & MUSB_INTR_DISCONNECT) { |
750 | dev_dbg(musb->controller, "DISCONNECT (%s) as %s, devctl %02x\n", | 750 | dev_dbg(musb->controller, "DISCONNECT (%s) as %s, devctl %02x\n", |
751 | usb_otg_state_string(musb->xceiv->state), | 751 | usb_otg_state_string(musb->xceiv->otg->state), |
752 | MUSB_MODE(musb), devctl); | 752 | MUSB_MODE(musb), devctl); |
753 | handled = IRQ_HANDLED; | 753 | handled = IRQ_HANDLED; |
754 | 754 | ||
755 | switch (musb->xceiv->state) { | 755 | switch (musb->xceiv->otg->state) { |
756 | case OTG_STATE_A_HOST: | 756 | case OTG_STATE_A_HOST: |
757 | case OTG_STATE_A_SUSPEND: | 757 | case OTG_STATE_A_SUSPEND: |
758 | musb_host_resume_root_hub(musb); | 758 | musb_host_resume_root_hub(musb); |
@@ -770,7 +770,7 @@ b_host: | |||
770 | musb_root_disconnect(musb); | 770 | musb_root_disconnect(musb); |
771 | if (musb->hcd) | 771 | if (musb->hcd) |
772 | musb->hcd->self.is_b_host = 0; | 772 | musb->hcd->self.is_b_host = 0; |
773 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; | 773 | musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; |
774 | MUSB_DEV_MODE(musb); | 774 | MUSB_DEV_MODE(musb); |
775 | musb_g_disconnect(musb); | 775 | musb_g_disconnect(musb); |
776 | break; | 776 | break; |
@@ -786,7 +786,7 @@ b_host: | |||
786 | break; | 786 | break; |
787 | default: | 787 | default: |
788 | WARNING("unhandled DISCONNECT transition (%s)\n", | 788 | WARNING("unhandled DISCONNECT transition (%s)\n", |
789 | usb_otg_state_string(musb->xceiv->state)); | 789 | usb_otg_state_string(musb->xceiv->otg->state)); |
790 | break; | 790 | break; |
791 | } | 791 | } |
792 | } | 792 | } |
@@ -812,15 +812,15 @@ b_host: | |||
812 | } | 812 | } |
813 | } else { | 813 | } else { |
814 | dev_dbg(musb->controller, "BUS RESET as %s\n", | 814 | dev_dbg(musb->controller, "BUS RESET as %s\n", |
815 | usb_otg_state_string(musb->xceiv->state)); | 815 | usb_otg_state_string(musb->xceiv->otg->state)); |
816 | switch (musb->xceiv->state) { | 816 | switch (musb->xceiv->otg->state) { |
817 | case OTG_STATE_A_SUSPEND: | 817 | case OTG_STATE_A_SUSPEND: |
818 | musb_g_reset(musb); | 818 | musb_g_reset(musb); |
819 | /* FALLTHROUGH */ | 819 | /* FALLTHROUGH */ |
820 | case OTG_STATE_A_WAIT_BCON: /* OPT TD.4.7-900ms */ | 820 | case OTG_STATE_A_WAIT_BCON: /* OPT TD.4.7-900ms */ |
821 | /* never use invalid T(a_wait_bcon) */ | 821 | /* never use invalid T(a_wait_bcon) */ |
822 | dev_dbg(musb->controller, "HNP: in %s, %d msec timeout\n", | 822 | dev_dbg(musb->controller, "HNP: in %s, %d msec timeout\n", |
823 | usb_otg_state_string(musb->xceiv->state), | 823 | usb_otg_state_string(musb->xceiv->otg->state), |
824 | TA_WAIT_BCON(musb)); | 824 | TA_WAIT_BCON(musb)); |
825 | mod_timer(&musb->otg_timer, jiffies | 825 | mod_timer(&musb->otg_timer, jiffies |
826 | + msecs_to_jiffies(TA_WAIT_BCON(musb))); | 826 | + msecs_to_jiffies(TA_WAIT_BCON(musb))); |
@@ -831,19 +831,19 @@ b_host: | |||
831 | break; | 831 | break; |
832 | case OTG_STATE_B_WAIT_ACON: | 832 | case OTG_STATE_B_WAIT_ACON: |
833 | dev_dbg(musb->controller, "HNP: RESET (%s), to b_peripheral\n", | 833 | dev_dbg(musb->controller, "HNP: RESET (%s), to b_peripheral\n", |
834 | usb_otg_state_string(musb->xceiv->state)); | 834 | usb_otg_state_string(musb->xceiv->otg->state)); |
835 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; | 835 | musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; |
836 | musb_g_reset(musb); | 836 | musb_g_reset(musb); |
837 | break; | 837 | break; |
838 | case OTG_STATE_B_IDLE: | 838 | case OTG_STATE_B_IDLE: |
839 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; | 839 | musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; |
840 | /* FALLTHROUGH */ | 840 | /* FALLTHROUGH */ |
841 | case OTG_STATE_B_PERIPHERAL: | 841 | case OTG_STATE_B_PERIPHERAL: |
842 | musb_g_reset(musb); | 842 | musb_g_reset(musb); |
843 | break; | 843 | break; |
844 | default: | 844 | default: |
845 | dev_dbg(musb->controller, "Unhandled BUS RESET as %s\n", | 845 | dev_dbg(musb->controller, "Unhandled BUS RESET as %s\n", |
846 | usb_otg_state_string(musb->xceiv->state)); | 846 | usb_otg_state_string(musb->xceiv->otg->state)); |
847 | } | 847 | } |
848 | } | 848 | } |
849 | } | 849 | } |
@@ -1630,7 +1630,7 @@ musb_mode_show(struct device *dev, struct device_attribute *attr, char *buf) | |||
1630 | int ret = -EINVAL; | 1630 | int ret = -EINVAL; |
1631 | 1631 | ||
1632 | spin_lock_irqsave(&musb->lock, flags); | 1632 | spin_lock_irqsave(&musb->lock, flags); |
1633 | ret = sprintf(buf, "%s\n", usb_otg_state_string(musb->xceiv->state)); | 1633 | ret = sprintf(buf, "%s\n", usb_otg_state_string(musb->xceiv->otg->state)); |
1634 | spin_unlock_irqrestore(&musb->lock, flags); | 1634 | spin_unlock_irqrestore(&musb->lock, flags); |
1635 | 1635 | ||
1636 | return ret; | 1636 | return ret; |
@@ -1675,7 +1675,7 @@ musb_vbus_store(struct device *dev, struct device_attribute *attr, | |||
1675 | spin_lock_irqsave(&musb->lock, flags); | 1675 | spin_lock_irqsave(&musb->lock, flags); |
1676 | /* force T(a_wait_bcon) to be zero/unlimited *OR* valid */ | 1676 | /* force T(a_wait_bcon) to be zero/unlimited *OR* valid */ |
1677 | musb->a_wait_bcon = val ? max_t(int, val, OTG_TIME_A_WAIT_BCON) : 0 ; | 1677 | musb->a_wait_bcon = val ? max_t(int, val, OTG_TIME_A_WAIT_BCON) : 0 ; |
1678 | if (musb->xceiv->state == OTG_STATE_A_WAIT_BCON) | 1678 | if (musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON) |
1679 | musb->is_active = 0; | 1679 | musb->is_active = 0; |
1680 | musb_platform_try_idle(musb, jiffies + msecs_to_jiffies(val)); | 1680 | musb_platform_try_idle(musb, jiffies + msecs_to_jiffies(val)); |
1681 | spin_unlock_irqrestore(&musb->lock, flags); | 1681 | spin_unlock_irqrestore(&musb->lock, flags); |
@@ -1743,8 +1743,8 @@ static void musb_irq_work(struct work_struct *data) | |||
1743 | { | 1743 | { |
1744 | struct musb *musb = container_of(data, struct musb, irq_work); | 1744 | struct musb *musb = container_of(data, struct musb, irq_work); |
1745 | 1745 | ||
1746 | if (musb->xceiv->state != musb->xceiv_old_state) { | 1746 | if (musb->xceiv->otg->state != musb->xceiv_old_state) { |
1747 | musb->xceiv_old_state = musb->xceiv->state; | 1747 | musb->xceiv_old_state = musb->xceiv->otg->state; |
1748 | sysfs_notify(&musb->controller->kobj, NULL, "mode"); | 1748 | sysfs_notify(&musb->controller->kobj, NULL, "mode"); |
1749 | } | 1749 | } |
1750 | } | 1750 | } |
@@ -1983,10 +1983,10 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) | |||
1983 | 1983 | ||
1984 | if (musb->xceiv->otg->default_a) { | 1984 | if (musb->xceiv->otg->default_a) { |
1985 | MUSB_HST_MODE(musb); | 1985 | MUSB_HST_MODE(musb); |
1986 | musb->xceiv->state = OTG_STATE_A_IDLE; | 1986 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
1987 | } else { | 1987 | } else { |
1988 | MUSB_DEV_MODE(musb); | 1988 | MUSB_DEV_MODE(musb); |
1989 | musb->xceiv->state = OTG_STATE_B_IDLE; | 1989 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
1990 | } | 1990 | } |
1991 | 1991 | ||
1992 | switch (musb->port_mode) { | 1992 | switch (musb->port_mode) { |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 759ef1d236b2..440333fcf3a7 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -179,9 +179,9 @@ static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout) | |||
179 | 179 | ||
180 | /* Never idle if active, or when VBUS timeout is not set as host */ | 180 | /* Never idle if active, or when VBUS timeout is not set as host */ |
181 | if (musb->is_active || (musb->a_wait_bcon == 0 && | 181 | if (musb->is_active || (musb->a_wait_bcon == 0 && |
182 | musb->xceiv->state == OTG_STATE_A_WAIT_BCON)) { | 182 | musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON)) { |
183 | dev_dbg(musb->controller, "%s active, deleting timer\n", | 183 | dev_dbg(musb->controller, "%s active, deleting timer\n", |
184 | usb_otg_state_string(musb->xceiv->state)); | 184 | usb_otg_state_string(musb->xceiv->otg->state)); |
185 | del_timer(&glue->timer); | 185 | del_timer(&glue->timer); |
186 | glue->last_timer = jiffies; | 186 | glue->last_timer = jiffies; |
187 | return; | 187 | return; |
@@ -201,7 +201,7 @@ static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout) | |||
201 | glue->last_timer = timeout; | 201 | glue->last_timer = timeout; |
202 | 202 | ||
203 | dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n", | 203 | dev_dbg(musb->controller, "%s inactive, starting idle timer for %u ms\n", |
204 | usb_otg_state_string(musb->xceiv->state), | 204 | usb_otg_state_string(musb->xceiv->otg->state), |
205 | jiffies_to_msecs(timeout - jiffies)); | 205 | jiffies_to_msecs(timeout - jiffies)); |
206 | mod_timer(&glue->timer, timeout); | 206 | mod_timer(&glue->timer, timeout); |
207 | } | 207 | } |
@@ -265,10 +265,10 @@ static void otg_timer(unsigned long _musb) | |||
265 | */ | 265 | */ |
266 | devctl = dsps_readb(mregs, MUSB_DEVCTL); | 266 | devctl = dsps_readb(mregs, MUSB_DEVCTL); |
267 | dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, | 267 | dev_dbg(musb->controller, "Poll devctl %02x (%s)\n", devctl, |
268 | usb_otg_state_string(musb->xceiv->state)); | 268 | usb_otg_state_string(musb->xceiv->otg->state)); |
269 | 269 | ||
270 | spin_lock_irqsave(&musb->lock, flags); | 270 | spin_lock_irqsave(&musb->lock, flags); |
271 | switch (musb->xceiv->state) { | 271 | switch (musb->xceiv->otg->state) { |
272 | case OTG_STATE_A_WAIT_BCON: | 272 | case OTG_STATE_A_WAIT_BCON: |
273 | dsps_writeb(musb->mregs, MUSB_DEVCTL, 0); | 273 | dsps_writeb(musb->mregs, MUSB_DEVCTL, 0); |
274 | skip_session = 1; | 274 | skip_session = 1; |
@@ -277,10 +277,10 @@ static void otg_timer(unsigned long _musb) | |||
277 | case OTG_STATE_A_IDLE: | 277 | case OTG_STATE_A_IDLE: |
278 | case OTG_STATE_B_IDLE: | 278 | case OTG_STATE_B_IDLE: |
279 | if (devctl & MUSB_DEVCTL_BDEVICE) { | 279 | if (devctl & MUSB_DEVCTL_BDEVICE) { |
280 | musb->xceiv->state = OTG_STATE_B_IDLE; | 280 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
281 | MUSB_DEV_MODE(musb); | 281 | MUSB_DEV_MODE(musb); |
282 | } else { | 282 | } else { |
283 | musb->xceiv->state = OTG_STATE_A_IDLE; | 283 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
284 | MUSB_HST_MODE(musb); | 284 | MUSB_HST_MODE(musb); |
285 | } | 285 | } |
286 | if (!(devctl & MUSB_DEVCTL_SESSION) && !skip_session) | 286 | if (!(devctl & MUSB_DEVCTL_SESSION) && !skip_session) |
@@ -288,7 +288,7 @@ static void otg_timer(unsigned long _musb) | |||
288 | mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); | 288 | mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); |
289 | break; | 289 | break; |
290 | case OTG_STATE_A_WAIT_VFALL: | 290 | case OTG_STATE_A_WAIT_VFALL: |
291 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 291 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
292 | dsps_writel(musb->ctrl_base, wrp->coreintr_set, | 292 | dsps_writel(musb->ctrl_base, wrp->coreintr_set, |
293 | MUSB_INTR_VBUSERROR << wrp->usb_shift); | 293 | MUSB_INTR_VBUSERROR << wrp->usb_shift); |
294 | break; | 294 | break; |
@@ -373,26 +373,26 @@ static irqreturn_t dsps_interrupt(int irq, void *hci) | |||
373 | * devctl. | 373 | * devctl. |
374 | */ | 374 | */ |
375 | musb->int_usb &= ~MUSB_INTR_VBUSERROR; | 375 | musb->int_usb &= ~MUSB_INTR_VBUSERROR; |
376 | musb->xceiv->state = OTG_STATE_A_WAIT_VFALL; | 376 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL; |
377 | mod_timer(&glue->timer, | 377 | mod_timer(&glue->timer, |
378 | jiffies + wrp->poll_seconds * HZ); | 378 | jiffies + wrp->poll_seconds * HZ); |
379 | WARNING("VBUS error workaround (delay coming)\n"); | 379 | WARNING("VBUS error workaround (delay coming)\n"); |
380 | } else if (drvvbus) { | 380 | } else if (drvvbus) { |
381 | MUSB_HST_MODE(musb); | 381 | MUSB_HST_MODE(musb); |
382 | musb->xceiv->otg->default_a = 1; | 382 | musb->xceiv->otg->default_a = 1; |
383 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 383 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
384 | del_timer(&glue->timer); | 384 | del_timer(&glue->timer); |
385 | } else { | 385 | } else { |
386 | musb->is_active = 0; | 386 | musb->is_active = 0; |
387 | MUSB_DEV_MODE(musb); | 387 | MUSB_DEV_MODE(musb); |
388 | musb->xceiv->otg->default_a = 0; | 388 | musb->xceiv->otg->default_a = 0; |
389 | musb->xceiv->state = OTG_STATE_B_IDLE; | 389 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
390 | } | 390 | } |
391 | 391 | ||
392 | /* NOTE: this must complete power-on within 100 ms. */ | 392 | /* NOTE: this must complete power-on within 100 ms. */ |
393 | dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", | 393 | dev_dbg(musb->controller, "VBUS %s (%s)%s, devctl %02x\n", |
394 | drvvbus ? "on" : "off", | 394 | drvvbus ? "on" : "off", |
395 | usb_otg_state_string(musb->xceiv->state), | 395 | usb_otg_state_string(musb->xceiv->otg->state), |
396 | err ? " ERROR" : "", | 396 | err ? " ERROR" : "", |
397 | devctl); | 397 | devctl); |
398 | ret = IRQ_HANDLED; | 398 | ret = IRQ_HANDLED; |
@@ -402,7 +402,7 @@ static irqreturn_t dsps_interrupt(int irq, void *hci) | |||
402 | ret |= musb_interrupt(musb); | 402 | ret |= musb_interrupt(musb); |
403 | 403 | ||
404 | /* Poll for ID change in OTG port mode */ | 404 | /* Poll for ID change in OTG port mode */ |
405 | if (musb->xceiv->state == OTG_STATE_B_IDLE && | 405 | if (musb->xceiv->otg->state == OTG_STATE_B_IDLE && |
406 | musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) | 406 | musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) |
407 | mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); | 407 | mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); |
408 | out: | 408 | out: |
@@ -900,7 +900,7 @@ static int dsps_resume(struct device *dev) | |||
900 | dsps_writel(mbase, wrp->mode, glue->context.mode); | 900 | dsps_writel(mbase, wrp->mode, glue->context.mode); |
901 | dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode); | 901 | dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode); |
902 | dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode); | 902 | dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode); |
903 | if (musb->xceiv->state == OTG_STATE_B_IDLE && | 903 | if (musb->xceiv->otg->state == OTG_STATE_B_IDLE && |
904 | musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) | 904 | musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) |
905 | mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); | 905 | mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); |
906 | 906 | ||
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 4ab1896957e1..56c31b769a54 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -1546,7 +1546,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget) | |||
1546 | 1546 | ||
1547 | spin_lock_irqsave(&musb->lock, flags); | 1547 | spin_lock_irqsave(&musb->lock, flags); |
1548 | 1548 | ||
1549 | switch (musb->xceiv->state) { | 1549 | switch (musb->xceiv->otg->state) { |
1550 | case OTG_STATE_B_PERIPHERAL: | 1550 | case OTG_STATE_B_PERIPHERAL: |
1551 | /* NOTE: OTG state machine doesn't include B_SUSPENDED; | 1551 | /* NOTE: OTG state machine doesn't include B_SUSPENDED; |
1552 | * that's part of the standard usb 1.1 state machine, and | 1552 | * that's part of the standard usb 1.1 state machine, and |
@@ -1587,7 +1587,7 @@ static int musb_gadget_wakeup(struct usb_gadget *gadget) | |||
1587 | goto done; | 1587 | goto done; |
1588 | default: | 1588 | default: |
1589 | dev_dbg(musb->controller, "Unhandled wake: %s\n", | 1589 | dev_dbg(musb->controller, "Unhandled wake: %s\n", |
1590 | usb_otg_state_string(musb->xceiv->state)); | 1590 | usb_otg_state_string(musb->xceiv->otg->state)); |
1591 | goto done; | 1591 | goto done; |
1592 | } | 1592 | } |
1593 | 1593 | ||
@@ -1791,7 +1791,7 @@ int musb_gadget_setup(struct musb *musb) | |||
1791 | 1791 | ||
1792 | MUSB_DEV_MODE(musb); | 1792 | MUSB_DEV_MODE(musb); |
1793 | musb->xceiv->otg->default_a = 0; | 1793 | musb->xceiv->otg->default_a = 0; |
1794 | musb->xceiv->state = OTG_STATE_B_IDLE; | 1794 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
1795 | 1795 | ||
1796 | /* this "gadget" abstracts/virtualizes the controller */ | 1796 | /* this "gadget" abstracts/virtualizes the controller */ |
1797 | musb->g.name = musb_driver_name; | 1797 | musb->g.name = musb_driver_name; |
@@ -1857,7 +1857,7 @@ static int musb_gadget_start(struct usb_gadget *g, | |||
1857 | musb->is_active = 1; | 1857 | musb->is_active = 1; |
1858 | 1858 | ||
1859 | otg_set_peripheral(otg, &musb->g); | 1859 | otg_set_peripheral(otg, &musb->g); |
1860 | musb->xceiv->state = OTG_STATE_B_IDLE; | 1860 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
1861 | spin_unlock_irqrestore(&musb->lock, flags); | 1861 | spin_unlock_irqrestore(&musb->lock, flags); |
1862 | 1862 | ||
1863 | musb_start(musb); | 1863 | musb_start(musb); |
@@ -1941,7 +1941,7 @@ static int musb_gadget_stop(struct usb_gadget *g) | |||
1941 | 1941 | ||
1942 | (void) musb_gadget_vbus_draw(&musb->g, 0); | 1942 | (void) musb_gadget_vbus_draw(&musb->g, 0); |
1943 | 1943 | ||
1944 | musb->xceiv->state = OTG_STATE_UNDEFINED; | 1944 | musb->xceiv->otg->state = OTG_STATE_UNDEFINED; |
1945 | stop_activity(musb, NULL); | 1945 | stop_activity(musb, NULL); |
1946 | otg_set_peripheral(musb->xceiv->otg, NULL); | 1946 | otg_set_peripheral(musb->xceiv->otg, NULL); |
1947 | 1947 | ||
@@ -1968,7 +1968,7 @@ static int musb_gadget_stop(struct usb_gadget *g) | |||
1968 | void musb_g_resume(struct musb *musb) | 1968 | void musb_g_resume(struct musb *musb) |
1969 | { | 1969 | { |
1970 | musb->is_suspended = 0; | 1970 | musb->is_suspended = 0; |
1971 | switch (musb->xceiv->state) { | 1971 | switch (musb->xceiv->otg->state) { |
1972 | case OTG_STATE_B_IDLE: | 1972 | case OTG_STATE_B_IDLE: |
1973 | break; | 1973 | break; |
1974 | case OTG_STATE_B_WAIT_ACON: | 1974 | case OTG_STATE_B_WAIT_ACON: |
@@ -1982,7 +1982,7 @@ void musb_g_resume(struct musb *musb) | |||
1982 | break; | 1982 | break; |
1983 | default: | 1983 | default: |
1984 | WARNING("unhandled RESUME transition (%s)\n", | 1984 | WARNING("unhandled RESUME transition (%s)\n", |
1985 | usb_otg_state_string(musb->xceiv->state)); | 1985 | usb_otg_state_string(musb->xceiv->otg->state)); |
1986 | } | 1986 | } |
1987 | } | 1987 | } |
1988 | 1988 | ||
@@ -1994,10 +1994,10 @@ void musb_g_suspend(struct musb *musb) | |||
1994 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | 1994 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); |
1995 | dev_dbg(musb->controller, "devctl %02x\n", devctl); | 1995 | dev_dbg(musb->controller, "devctl %02x\n", devctl); |
1996 | 1996 | ||
1997 | switch (musb->xceiv->state) { | 1997 | switch (musb->xceiv->otg->state) { |
1998 | case OTG_STATE_B_IDLE: | 1998 | case OTG_STATE_B_IDLE: |
1999 | if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) | 1999 | if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) |
2000 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; | 2000 | musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; |
2001 | break; | 2001 | break; |
2002 | case OTG_STATE_B_PERIPHERAL: | 2002 | case OTG_STATE_B_PERIPHERAL: |
2003 | musb->is_suspended = 1; | 2003 | musb->is_suspended = 1; |
@@ -2012,7 +2012,7 @@ void musb_g_suspend(struct musb *musb) | |||
2012 | * A_PERIPHERAL may need care too | 2012 | * A_PERIPHERAL may need care too |
2013 | */ | 2013 | */ |
2014 | WARNING("unhandled SUSPEND transition (%s)\n", | 2014 | WARNING("unhandled SUSPEND transition (%s)\n", |
2015 | usb_otg_state_string(musb->xceiv->state)); | 2015 | usb_otg_state_string(musb->xceiv->otg->state)); |
2016 | } | 2016 | } |
2017 | } | 2017 | } |
2018 | 2018 | ||
@@ -2043,22 +2043,22 @@ void musb_g_disconnect(struct musb *musb) | |||
2043 | spin_lock(&musb->lock); | 2043 | spin_lock(&musb->lock); |
2044 | } | 2044 | } |
2045 | 2045 | ||
2046 | switch (musb->xceiv->state) { | 2046 | switch (musb->xceiv->otg->state) { |
2047 | default: | 2047 | default: |
2048 | dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n", | 2048 | dev_dbg(musb->controller, "Unhandled disconnect %s, setting a_idle\n", |
2049 | usb_otg_state_string(musb->xceiv->state)); | 2049 | usb_otg_state_string(musb->xceiv->otg->state)); |
2050 | musb->xceiv->state = OTG_STATE_A_IDLE; | 2050 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
2051 | MUSB_HST_MODE(musb); | 2051 | MUSB_HST_MODE(musb); |
2052 | break; | 2052 | break; |
2053 | case OTG_STATE_A_PERIPHERAL: | 2053 | case OTG_STATE_A_PERIPHERAL: |
2054 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; | 2054 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; |
2055 | MUSB_HST_MODE(musb); | 2055 | MUSB_HST_MODE(musb); |
2056 | break; | 2056 | break; |
2057 | case OTG_STATE_B_WAIT_ACON: | 2057 | case OTG_STATE_B_WAIT_ACON: |
2058 | case OTG_STATE_B_HOST: | 2058 | case OTG_STATE_B_HOST: |
2059 | case OTG_STATE_B_PERIPHERAL: | 2059 | case OTG_STATE_B_PERIPHERAL: |
2060 | case OTG_STATE_B_IDLE: | 2060 | case OTG_STATE_B_IDLE: |
2061 | musb->xceiv->state = OTG_STATE_B_IDLE; | 2061 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
2062 | break; | 2062 | break; |
2063 | case OTG_STATE_B_SRP_INIT: | 2063 | case OTG_STATE_B_SRP_INIT: |
2064 | break; | 2064 | break; |
@@ -2118,13 +2118,13 @@ __acquires(musb->lock) | |||
2118 | * In that case, do not rely on devctl for setting | 2118 | * In that case, do not rely on devctl for setting |
2119 | * peripheral mode. | 2119 | * peripheral mode. |
2120 | */ | 2120 | */ |
2121 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; | 2121 | musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; |
2122 | musb->g.is_a_peripheral = 0; | 2122 | musb->g.is_a_peripheral = 0; |
2123 | } else if (devctl & MUSB_DEVCTL_BDEVICE) { | 2123 | } else if (devctl & MUSB_DEVCTL_BDEVICE) { |
2124 | musb->xceiv->state = OTG_STATE_B_PERIPHERAL; | 2124 | musb->xceiv->otg->state = OTG_STATE_B_PERIPHERAL; |
2125 | musb->g.is_a_peripheral = 0; | 2125 | musb->g.is_a_peripheral = 0; |
2126 | } else { | 2126 | } else { |
2127 | musb->xceiv->state = OTG_STATE_A_PERIPHERAL; | 2127 | musb->xceiv->otg->state = OTG_STATE_A_PERIPHERAL; |
2128 | musb->g.is_a_peripheral = 1; | 2128 | musb->g.is_a_peripheral = 1; |
2129 | } | 2129 | } |
2130 | 2130 | ||
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 855793d701bb..23d474d3d7f4 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -2463,7 +2463,7 @@ static int musb_bus_suspend(struct usb_hcd *hcd) | |||
2463 | if (!is_host_active(musb)) | 2463 | if (!is_host_active(musb)) |
2464 | return 0; | 2464 | return 0; |
2465 | 2465 | ||
2466 | switch (musb->xceiv->state) { | 2466 | switch (musb->xceiv->otg->state) { |
2467 | case OTG_STATE_A_SUSPEND: | 2467 | case OTG_STATE_A_SUSPEND: |
2468 | return 0; | 2468 | return 0; |
2469 | case OTG_STATE_A_WAIT_VRISE: | 2469 | case OTG_STATE_A_WAIT_VRISE: |
@@ -2473,7 +2473,7 @@ static int musb_bus_suspend(struct usb_hcd *hcd) | |||
2473 | */ | 2473 | */ |
2474 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | 2474 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); |
2475 | if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) | 2475 | if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) |
2476 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; | 2476 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; |
2477 | break; | 2477 | break; |
2478 | default: | 2478 | default: |
2479 | break; | 2479 | break; |
@@ -2481,7 +2481,7 @@ static int musb_bus_suspend(struct usb_hcd *hcd) | |||
2481 | 2481 | ||
2482 | if (musb->is_active) { | 2482 | if (musb->is_active) { |
2483 | WARNING("trying to suspend as %s while active\n", | 2483 | WARNING("trying to suspend as %s while active\n", |
2484 | usb_otg_state_string(musb->xceiv->state)); | 2484 | usb_otg_state_string(musb->xceiv->otg->state)); |
2485 | return -EBUSY; | 2485 | return -EBUSY; |
2486 | } else | 2486 | } else |
2487 | return 0; | 2487 | return 0; |
@@ -2678,7 +2678,7 @@ int musb_host_setup(struct musb *musb, int power_budget) | |||
2678 | 2678 | ||
2679 | MUSB_HST_MODE(musb); | 2679 | MUSB_HST_MODE(musb); |
2680 | musb->xceiv->otg->default_a = 1; | 2680 | musb->xceiv->otg->default_a = 1; |
2681 | musb->xceiv->state = OTG_STATE_A_IDLE; | 2681 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
2682 | 2682 | ||
2683 | otg_set_host(musb->xceiv->otg, &hcd->self); | 2683 | otg_set_host(musb->xceiv->otg, &hcd->self); |
2684 | hcd->self.otg_port = 1; | 2684 | hcd->self.otg_port = 1; |
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c index e2d2d8c9891b..a133bd8c5dc7 100644 --- a/drivers/usb/musb/musb_virthub.c +++ b/drivers/usb/musb/musb_virthub.c | |||
@@ -69,7 +69,7 @@ void musb_host_finish_resume(struct work_struct *work) | |||
69 | musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16; | 69 | musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16; |
70 | usb_hcd_poll_rh_status(musb->hcd); | 70 | usb_hcd_poll_rh_status(musb->hcd); |
71 | /* NOTE: it might really be A_WAIT_BCON ... */ | 71 | /* NOTE: it might really be A_WAIT_BCON ... */ |
72 | musb->xceiv->state = OTG_STATE_A_HOST; | 72 | musb->xceiv->otg->state = OTG_STATE_A_HOST; |
73 | 73 | ||
74 | spin_unlock_irqrestore(&musb->lock, flags); | 74 | spin_unlock_irqrestore(&musb->lock, flags); |
75 | } | 75 | } |
@@ -107,9 +107,9 @@ void musb_port_suspend(struct musb *musb, bool do_suspend) | |||
107 | dev_dbg(musb->controller, "Root port suspended, power %02x\n", power); | 107 | dev_dbg(musb->controller, "Root port suspended, power %02x\n", power); |
108 | 108 | ||
109 | musb->port1_status |= USB_PORT_STAT_SUSPEND; | 109 | musb->port1_status |= USB_PORT_STAT_SUSPEND; |
110 | switch (musb->xceiv->state) { | 110 | switch (musb->xceiv->otg->state) { |
111 | case OTG_STATE_A_HOST: | 111 | case OTG_STATE_A_HOST: |
112 | musb->xceiv->state = OTG_STATE_A_SUSPEND; | 112 | musb->xceiv->otg->state = OTG_STATE_A_SUSPEND; |
113 | musb->is_active = otg->host->b_hnp_enable; | 113 | musb->is_active = otg->host->b_hnp_enable; |
114 | if (musb->is_active) | 114 | if (musb->is_active) |
115 | mod_timer(&musb->otg_timer, jiffies | 115 | mod_timer(&musb->otg_timer, jiffies |
@@ -118,13 +118,13 @@ void musb_port_suspend(struct musb *musb, bool do_suspend) | |||
118 | musb_platform_try_idle(musb, 0); | 118 | musb_platform_try_idle(musb, 0); |
119 | break; | 119 | break; |
120 | case OTG_STATE_B_HOST: | 120 | case OTG_STATE_B_HOST: |
121 | musb->xceiv->state = OTG_STATE_B_WAIT_ACON; | 121 | musb->xceiv->otg->state = OTG_STATE_B_WAIT_ACON; |
122 | musb->is_active = otg->host->b_hnp_enable; | 122 | musb->is_active = otg->host->b_hnp_enable; |
123 | musb_platform_try_idle(musb, 0); | 123 | musb_platform_try_idle(musb, 0); |
124 | break; | 124 | break; |
125 | default: | 125 | default: |
126 | dev_dbg(musb->controller, "bogus rh suspend? %s\n", | 126 | dev_dbg(musb->controller, "bogus rh suspend? %s\n", |
127 | usb_otg_state_string(musb->xceiv->state)); | 127 | usb_otg_state_string(musb->xceiv->otg->state)); |
128 | } | 128 | } |
129 | } else if (power & MUSB_POWER_SUSPENDM) { | 129 | } else if (power & MUSB_POWER_SUSPENDM) { |
130 | power &= ~MUSB_POWER_SUSPENDM; | 130 | power &= ~MUSB_POWER_SUSPENDM; |
@@ -145,7 +145,7 @@ void musb_port_reset(struct musb *musb, bool do_reset) | |||
145 | u8 power; | 145 | u8 power; |
146 | void __iomem *mbase = musb->mregs; | 146 | void __iomem *mbase = musb->mregs; |
147 | 147 | ||
148 | if (musb->xceiv->state == OTG_STATE_B_IDLE) { | 148 | if (musb->xceiv->otg->state == OTG_STATE_B_IDLE) { |
149 | dev_dbg(musb->controller, "HNP: Returning from HNP; no hub reset from b_idle\n"); | 149 | dev_dbg(musb->controller, "HNP: Returning from HNP; no hub reset from b_idle\n"); |
150 | musb->port1_status &= ~USB_PORT_STAT_RESET; | 150 | musb->port1_status &= ~USB_PORT_STAT_RESET; |
151 | return; | 151 | return; |
@@ -224,24 +224,24 @@ void musb_root_disconnect(struct musb *musb) | |||
224 | usb_hcd_poll_rh_status(musb->hcd); | 224 | usb_hcd_poll_rh_status(musb->hcd); |
225 | musb->is_active = 0; | 225 | musb->is_active = 0; |
226 | 226 | ||
227 | switch (musb->xceiv->state) { | 227 | switch (musb->xceiv->otg->state) { |
228 | case OTG_STATE_A_SUSPEND: | 228 | case OTG_STATE_A_SUSPEND: |
229 | if (otg->host->b_hnp_enable) { | 229 | if (otg->host->b_hnp_enable) { |
230 | musb->xceiv->state = OTG_STATE_A_PERIPHERAL; | 230 | musb->xceiv->otg->state = OTG_STATE_A_PERIPHERAL; |
231 | musb->g.is_a_peripheral = 1; | 231 | musb->g.is_a_peripheral = 1; |
232 | break; | 232 | break; |
233 | } | 233 | } |
234 | /* FALLTHROUGH */ | 234 | /* FALLTHROUGH */ |
235 | case OTG_STATE_A_HOST: | 235 | case OTG_STATE_A_HOST: |
236 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; | 236 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; |
237 | musb->is_active = 0; | 237 | musb->is_active = 0; |
238 | break; | 238 | break; |
239 | case OTG_STATE_A_WAIT_VFALL: | 239 | case OTG_STATE_A_WAIT_VFALL: |
240 | musb->xceiv->state = OTG_STATE_B_IDLE; | 240 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
241 | break; | 241 | break; |
242 | default: | 242 | default: |
243 | dev_dbg(musb->controller, "host disconnect (%s)\n", | 243 | dev_dbg(musb->controller, "host disconnect (%s)\n", |
244 | usb_otg_state_string(musb->xceiv->state)); | 244 | usb_otg_state_string(musb->xceiv->otg->state)); |
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
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); |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 25f02dfc8955..69ca92d6032f 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -415,13 +415,13 @@ static void musb_do_idle(unsigned long _musb) | |||
415 | 415 | ||
416 | spin_lock_irqsave(&musb->lock, flags); | 416 | spin_lock_irqsave(&musb->lock, flags); |
417 | 417 | ||
418 | switch (musb->xceiv->state) { | 418 | switch (musb->xceiv->otg->state) { |
419 | case OTG_STATE_A_WAIT_BCON: | 419 | case OTG_STATE_A_WAIT_BCON: |
420 | if ((musb->a_wait_bcon != 0) | 420 | if ((musb->a_wait_bcon != 0) |
421 | && (musb->idle_timeout == 0 | 421 | && (musb->idle_timeout == 0 |
422 | || time_after(jiffies, musb->idle_timeout))) { | 422 | || time_after(jiffies, musb->idle_timeout))) { |
423 | dev_dbg(musb->controller, "Nothing connected %s, turning off VBUS\n", | 423 | dev_dbg(musb->controller, "Nothing connected %s, turning off VBUS\n", |
424 | usb_otg_state_string(musb->xceiv->state)); | 424 | usb_otg_state_string(musb->xceiv->otg->state)); |
425 | } | 425 | } |
426 | /* FALLTHROUGH */ | 426 | /* FALLTHROUGH */ |
427 | case OTG_STATE_A_IDLE: | 427 | case OTG_STATE_A_IDLE: |
@@ -474,9 +474,9 @@ static void tusb_musb_try_idle(struct musb *musb, unsigned long timeout) | |||
474 | 474 | ||
475 | /* Never idle if active, or when VBUS timeout is not set as host */ | 475 | /* Never idle if active, or when VBUS timeout is not set as host */ |
476 | if (musb->is_active || ((musb->a_wait_bcon == 0) | 476 | if (musb->is_active || ((musb->a_wait_bcon == 0) |
477 | && (musb->xceiv->state == OTG_STATE_A_WAIT_BCON))) { | 477 | && (musb->xceiv->otg->state == OTG_STATE_A_WAIT_BCON))) { |
478 | dev_dbg(musb->controller, "%s active, deleting timer\n", | 478 | dev_dbg(musb->controller, "%s active, deleting timer\n", |
479 | usb_otg_state_string(musb->xceiv->state)); | 479 | usb_otg_state_string(musb->xceiv->otg->state)); |
480 | del_timer(&musb_idle_timer); | 480 | del_timer(&musb_idle_timer); |
481 | last_timer = jiffies; | 481 | last_timer = jiffies; |
482 | return; | 482 | return; |
@@ -493,7 +493,7 @@ static void tusb_musb_try_idle(struct musb *musb, unsigned long timeout) | |||
493 | last_timer = timeout; | 493 | last_timer = timeout; |
494 | 494 | ||
495 | dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n", | 495 | dev_dbg(musb->controller, "%s inactive, for idle timer for %lu ms\n", |
496 | usb_otg_state_string(musb->xceiv->state), | 496 | usb_otg_state_string(musb->xceiv->otg->state), |
497 | (unsigned long)jiffies_to_msecs(timeout - jiffies)); | 497 | (unsigned long)jiffies_to_msecs(timeout - jiffies)); |
498 | mod_timer(&musb_idle_timer, timeout); | 498 | mod_timer(&musb_idle_timer, timeout); |
499 | } | 499 | } |
@@ -524,7 +524,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on) | |||
524 | if (is_on) { | 524 | if (is_on) { |
525 | timer = OTG_TIMER_MS(OTG_TIME_A_WAIT_VRISE); | 525 | timer = OTG_TIMER_MS(OTG_TIME_A_WAIT_VRISE); |
526 | otg->default_a = 1; | 526 | otg->default_a = 1; |
527 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 527 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
528 | devctl |= MUSB_DEVCTL_SESSION; | 528 | devctl |= MUSB_DEVCTL_SESSION; |
529 | 529 | ||
530 | conf |= TUSB_DEV_CONF_USB_HOST_MODE; | 530 | conf |= TUSB_DEV_CONF_USB_HOST_MODE; |
@@ -537,16 +537,16 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on) | |||
537 | /* If ID pin is grounded, we want to be a_idle */ | 537 | /* If ID pin is grounded, we want to be a_idle */ |
538 | otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT); | 538 | otg_stat = musb_readl(tbase, TUSB_DEV_OTG_STAT); |
539 | if (!(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) { | 539 | if (!(otg_stat & TUSB_DEV_OTG_STAT_ID_STATUS)) { |
540 | switch (musb->xceiv->state) { | 540 | switch (musb->xceiv->otg->state) { |
541 | case OTG_STATE_A_WAIT_VRISE: | 541 | case OTG_STATE_A_WAIT_VRISE: |
542 | case OTG_STATE_A_WAIT_BCON: | 542 | case OTG_STATE_A_WAIT_BCON: |
543 | musb->xceiv->state = OTG_STATE_A_WAIT_VFALL; | 543 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VFALL; |
544 | break; | 544 | break; |
545 | case OTG_STATE_A_WAIT_VFALL: | 545 | case OTG_STATE_A_WAIT_VFALL: |
546 | musb->xceiv->state = OTG_STATE_A_IDLE; | 546 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
547 | break; | 547 | break; |
548 | default: | 548 | default: |
549 | musb->xceiv->state = OTG_STATE_A_IDLE; | 549 | musb->xceiv->otg->state = OTG_STATE_A_IDLE; |
550 | } | 550 | } |
551 | musb->is_active = 0; | 551 | musb->is_active = 0; |
552 | otg->default_a = 1; | 552 | otg->default_a = 1; |
@@ -554,7 +554,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on) | |||
554 | } else { | 554 | } else { |
555 | musb->is_active = 0; | 555 | musb->is_active = 0; |
556 | otg->default_a = 0; | 556 | otg->default_a = 0; |
557 | musb->xceiv->state = OTG_STATE_B_IDLE; | 557 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
558 | MUSB_DEV_MODE(musb); | 558 | MUSB_DEV_MODE(musb); |
559 | } | 559 | } |
560 | 560 | ||
@@ -569,7 +569,7 @@ static void tusb_musb_set_vbus(struct musb *musb, int is_on) | |||
569 | musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); | 569 | musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); |
570 | 570 | ||
571 | dev_dbg(musb->controller, "VBUS %s, devctl %02x otg %3x conf %08x prcm %08x\n", | 571 | dev_dbg(musb->controller, "VBUS %s, devctl %02x otg %3x conf %08x prcm %08x\n", |
572 | usb_otg_state_string(musb->xceiv->state), | 572 | usb_otg_state_string(musb->xceiv->otg->state), |
573 | musb_readb(musb->mregs, MUSB_DEVCTL), | 573 | musb_readb(musb->mregs, MUSB_DEVCTL), |
574 | musb_readl(tbase, TUSB_DEV_OTG_STAT), | 574 | musb_readl(tbase, TUSB_DEV_OTG_STAT), |
575 | conf, prcm); | 575 | conf, prcm); |
@@ -668,23 +668,23 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
668 | 668 | ||
669 | if (otg_stat & TUSB_DEV_OTG_STAT_SESS_END) { | 669 | if (otg_stat & TUSB_DEV_OTG_STAT_SESS_END) { |
670 | dev_dbg(musb->controller, "Forcing disconnect (no interrupt)\n"); | 670 | dev_dbg(musb->controller, "Forcing disconnect (no interrupt)\n"); |
671 | if (musb->xceiv->state != OTG_STATE_B_IDLE) { | 671 | if (musb->xceiv->otg->state != OTG_STATE_B_IDLE) { |
672 | /* INTR_DISCONNECT can hide... */ | 672 | /* INTR_DISCONNECT can hide... */ |
673 | musb->xceiv->state = OTG_STATE_B_IDLE; | 673 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
674 | musb->int_usb |= MUSB_INTR_DISCONNECT; | 674 | musb->int_usb |= MUSB_INTR_DISCONNECT; |
675 | } | 675 | } |
676 | musb->is_active = 0; | 676 | musb->is_active = 0; |
677 | } | 677 | } |
678 | dev_dbg(musb->controller, "vbus change, %s, otg %03x\n", | 678 | dev_dbg(musb->controller, "vbus change, %s, otg %03x\n", |
679 | usb_otg_state_string(musb->xceiv->state), otg_stat); | 679 | usb_otg_state_string(musb->xceiv->otg->state), otg_stat); |
680 | idle_timeout = jiffies + (1 * HZ); | 680 | idle_timeout = jiffies + (1 * HZ); |
681 | schedule_work(&musb->irq_work); | 681 | schedule_work(&musb->irq_work); |
682 | 682 | ||
683 | } else /* A-dev state machine */ { | 683 | } else /* A-dev state machine */ { |
684 | dev_dbg(musb->controller, "vbus change, %s, otg %03x\n", | 684 | dev_dbg(musb->controller, "vbus change, %s, otg %03x\n", |
685 | usb_otg_state_string(musb->xceiv->state), otg_stat); | 685 | usb_otg_state_string(musb->xceiv->otg->state), otg_stat); |
686 | 686 | ||
687 | switch (musb->xceiv->state) { | 687 | switch (musb->xceiv->otg->state) { |
688 | case OTG_STATE_A_IDLE: | 688 | case OTG_STATE_A_IDLE: |
689 | dev_dbg(musb->controller, "Got SRP, turning on VBUS\n"); | 689 | dev_dbg(musb->controller, "Got SRP, turning on VBUS\n"); |
690 | musb_platform_set_vbus(musb, 1); | 690 | musb_platform_set_vbus(musb, 1); |
@@ -731,9 +731,9 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
731 | u8 devctl; | 731 | u8 devctl; |
732 | 732 | ||
733 | dev_dbg(musb->controller, "%s timer, %03x\n", | 733 | dev_dbg(musb->controller, "%s timer, %03x\n", |
734 | usb_otg_state_string(musb->xceiv->state), otg_stat); | 734 | usb_otg_state_string(musb->xceiv->otg->state), otg_stat); |
735 | 735 | ||
736 | switch (musb->xceiv->state) { | 736 | switch (musb->xceiv->otg->state) { |
737 | case OTG_STATE_A_WAIT_VRISE: | 737 | case OTG_STATE_A_WAIT_VRISE: |
738 | /* VBUS has probably been valid for a while now, | 738 | /* VBUS has probably been valid for a while now, |
739 | * but may well have bounced out of range a bit | 739 | * but may well have bounced out of range a bit |
@@ -745,7 +745,7 @@ tusb_otg_ints(struct musb *musb, u32 int_src, void __iomem *tbase) | |||
745 | dev_dbg(musb->controller, "devctl %02x\n", devctl); | 745 | dev_dbg(musb->controller, "devctl %02x\n", devctl); |
746 | break; | 746 | break; |
747 | } | 747 | } |
748 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; | 748 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON; |
749 | musb->is_active = 0; | 749 | musb->is_active = 0; |
750 | idle_timeout = jiffies | 750 | idle_timeout = jiffies |
751 | + msecs_to_jiffies(musb->a_wait_bcon); | 751 | + msecs_to_jiffies(musb->a_wait_bcon); |
diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index d0180a70051d..1d631d5f4a27 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c | |||
@@ -56,7 +56,7 @@ static void ux500_musb_set_vbus(struct musb *musb, int is_on) | |||
56 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | 56 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); |
57 | 57 | ||
58 | if (is_on) { | 58 | if (is_on) { |
59 | if (musb->xceiv->state == OTG_STATE_A_IDLE) { | 59 | if (musb->xceiv->otg->state == OTG_STATE_A_IDLE) { |
60 | /* start the session */ | 60 | /* start the session */ |
61 | devctl |= MUSB_DEVCTL_SESSION; | 61 | devctl |= MUSB_DEVCTL_SESSION; |
62 | musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); | 62 | musb_writeb(musb->mregs, MUSB_DEVCTL, devctl); |
@@ -76,7 +76,7 @@ static void ux500_musb_set_vbus(struct musb *musb, int is_on) | |||
76 | } else { | 76 | } else { |
77 | musb->is_active = 1; | 77 | musb->is_active = 1; |
78 | musb->xceiv->otg->default_a = 1; | 78 | musb->xceiv->otg->default_a = 1; |
79 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 79 | musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE; |
80 | devctl |= MUSB_DEVCTL_SESSION; | 80 | devctl |= MUSB_DEVCTL_SESSION; |
81 | MUSB_HST_MODE(musb); | 81 | MUSB_HST_MODE(musb); |
82 | } | 82 | } |
@@ -102,7 +102,7 @@ static void ux500_musb_set_vbus(struct musb *musb, int is_on) | |||
102 | mdelay(200); | 102 | mdelay(200); |
103 | 103 | ||
104 | dev_dbg(musb->controller, "VBUS %s, devctl %02x\n", | 104 | dev_dbg(musb->controller, "VBUS %s, devctl %02x\n", |
105 | usb_otg_state_string(musb->xceiv->state), | 105 | usb_otg_state_string(musb->xceiv->otg->state), |
106 | musb_readb(musb->mregs, MUSB_DEVCTL)); | 106 | musb_readb(musb->mregs, MUSB_DEVCTL)); |
107 | } | 107 | } |
108 | 108 | ||
@@ -112,7 +112,7 @@ static int musb_otg_notifications(struct notifier_block *nb, | |||
112 | struct musb *musb = container_of(nb, struct musb, nb); | 112 | struct musb *musb = container_of(nb, struct musb, nb); |
113 | 113 | ||
114 | dev_dbg(musb->controller, "musb_otg_notifications %ld %s\n", | 114 | dev_dbg(musb->controller, "musb_otg_notifications %ld %s\n", |
115 | event, usb_otg_state_string(musb->xceiv->state)); | 115 | event, usb_otg_state_string(musb->xceiv->otg->state)); |
116 | 116 | ||
117 | switch (event) { | 117 | switch (event) { |
118 | case UX500_MUSB_ID: | 118 | case UX500_MUSB_ID: |
@@ -127,7 +127,7 @@ static int musb_otg_notifications(struct notifier_block *nb, | |||
127 | if (is_host_active(musb)) | 127 | if (is_host_active(musb)) |
128 | ux500_musb_set_vbus(musb, 0); | 128 | ux500_musb_set_vbus(musb, 0); |
129 | else | 129 | else |
130 | musb->xceiv->state = OTG_STATE_B_IDLE; | 130 | musb->xceiv->otg->state = OTG_STATE_B_IDLE; |
131 | break; | 131 | break; |
132 | default: | 132 | default: |
133 | dev_dbg(musb->controller, "ID float\n"); | 133 | dev_dbg(musb->controller, "ID float\n"); |
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index 11ab2c45e462..2d5250143ce1 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c | |||
@@ -446,7 +446,7 @@ static int ab9540_usb_link_status_update(struct ab8500_usb *ab, | |||
446 | if (event != UX500_MUSB_RIDB) | 446 | if (event != UX500_MUSB_RIDB) |
447 | event = UX500_MUSB_NONE; | 447 | event = UX500_MUSB_NONE; |
448 | /* Fallback to default B_IDLE as nothing is connected. */ | 448 | /* Fallback to default B_IDLE as nothing is connected. */ |
449 | ab->phy.state = OTG_STATE_B_IDLE; | 449 | ab->phy.otg->state = OTG_STATE_B_IDLE; |
450 | break; | 450 | break; |
451 | 451 | ||
452 | case USB_LINK_ACA_RID_C_NM_9540: | 452 | case USB_LINK_ACA_RID_C_NM_9540: |
@@ -584,7 +584,7 @@ static int ab8540_usb_link_status_update(struct ab8500_usb *ab, | |||
584 | * Fallback to default B_IDLE as nothing | 584 | * Fallback to default B_IDLE as nothing |
585 | * is connected | 585 | * is connected |
586 | */ | 586 | */ |
587 | ab->phy.state = OTG_STATE_B_IDLE; | 587 | ab->phy.otg->state = OTG_STATE_B_IDLE; |
588 | break; | 588 | break; |
589 | 589 | ||
590 | case USB_LINK_ACA_RID_C_NM_8540: | 590 | case USB_LINK_ACA_RID_C_NM_8540: |
@@ -693,7 +693,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab, | |||
693 | * Fallback to default B_IDLE as nothing | 693 | * Fallback to default B_IDLE as nothing |
694 | * is connected | 694 | * is connected |
695 | */ | 695 | */ |
696 | ab->phy.state = OTG_STATE_B_IDLE; | 696 | ab->phy.otg->state = OTG_STATE_B_IDLE; |
697 | break; | 697 | break; |
698 | 698 | ||
699 | case USB_LINK_ACA_RID_C_NM_8505: | 699 | case USB_LINK_ACA_RID_C_NM_8505: |
@@ -776,7 +776,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab, | |||
776 | if (event != UX500_MUSB_RIDB) | 776 | if (event != UX500_MUSB_RIDB) |
777 | event = UX500_MUSB_NONE; | 777 | event = UX500_MUSB_NONE; |
778 | /* Fallback to default B_IDLE as nothing is connected */ | 778 | /* Fallback to default B_IDLE as nothing is connected */ |
779 | ab->phy.state = OTG_STATE_B_IDLE; | 779 | ab->phy.otg->state = OTG_STATE_B_IDLE; |
780 | break; | 780 | break; |
781 | 781 | ||
782 | case USB_LINK_ACA_RID_C_NM_8500: | 782 | case USB_LINK_ACA_RID_C_NM_8500: |
@@ -1380,7 +1380,7 @@ static int ab8500_usb_probe(struct platform_device *pdev) | |||
1380 | ab->phy.label = "ab8500"; | 1380 | ab->phy.label = "ab8500"; |
1381 | ab->phy.set_suspend = ab8500_usb_set_suspend; | 1381 | ab->phy.set_suspend = ab8500_usb_set_suspend; |
1382 | ab->phy.set_power = ab8500_usb_set_power; | 1382 | ab->phy.set_power = ab8500_usb_set_power; |
1383 | ab->phy.state = OTG_STATE_UNDEFINED; | 1383 | ab->phy.otg->state = OTG_STATE_UNDEFINED; |
1384 | 1384 | ||
1385 | otg->phy = &ab->phy; | 1385 | otg->phy = &ab->phy; |
1386 | otg->set_host = ab8500_usb_set_host; | 1386 | otg->set_host = ab8500_usb_set_host; |
diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index f1ea5990a50a..15d7a81eece5 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c | |||
@@ -623,7 +623,7 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
623 | /* Mini-A cable connected */ | 623 | /* Mini-A cable connected */ |
624 | struct otg_fsm *fsm = &otg_dev->fsm; | 624 | struct otg_fsm *fsm = &otg_dev->fsm; |
625 | 625 | ||
626 | otg->phy->state = OTG_STATE_UNDEFINED; | 626 | otg.state = OTG_STATE_UNDEFINED; |
627 | fsm->protocol = PROTO_UNDEF; | 627 | fsm->protocol = PROTO_UNDEF; |
628 | } | 628 | } |
629 | } | 629 | } |
@@ -681,7 +681,7 @@ static int fsl_otg_set_power(struct usb_phy *phy, unsigned mA) | |||
681 | { | 681 | { |
682 | if (!fsl_otg_dev) | 682 | if (!fsl_otg_dev) |
683 | return -ENODEV; | 683 | return -ENODEV; |
684 | if (phy->state == OTG_STATE_B_PERIPHERAL) | 684 | if (phy->otg.state == OTG_STATE_B_PERIPHERAL) |
685 | pr_info("FSL OTG: Draw %d mA\n", mA); | 685 | pr_info("FSL OTG: Draw %d mA\n", mA); |
686 | 686 | ||
687 | return 0; | 687 | return 0; |
@@ -714,7 +714,7 @@ static int fsl_otg_start_srp(struct usb_otg *otg) | |||
714 | { | 714 | { |
715 | struct fsl_otg *otg_dev; | 715 | struct fsl_otg *otg_dev; |
716 | 716 | ||
717 | if (!otg || otg->phy->state != OTG_STATE_B_IDLE) | 717 | if (!otg || otg.state != OTG_STATE_B_IDLE) |
718 | return -ENODEV; | 718 | return -ENODEV; |
719 | 719 | ||
720 | otg_dev = container_of(otg->phy, struct fsl_otg, phy); | 720 | otg_dev = container_of(otg->phy, struct fsl_otg, phy); |
@@ -989,10 +989,10 @@ int usb_otg_start(struct platform_device *pdev) | |||
989 | * Also: record initial state of ID pin | 989 | * Also: record initial state of ID pin |
990 | */ | 990 | */ |
991 | if (fsl_readl(&p_otg->dr_mem_map->otgsc) & OTGSC_STS_USB_ID) { | 991 | if (fsl_readl(&p_otg->dr_mem_map->otgsc) & OTGSC_STS_USB_ID) { |
992 | p_otg->phy.state = OTG_STATE_UNDEFINED; | 992 | p_otg->phy->otg.state = OTG_STATE_UNDEFINED; |
993 | p_otg->fsm.id = 1; | 993 | p_otg->fsm.id = 1; |
994 | } else { | 994 | } else { |
995 | p_otg->phy.state = OTG_STATE_A_IDLE; | 995 | p_otg->phy->otg.state = OTG_STATE_A_IDLE; |
996 | p_otg->fsm.id = 0; | 996 | p_otg->fsm.id = 0; |
997 | } | 997 | } |
998 | 998 | ||
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index 7594e5069ae5..280a3458ff6b 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c | |||
@@ -123,7 +123,7 @@ static int nop_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | otg->gadget = gadget; | 125 | otg->gadget = gadget; |
126 | otg->phy->state = OTG_STATE_B_IDLE; | 126 | otg->state = OTG_STATE_B_IDLE; |
127 | return 0; | 127 | return 0; |
128 | } | 128 | } |
129 | 129 | ||
@@ -225,9 +225,9 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, | |||
225 | nop->phy.dev = nop->dev; | 225 | nop->phy.dev = nop->dev; |
226 | nop->phy.label = "nop-xceiv"; | 226 | nop->phy.label = "nop-xceiv"; |
227 | nop->phy.set_suspend = nop_set_suspend; | 227 | nop->phy.set_suspend = nop_set_suspend; |
228 | nop->phy.state = OTG_STATE_UNDEFINED; | ||
229 | nop->phy.type = type; | 228 | nop->phy.type = type; |
230 | 229 | ||
230 | nop->phy.otg->state = OTG_STATE_UNDEFINED; | ||
231 | nop->phy.otg->phy = &nop->phy; | 231 | nop->phy.otg->phy = &nop->phy; |
232 | nop->phy.otg->set_host = nop_set_host; | 232 | nop->phy.otg->set_host = nop_set_host; |
233 | nop->phy.otg->set_peripheral = nop_set_peripheral; | 233 | nop->phy.otg->set_peripheral = nop_set_peripheral; |
diff --git a/drivers/usb/phy/phy-gpio-vbus-usb.c b/drivers/usb/phy/phy-gpio-vbus-usb.c index f4b14bd97e14..7a6be3e5dc23 100644 --- a/drivers/usb/phy/phy-gpio-vbus-usb.c +++ b/drivers/usb/phy/phy-gpio-vbus-usb.c | |||
@@ -121,7 +121,7 @@ static void gpio_vbus_work(struct work_struct *work) | |||
121 | 121 | ||
122 | if (vbus) { | 122 | if (vbus) { |
123 | status = USB_EVENT_VBUS; | 123 | status = USB_EVENT_VBUS; |
124 | gpio_vbus->phy.state = OTG_STATE_B_PERIPHERAL; | 124 | gpio_vbus->phy.otg->state = OTG_STATE_B_PERIPHERAL; |
125 | gpio_vbus->phy.last_event = status; | 125 | gpio_vbus->phy.last_event = status; |
126 | usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); | 126 | usb_gadget_vbus_connect(gpio_vbus->phy.otg->gadget); |
127 | 127 | ||
@@ -143,7 +143,7 @@ static void gpio_vbus_work(struct work_struct *work) | |||
143 | 143 | ||
144 | usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); | 144 | usb_gadget_vbus_disconnect(gpio_vbus->phy.otg->gadget); |
145 | status = USB_EVENT_NONE; | 145 | status = USB_EVENT_NONE; |
146 | gpio_vbus->phy.state = OTG_STATE_B_IDLE; | 146 | gpio_vbus->phy.otg->state = OTG_STATE_B_IDLE; |
147 | gpio_vbus->phy.last_event = status; | 147 | gpio_vbus->phy.last_event = status; |
148 | 148 | ||
149 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, | 149 | atomic_notifier_call_chain(&gpio_vbus->phy.notifier, |
@@ -196,7 +196,7 @@ static int gpio_vbus_set_peripheral(struct usb_otg *otg, | |||
196 | set_vbus_draw(gpio_vbus, 0); | 196 | set_vbus_draw(gpio_vbus, 0); |
197 | 197 | ||
198 | usb_gadget_vbus_disconnect(otg->gadget); | 198 | usb_gadget_vbus_disconnect(otg->gadget); |
199 | otg->phy->state = OTG_STATE_UNDEFINED; | 199 | otg->state = OTG_STATE_UNDEFINED; |
200 | 200 | ||
201 | otg->gadget = NULL; | 201 | otg->gadget = NULL; |
202 | return 0; | 202 | return 0; |
@@ -218,7 +218,7 @@ static int gpio_vbus_set_power(struct usb_phy *phy, unsigned mA) | |||
218 | 218 | ||
219 | gpio_vbus = container_of(phy, struct gpio_vbus_data, phy); | 219 | gpio_vbus = container_of(phy, struct gpio_vbus_data, phy); |
220 | 220 | ||
221 | if (phy->state == OTG_STATE_B_PERIPHERAL) | 221 | if (phy->otg->state == OTG_STATE_B_PERIPHERAL) |
222 | set_vbus_draw(gpio_vbus, mA); | 222 | set_vbus_draw(gpio_vbus, mA); |
223 | return 0; | 223 | return 0; |
224 | } | 224 | } |
@@ -269,8 +269,8 @@ static int gpio_vbus_probe(struct platform_device *pdev) | |||
269 | gpio_vbus->phy.dev = gpio_vbus->dev; | 269 | gpio_vbus->phy.dev = gpio_vbus->dev; |
270 | gpio_vbus->phy.set_power = gpio_vbus_set_power; | 270 | gpio_vbus->phy.set_power = gpio_vbus_set_power; |
271 | gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; | 271 | gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; |
272 | gpio_vbus->phy.state = OTG_STATE_UNDEFINED; | ||
273 | 272 | ||
273 | gpio_vbus->phy.otg->state = OTG_STATE_UNDEFINED; | ||
274 | gpio_vbus->phy.otg->phy = &gpio_vbus->phy; | 274 | gpio_vbus->phy.otg->phy = &gpio_vbus->phy; |
275 | gpio_vbus->phy.otg->set_peripheral = gpio_vbus_set_peripheral; | 275 | gpio_vbus->phy.otg->set_peripheral = gpio_vbus_set_peripheral; |
276 | 276 | ||
diff --git a/drivers/usb/phy/phy-isp1301-omap.c b/drivers/usb/phy/phy-isp1301-omap.c index 8eea56d3ded6..24f84cbbed57 100644 --- a/drivers/usb/phy/phy-isp1301-omap.c +++ b/drivers/usb/phy/phy-isp1301-omap.c | |||
@@ -234,7 +234,7 @@ isp1301_clear_bits(struct isp1301 *isp, u8 reg, u8 bits) | |||
234 | 234 | ||
235 | static inline const char *state_name(struct isp1301 *isp) | 235 | static inline const char *state_name(struct isp1301 *isp) |
236 | { | 236 | { |
237 | return usb_otg_state_string(isp->phy.state); | 237 | return usb_otg_state_string(isp->phy.otg->state); |
238 | } | 238 | } |
239 | 239 | ||
240 | /*-------------------------------------------------------------------------*/ | 240 | /*-------------------------------------------------------------------------*/ |
@@ -249,7 +249,7 @@ static inline const char *state_name(struct isp1301 *isp) | |||
249 | 249 | ||
250 | static void power_down(struct isp1301 *isp) | 250 | static void power_down(struct isp1301 *isp) |
251 | { | 251 | { |
252 | isp->phy.state = OTG_STATE_UNDEFINED; | 252 | isp->phy.otg->state = OTG_STATE_UNDEFINED; |
253 | 253 | ||
254 | // isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); | 254 | // isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN); |
255 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND); | 255 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND); |
@@ -339,7 +339,7 @@ static void a_idle(struct isp1301 *isp, const char *tag) | |||
339 | { | 339 | { |
340 | u32 l; | 340 | u32 l; |
341 | 341 | ||
342 | if (isp->phy.state == OTG_STATE_A_IDLE) | 342 | if (isp->phy.otg->state == OTG_STATE_A_IDLE) |
343 | return; | 343 | return; |
344 | 344 | ||
345 | isp->phy.otg->default_a = 1; | 345 | isp->phy.otg->default_a = 1; |
@@ -351,7 +351,7 @@ static void a_idle(struct isp1301 *isp, const char *tag) | |||
351 | isp->phy.otg->gadget->is_a_peripheral = 1; | 351 | isp->phy.otg->gadget->is_a_peripheral = 1; |
352 | gadget_suspend(isp); | 352 | gadget_suspend(isp); |
353 | } | 353 | } |
354 | isp->phy.state = OTG_STATE_A_IDLE; | 354 | isp->phy.otg->state = OTG_STATE_A_IDLE; |
355 | l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; | 355 | l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; |
356 | omap_writel(l, OTG_CTRL); | 356 | omap_writel(l, OTG_CTRL); |
357 | isp->last_otg_ctrl = l; | 357 | isp->last_otg_ctrl = l; |
@@ -363,7 +363,7 @@ static void b_idle(struct isp1301 *isp, const char *tag) | |||
363 | { | 363 | { |
364 | u32 l; | 364 | u32 l; |
365 | 365 | ||
366 | if (isp->phy.state == OTG_STATE_B_IDLE) | 366 | if (isp->phy.otg->state == OTG_STATE_B_IDLE) |
367 | return; | 367 | return; |
368 | 368 | ||
369 | isp->phy.otg->default_a = 0; | 369 | isp->phy.otg->default_a = 0; |
@@ -375,7 +375,7 @@ static void b_idle(struct isp1301 *isp, const char *tag) | |||
375 | isp->phy.otg->gadget->is_a_peripheral = 0; | 375 | isp->phy.otg->gadget->is_a_peripheral = 0; |
376 | gadget_suspend(isp); | 376 | gadget_suspend(isp); |
377 | } | 377 | } |
378 | isp->phy.state = OTG_STATE_B_IDLE; | 378 | isp->phy.otg->state = OTG_STATE_B_IDLE; |
379 | l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; | 379 | l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS; |
380 | omap_writel(l, OTG_CTRL); | 380 | omap_writel(l, OTG_CTRL); |
381 | isp->last_otg_ctrl = l; | 381 | isp->last_otg_ctrl = l; |
@@ -474,7 +474,7 @@ static void check_state(struct isp1301 *isp, const char *tag) | |||
474 | default: | 474 | default: |
475 | break; | 475 | break; |
476 | } | 476 | } |
477 | if (isp->phy.state == state && !extra) | 477 | if (isp->phy.otg->state == state && !extra) |
478 | return; | 478 | return; |
479 | pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag, | 479 | pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag, |
480 | usb_otg_state_string(state), fsm, state_name(isp), | 480 | usb_otg_state_string(state), fsm, state_name(isp), |
@@ -498,23 +498,23 @@ static void update_otg1(struct isp1301 *isp, u8 int_src) | |||
498 | 498 | ||
499 | if (int_src & INTR_SESS_VLD) | 499 | if (int_src & INTR_SESS_VLD) |
500 | otg_ctrl |= OTG_ASESSVLD; | 500 | otg_ctrl |= OTG_ASESSVLD; |
501 | else if (isp->phy.state == OTG_STATE_A_WAIT_VFALL) { | 501 | else if (isp->phy.otg->state == OTG_STATE_A_WAIT_VFALL) { |
502 | a_idle(isp, "vfall"); | 502 | a_idle(isp, "vfall"); |
503 | otg_ctrl &= ~OTG_CTRL_BITS; | 503 | otg_ctrl &= ~OTG_CTRL_BITS; |
504 | } | 504 | } |
505 | if (int_src & INTR_VBUS_VLD) | 505 | if (int_src & INTR_VBUS_VLD) |
506 | otg_ctrl |= OTG_VBUSVLD; | 506 | otg_ctrl |= OTG_VBUSVLD; |
507 | if (int_src & INTR_ID_GND) { /* default-A */ | 507 | if (int_src & INTR_ID_GND) { /* default-A */ |
508 | if (isp->phy.state == OTG_STATE_B_IDLE | 508 | if (isp->phy.otg->state == OTG_STATE_B_IDLE |
509 | || isp->phy.state | 509 | || isp->phy.otg->state |
510 | == OTG_STATE_UNDEFINED) { | 510 | == OTG_STATE_UNDEFINED) { |
511 | a_idle(isp, "init"); | 511 | a_idle(isp, "init"); |
512 | return; | 512 | return; |
513 | } | 513 | } |
514 | } else { /* default-B */ | 514 | } else { /* default-B */ |
515 | otg_ctrl |= OTG_ID; | 515 | otg_ctrl |= OTG_ID; |
516 | if (isp->phy.state == OTG_STATE_A_IDLE | 516 | if (isp->phy.otg->state == OTG_STATE_A_IDLE |
517 | || isp->phy.state == OTG_STATE_UNDEFINED) { | 517 | || isp->phy.otg->state == OTG_STATE_UNDEFINED) { |
518 | b_idle(isp, "init"); | 518 | b_idle(isp, "init"); |
519 | return; | 519 | return; |
520 | } | 520 | } |
@@ -548,14 +548,14 @@ static void otg_update_isp(struct isp1301 *isp) | |||
548 | isp->last_otg_ctrl = otg_ctrl; | 548 | isp->last_otg_ctrl = otg_ctrl; |
549 | otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS; | 549 | otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS; |
550 | 550 | ||
551 | switch (isp->phy.state) { | 551 | switch (isp->phy.otg->state) { |
552 | case OTG_STATE_B_IDLE: | 552 | case OTG_STATE_B_IDLE: |
553 | case OTG_STATE_B_PERIPHERAL: | 553 | case OTG_STATE_B_PERIPHERAL: |
554 | case OTG_STATE_B_SRP_INIT: | 554 | case OTG_STATE_B_SRP_INIT: |
555 | if (!(otg_ctrl & OTG_PULLUP)) { | 555 | if (!(otg_ctrl & OTG_PULLUP)) { |
556 | // if (otg_ctrl & OTG_B_HNPEN) { | 556 | // if (otg_ctrl & OTG_B_HNPEN) { |
557 | if (isp->phy.otg->gadget->b_hnp_enable) { | 557 | if (isp->phy.otg->gadget->b_hnp_enable) { |
558 | isp->phy.state = OTG_STATE_B_WAIT_ACON; | 558 | isp->phy.otg->state = OTG_STATE_B_WAIT_ACON; |
559 | pr_debug(" --> b_wait_acon\n"); | 559 | pr_debug(" --> b_wait_acon\n"); |
560 | } | 560 | } |
561 | goto pulldown; | 561 | goto pulldown; |
@@ -585,7 +585,7 @@ pulldown: | |||
585 | if (!(isp->phy.otg->host)) | 585 | if (!(isp->phy.otg->host)) |
586 | otg_ctrl &= ~OTG_DRV_VBUS; | 586 | otg_ctrl &= ~OTG_DRV_VBUS; |
587 | 587 | ||
588 | switch (isp->phy.state) { | 588 | switch (isp->phy.otg->state) { |
589 | case OTG_STATE_A_SUSPEND: | 589 | case OTG_STATE_A_SUSPEND: |
590 | if (otg_ctrl & OTG_DRV_VBUS) { | 590 | if (otg_ctrl & OTG_DRV_VBUS) { |
591 | set |= OTG1_VBUS_DRV; | 591 | set |= OTG1_VBUS_DRV; |
@@ -596,7 +596,7 @@ pulldown: | |||
596 | 596 | ||
597 | /* FALLTHROUGH */ | 597 | /* FALLTHROUGH */ |
598 | case OTG_STATE_A_VBUS_ERR: | 598 | case OTG_STATE_A_VBUS_ERR: |
599 | isp->phy.state = OTG_STATE_A_WAIT_VFALL; | 599 | isp->phy.otg->state = OTG_STATE_A_WAIT_VFALL; |
600 | pr_debug(" --> a_wait_vfall\n"); | 600 | pr_debug(" --> a_wait_vfall\n"); |
601 | /* FALLTHROUGH */ | 601 | /* FALLTHROUGH */ |
602 | case OTG_STATE_A_WAIT_VFALL: | 602 | case OTG_STATE_A_WAIT_VFALL: |
@@ -605,7 +605,7 @@ pulldown: | |||
605 | break; | 605 | break; |
606 | case OTG_STATE_A_IDLE: | 606 | case OTG_STATE_A_IDLE: |
607 | if (otg_ctrl & OTG_DRV_VBUS) { | 607 | if (otg_ctrl & OTG_DRV_VBUS) { |
608 | isp->phy.state = OTG_STATE_A_WAIT_VRISE; | 608 | isp->phy.otg->state = OTG_STATE_A_WAIT_VRISE; |
609 | pr_debug(" --> a_wait_vrise\n"); | 609 | pr_debug(" --> a_wait_vrise\n"); |
610 | } | 610 | } |
611 | /* FALLTHROUGH */ | 611 | /* FALLTHROUGH */ |
@@ -625,17 +625,17 @@ pulldown: | |||
625 | if (otg_change & OTG_PULLUP) { | 625 | if (otg_change & OTG_PULLUP) { |
626 | u32 l; | 626 | u32 l; |
627 | 627 | ||
628 | switch (isp->phy.state) { | 628 | switch (isp->phy.otg->state) { |
629 | case OTG_STATE_B_IDLE: | 629 | case OTG_STATE_B_IDLE: |
630 | if (clr & OTG1_DP_PULLUP) | 630 | if (clr & OTG1_DP_PULLUP) |
631 | break; | 631 | break; |
632 | isp->phy.state = OTG_STATE_B_PERIPHERAL; | 632 | isp->phy.otg->state = OTG_STATE_B_PERIPHERAL; |
633 | pr_debug(" --> b_peripheral\n"); | 633 | pr_debug(" --> b_peripheral\n"); |
634 | break; | 634 | break; |
635 | case OTG_STATE_A_SUSPEND: | 635 | case OTG_STATE_A_SUSPEND: |
636 | if (clr & OTG1_DP_PULLUP) | 636 | if (clr & OTG1_DP_PULLUP) |
637 | break; | 637 | break; |
638 | isp->phy.state = OTG_STATE_A_PERIPHERAL; | 638 | isp->phy.otg->state = OTG_STATE_A_PERIPHERAL; |
639 | pr_debug(" --> a_peripheral\n"); | 639 | pr_debug(" --> a_peripheral\n"); |
640 | break; | 640 | break; |
641 | default: | 641 | default: |
@@ -673,7 +673,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
673 | * remote wakeup (SRP, normal) using their own timer | 673 | * remote wakeup (SRP, normal) using their own timer |
674 | * to give "check cable and A-device" messages. | 674 | * to give "check cable and A-device" messages. |
675 | */ | 675 | */ |
676 | if (isp->phy.state == OTG_STATE_B_SRP_INIT) | 676 | if (isp->phy.otg->state == OTG_STATE_B_SRP_INIT) |
677 | b_idle(isp, "srp_timeout"); | 677 | b_idle(isp, "srp_timeout"); |
678 | 678 | ||
679 | omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC); | 679 | omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC); |
@@ -691,7 +691,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
691 | omap_writel(otg_ctrl, OTG_CTRL); | 691 | omap_writel(otg_ctrl, OTG_CTRL); |
692 | 692 | ||
693 | /* subset of b_peripheral()... */ | 693 | /* subset of b_peripheral()... */ |
694 | isp->phy.state = OTG_STATE_B_PERIPHERAL; | 694 | isp->phy.otg->state = OTG_STATE_B_PERIPHERAL; |
695 | pr_debug(" --> b_peripheral\n"); | 695 | pr_debug(" --> b_peripheral\n"); |
696 | 696 | ||
697 | omap_writew(B_HNP_FAIL, OTG_IRQ_SRC); | 697 | omap_writew(B_HNP_FAIL, OTG_IRQ_SRC); |
@@ -703,7 +703,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
703 | state_name(isp), omap_readl(OTG_CTRL)); | 703 | state_name(isp), omap_readl(OTG_CTRL)); |
704 | 704 | ||
705 | isp1301_defer_work(isp, WORK_UPDATE_OTG); | 705 | isp1301_defer_work(isp, WORK_UPDATE_OTG); |
706 | switch (isp->phy.state) { | 706 | switch (isp->phy.otg->state) { |
707 | case OTG_STATE_A_IDLE: | 707 | case OTG_STATE_A_IDLE: |
708 | if (!otg->host) | 708 | if (!otg->host) |
709 | break; | 709 | break; |
@@ -734,7 +734,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
734 | otg_ctrl |= OTG_BUSDROP; | 734 | otg_ctrl |= OTG_BUSDROP; |
735 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; | 735 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; |
736 | omap_writel(otg_ctrl, OTG_CTRL); | 736 | omap_writel(otg_ctrl, OTG_CTRL); |
737 | isp->phy.state = OTG_STATE_A_WAIT_VFALL; | 737 | isp->phy.otg->state = OTG_STATE_A_WAIT_VFALL; |
738 | 738 | ||
739 | omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC); | 739 | omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC); |
740 | ret = IRQ_HANDLED; | 740 | ret = IRQ_HANDLED; |
@@ -748,7 +748,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
748 | otg_ctrl |= OTG_BUSDROP; | 748 | otg_ctrl |= OTG_BUSDROP; |
749 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; | 749 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS; |
750 | omap_writel(otg_ctrl, OTG_CTRL); | 750 | omap_writel(otg_ctrl, OTG_CTRL); |
751 | isp->phy.state = OTG_STATE_A_VBUS_ERR; | 751 | isp->phy.otg->state = OTG_STATE_A_VBUS_ERR; |
752 | 752 | ||
753 | omap_writew(A_VBUS_ERR, OTG_IRQ_SRC); | 753 | omap_writew(A_VBUS_ERR, OTG_IRQ_SRC); |
754 | ret = IRQ_HANDLED; | 754 | ret = IRQ_HANDLED; |
@@ -769,7 +769,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
769 | 769 | ||
770 | /* role is peripheral */ | 770 | /* role is peripheral */ |
771 | if (otg_ctrl & OTG_DRIVER_SEL) { | 771 | if (otg_ctrl & OTG_DRIVER_SEL) { |
772 | switch (isp->phy.state) { | 772 | switch (isp->phy.otg->state) { |
773 | case OTG_STATE_A_IDLE: | 773 | case OTG_STATE_A_IDLE: |
774 | b_idle(isp, __func__); | 774 | b_idle(isp, __func__); |
775 | break; | 775 | break; |
@@ -786,18 +786,18 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp) | |||
786 | } | 786 | } |
787 | 787 | ||
788 | if (otg->host) { | 788 | if (otg->host) { |
789 | switch (isp->phy.state) { | 789 | switch (isp->phy.otg->state) { |
790 | case OTG_STATE_B_WAIT_ACON: | 790 | case OTG_STATE_B_WAIT_ACON: |
791 | isp->phy.state = OTG_STATE_B_HOST; | 791 | isp->phy.otg->state = OTG_STATE_B_HOST; |
792 | pr_debug(" --> b_host\n"); | 792 | pr_debug(" --> b_host\n"); |
793 | kick = 1; | 793 | kick = 1; |
794 | break; | 794 | break; |
795 | case OTG_STATE_A_WAIT_BCON: | 795 | case OTG_STATE_A_WAIT_BCON: |
796 | isp->phy.state = OTG_STATE_A_HOST; | 796 | isp->phy.otg->state = OTG_STATE_A_HOST; |
797 | pr_debug(" --> a_host\n"); | 797 | pr_debug(" --> a_host\n"); |
798 | break; | 798 | break; |
799 | case OTG_STATE_A_PERIPHERAL: | 799 | case OTG_STATE_A_PERIPHERAL: |
800 | isp->phy.state = OTG_STATE_A_WAIT_BCON; | 800 | isp->phy.otg->state = OTG_STATE_A_WAIT_BCON; |
801 | pr_debug(" --> a_wait_bcon\n"); | 801 | pr_debug(" --> a_wait_bcon\n"); |
802 | break; | 802 | break; |
803 | default: | 803 | default: |
@@ -937,7 +937,7 @@ static void b_peripheral(struct isp1301 *isp) | |||
937 | /* UDC driver just set OTG_BSESSVLD */ | 937 | /* UDC driver just set OTG_BSESSVLD */ |
938 | isp1301_set_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLUP); | 938 | isp1301_set_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLUP); |
939 | isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLDOWN); | 939 | isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLDOWN); |
940 | isp->phy.state = OTG_STATE_B_PERIPHERAL; | 940 | isp->phy.otg->state = OTG_STATE_B_PERIPHERAL; |
941 | pr_debug(" --> b_peripheral\n"); | 941 | pr_debug(" --> b_peripheral\n"); |
942 | dump_regs(isp, "2periph"); | 942 | dump_regs(isp, "2periph"); |
943 | #endif | 943 | #endif |
@@ -947,7 +947,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
947 | { | 947 | { |
948 | struct usb_otg *otg = isp->phy.otg; | 948 | struct usb_otg *otg = isp->phy.otg; |
949 | u8 isp_stat, isp_bstat; | 949 | u8 isp_stat, isp_bstat; |
950 | enum usb_otg_state state = isp->phy.state; | 950 | enum usb_otg_state state = isp->phy.otg->state; |
951 | 951 | ||
952 | if (stat & INTR_BDIS_ACON) | 952 | if (stat & INTR_BDIS_ACON) |
953 | pr_debug("OTG: BDIS_ACON, %s\n", state_name(isp)); | 953 | pr_debug("OTG: BDIS_ACON, %s\n", state_name(isp)); |
@@ -970,7 +970,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
970 | * when HNP is used. | 970 | * when HNP is used. |
971 | */ | 971 | */ |
972 | if (isp_stat & INTR_VBUS_VLD) | 972 | if (isp_stat & INTR_VBUS_VLD) |
973 | isp->phy.state = OTG_STATE_A_HOST; | 973 | isp->phy.otg->state = OTG_STATE_A_HOST; |
974 | break; | 974 | break; |
975 | case OTG_STATE_A_WAIT_VFALL: | 975 | case OTG_STATE_A_WAIT_VFALL: |
976 | if (!(isp_stat & INTR_SESS_VLD)) | 976 | if (!(isp_stat & INTR_SESS_VLD)) |
@@ -978,7 +978,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
978 | break; | 978 | break; |
979 | default: | 979 | default: |
980 | if (!(isp_stat & INTR_VBUS_VLD)) | 980 | if (!(isp_stat & INTR_VBUS_VLD)) |
981 | isp->phy.state = OTG_STATE_A_VBUS_ERR; | 981 | isp->phy.otg->state = OTG_STATE_A_VBUS_ERR; |
982 | break; | 982 | break; |
983 | } | 983 | } |
984 | isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS); | 984 | isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS); |
@@ -1007,7 +1007,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
1007 | if (otg->default_a) { | 1007 | if (otg->default_a) { |
1008 | switch (state) { | 1008 | switch (state) { |
1009 | default: | 1009 | default: |
1010 | isp->phy.state = OTG_STATE_A_WAIT_VFALL; | 1010 | isp->phy.otg->state = OTG_STATE_A_WAIT_VFALL; |
1011 | break; | 1011 | break; |
1012 | case OTG_STATE_A_WAIT_VFALL: | 1012 | case OTG_STATE_A_WAIT_VFALL: |
1013 | state = OTG_STATE_A_IDLE; | 1013 | state = OTG_STATE_A_IDLE; |
@@ -1020,7 +1020,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
1020 | host_suspend(isp); | 1020 | host_suspend(isp); |
1021 | isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, | 1021 | isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, |
1022 | MC1_BDIS_ACON_EN); | 1022 | MC1_BDIS_ACON_EN); |
1023 | isp->phy.state = OTG_STATE_B_IDLE; | 1023 | isp->phy.otg->state = OTG_STATE_B_IDLE; |
1024 | l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK; | 1024 | l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK; |
1025 | l &= ~OTG_CTRL_BITS; | 1025 | l &= ~OTG_CTRL_BITS; |
1026 | omap_writel(l, OTG_CTRL); | 1026 | omap_writel(l, OTG_CTRL); |
@@ -1031,7 +1031,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
1031 | } | 1031 | } |
1032 | isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS); | 1032 | isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS); |
1033 | 1033 | ||
1034 | switch (isp->phy.state) { | 1034 | switch (isp->phy.otg->state) { |
1035 | case OTG_STATE_B_PERIPHERAL: | 1035 | case OTG_STATE_B_PERIPHERAL: |
1036 | case OTG_STATE_B_WAIT_ACON: | 1036 | case OTG_STATE_B_WAIT_ACON: |
1037 | case OTG_STATE_B_HOST: | 1037 | case OTG_STATE_B_HOST: |
@@ -1071,7 +1071,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat) | |||
1071 | } | 1071 | } |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | if (state != isp->phy.state) | 1074 | if (state != isp->phy.otg->state) |
1075 | pr_debug(" isp, %s -> %s\n", | 1075 | pr_debug(" isp, %s -> %s\n", |
1076 | usb_otg_state_string(state), state_name(isp)); | 1076 | usb_otg_state_string(state), state_name(isp)); |
1077 | 1077 | ||
@@ -1129,10 +1129,10 @@ isp1301_work(struct work_struct *work) | |||
1129 | * skip A_WAIT_VRISE; hc transitions invisibly | 1129 | * skip A_WAIT_VRISE; hc transitions invisibly |
1130 | * skip A_WAIT_BCON; same. | 1130 | * skip A_WAIT_BCON; same. |
1131 | */ | 1131 | */ |
1132 | switch (isp->phy.state) { | 1132 | switch (isp->phy.otg->state) { |
1133 | case OTG_STATE_A_WAIT_BCON: | 1133 | case OTG_STATE_A_WAIT_BCON: |
1134 | case OTG_STATE_A_WAIT_VRISE: | 1134 | case OTG_STATE_A_WAIT_VRISE: |
1135 | isp->phy.state = OTG_STATE_A_HOST; | 1135 | isp->phy.otg->state = OTG_STATE_A_HOST; |
1136 | pr_debug(" --> a_host\n"); | 1136 | pr_debug(" --> a_host\n"); |
1137 | otg_ctrl = omap_readl(OTG_CTRL); | 1137 | otg_ctrl = omap_readl(OTG_CTRL); |
1138 | otg_ctrl |= OTG_A_BUSREQ; | 1138 | otg_ctrl |= OTG_A_BUSREQ; |
@@ -1141,7 +1141,7 @@ isp1301_work(struct work_struct *work) | |||
1141 | omap_writel(otg_ctrl, OTG_CTRL); | 1141 | omap_writel(otg_ctrl, OTG_CTRL); |
1142 | break; | 1142 | break; |
1143 | case OTG_STATE_B_WAIT_ACON: | 1143 | case OTG_STATE_B_WAIT_ACON: |
1144 | isp->phy.state = OTG_STATE_B_HOST; | 1144 | isp->phy.otg->state = OTG_STATE_B_HOST; |
1145 | pr_debug(" --> b_host (acon)\n"); | 1145 | pr_debug(" --> b_host (acon)\n"); |
1146 | break; | 1146 | break; |
1147 | case OTG_STATE_B_HOST: | 1147 | case OTG_STATE_B_HOST: |
@@ -1368,7 +1368,7 @@ isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) | |||
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | power_up(isp); | 1370 | power_up(isp); |
1371 | isp->phy.state = OTG_STATE_B_IDLE; | 1371 | isp->phy.otg->state = OTG_STATE_B_IDLE; |
1372 | 1372 | ||
1373 | if (machine_is_omap_h2() || machine_is_omap_h3()) | 1373 | if (machine_is_omap_h2() || machine_is_omap_h3()) |
1374 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); | 1374 | isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0); |
@@ -1403,7 +1403,7 @@ isp1301_set_power(struct usb_phy *dev, unsigned mA) | |||
1403 | { | 1403 | { |
1404 | if (!the_transceiver) | 1404 | if (!the_transceiver) |
1405 | return -ENODEV; | 1405 | return -ENODEV; |
1406 | if (dev->state == OTG_STATE_B_PERIPHERAL) | 1406 | if (dev->otg->state == OTG_STATE_B_PERIPHERAL) |
1407 | enable_vbus_draw(the_transceiver, mA); | 1407 | enable_vbus_draw(the_transceiver, mA); |
1408 | return 0; | 1408 | return 0; |
1409 | } | 1409 | } |
@@ -1414,7 +1414,7 @@ isp1301_start_srp(struct usb_otg *otg) | |||
1414 | struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); | 1414 | struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); |
1415 | u32 otg_ctrl; | 1415 | u32 otg_ctrl; |
1416 | 1416 | ||
1417 | if (isp != the_transceiver || isp->phy.state != OTG_STATE_B_IDLE) | 1417 | if (isp != the_transceiver || isp->phy.otg->state != OTG_STATE_B_IDLE) |
1418 | return -ENODEV; | 1418 | return -ENODEV; |
1419 | 1419 | ||
1420 | otg_ctrl = omap_readl(OTG_CTRL); | 1420 | otg_ctrl = omap_readl(OTG_CTRL); |
@@ -1424,7 +1424,7 @@ isp1301_start_srp(struct usb_otg *otg) | |||
1424 | otg_ctrl |= OTG_B_BUSREQ; | 1424 | otg_ctrl |= OTG_B_BUSREQ; |
1425 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK; | 1425 | otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK; |
1426 | omap_writel(otg_ctrl, OTG_CTRL); | 1426 | omap_writel(otg_ctrl, OTG_CTRL); |
1427 | isp->phy.state = OTG_STATE_B_SRP_INIT; | 1427 | isp->phy.otg->state = OTG_STATE_B_SRP_INIT; |
1428 | 1428 | ||
1429 | pr_debug("otg: SRP, %s ... %06x\n", state_name(isp), | 1429 | pr_debug("otg: SRP, %s ... %06x\n", state_name(isp), |
1430 | omap_readl(OTG_CTRL)); | 1430 | omap_readl(OTG_CTRL)); |
@@ -1452,9 +1452,9 @@ isp1301_start_hnp(struct usb_otg *otg) | |||
1452 | /* We want hardware to manage most HNP protocol timings. | 1452 | /* We want hardware to manage most HNP protocol timings. |
1453 | * So do this part as early as possible... | 1453 | * So do this part as early as possible... |
1454 | */ | 1454 | */ |
1455 | switch (isp->phy.state) { | 1455 | switch (isp->phy.otg->state) { |
1456 | case OTG_STATE_B_HOST: | 1456 | case OTG_STATE_B_HOST: |
1457 | isp->phy.state = OTG_STATE_B_PERIPHERAL; | 1457 | isp->phy.otg->state = OTG_STATE_B_PERIPHERAL; |
1458 | /* caller will suspend next */ | 1458 | /* caller will suspend next */ |
1459 | break; | 1459 | break; |
1460 | case OTG_STATE_A_HOST: | 1460 | case OTG_STATE_A_HOST: |
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c index 471e69dbcca0..18015b7c8afc 100644 --- a/drivers/usb/phy/phy-msm-usb.c +++ b/drivers/usb/phy/phy-msm-usb.c | |||
@@ -721,11 +721,11 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host) | |||
721 | } | 721 | } |
722 | 722 | ||
723 | if (!host) { | 723 | if (!host) { |
724 | if (otg->phy->state == OTG_STATE_A_HOST) { | 724 | if (otg->state == OTG_STATE_A_HOST) { |
725 | pm_runtime_get_sync(otg->phy->dev); | 725 | pm_runtime_get_sync(otg->phy->dev); |
726 | msm_otg_start_host(otg->phy, 0); | 726 | msm_otg_start_host(otg->phy, 0); |
727 | otg->host = NULL; | 727 | otg->host = NULL; |
728 | otg->phy->state = OTG_STATE_UNDEFINED; | 728 | otg->state = OTG_STATE_UNDEFINED; |
729 | schedule_work(&motg->sm_work); | 729 | schedule_work(&motg->sm_work); |
730 | } else { | 730 | } else { |
731 | otg->host = NULL; | 731 | otg->host = NULL; |
@@ -794,11 +794,11 @@ static int msm_otg_set_peripheral(struct usb_otg *otg, | |||
794 | } | 794 | } |
795 | 795 | ||
796 | if (!gadget) { | 796 | if (!gadget) { |
797 | if (otg->phy->state == OTG_STATE_B_PERIPHERAL) { | 797 | if (otg->state == OTG_STATE_B_PERIPHERAL) { |
798 | pm_runtime_get_sync(otg->phy->dev); | 798 | pm_runtime_get_sync(otg->phy->dev); |
799 | msm_otg_start_peripheral(otg->phy, 0); | 799 | msm_otg_start_peripheral(otg->phy, 0); |
800 | otg->gadget = NULL; | 800 | otg->gadget = NULL; |
801 | otg->phy->state = OTG_STATE_UNDEFINED; | 801 | otg->state = OTG_STATE_UNDEFINED; |
802 | schedule_work(&motg->sm_work); | 802 | schedule_work(&motg->sm_work); |
803 | } else { | 803 | } else { |
804 | otg->gadget = NULL; | 804 | otg->gadget = NULL; |
@@ -1170,12 +1170,12 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
1170 | struct msm_otg *motg = container_of(w, struct msm_otg, sm_work); | 1170 | struct msm_otg *motg = container_of(w, struct msm_otg, sm_work); |
1171 | struct usb_otg *otg = motg->phy.otg; | 1171 | struct usb_otg *otg = motg->phy.otg; |
1172 | 1172 | ||
1173 | switch (otg->phy->state) { | 1173 | switch (otg->state) { |
1174 | case OTG_STATE_UNDEFINED: | 1174 | case OTG_STATE_UNDEFINED: |
1175 | dev_dbg(otg->phy->dev, "OTG_STATE_UNDEFINED state\n"); | 1175 | dev_dbg(otg->phy->dev, "OTG_STATE_UNDEFINED state\n"); |
1176 | msm_otg_reset(otg->phy); | 1176 | msm_otg_reset(otg->phy); |
1177 | msm_otg_init_sm(motg); | 1177 | msm_otg_init_sm(motg); |
1178 | otg->phy->state = OTG_STATE_B_IDLE; | 1178 | otg->state = OTG_STATE_B_IDLE; |
1179 | /* FALL THROUGH */ | 1179 | /* FALL THROUGH */ |
1180 | case OTG_STATE_B_IDLE: | 1180 | case OTG_STATE_B_IDLE: |
1181 | dev_dbg(otg->phy->dev, "OTG_STATE_B_IDLE state\n"); | 1181 | dev_dbg(otg->phy->dev, "OTG_STATE_B_IDLE state\n"); |
@@ -1183,7 +1183,7 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
1183 | /* disable BSV bit */ | 1183 | /* disable BSV bit */ |
1184 | writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC); | 1184 | writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC); |
1185 | msm_otg_start_host(otg->phy, 1); | 1185 | msm_otg_start_host(otg->phy, 1); |
1186 | otg->phy->state = OTG_STATE_A_HOST; | 1186 | otg->state = OTG_STATE_A_HOST; |
1187 | } else if (test_bit(B_SESS_VLD, &motg->inputs)) { | 1187 | } else if (test_bit(B_SESS_VLD, &motg->inputs)) { |
1188 | switch (motg->chg_state) { | 1188 | switch (motg->chg_state) { |
1189 | case USB_CHG_STATE_UNDEFINED: | 1189 | case USB_CHG_STATE_UNDEFINED: |
@@ -1199,13 +1199,13 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
1199 | msm_otg_notify_charger(motg, | 1199 | msm_otg_notify_charger(motg, |
1200 | IDEV_CHG_MAX); | 1200 | IDEV_CHG_MAX); |
1201 | msm_otg_start_peripheral(otg->phy, 1); | 1201 | msm_otg_start_peripheral(otg->phy, 1); |
1202 | otg->phy->state | 1202 | otg->state |
1203 | = OTG_STATE_B_PERIPHERAL; | 1203 | = OTG_STATE_B_PERIPHERAL; |
1204 | break; | 1204 | break; |
1205 | case USB_SDP_CHARGER: | 1205 | case USB_SDP_CHARGER: |
1206 | msm_otg_notify_charger(motg, IUNIT); | 1206 | msm_otg_notify_charger(motg, IUNIT); |
1207 | msm_otg_start_peripheral(otg->phy, 1); | 1207 | msm_otg_start_peripheral(otg->phy, 1); |
1208 | otg->phy->state | 1208 | otg->state |
1209 | = OTG_STATE_B_PERIPHERAL; | 1209 | = OTG_STATE_B_PERIPHERAL; |
1210 | break; | 1210 | break; |
1211 | default: | 1211 | default: |
@@ -1230,7 +1230,7 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
1230 | motg->chg_type = USB_INVALID_CHARGER; | 1230 | motg->chg_type = USB_INVALID_CHARGER; |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | if (otg->phy->state == OTG_STATE_B_IDLE) | 1233 | if (otg->state == OTG_STATE_B_IDLE) |
1234 | pm_runtime_put_sync(otg->phy->dev); | 1234 | pm_runtime_put_sync(otg->phy->dev); |
1235 | break; | 1235 | break; |
1236 | case OTG_STATE_B_PERIPHERAL: | 1236 | case OTG_STATE_B_PERIPHERAL: |
@@ -1241,7 +1241,7 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
1241 | msm_otg_start_peripheral(otg->phy, 0); | 1241 | msm_otg_start_peripheral(otg->phy, 0); |
1242 | motg->chg_state = USB_CHG_STATE_UNDEFINED; | 1242 | motg->chg_state = USB_CHG_STATE_UNDEFINED; |
1243 | motg->chg_type = USB_INVALID_CHARGER; | 1243 | motg->chg_type = USB_INVALID_CHARGER; |
1244 | otg->phy->state = OTG_STATE_B_IDLE; | 1244 | otg->state = OTG_STATE_B_IDLE; |
1245 | msm_otg_reset(otg->phy); | 1245 | msm_otg_reset(otg->phy); |
1246 | schedule_work(w); | 1246 | schedule_work(w); |
1247 | } | 1247 | } |
@@ -1250,7 +1250,7 @@ static void msm_otg_sm_work(struct work_struct *w) | |||
1250 | dev_dbg(otg->phy->dev, "OTG_STATE_A_HOST state\n"); | 1250 | dev_dbg(otg->phy->dev, "OTG_STATE_A_HOST state\n"); |
1251 | if (test_bit(ID, &motg->inputs)) { | 1251 | if (test_bit(ID, &motg->inputs)) { |
1252 | msm_otg_start_host(otg->phy, 0); | 1252 | msm_otg_start_host(otg->phy, 0); |
1253 | otg->phy->state = OTG_STATE_B_IDLE; | 1253 | otg->state = OTG_STATE_B_IDLE; |
1254 | msm_otg_reset(otg->phy); | 1254 | msm_otg_reset(otg->phy); |
1255 | schedule_work(w); | 1255 | schedule_work(w); |
1256 | } | 1256 | } |
@@ -1303,7 +1303,7 @@ static int msm_otg_mode_show(struct seq_file *s, void *unused) | |||
1303 | struct msm_otg *motg = s->private; | 1303 | struct msm_otg *motg = s->private; |
1304 | struct usb_otg *otg = motg->phy.otg; | 1304 | struct usb_otg *otg = motg->phy.otg; |
1305 | 1305 | ||
1306 | switch (otg->phy->state) { | 1306 | switch (otg->state) { |
1307 | case OTG_STATE_A_HOST: | 1307 | case OTG_STATE_A_HOST: |
1308 | seq_puts(s, "host\n"); | 1308 | seq_puts(s, "host\n"); |
1309 | break; | 1309 | break; |
@@ -1353,7 +1353,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf, | |||
1353 | 1353 | ||
1354 | switch (req_mode) { | 1354 | switch (req_mode) { |
1355 | case USB_DR_MODE_UNKNOWN: | 1355 | case USB_DR_MODE_UNKNOWN: |
1356 | switch (otg->phy->state) { | 1356 | switch (otg->state) { |
1357 | case OTG_STATE_A_HOST: | 1357 | case OTG_STATE_A_HOST: |
1358 | case OTG_STATE_B_PERIPHERAL: | 1358 | case OTG_STATE_B_PERIPHERAL: |
1359 | set_bit(ID, &motg->inputs); | 1359 | set_bit(ID, &motg->inputs); |
@@ -1364,7 +1364,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf, | |||
1364 | } | 1364 | } |
1365 | break; | 1365 | break; |
1366 | case USB_DR_MODE_PERIPHERAL: | 1366 | case USB_DR_MODE_PERIPHERAL: |
1367 | switch (otg->phy->state) { | 1367 | switch (otg->state) { |
1368 | case OTG_STATE_B_IDLE: | 1368 | case OTG_STATE_B_IDLE: |
1369 | case OTG_STATE_A_HOST: | 1369 | case OTG_STATE_A_HOST: |
1370 | set_bit(ID, &motg->inputs); | 1370 | set_bit(ID, &motg->inputs); |
@@ -1375,7 +1375,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf, | |||
1375 | } | 1375 | } |
1376 | break; | 1376 | break; |
1377 | case USB_DR_MODE_HOST: | 1377 | case USB_DR_MODE_HOST: |
1378 | switch (otg->phy->state) { | 1378 | switch (otg->state) { |
1379 | case OTG_STATE_B_IDLE: | 1379 | case OTG_STATE_B_IDLE: |
1380 | case OTG_STATE_B_PERIPHERAL: | 1380 | case OTG_STATE_B_PERIPHERAL: |
1381 | clear_bit(ID, &motg->inputs); | 1381 | clear_bit(ID, &motg->inputs); |
@@ -1769,7 +1769,7 @@ static int msm_otg_runtime_idle(struct device *dev) | |||
1769 | * This 1 sec delay also prevents entering into LPM immediately | 1769 | * This 1 sec delay also prevents entering into LPM immediately |
1770 | * after asynchronous interrupt. | 1770 | * after asynchronous interrupt. |
1771 | */ | 1771 | */ |
1772 | if (otg->phy->state != OTG_STATE_UNDEFINED) | 1772 | if (otg->state != OTG_STATE_UNDEFINED) |
1773 | pm_schedule_suspend(dev, 1000); | 1773 | pm_schedule_suspend(dev, 1000); |
1774 | 1774 | ||
1775 | return -EAGAIN; | 1775 | return -EAGAIN; |
diff --git a/drivers/usb/phy/phy-mv-usb.c b/drivers/usb/phy/phy-mv-usb.c index c9517d8bda8d..ee87aa7144db 100644 --- a/drivers/usb/phy/phy-mv-usb.c +++ b/drivers/usb/phy/phy-mv-usb.c | |||
@@ -339,68 +339,68 @@ static void mv_otg_update_state(struct mv_otg *mvotg) | |||
339 | { | 339 | { |
340 | struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; | 340 | struct mv_otg_ctrl *otg_ctrl = &mvotg->otg_ctrl; |
341 | struct usb_phy *phy = &mvotg->phy; | 341 | struct usb_phy *phy = &mvotg->phy; |
342 | int old_state = phy->state; | 342 | int old_state = mvotg->phy.otg->state; |
343 | 343 | ||
344 | switch (old_state) { | 344 | switch (old_state) { |
345 | case OTG_STATE_UNDEFINED: | 345 | case OTG_STATE_UNDEFINED: |
346 | phy->state = OTG_STATE_B_IDLE; | 346 | mvotg->phy.otg->state = OTG_STATE_B_IDLE; |
347 | /* FALL THROUGH */ | 347 | /* FALL THROUGH */ |
348 | case OTG_STATE_B_IDLE: | 348 | case OTG_STATE_B_IDLE: |
349 | if (otg_ctrl->id == 0) | 349 | if (otg_ctrl->id == 0) |
350 | phy->state = OTG_STATE_A_IDLE; | 350 | mvotg->phy.otg->state = OTG_STATE_A_IDLE; |
351 | else if (otg_ctrl->b_sess_vld) | 351 | else if (otg_ctrl->b_sess_vld) |
352 | phy->state = OTG_STATE_B_PERIPHERAL; | 352 | mvotg->phy.otg->state = OTG_STATE_B_PERIPHERAL; |
353 | break; | 353 | break; |
354 | case OTG_STATE_B_PERIPHERAL: | 354 | case OTG_STATE_B_PERIPHERAL: |
355 | if (!otg_ctrl->b_sess_vld || otg_ctrl->id == 0) | 355 | if (!otg_ctrl->b_sess_vld || otg_ctrl->id == 0) |
356 | phy->state = OTG_STATE_B_IDLE; | 356 | mvotg->phy.otg->state = OTG_STATE_B_IDLE; |
357 | break; | 357 | break; |
358 | case OTG_STATE_A_IDLE: | 358 | case OTG_STATE_A_IDLE: |
359 | if (otg_ctrl->id) | 359 | if (otg_ctrl->id) |
360 | phy->state = OTG_STATE_B_IDLE; | 360 | mvotg->phy.otg->state = OTG_STATE_B_IDLE; |
361 | else if (!(otg_ctrl->a_bus_drop) && | 361 | else if (!(otg_ctrl->a_bus_drop) && |
362 | (otg_ctrl->a_bus_req || otg_ctrl->a_srp_det)) | 362 | (otg_ctrl->a_bus_req || otg_ctrl->a_srp_det)) |
363 | phy->state = OTG_STATE_A_WAIT_VRISE; | 363 | mvotg->phy.otg->state = OTG_STATE_A_WAIT_VRISE; |
364 | break; | 364 | break; |
365 | case OTG_STATE_A_WAIT_VRISE: | 365 | case OTG_STATE_A_WAIT_VRISE: |
366 | if (otg_ctrl->a_vbus_vld) | 366 | if (otg_ctrl->a_vbus_vld) |
367 | phy->state = OTG_STATE_A_WAIT_BCON; | 367 | mvotg->phy.otg->state = OTG_STATE_A_WAIT_BCON; |
368 | break; | 368 | break; |
369 | case OTG_STATE_A_WAIT_BCON: | 369 | case OTG_STATE_A_WAIT_BCON: |
370 | if (otg_ctrl->id || otg_ctrl->a_bus_drop | 370 | if (otg_ctrl->id || otg_ctrl->a_bus_drop |
371 | || otg_ctrl->a_wait_bcon_timeout) { | 371 | || otg_ctrl->a_wait_bcon_timeout) { |
372 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); | 372 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); |
373 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; | 373 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; |
374 | phy->state = OTG_STATE_A_WAIT_VFALL; | 374 | mvotg->phy.otg->state = OTG_STATE_A_WAIT_VFALL; |
375 | otg_ctrl->a_bus_req = 0; | 375 | otg_ctrl->a_bus_req = 0; |
376 | } else if (!otg_ctrl->a_vbus_vld) { | 376 | } else if (!otg_ctrl->a_vbus_vld) { |
377 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); | 377 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); |
378 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; | 378 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; |
379 | phy->state = OTG_STATE_A_VBUS_ERR; | 379 | mvotg->phy.otg->state = OTG_STATE_A_VBUS_ERR; |
380 | } else if (otg_ctrl->b_conn) { | 380 | } else if (otg_ctrl->b_conn) { |
381 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); | 381 | mv_otg_cancel_timer(mvotg, A_WAIT_BCON_TIMER); |
382 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; | 382 | mvotg->otg_ctrl.a_wait_bcon_timeout = 0; |
383 | phy->state = OTG_STATE_A_HOST; | 383 | mvotg->phy.otg->state = OTG_STATE_A_HOST; |
384 | } | 384 | } |
385 | break; | 385 | break; |
386 | case OTG_STATE_A_HOST: | 386 | case OTG_STATE_A_HOST: |
387 | if (otg_ctrl->id || !otg_ctrl->b_conn | 387 | if (otg_ctrl->id || !otg_ctrl->b_conn |
388 | || otg_ctrl->a_bus_drop) | 388 | || otg_ctrl->a_bus_drop) |
389 | phy->state = OTG_STATE_A_WAIT_BCON; | 389 | mvotg->phy.otg->state = OTG_STATE_A_WAIT_BCON; |
390 | else if (!otg_ctrl->a_vbus_vld) | 390 | else if (!otg_ctrl->a_vbus_vld) |
391 | phy->state = OTG_STATE_A_VBUS_ERR; | 391 | mvotg->phy.otg->state = OTG_STATE_A_VBUS_ERR; |
392 | break; | 392 | break; |
393 | case OTG_STATE_A_WAIT_VFALL: | 393 | case OTG_STATE_A_WAIT_VFALL: |
394 | if (otg_ctrl->id | 394 | if (otg_ctrl->id |
395 | || (!otg_ctrl->b_conn && otg_ctrl->a_sess_vld) | 395 | || (!otg_ctrl->b_conn && otg_ctrl->a_sess_vld) |
396 | || otg_ctrl->a_bus_req) | 396 | || otg_ctrl->a_bus_req) |
397 | phy->state = OTG_STATE_A_IDLE; | 397 | mvotg->phy.otg->state = OTG_STATE_A_IDLE; |
398 | break; | 398 | break; |
399 | case OTG_STATE_A_VBUS_ERR: | 399 | case OTG_STATE_A_VBUS_ERR: |
400 | if (otg_ctrl->id || otg_ctrl->a_clr_err | 400 | if (otg_ctrl->id || otg_ctrl->a_clr_err |
401 | || otg_ctrl->a_bus_drop) { | 401 | || otg_ctrl->a_bus_drop) { |
402 | otg_ctrl->a_clr_err = 0; | 402 | otg_ctrl->a_clr_err = 0; |
403 | phy->state = OTG_STATE_A_WAIT_VFALL; | 403 | mvotg->phy.otg->state = OTG_STATE_A_WAIT_VFALL; |
404 | } | 404 | } |
405 | break; | 405 | break; |
406 | default: | 406 | default: |
@@ -420,8 +420,8 @@ static void mv_otg_work(struct work_struct *work) | |||
420 | run: | 420 | run: |
421 | /* work queue is single thread, or we need spin_lock to protect */ | 421 | /* work queue is single thread, or we need spin_lock to protect */ |
422 | phy = &mvotg->phy; | 422 | phy = &mvotg->phy; |
423 | otg = phy->otg; | 423 | otg = mvotg->phy.otg; |
424 | old_state = phy->state; | 424 | old_state = otg->state; |
425 | 425 | ||
426 | if (!mvotg->active) | 426 | if (!mvotg->active) |
427 | return; | 427 | return; |
@@ -429,12 +429,12 @@ run: | |||
429 | mv_otg_update_inputs(mvotg); | 429 | mv_otg_update_inputs(mvotg); |
430 | mv_otg_update_state(mvotg); | 430 | mv_otg_update_state(mvotg); |
431 | 431 | ||
432 | if (old_state != phy->state) { | 432 | if (old_state != mvotg->phy.otg->state) { |
433 | dev_info(&mvotg->pdev->dev, "change from state %s to %s\n", | 433 | dev_info(&mvotg->pdev->dev, "change from state %s to %s\n", |
434 | state_string[old_state], | 434 | state_string[old_state], |
435 | state_string[phy->state]); | 435 | state_string[mvotg->phy.otg->state]); |
436 | 436 | ||
437 | switch (phy->state) { | 437 | switch (mvotg->phy.otg->state) { |
438 | case OTG_STATE_B_IDLE: | 438 | case OTG_STATE_B_IDLE: |
439 | otg->default_a = 0; | 439 | otg->default_a = 0; |
440 | if (old_state == OTG_STATE_B_PERIPHERAL) | 440 | if (old_state == OTG_STATE_B_PERIPHERAL) |
@@ -545,8 +545,8 @@ set_a_bus_req(struct device *dev, struct device_attribute *attr, | |||
545 | return -1; | 545 | return -1; |
546 | 546 | ||
547 | /* We will use this interface to change to A device */ | 547 | /* We will use this interface to change to A device */ |
548 | if (mvotg->phy.state != OTG_STATE_B_IDLE | 548 | if (mvotg->phy.otg->state != OTG_STATE_B_IDLE |
549 | && mvotg->phy.state != OTG_STATE_A_IDLE) | 549 | && mvotg->phy.otg->state != OTG_STATE_A_IDLE) |
550 | return -1; | 550 | return -1; |
551 | 551 | ||
552 | /* The clock may disabled and we need to set irq for ID detected */ | 552 | /* The clock may disabled and we need to set irq for ID detected */ |
@@ -715,9 +715,9 @@ static int mv_otg_probe(struct platform_device *pdev) | |||
715 | mvotg->phy.dev = &pdev->dev; | 715 | mvotg->phy.dev = &pdev->dev; |
716 | mvotg->phy.otg = otg; | 716 | mvotg->phy.otg = otg; |
717 | mvotg->phy.label = driver_name; | 717 | mvotg->phy.label = driver_name; |
718 | mvotg->phy.state = OTG_STATE_UNDEFINED; | ||
719 | 718 | ||
720 | otg->phy = &mvotg->phy; | 719 | otg->phy = &mvotg->phy; |
720 | otg->state = OTG_STATE_UNDEFINED; | ||
721 | otg->set_host = mv_otg_set_host; | 721 | otg->set_host = mv_otg_set_host; |
722 | otg->set_peripheral = mv_otg_set_peripheral; | 722 | otg->set_peripheral = mv_otg_set_peripheral; |
723 | otg->set_vbus = mv_otg_set_vbus; | 723 | otg->set_vbus = mv_otg_set_vbus; |
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c index cc61ee44b911..04ece535c2f8 100644 --- a/drivers/usb/phy/phy-tahvo.c +++ b/drivers/usb/phy/phy-tahvo.c | |||
@@ -81,33 +81,33 @@ static void check_vbus_state(struct tahvo_usb *tu) | |||
81 | 81 | ||
82 | reg = retu_read(rdev, TAHVO_REG_IDSR); | 82 | reg = retu_read(rdev, TAHVO_REG_IDSR); |
83 | if (reg & TAHVO_STAT_VBUS) { | 83 | if (reg & TAHVO_STAT_VBUS) { |
84 | switch (tu->phy.state) { | 84 | switch (tu->phy.otg->state) { |
85 | case OTG_STATE_B_IDLE: | 85 | case OTG_STATE_B_IDLE: |
86 | /* Enable the gadget driver */ | 86 | /* Enable the gadget driver */ |
87 | if (tu->phy.otg->gadget) | 87 | if (tu->phy.otg->gadget) |
88 | usb_gadget_vbus_connect(tu->phy.otg->gadget); | 88 | usb_gadget_vbus_connect(tu->phy.otg->gadget); |
89 | tu->phy.state = OTG_STATE_B_PERIPHERAL; | 89 | tu->phy.otg->state = OTG_STATE_B_PERIPHERAL; |
90 | break; | 90 | break; |
91 | case OTG_STATE_A_IDLE: | 91 | case OTG_STATE_A_IDLE: |
92 | /* | 92 | /* |
93 | * Session is now valid assuming the USB hub is driving | 93 | * Session is now valid assuming the USB hub is driving |
94 | * Vbus. | 94 | * Vbus. |
95 | */ | 95 | */ |
96 | tu->phy.state = OTG_STATE_A_HOST; | 96 | tu->phy.otg->state = OTG_STATE_A_HOST; |
97 | break; | 97 | break; |
98 | default: | 98 | default: |
99 | break; | 99 | break; |
100 | } | 100 | } |
101 | dev_info(&tu->pt_dev->dev, "USB cable connected\n"); | 101 | dev_info(&tu->pt_dev->dev, "USB cable connected\n"); |
102 | } else { | 102 | } else { |
103 | switch (tu->phy.state) { | 103 | switch (tu->phy.otg->state) { |
104 | case OTG_STATE_B_PERIPHERAL: | 104 | case OTG_STATE_B_PERIPHERAL: |
105 | if (tu->phy.otg->gadget) | 105 | if (tu->phy.otg->gadget) |
106 | usb_gadget_vbus_disconnect(tu->phy.otg->gadget); | 106 | usb_gadget_vbus_disconnect(tu->phy.otg->gadget); |
107 | tu->phy.state = OTG_STATE_B_IDLE; | 107 | tu->phy.otg->state = OTG_STATE_B_IDLE; |
108 | break; | 108 | break; |
109 | case OTG_STATE_A_HOST: | 109 | case OTG_STATE_A_HOST: |
110 | tu->phy.state = OTG_STATE_A_IDLE; | 110 | tu->phy.otg->state = OTG_STATE_A_IDLE; |
111 | break; | 111 | break; |
112 | default: | 112 | default: |
113 | break; | 113 | break; |
@@ -132,14 +132,14 @@ static void tahvo_usb_become_host(struct tahvo_usb *tu) | |||
132 | /* Power up the transceiver in USB host mode */ | 132 | /* Power up the transceiver in USB host mode */ |
133 | retu_write(rdev, TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND | | 133 | retu_write(rdev, TAHVO_REG_USBR, USBR_REGOUT | USBR_NSUSPEND | |
134 | USBR_MASTER_SW2 | USBR_MASTER_SW1); | 134 | USBR_MASTER_SW2 | USBR_MASTER_SW1); |
135 | tu->phy.state = OTG_STATE_A_IDLE; | 135 | tu->phy.otg->state = OTG_STATE_A_IDLE; |
136 | 136 | ||
137 | check_vbus_state(tu); | 137 | check_vbus_state(tu); |
138 | } | 138 | } |
139 | 139 | ||
140 | static void tahvo_usb_stop_host(struct tahvo_usb *tu) | 140 | static void tahvo_usb_stop_host(struct tahvo_usb *tu) |
141 | { | 141 | { |
142 | tu->phy.state = OTG_STATE_A_IDLE; | 142 | tu->phy.otg->state = OTG_STATE_A_IDLE; |
143 | } | 143 | } |
144 | 144 | ||
145 | static void tahvo_usb_become_peripheral(struct tahvo_usb *tu) | 145 | static void tahvo_usb_become_peripheral(struct tahvo_usb *tu) |
@@ -151,7 +151,7 @@ static void tahvo_usb_become_peripheral(struct tahvo_usb *tu) | |||
151 | /* Power up transceiver and set it in USB peripheral mode */ | 151 | /* Power up transceiver and set it in USB peripheral mode */ |
152 | retu_write(rdev, TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT | | 152 | retu_write(rdev, TAHVO_REG_USBR, USBR_SLAVE_CONTROL | USBR_REGOUT | |
153 | USBR_NSUSPEND | USBR_SLAVE_SW); | 153 | USBR_NSUSPEND | USBR_SLAVE_SW); |
154 | tu->phy.state = OTG_STATE_B_IDLE; | 154 | tu->phy.otg->state = OTG_STATE_B_IDLE; |
155 | 155 | ||
156 | check_vbus_state(tu); | 156 | check_vbus_state(tu); |
157 | } | 157 | } |
@@ -160,7 +160,7 @@ static void tahvo_usb_stop_peripheral(struct tahvo_usb *tu) | |||
160 | { | 160 | { |
161 | if (tu->phy.otg->gadget) | 161 | if (tu->phy.otg->gadget) |
162 | usb_gadget_vbus_disconnect(tu->phy.otg->gadget); | 162 | usb_gadget_vbus_disconnect(tu->phy.otg->gadget); |
163 | tu->phy.state = OTG_STATE_B_IDLE; | 163 | tu->phy.otg->state = OTG_STATE_B_IDLE; |
164 | } | 164 | } |
165 | 165 | ||
166 | static void tahvo_usb_power_off(struct tahvo_usb *tu) | 166 | static void tahvo_usb_power_off(struct tahvo_usb *tu) |
@@ -173,7 +173,7 @@ static void tahvo_usb_power_off(struct tahvo_usb *tu) | |||
173 | 173 | ||
174 | /* Power off transceiver */ | 174 | /* Power off transceiver */ |
175 | retu_write(rdev, TAHVO_REG_USBR, 0); | 175 | retu_write(rdev, TAHVO_REG_USBR, 0); |
176 | tu->phy.state = OTG_STATE_UNDEFINED; | 176 | tu->phy.otg->state = OTG_STATE_UNDEFINED; |
177 | } | 177 | } |
178 | 178 | ||
179 | static int tahvo_usb_set_suspend(struct usb_phy *dev, int suspend) | 179 | static int tahvo_usb_set_suspend(struct usb_phy *dev, int suspend) |
@@ -379,7 +379,7 @@ static int tahvo_usb_probe(struct platform_device *pdev) | |||
379 | /* Create OTG interface */ | 379 | /* Create OTG interface */ |
380 | tahvo_usb_power_off(tu); | 380 | tahvo_usb_power_off(tu); |
381 | tu->phy.dev = &pdev->dev; | 381 | tu->phy.dev = &pdev->dev; |
382 | tu->phy.state = OTG_STATE_UNDEFINED; | 382 | tu->phy.otg->state = OTG_STATE_UNDEFINED; |
383 | tu->phy.label = DRIVER_NAME; | 383 | tu->phy.label = DRIVER_NAME; |
384 | tu->phy.set_suspend = tahvo_usb_set_suspend; | 384 | tu->phy.set_suspend = tahvo_usb_set_suspend; |
385 | 385 | ||
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 154332b7c8c0..33d3480c9cda 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
@@ -18,6 +18,8 @@ struct usb_otg { | |||
18 | struct usb_bus *host; | 18 | struct usb_bus *host; |
19 | struct usb_gadget *gadget; | 19 | struct usb_gadget *gadget; |
20 | 20 | ||
21 | enum usb_otg_state state; | ||
22 | |||
21 | /* bind/unbind the host controller */ | 23 | /* bind/unbind the host controller */ |
22 | int (*set_host)(struct usb_otg *otg, struct usb_bus *host); | 24 | int (*set_host)(struct usb_otg *otg, struct usb_bus *host); |
23 | 25 | ||
diff --git a/include/linux/usb/phy.h b/include/linux/usb/phy.h index 353053a33f21..ac7d7913694f 100644 --- a/include/linux/usb/phy.h +++ b/include/linux/usb/phy.h | |||
@@ -77,7 +77,6 @@ struct usb_phy { | |||
77 | unsigned int flags; | 77 | unsigned int flags; |
78 | 78 | ||
79 | enum usb_phy_type type; | 79 | enum usb_phy_type type; |
80 | enum usb_otg_state state; | ||
81 | enum usb_phy_events last_event; | 80 | enum usb_phy_events last_event; |
82 | 81 | ||
83 | struct usb_otg *otg; | 82 | struct usb_otg *otg; |