* change it unless you really know what you're doing
*/
+ DBG(4, "Some asshole called musb_charger_detect!");
+
switch(musb->xceiv->state) {
case OTG_STATE_B_IDLE:
/* we always reset transceiver */
reg = musb_readb(mbase, MUSB_DEVCTL);
reg |= MUSB_DEVCTL_SESSION;
musb_writeb(mbase, MUSB_DEVCTL, reg);
+
+ /* Pretend there's a session request */
+ musb->ep0_stage = MUSB_EP0_START;
+ musb->xceiv->state = OTG_STATE_A_IDLE;
+ MUSB_HST_MODE(musb);
+ musb_set_vbus(musb, 1);
+
+ /* Connect request */
+ {
+ struct usb_hcd *hcd = musb_to_hcd(musb);
+
+ musb->is_active = 1;
+ set_bit(HCD_FLAG_SAW_IRQ, &hcd->flags);
+
+ musb->ep0_stage = MUSB_EP0_START;
+
+#ifdef CONFIG_USB_MUSB_OTG
+ /* flush endpoints when transitioning from Device Mode */
+ if (is_peripheral_active(musb)) {
+ /* REVISIT HNP; just force disconnect */
+ }
+ musb_writew(mbase, MUSB_INTRTXE, musb->epmask);
+ musb_writew(mbase, MUSB_INTRRXE, musb->epmask & 0xfffe);
+ musb_writeb(mbase, MUSB_INTRUSBE, 0xf7);
+#endif
+ musb->port1_status &= ~(USB_PORT_STAT_LOW_SPEED
+ |USB_PORT_STAT_HIGH_SPEED
+ |USB_PORT_STAT_ENABLE
+ );
+ musb->port1_status |= USB_PORT_STAT_CONNECTION
+ |(USB_PORT_STAT_C_CONNECTION << 16);
+
+ /* high vs full speed is just a guess until after reset */
+ /* if (devctl & MUSB_DEVCTL_LSDEV)
+ musb->port1_status |= USB_PORT_STAT_LOW_SPEED;*/
+
+ if (hcd->status_urb)
+ usb_hcd_poll_rh_status(hcd);
+ else
+ usb_hcd_resume_root_hub(hcd);
+
+ MUSB_HST_MODE(musb);
+
+ /* indicate new connection to OTG machine */
+ switch (musb->xceiv->state) {
+ default:
+ musb->xceiv->state = OTG_STATE_A_HOST;
+ hcd->self.is_b_host = 0;
+ break;
+ }
+ DBG(1, "CONNECT (%s) devctl %02x\n",
+ otg_state_string(musb), devctl);
+ }
break;
case 'H':
struct usb_bus *host;
u8 devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
- devctl |= MUSB_DEVCTL_SESSION;
- musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
-
switch (musb_mode) {
#ifdef CONFIG_USB_MUSB_HDRC_HCD
case MUSB_HOST:
host = hcd_to_bus(hcd);
otg_set_host(musb->xceiv, host);
+
+ if (machine_is_nokia_rx51()) {
+ u8 testmode;
+ void __iomem *mbase=musb->mregs;
+
+ musb_platform_resume(musb);
+
+ devctl |= MUSB_DEVCTL_SESSION;
+ musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+
+ testmode = musb_readb(musb->mregs, MUSB_TESTMODE);
+ testmode |= MUSB_TEST_FORCE_HOST | MUSB_TEST_FORCE_FS;
+ musb_writeb(musb->mregs, MUSB_TESTMODE, testmode);
+ }
break;
#endif
#ifdef CONFIG_USB_GADGET_MUSB_HDRC
case MUSB_PERIPHERAL:
+ if (machine_is_nokia_rx51()) {
+ musb_platform_resume(musb);
+ musb_set_vbus(musb, 0);
+
+ devctl &= ~MUSB_DEVCTL_SESSION;
+ musb_writeb(musb->mregs, MUSB_DEVCTL, devctl);
+
+ musb_writeb(musb->mregs, MUSB_TESTMODE, 0);
+ }
+
otg_set_peripheral(musb->xceiv, &musb->g);
break;
#endif
/* REVISIT this assumes host and peripheral controllers
* are registered, and that both are active...
*/
+ linkstat = USB_LINK_ID;
+ printk(KERN_INFO "%s: linkstat: %d; not messing the state\n", __func__, linkstat);
+#if 0
spin_lock_irq(&twl->lock);
twl->linkstat = linkstat;
if (linkstat == USB_LINK_ID) {
twl->otg.state = OTG_STATE_B_IDLE;
}
spin_unlock_irq(&twl->lock);
+#endif
return linkstat;
}