Hi All ,
I'm developing the project on DM3730 + TPS65920 ,using Android 2.3.1 , kernel 2.6.32 .I get stuck when debug USB OTG .
In Driver Configuration ,
select "Both host and peripheral" , it is ok when the pad works as device .But when it works as host ,it can detect the usb device first time ,plug the usb device out ,and plug in again ,the usb device could not be detected .
But it works ok when select "USB Host" or "USB Peripheral" in Driver Configuration .
Detail Configuration is as follow :
Device Drivers --->
USB support --->
(*)TWL4030 USB Transceiver Driver
--*--NOP USB Transceiver Driver
Driver mode(Both host and peripheral: USB OTG (On The Go) Device) --->
(X) Both host and peripheral: USB OTG ( On The Go ) Device .
USB Gadget Support --->
USB Peripheral Controller (Inventra HDRC USB Peripheral (TI , ADI ,.....))---->
(X) Inventral HDRC USB Peripheral (TI ,ADI ,....)
(*)USB Gadget Drivers (Android Gadget) ---->
(X) Android Gadget
There are two interrupt :
One is applied in twl4030-usb.c (twl4030_usb_irq) ,which is used to detect the usb link ,
the other is applied in musb_core.c (generic_interrupt ) ,which is used to set vbus .
From the log ,it will trigger twl4030_usb_irq ,and then trigger generic_interrupt when it works ok .
When the pad use as host ,it can trigger twl4030_usb_irq ,but could not trigger generic_intterrupt .
static irqreturn_t generic_interrupt(int irq, void *__hci)
{
unsigned long flags;
irqreturn_t retval = IRQ_NONE;
struct musb *musb = __hci;
spin_lock_irqsave(&musb->lock, flags);
musb->int_usb = musb_readb(musb->mregs, MUSB_INTRUSB);
musb->int_tx = musb_readw(musb->mregs, MUSB_INTRTX);
musb->int_rx = musb_readw(musb->mregs, MUSB_INTRRX);
if (musb->int_usb || musb->int_tx || musb->int_rx)
retval = musb_interrupt(musb);
spin_unlock_irqrestore(&musb->lock, flags);
return retval;
}