OTG Mass storage mode

Started by stylesuxx, February 28, 2014, 09:10:40 PM

Previous topic - Next topic

stylesuxx

Hey guys,
I want to be able to use my A20 board as a mass storage device.
I am using a self compiled kernel with default a20 config and a custom bootstrapped debian wheezy rootfs.
Linux olimex-a20 3.4.79+ #12 SMP PREEMPT Fri Feb 28 16:17:46 CET 2014 armv7l GNU/Linux

I created a backing file and load the module like so:

modprobe g_mass_storage file=/path/to/backing_file

Now if I connect the A20 board to a host dmesg on the host shows the following:

Quote[96299.382256] usb 3-3: new full-speed USB device number 51 using xhci_hcd
[96299.438789] usb 3-3: New USB device found, idVendor=0525, idProduct=a4a5
[96299.438806] usb 3-3: New USB device strings: Mfr=2, Product=3, SerialNumber=0
[96299.438808] usb 3-3: Product: Mass Storage Gadget
[96299.438810] usb 3-3: Manufacturer: Linux 3.4.79+ with sw_usb_udc
[96304.471960] usb-storage 3-3:1.0: USB Mass Storage device detected
[96304.472161] usb-storage 3-3:1.0: Quirks match for vid 0525 pid a4a5: 10000
[96304.472307] scsi20 : usb-storage 3-3:1.0
[96305.475789] scsi 20:0:0:0: Direct-Access     Linux    File-CD Gadget   0333 PQ: 0 ANSI: 2
[96305.476024] sd 20:0:0:0: Attached scsi generic sg2 type 0
[96305.476969] sd 20:0:0:0: [sdb] 131072 512-byte logical blocks: (67.1 MB/64.0 MiB)
[96308.632775] usb 3-3: reset full-speed USB device number 51 using xhci_hcd
[96308.632952] usb 3-3: Device not responding to set address.
[96308.833903] usb 3-3: Device not responding to set address.
[96309.034867] usb 3-3: device not accepting address 51, error -71
[96309.188046] usb 3-3: reset full-speed USB device number 51 using xhci_hcd
[96309.188184] usb 3-3: Device not responding to set address.
[96309.389413] usb 3-3: Device not responding to set address.
[96309.590372] usb 3-3: device not accepting address 51, error -71
[96309.743536] usb 3-3: reset full-speed USB device number 51 using xhci_hcd
[96309.743712] usb 3-3: Device not responding to set address.
[96309.944739] usb 3-3: Device not responding to set address.
[96310.145781] usb 3-3: device not accepting address 51, error -71
[96310.298970] usb 3-3: reset full-speed USB device number 51 using xhci_hcd
[96310.299115] usb 3-3: Device not responding to set address.
[96310.500175] usb 3-3: Device not responding to set address.
[96310.701221] usb 3-3: device not accepting address 51, error -71
[96310.701264] usb 3-3: USB disconnect, device number 51
[96310.707280] sd 20:0:0:0: [sdb] Write Protect is off
[96310.707283] sd 20:0:0:0: [sdb] Mode Sense: 0f 00 00 00
[96310.707329] sd 20:0:0:0: [sdb] No Caching mode page found
[96310.707334] sd 20:0:0:0: [sdb] Assuming drive cache: write through
[96310.707535] sd 20:0:0:0: [sdb] Attached SCSI removable disk
[96310.708051] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with disabled ep ee19b600
[96310.708055] xhci_hcd 0000:00:14.0: xHCI xhci_drop_endpoint called with disabled ep ee19b62c
[96310.861398] usb 3-3: new full-speed USB device number 52 using xhci_hcd
[96310.861607] usb 3-3: Device not responding to set address.
[96311.062777] usb 3-3: Device not responding to set address.
[96311.263729] usb 3-3: device not accepting address 52, error -71
[96311.416845] usb 3-3: new full-speed USB device number 53 using xhci_hcd
[96311.417054] usb 3-3: Device not responding to set address.
[96311.618135] usb 3-3: Device not responding to set address.
[96311.819119] usb 3-3: device not accepting address 53, error -71
[96311.972306] usb 3-3: new full-speed USB device number 54 using xhci_hcd
[96311.972508] usb 3-3: Device not responding to set address.
[96312.173568] usb 3-3: Device not responding to set address.

On the A20 I get the following message when loading the module:

Quoteusb open backing file: /home/dev/backing_file, 0xeead9a00
[   34.202313] usb open backing file: /home/dev/backing_file, 0xeead9a00
<6>g_mass_storage gadget: Mass Storage Function, version: 2009/09/11
[   34.215101] g_mass_storage gadget: Mass Storage Function, version: 2009/09/11
<6>g_mass_storage gadget: Number of LUNs=1
[   34.227140] g_mass_storage gadget: Number of LUNs=1
<6> lun0: LUN: removable file: /home/dev/backing_file
[   34.236938]  lun0: LUN: removable file: /home/dev/backing_file
ep_matches, wrn: endpoint already claimed, ep(0xc0867f04, 0xbf0312dc, ep1-bulk)
[   34.249943] ep_matches, wrn: endpoint already claimed, ep(0xc0867f04, 0xbf0312dc, ep1-bulk)
<6>g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
[   34.264313] g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
<4>g_mass_storage gadget: userspace failed to provide iSerialNumber
[   34.278093] g_mass_storage gadget: userspace failed to provide iSerialNumber
<6>g_mass_storage gadget: g_mass_storage ready
[   34.289508] g_mass_storage gadget: g_mass_storage ready

Till this point it looks good, but then, this happens, and the board freezes:

Quote
root@olimex-a20:~# WRN:L1041(drivers/usb/sunxi_usb/udc/sw_udc.c):[   34.619161] WRN:L1041(drivers/usb/sunxi_usb/udc/sw_udc.c):ERR: Operation not supported
ERR: Operation not supported
WRN:L1041(drivers/usb/sunxi_usb/udc/sw_udc.c):[   34.633968] WRN:L1041(drivers/usb/sunxi_usb/udc/sw_udc.c):ERR: Operation not supported
ERR: Operation not supported
WRN:L1041(drivers/usb/sunxi_usb/udc/sw_udc.c):[   34.648685] WRN:L1041(drivers/usb/sunxi_usb/udc/sw_udc.c):ERR: Operation not supported
ERR: Operation not supported
<6>g_mass_storage gadget: full-speed config #1: Linux File-Backed Storage
[   34.667367] g_mass_storage gadget: full-speed config #1: Linux File-Backed Storage
WRN:L1355(drivers/usb/sunxi_usb/udc/sw_udc.c):[   39.678383] WRN:L1355(drivers/usb/sunxi_usb/udc/sw_udc.c):handle_ep0: ep0 setup end
handle_ep0: ep0 setup end
<3>INFO: rcu_preempt detected stalls on CPUs/tasks:[  106.696191] INFO: rcu_preempt detected stalls on CPUs/tasks:<c>

<3>   0: (1 GPs behind) idle=55b/140000000000001/0 drain=0 . timer=-1
[  106.708401]    0: (1 GPs behind) idle=55b/140000000000001/0 drain=0 . timer=-1
<3>   [  106.715832]    <c>(detected by 1, t=6051 jiffies)
(detected by 1, t=6051 jiffies)
<3>INFO: Stall ended before state dump start
[  106.727478] INFO: Stall ended before state dump start

So what am I missing?

Greetz,
Chris