请教各位专家。
- 问题:tiny210 linux,尝试s3c-udc与gadgetfs一起使用,失败。
- 错误现象:
1.把usb.c(gadgetfs官方测试程序,我修改过)编译为可执行程序 usb。执行usb时,到向文
件描述符write后死机.
我对usb.c的修改,是为了使之识别 s3c-ucd。按s3c-hsudc.c注释,
The S3C24XX USB 2.0 high-speed USB controller supports upto 9 endpoints.
Each endpoint can be configured as either in or out endpoint. Endpoints
can be configured for Bulk or Interrupt transfer mode.
我试着进行了几种配置,均导致死机。
2. 执行前usb运行前,执行了下述操作,控制台均无报错。
mkdir /dev/gadget
insmod gadgetfs.ko
mount -t gadgetfs none /dev/gadget
此时,
[root@FriendlyARM plg]# ls /dev/gadget
ls /dev/gadget
s3c-udc
3. dmesg的出错信息:
[299.539226] gadgetfs: USB Gadget filesystem, version 24 Aug 2004
[353.895836] s3c-udc: bind to driver nop --> error -120
其中第二行是mount操作后出现的。
我猜测,usb.c死机的原因在这里,即gadgetfs加载失败。
请教原因何在?
- 操作系统:
[root@FriendlyARM plg]# uname -a
uname -a
Linux FriendlyARM 3.0.8-FriendlyARM #9 PREEMPT Tue May 7 22:56:46 CST 2013 armv7l GNU/Linux
- 内核配置:
│ │--- USB Gadget Support │ │
│ │[*] Debugging messages (DEVELOPMENT) │ │
│ │[*] Debugging information files (DEVELOPMENT)│ │
│ │(500) Maximum VBUS Power usage (2-500 mA)│ │
│ │USB Peripheral Controller (S3C HS USB OTG Device)--->│ │
│ │*** NOTE: S3C OTG device role enables the controller driver below ***│ │
│ │<*> S3C high speed(2.0, dual-speed) USB OTG device (NEW) │ │
│ │S3C OTGD transfer mode (enabled DMA MODE)--->│ │
│ │<M> USB Gadget Drivers │ │
│ │<M> Gadget Zero (DEVELOPMENT)│ │
│ │< > Audio Gadget (EXPERIMENTAL)│ │
│ │< > Ethernet Gadget (with CDC Ethernet support)│ │
│ │< > Network Control Model (NCM) support│ │
│ │<M> Gadget Filesystem (EXPERIMENTAL) │ │
│ │< > Function Filesystem (EXPERIMENTAL) │ │
│ │< > File-backed Storage Gadget │ │
│ │<M> Mass Storage Gadget│ │
│ │<M> Serial Gadget (with CDC ACM and CDC OBEX support)│ │
│ │< > MIDI Gadget (EXPERIMENTAL) │ │
│ │< > Printer Gadget │ │
│ │< > CDC Composite Device (Ethernet and ACM)│ │
│ │< > Nokia composite gadget │ │
│ │< > Multifunction Composite Gadget (EXPERIMENTAL)│ │
│ │< > HID Gadget │ │
│ │< > EHCI Debug Device Gadget │ │
│ │< > USB Webcam Gadget│ │
- 其他信息:
1. g_serial.ko与s3c-udc配合,可以与PC的HOST端通信;
我的理解,这表明 tiny210的ucd 确实是 s3c-udc.
2. gadgetfs.ko载入内核(with dummy_hcd + usb.c),dmesg无错误信息。
我的理解,这表明gadgetfs.ko与dummy_hcd可以配合工作。
# lsusb -v
lsusb -v
Bus 3 Device 7 ID 0525a4a4 Netchip Technology, Inc. Linux-USB user-mode bulk source/sink
Device Descriptor
bLength18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass255 Vendor Specific Class
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize064
idVendor 0x0525 Netchip Technology, Inc.
idProduct0xa4a4 Linux-USB user-mode bulk source/sink
bcdDevice1.00
iManufacturer 1 Licensed to Code, LLC
iProduct2 My Source/Sink Product
iSerial 3 1.3
bNumConfigurations1
Configuration Descriptor
bLength 9
bDescriptorType 2
wTotalLength 39
bNumInterfaces1
bConfigurationValue 3
iConfiguration4 The Configuration
bmAttributes 0xc0
Self Powered
MaxPower2mA
Interface Descriptor
bLength 9
bDescriptorType 4
bInterfaceNumber0
bAlternateSetting 0
bNumEndpoints 3
bInterfaceClass 255 Vendor Specific Class
bInterfaceSubClass0
bInterfaceProtocol0
iInterface5 Source/Sink
Endpoint Descriptor
bLength 7
bDescriptorType 5
bEndpointAddress 0x87EP 7 IN
bmAttributes2
Transfer TypeBulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x02001x 512 bytes
bInterval 0
Endpoint Descriptor
bLength 7
bDescriptorType 5
bEndpointAddress 0x03EP 3 OUT
bmAttributes2
Transfer TypeBulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x02001x 512 bytes
bInterval 1
Endpoint Descriptor
bLength 7
bDescriptorType 5
bEndpointAddress 0x8bEP 11 IN
bmAttributes3
Transfer TypeInterrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x00081x 8 bytes
bInterval 6
Device Qualifier (for other device speed)
bLength10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass255 Vendor Specific Class
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize064
bNumConfigurations1
Device Status 0x0000
(Bus Powered)
Bus 3 Device 1 ID 1d6b0002 Linux Foundation 2.0 root hub
Device Descriptor
bLength18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 1 Single TT
bMaxPacketSize064
idVendor 0x1d6b Linux Foundation
idProduct0x0002 2.0 root hub
bcdDevice3.00
iManufacturer 3 Linux 3.0.8-FriendlyARM dummy_hcd
iProduct2 Dummy host controller
iSerial 1 dummy_hcd
bNumConfigurations1
Configuration Descriptor
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces1
bConfigurationValue 1
iConfiguration0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower0mA
Interface Descriptor
bLength 9
bDescriptorType 4
bInterfaceNumber0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass0 Unused
bInterfaceProtocol0 Full speed (or root) hub
iInterface0
Endpoint Descriptor
bLength 7
bDescriptorType 5
bEndpointAddress 0x81EP 1 IN
bmAttributes3
Transfer TypeInterrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x00041x 4 bytes
bInterval12
Hub Descriptor
bLength 9
bDescriptorType41
nNbrPorts 1
wHubCharacteristic 0x0001
Per-port power switching
Ganged overcurrent protection
TT think time 8 FS bits
bPwrOn2PwrGood0 * 2 milli seconds
bHubContrCurrent0 milli Ampere
DeviceRemovable0xff
PortPwrCtrlMask0xff
Hub Port Status
Port 1 0000.0503 highspeed power enable connect
Device Status 0x0003
Self Powered
Remote Wakeup Enabled
Bus 2 Device 1 ID 1d6b0001 Linux Foundation 1.1 root hub
Device Descriptor
bLength18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize064
idVendor 0x1d6b Linux Foundation
idProduct0x0001 1.1 root hub
bcdDevice3.00
iManufacturer 3 Linux 3.0.8-FriendlyARM ohci_hcd
iProduct2 EXYNOS OHCI Host Controller
iSerial 1 s5p-ohci
bNumConfigurations1
Configuration Descriptor
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces1
bConfigurationValue 1
iConfiguration0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower0mA
Interface Descriptor
bLength 9
bDescriptorType 4
bInterfaceNumber0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass0 Unused
bInterfaceProtocol0 Full speed (or root) hub
iInterface0
Endpoint Descriptor
bLength 7
bDescriptorType 5
bEndpointAddress 0x81EP 1 IN
bmAttributes3
Transfer TypeInterrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x00021x 2 bytes
bInterval 255
Hub Descriptor
bLength 9
bDescriptorType41
nNbrPorts 1
wHubCharacteristic 0x0002
No power switching (usb 1.0)
Ganged overcurrent protection
bPwrOn2PwrGood2 * 2 milli seconds
bHubContrCurrent0 milli Ampere
DeviceRemovable0x00
PortPwrCtrlMask0xff
Hub Port Status
Port 1 0000.0100 power
Device Status 0x0003
Self Powered
Remote Wakeup Enabled
Bus 1 Device 1 ID 1d6b0002 Linux Foundation 2.0 root hub
Device Descriptor
bLength18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass9 Hub
bDeviceSubClass 0 Unused
bDeviceProtocol 0 Full speed (or root) hub
bMaxPacketSize064
idVendor 0x1d6b Linux Foundation
idProduct0x0002 2.0 root hub
bcdDevice3.00
iManufacturer 3 Linux 3.0.8-FriendlyARM ehci_hcd
iProduct2 S5P EHCI Host Controller
iSerial 1 s5p-ehci
bNumConfigurations1
Configuration Descriptor
bLength 9
bDescriptorType 2
wTotalLength 25
bNumInterfaces1
bConfigurationValue 1
iConfiguration0
bmAttributes 0xe0
Self Powered
Remote Wakeup
MaxPower0mA
Interface Descriptor
bLength 9
bDescriptorType 4
bInterfaceNumber0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 9 Hub
bInterfaceSubClass0 Unused
bInterfaceProtocol0 Full speed (or root) hub
iInterface0
Endpoint Descriptor
bLength 7
bDescriptorType 5
bEndpointAddress 0x81EP 1 IN
bmAttributes3
Transfer TypeInterrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x00041x 4 bytes
bInterval12
Hub Descriptor
bLength 9
bDescriptorType41
nNbrPorts 1
wHubCharacteristic 0x0009
Per-port power switching
Per-port overcurrent protection
bPwrOn2PwrGood 10 * 2 milli seconds
bHubContrCurrent0 milli Ampere
DeviceRemovable0x00
PortPwrCtrlMask0xff
Hub Port Status
Port 1 0000.0100 power
Device Status 0x0003
Self Powered
Remote Wakeup Enabled
[root@FriendlyARM plg]#
3. g_zero.ko载入内核,dmesg无错误信息,如下:
[495.979552] zero gadget: adding config #3 'source/sink'/bf1fad28
[495.979569] zero gadget: adding 'source/sink'/d9c30080 to config 'source/sink'/bf1fad28
[495.979586] zero gadget: dual speed source/sink: IN/ep2-bulk, OUT/ep1-bulk
[495.979596] zero gadget: cfg 3/bf1fad28 speeds: high full
[495.979605] zero gadget: interface 0 = source/sink/d9c30080
[495.979615] zero gadget: adding config #2 'loopback'/bf1fada8
[495.979625] zero gadget: adding 'loopback'/d9c30880 to config 'loopback'/bf1fada8
[495.979637] zero gadget: dual speed loopback: IN/ep2-bulk, OUT/ep1-bulk
[495.979646] zero gadget: cfg 2/bf1fada8 speeds: high full
[495.979655] zero gadget: interface 0 = loopback/d9c30880
[495.979664] zero gadget: Gadget Zero, version: Cinco de Mayo 2008
[495.979724] zero gadget: zero ready
[495.998990] Registered gadget driver 'zero'
4.usb.c我修改的那一段,某个版本如下:
/* s3c-udc, high speed. by Young */
} else if