主题 : tiny210v2的linux3.0.8内核是否支持 gadgetfs? s3c-udc: bind to driver nop --> error -120 复制链接 | 浏览器收藏 | 打印
级别: 新手上路
UID: 91064
精华: 0
发帖: 13
金钱: 65 两
威望: 13 点
综合积分: 26 分
注册时间: 2013-05-01
最后登录: 2018-02-08
楼主  发表于: 2013-05-18 22:03

 tiny210v2的linux3.0.8内核是否支持 gadgetfs? s3c-udc: bind to driver nop --> error -120

管理提醒: 本帖被 xoom 从 友善之臂官方客服中心 移动到本区(2013-05-20)
请问友善之臂在tiny210v2中对linux3.0.8内核所做修改(s3c*),是否支 gadgetfs?
谢谢。
[ 此帖被younggift在2013-05-19 22:19重新编辑 ]
自由,自强,共享,共创。
级别: 论坛版主
UID: 12573
精华: 27
发帖: 8838
金钱: 46490 两
威望: 9298 点
综合积分: 18216 分
注册时间: 2010-01-09
最后登录: 2019-07-16
1楼  发表于: 2013-05-19 09:01
支持
新手如何向我们反馈有效的信息,以便解决问题,见此贴:
http://www.arm9home.net/read.php?tid-14431.html

[注]: 此处签名链接仅为指引方向,而非解答问题本身.
级别: 新手上路
UID: 91064
精华: 0
发帖: 13
金钱: 65 两
威望: 13 点
综合积分: 26 分
注册时间: 2013-05-01
最后登录: 2018-02-08
2楼  发表于: 2013-05-19 21:48

 回 1楼(mindee) 的帖子

请教 mindee 先生,
我在 mount gadgetfs 时 dmesg 报 error -120,请问错在哪里?
配置 g_serial 和 g_zero 与 s3c-udc 一起工作没问题,配置 gadgetfs 与 dummy-hcd一起工作没有问题。
以下是详细现象。

- 问题: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
   bLength                18
   bDescriptorType         1
   bcdUSB               2.00
   bDeviceClass          255 Vendor Specific Class
   bDeviceSubClass         0
   bDeviceProtocol         0
   bMaxPacketSize0        64
   idVendor           0x0525 Netchip Technology, Inc.
   idProduct          0xa4a4 Linux-USB user-mode bulk source/sink
   bcdDevice            1.00
   iManufacturer           1 Licensed to Code, LLC
   iProduct                2 My Source/Sink Product
   iSerial                 3 1.3
   bNumConfigurations      1
   Configuration Descriptor
     bLength                 9
     bDescriptorType         2
     wTotalLength           39
     bNumInterfaces          1
     bConfigurationValue     3
     iConfiguration          4 The Configuration
     bmAttributes         0xc0
       Self Powered
     MaxPower                2mA
     Interface Descriptor
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       0
       bNumEndpoints           3
       bInterfaceClass       255 Vendor Specific Class
       bInterfaceSubClass      0
       bInterfaceProtocol      0
       iInterface              5 Source/Sink
       Endpoint Descriptor
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x87  EP 7 IN
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0200  1x 512 bytes
         bInterval               0
       Endpoint Descriptor
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x03  EP 3 OUT
         bmAttributes            2
           Transfer Type            Bulk
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0200  1x 512 bytes
         bInterval               1
       Endpoint Descriptor
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x8b  EP 11 IN
         bmAttributes            3
           Transfer Type            Interrupt
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0008  1x 8 bytes
         bInterval               6
Device Qualifier (for other device speed)
   bLength                10
   bDescriptorType         6
   bcdUSB               2.00
   bDeviceClass          255 Vendor Specific Class
   bDeviceSubClass         0
   bDeviceProtocol         0
   bMaxPacketSize0        64
   bNumConfigurations      1
Device Status     0x0000
   (Bus Powered)

Bus 3 Device 1 ID 1d6b0002 Linux Foundation 2.0 root hub
Device Descriptor
   bLength                18
   bDescriptorType         1
   bcdUSB               2.00
   bDeviceClass            9 Hub
   bDeviceSubClass         0 Unused
   bDeviceProtocol         1 Single TT
   bMaxPacketSize0        64
   idVendor           0x1d6b Linux Foundation
   idProduct          0x0002 2.0 root hub
   bcdDevice            3.00
   iManufacturer           3 Linux 3.0.8-FriendlyARM dummy_hcd
   iProduct                2 Dummy host controller
   iSerial                 1 dummy_hcd
   bNumConfigurations      1
   Configuration Descriptor
     bLength                 9
     bDescriptorType         2
     wTotalLength           25
     bNumInterfaces          1
     bConfigurationValue     1
     iConfiguration          0
     bmAttributes         0xe0
       Self Powered
       Remote Wakeup
     MaxPower                0mA
     Interface Descriptor
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       0
       bNumEndpoints           1
       bInterfaceClass         9 Hub
       bInterfaceSubClass      0 Unused
       bInterfaceProtocol      0 Full speed (or root) hub
       iInterface              0
       Endpoint Descriptor
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x81  EP 1 IN
         bmAttributes            3
           Transfer Type            Interrupt
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0004  1x 4 bytes
         bInterval              12
