USB2 Driver Crash after enumeration

Submitted by kerneltrap
on November 6, 2009 - 1:23pm

Hi,

I am trying to port Synopsys OTG USB driver 2.90. to Xtensa Linux 2.6.29.1.

I got Synopsys OTG USB driver which was for the IPMate platform.

It has the support for the LM_bus and PCI bus. I am not using either

LM bus or PCI for the USB but Xtensa is using Platform bus, So I tried to use the same.

With these changes any device connected to host port is being enumerated.

But after that it crashes. What could be reason of it.
If anything is missing please let me know.
While debugging i found that there is some issue with the add_device call.
After enumeration function usb_new_device() is being called which calls add_device()

Two Observations at this Point:

1. If I call this function directly (without debugger) it crashes in this function.
There is no call trace, but PC is inside the function copy_user_page().

2. But if I traverse this function using debugger then there is no such crash
As i releases debugger immidiately it crashes.

My doubts

1. Is Driver/Device registration sequence correct ?

2. I am using EHCI and UHCI as a modules. usbcore, scsi_mod, usb_storage, sd_mod are the part of the kernel.

3. Is there any thing else need to be configured in the Kernel.

Getting following Info :: -

#

# cat /proc/bus/usb/devices

T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 1

B: Alloc= 0/800 us ( 0%), #Int= 0, #Iso= 0

D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1

P: Vendor=0000 ProdID=0000 Rev= 2.06

S: Manufacturer=Linux 2.6.24.4 dwc_otg_hcd

S: Product=DWC OTG Controller

S: SerialNumber=dwc_otg.1

C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA

I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub

E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms

T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0

D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1

P: Vendor=0930 ProdID=6544 Rev= 1.00

S: Manufacturer=Kingston

S: Product=DataTraveler 120

S: SerialNumber=0019B931DF26C910A5BF0175

C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA

I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms

E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=31875us

#

# cat /proc/scsi/usb-storage/1

Host scsi1: usb-storage

Vendor: Kingston

Product: DataTraveler 120

Serial Number: 0019B931DF26C910A5BF0175

Protocol: Transparent SCSI

Transport: Bulk

Quirks:

# lsmod

Module Size Used by Tainted: G

dwc_otg 196152 0

uhci_hcd 24176 0

ehci_hcd 31852 0

static int __init dwc_otg_driver_init(void)

{

#ifdef LM_INTERFACE

retval = lm_driver_register(&dwc_otg_driver);

// I have added following for the platform device support ..Is any thing wrong here ??

#elif PLATFORM_INTERFACE

{

struct resource otg_dev_resource;

otg_dev_resource.start = USB_OTG_BASE;

otg_dev_resource.end = USB_OTG_BASE + SZ_256K - 1;

otg_dev_resource.flags = IORESOURCE_MEM;

/* lmdev->irq = 15; */ /* TBD*/

/*lmdev->irq = 20;*/ /* TBD*/

printk(KERN_INFO " Before platform_device_register_simple .. \n\n");

printk(KERN_INFO "retval %d", retval);

/*struct platform_device *platform_device_register_simple(char *name, int id,
struct resource *res, unsigned int num) */

pdev = platform_device_register_simple("dwc_otg", 1,
&otg_dev_resource , 1);
retval = platform_driver_register(&dwc_otg_driver);

printk(KERN_INFO " platform_driver_register .. complete \n\n");

#endif

}

If you need any other info Please let me know.

Log file and .config files are also attached.

Any help is highly appreciated.

Thanks & Regards,
Vijay