Lines Matching refs:musb
23 struct musb *musb;
27 musb = container_of(work, struct musb, finish_resume_work.work);
29 spin_lock_irqsave(&musb->lock, flags);
31 power = musb_readb(musb->mregs, MUSB_POWER);
33 musb_dbg(musb, "root port resume stopped, power %02x", power);
34 musb_writeb(musb->mregs, MUSB_POWER, power);
41 musb->is_active = 1;
42 musb->port1_status &= ~(USB_PORT_STAT_SUSPEND | MUSB_PORT_STAT_RESUME);
43 musb->port1_status |= USB_PORT_STAT_C_SUSPEND << 16;
44 usb_hcd_poll_rh_status(musb->hcd);
46 musb->xceiv->otg->state = OTG_STATE_A_HOST;
48 spin_unlock_irqrestore(&musb->lock, flags);
51 int musb_port_suspend(struct musb *musb, bool do_suspend)
53 struct usb_otg *otg = musb->xceiv->otg;
55 void __iomem *mbase = musb->mregs;
57 if (!is_host_active(musb))
85 musb_dbg(musb, "Root port suspended, power %02x", power);
87 musb->port1_status |= USB_PORT_STAT_SUSPEND;
88 switch (musb->xceiv->otg->state) {
90 musb->xceiv->otg->state = OTG_STATE_A_SUSPEND;
91 musb->is_active = otg->host->b_hnp_enable;
92 if (musb->is_active)
93 mod_timer(&musb->otg_timer, jiffies
96 musb_platform_try_idle(musb, 0);
99 musb->xceiv->otg->state = OTG_STATE_B_WAIT_ACON;
100 musb->is_active = otg->host->b_hnp_enable;
101 musb_platform_try_idle(musb, 0);
104 musb_dbg(musb, "bogus rh suspend? %s",
105 usb_otg_state_string(musb->xceiv->otg->state));
112 musb_dbg(musb, "Root port resuming, power %02x", power);
114 musb->port1_status |= MUSB_PORT_STAT_RESUME;
115 schedule_delayed_work(&musb->finish_resume_work,
121 void musb_port_reset(struct musb *musb, bool do_reset)
124 void __iomem *mbase = musb->mregs;
126 if (musb->xceiv->otg->state == OTG_STATE_B_IDLE) {
127 musb_dbg(musb, "HNP: Returning from HNP; no hub reset from b_idle");
128 musb->port1_status &= ~USB_PORT_STAT_RESET;
132 if (!is_host_active(musb))
142 * Then we must clear RESUME and wait a bit to let musb start
148 long remain = (unsigned long) musb->rh_timer - jiffies;
150 if (musb->rh_timer > 0 && remain > 0) {
153 &musb->deassert_reset_work, remain);
161 schedule_delayed_work(&musb->deassert_reset_work,
170 musb->port1_status |= USB_PORT_STAT_RESET;
171 musb->port1_status &= ~USB_PORT_STAT_ENABLE;
172 schedule_delayed_work(&musb->deassert_reset_work,
175 musb_dbg(musb, "root port reset stopped");
176 musb_platform_pre_root_reset_end(musb);
179 musb_platform_post_root_reset_end(musb);
183 musb_dbg(musb, "high-speed device connected");
184 musb->port1_status |= USB_PORT_STAT_HIGH_SPEED;
187 musb->port1_status &= ~USB_PORT_STAT_RESET;
188 musb->port1_status |= USB_PORT_STAT_ENABLE
191 usb_hcd_poll_rh_status(musb->hcd);
193 musb->vbuserr_retry = VBUSERR_RETRY_COUNT;
197 void musb_root_disconnect(struct musb *musb)
199 struct usb_otg *otg = musb->xceiv->otg;
201 musb->port1_status = USB_PORT_STAT_POWER
204 usb_hcd_poll_rh_status(musb->hcd);
205 musb->is_active = 0;
207 switch (musb->xceiv->otg->state) {
210 musb->xceiv->otg->state = OTG_STATE_A_PERIPHERAL;
211 musb->g.is_a_peripheral = 1;
216 musb->xceiv->otg->state = OTG_STATE_A_WAIT_BCON;
217 musb->is_active = 0;
220 musb->xceiv->otg->state = OTG_STATE_B_IDLE;
223 musb_dbg(musb, "host disconnect (%s)",
224 usb_otg_state_string(musb->xceiv->otg->state));
232 /* Caller may or may not hold musb->lock */
235 struct musb *musb = hcd_to_musb(hcd);
239 if (musb->port1_status & 0xffff0000) {
246 static int musb_has_gadget(struct musb *musb)
257 return musb->port_mode == MUSB_HOST;
269 struct musb *musb = hcd_to_musb(hcd);
275 spin_lock_irqsave(&musb->lock, flags);
278 spin_unlock_irqrestore(&musb->lock, flags);
305 musb_port_suspend(musb, false);
309 musb_platform_set_vbus(musb, 0);
320 musb_dbg(musb, "clear feature %d", wValue);
321 musb->port1_status &= ~(1 << wValue);
350 put_unaligned(cpu_to_le32(musb->port1_status
355 musb_dbg(musb, "port status %08x", musb->port1_status);
373 if (!hcd->self.is_b_host && musb_has_gadget(musb))
377 musb_port_reset(musb, true);
380 musb_port_suspend(musb, true);
383 if (unlikely(is_host_active(musb)))
403 musb_load_testpacket(musb);
410 musb_writeb(musb->mregs, MUSB_DEVCTL,
420 musb_writeb(musb->mregs, MUSB_TESTMODE, temp);
425 musb_dbg(musb, "set feature %d", wValue);
426 musb->port1_status |= 1 << wValue;
434 spin_unlock_irqrestore(&musb->lock, flags);
437 musb_start(musb);