Hub Descriptor
   bLength               9
   bDescriptorType      41
   nNbrPorts             1
   wHubCharacteristic 0x0001
     Per-port power switching
     Ganged overcurrent protection
     TT think time 8 FS bits
   bPwrOn2PwrGood        0 * 2 milli seconds
   bHubContrCurrent      0 milli Ampere
   DeviceRemovable    0xff
   PortPwrCtrlMask    0xff
  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
   bLength                18
   bDescriptorType         1
   bcdUSB               1.10
   bDeviceClass            9 Hub
   bDeviceSubClass         0 Unused
   bDeviceProtocol         0 Full speed (or root) hub
   bMaxPacketSize0        64
   idVendor           0x1d6b Linux Foundation
   idProduct          0x0001 1.1 root hub
   bcdDevice            3.00
   iManufacturer           3 Linux 3.0.8-FriendlyARM ohci_hcd
   iProduct                2 EXYNOS OHCI Host Controller
   iSerial                 1 s5p-ohci
   bNumConfigurations      1
   Configuration Descriptor
     bLength                 9
     bDescriptorType         2
     wTotalLength           25
     bNumInterfaces          1
     bConfigurationValue     1
     iConfiguration          0
     bmAttributes         0xe0
       Self Powered
       Remote Wakeup
     MaxPower                0mA
     Interface Descriptor
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       0
       bNumEndpoints           1
       bInterfaceClass         9 Hub
       bInterfaceSubClass      0 Unused
       bInterfaceProtocol      0 Full speed (or root) hub
       iInterface              0
       Endpoint Descriptor
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x81  EP 1 IN
         bmAttributes            3
           Transfer Type            Interrupt
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0002  1x 2 bytes
         bInterval             255
Hub Descriptor
   bLength               9
   bDescriptorType      41
   nNbrPorts             1
   wHubCharacteristic 0x0002
     No power switching (usb 1.0)
     Ganged overcurrent protection
   bPwrOn2PwrGood        2 * 2 milli seconds
   bHubContrCurrent      0 milli Ampere
   DeviceRemovable    0x00
   PortPwrCtrlMask    0xff
  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
   bLength                18
   bDescriptorType         1
   bcdUSB               2.00
   bDeviceClass            9 Hub
   bDeviceSubClass         0 Unused
   bDeviceProtocol         0 Full speed (or root) hub
   bMaxPacketSize0        64
   idVendor           0x1d6b Linux Foundation
   idProduct          0x0002 2.0 root hub
   bcdDevice            3.00
   iManufacturer           3 Linux 3.0.8-FriendlyARM ehci_hcd
   iProduct                2 S5P EHCI Host Controller
   iSerial                 1 s5p-ehci
   bNumConfigurations      1
   Configuration Descriptor
     bLength                 9
     bDescriptorType         2
     wTotalLength           25
     bNumInterfaces          1
     bConfigurationValue     1
     iConfiguration          0
     bmAttributes         0xe0
       Self Powered
       Remote Wakeup
     MaxPower                0mA
     Interface Descriptor
       bLength                 9
       bDescriptorType         4
       bInterfaceNumber        0
       bAlternateSetting       0
       bNumEndpoints           1
       bInterfaceClass         9 Hub
       bInterfaceSubClass      0 Unused
       bInterfaceProtocol      0 Full speed (or root) hub
       iInterface              0
       Endpoint Descriptor
         bLength                 7
         bDescriptorType         5
         bEndpointAddress     0x81  EP 1 IN
         bmAttributes            3
           Transfer Type            Interrupt
           Synch Type               None
           Usage Type               Data
         wMaxPacketSize     0x0004  1x 4 bytes
         bInterval              12
Hub Descriptor
   bLength               9
   bDescriptorType      41
   nNbrPorts             1
   wHubCharacteristic 0x0009
     Per-port power switching
     Per-port overcurrent protection
   bPwrOn2PwrGood       10 * 2 milli seconds
   bHubContrCurrent      0 milli Ampere
   DeviceRemovable    0x00
   PortPwrCtrlMask    0xff
  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
                (stat (DEVNAME = "s3c-udc", &statb) == 0) {
        HIGHSPEED = 1;
        device_desc.bcdDevice = __constant_cpu_to_le16 (0x0100);
                fs_source_desc.bEndpointAddress
                    = hs_source_desc.bEndpointAddress
                    = USB_DIR_IN | 2;
        EP_IN_NAME = "ep2-bulk";
                fs_sink_desc.bEndpointAddress
                    = hs_sink_desc.bEndpointAddress
                    =USB_DIR_OUT | 1;
        EP_OUT_NAME = "ep1-bulk";

        source_sink_intf.bNumEndpoints = 3;
                fs_status_desc.bEndpointAddress
                    = hs_status_desc.bEndpointAddress
                    = USB_DIR_IN | 3;
        EP_STATUS_NAME = "ep3-int";
    }
级别: 侠客
UID: 69671
精华: 0
发帖: 65
金钱: 325 两
威望: 65 点
综合积分: 130 分
注册时间: 2012-05-09
最后登录: 2015-07-02
3楼  发表于: 2013-06-20 23:02
楼主 你说的usb.c  是那个目录下的usb.c  ?