Re: USB device controller

800 views
Skip to first unread message

mirots

unread,
Oct 1, 2012, 11:04:34 AM10/1/12
to linux...@googlegroups.com
This is my boot (dmesg) log:

[    0.050000] [usb_manager]: CONFIG_USB_SW_SUN4I_USB0_OTG
[    0.050000] [sw_hcd0]: usb host driver initialize........
[    0.050000] [sw_hcd0]: open_usb_clock
[    0.060000] [sw_hcd0]: host_init_state = 0
[    0.060000] [sw_hcd0]: platform is usb host
[    0.060000] [sw_hcd0]: sw_hcd_init_controller: sw_hcd_host0: USB Host mode controller at f1c13000 using PIO, IRQ 38
[    0.060000] sw_hcd_host0 sw_hcd_host0: sw_hcd host driver
[    0.060000] sw_hcd_host0 sw_hcd_host0: new USB bus registered, assigned bus number 1
[    0.060000] hub 1-0:1.0: USB hub found
[    0.060000] hub 1-0:1.0: 1 port detected
[    0.060000] wrn: hcd is not enable, need not start hcd
[    0.060000] [sw_hcd0]: sw_usb_host0_disable start
[    0.060000] -------sw_hcd0_soft_disconnect---------
[    0.060000] [sw_hcd_host0]: Set USB Power OFF
[    0.060000] wrn: hcd is not enable, need not stop hcd
[    0.060000] [sw_hcd0]: close_usb_clock
[    0.060000] [sw_hcd0]: sw_usb_host0_disable end
[    0.060000] [sw_udc]: udc_init: version 20080411
[

And here is g_serial (compiled into kernel) trying to load a little later

[    3.030000] The port change to OHCI now!
[    3.030000] Initializing USB Mass Storage driver...
[    3.040000] usbcore: registered new interface driver usb-storage
[    3.040000] USB Mass Storage support registered.
[    3.050000] usbcore: registered new interface driver ums-alauda
[    3.050000] usbcore: registered new interface driver ums-cypress
[    3.060000] usbcore: registered new interface driver ums-datafab
[    3.070000] usbcore: registered new interface driver ums_eneub6250
[    3.070000] usbcore: registered new interface driver ums-freecom
[    3.080000] usbcore: registered new interface driver ums-isd200
[    3.080000] usbcore: registered new interface driver ums-jumpshot
[    3.090000] usbcore: registered new interface driver ums-karma
[    3.100000] usbcore: registered new interface driver ums-onetouch
[    3.100000] usbcore: registered new interface driver ums-realtek
[    3.110000] usbcore: registered new interface driver ums-sddr09
[    3.110000] usbcore: registered new interface driver ums-sddr55
[    3.120000] usbcore: registered new interface driver ums-usbat
[    3.130000] usbcore: registered new interface driver usbserial
[    3.130000] usbserial: USB Serial Driver core
[    3.140000] USB Serial support registered for GSM modem (1-port)
[    3.140000] usbcore: registered new interface driver option
[    3.150000] option: v0.7.2:USB Driver for GSM modems
[    3.150000] [sw_udc]: [sw_usb_udc]: binding gadget driver 'g_serial'
[    3.160000] [sw_udc]: alloc request: ep(0xc077f858, ep0, 64), req(0xd9a91880)
[    3.170000] WRN:L2705(drivers/usb/sun4i_usb/udc/sw_udc.c):ERR: usb device is not active
[    3.170000] ep_matches, wrn: endpoint already claimed, ep(0xc077f898, 0xd9a91840, ep1-bulk)
[    3.180000] ep_matches, wrn: endpoint already claimed, ep(0xc077f898, 0xd9a91840, ep1-bulk)
[    3.190000] ep_matches, wrn: endpoint already claimed, ep(0xc077f8d8, 0xd9a91840, ep2-bulk)
[    3.200000] 3333333
[    3.200000] 3333333
[    3.200000] [sw_udc]: alloc request: ep(0xc077f998, ep5-int, 512), req(0xd9a91c80)
[    3.210000] g_serial gadget: Gadget Serial v2.4
[    3.220000] g_serial gadget: g_serial ready
[    3.220000] [sw_udc]: CONFIG_USB_GADGET_DUALSPEED
[    3.220000] [sw_udc]: usbd_start_work
[    3.230000] mousedev: PS/2 mouse device common for all mice
[    3.230000] input: sun4i-keyboard as /devices/virtual/input/input0
[    3.240000] ==register_early_suspend =


It can be clearly seen (last two lines), that keyboard and mouse connected to other USB host port are working perfectly



On Monday, October 1, 2012 3:31:00 PM UTC+2, Yuuki wrote:

Current state:
1. Gadget driver loads without issues.
2. USB manager switches to device-mode without issues.
3. Host detects new hardware (needs patching sources - initialization value of is_udc_enable to 1 in [code]drivers/usb/sun4i_usb/udc/sw_udc.c[/code]).
4. Linux host works without issues, but Windows host fails to get descriptor from device and do not detect any endpoints. Tested with g_serial, g_zero, g_ether, g_mass_storage.


PS: g_ether gadget needs some patch to make it compile at all. Just modifying rndis_bind_config() call in drivers/usb/gadget/ether.c and drivers/usb/gadget/multi.c to supply two additional arguments with 0 and NULL values lead to kernel crash upon rmmod.

Yuuki

unread,
Oct 1, 2012, 11:43:33 AM10/1/12
to linux...@googlegroups.com
Since your board has several USB ports it seems weird that it has only one host controller as you got KB/mouse plugged in and trying to use device mode in parallel... My board has 3 host controllers (EHCI, OHCI and UDC) loaded during boot but has only one physical OTG-capable USB port. Try to modprobe gadget with other USB deviced unplugged.

понедельник, 1 октября 2012 г., 19:04:34 UTC+4 пользователь Meir Tseitlin написал:

Yuuki

unread,
Oct 1, 2012, 11:56:13 AM10/1/12
to linux...@googlegroups.com
Got some USB low level info. Here is dump from Linux host PC. Windows host sends only one GET_CONFIGURATION (with requestable length 0xff) and after that makes 2 GET_DESCRIPTOR requests. One is 0x00 and second is 0x02. After receiving reply for second request there no packets until device is unplugged.


usb_dump.pcap

Meir Tseitlin

unread,
Oct 1, 2012, 12:23:58 PM10/1/12
to linux...@googlegroups.com
My device has 2 ports (one host only and one otg), I connected keyboard/mouse using USB splitter to the host port.
OTG port seems to be dead - it is not responding as host or as device (but when you boot original android (4.0.4) - it works perfectly well
BTW - I use latest (3.0.42+) version from git
I can't do anything if i'll disconnect keyboard....

Meir Tseitlin

unread,
Oct 1, 2012, 2:45:25 PM10/1/12
to linux...@googlegroups.com
Ok, sorry for a mess - I discovered my problem - apparently my device disables OTG port in hardware when external power is applied.
We can delete those messages to discuss real issues....

Yuuki

unread,
Oct 1, 2012, 5:35:38 PM10/1/12
to linux...@googlegroups.com
You can use ssh to operate your device without kb/mouse.

понедельник, 1 октября 2012 г., 20:23:58 UTC+4 пользователь Meir Tseitlin написал:

Yuuki

unread,
Oct 17, 2012, 7:26:52 AM10/17/12
to linux...@googlegroups.com
Seems issue solved for me. Original message's "PS" fix is wrong - there is need to specify cpu_to_le16 (CDC_VENDOR_NUM) and manufacturer as additional arguments, not 0 and NULL. After that g_ether works perfectly.

понедельник, 1 октября 2012 г., 17:31:00 UTC+4 пользователь Yuuki написал:
Reply all
Reply to author
Forward
0 new messages