Hi,
I am trying to access the storage area of boot and rootfs partition to a pc through OTG USB of A20-OLinuXino-MICRO. Right now, I am using linux-sunxi-sunxi-3.4 debian source for the mass storage gadget.I configured in menuconfig as :
Device Drivers --->
- USB support --->
<*> Inventra Highspeed Dual Role Controller (TI, ADI, AW, ...)
<*> Platform Glue Layer (Allwinner SUN4I/SUN5I/SUN7I) --->
MUSB DMA mode (Disable DMA (always use PIO)) --->
<*> USB Gadget Support --->
<M> USB Gadget Drivers
<M> Mass Storage Gadget
After booting up this image , Inserted the module :
$ modprobe g_mass_storage file=/dev/mmcblk0p1,/dev/mmcblk0p2 removable=y
It works perfectly and shows up the boot and rootfs partition of Olimex in the Ubuntu PC. when I unplug and plug-in the usb-to-mini-usb cable from pc to olimex board, it Doesn't show up any partition to mount in my PC.I also tried re-inserting the module but of no use. The storage shows up in PC only after booting up and modprobe is given for the first time.
How to make g_mass_storage(Mass storage Gadget) module work perfectly each time even after unplug and plug-in of usb cable from pc to A20-OLinuXino-MICRO should not make any fault ??
Any help on Mass storage Gadget is appreciated. its urgent :(
Thanks in advance,
Shijin
Did you enabled the SUNXI USB2.0 Dual Role Controller (at the very bottom of USB support options) and the options inside? I haven't tried the USB gadgets, but this seem like vital component and it looks that this is handling the pluging and umpluging.
Hi,
Thanks for the support
At first I used 'SUNXI USB2.0 Dual Role Controller support' but it freeze the device when I inserted the g_mass_storage module, only because of that I choose 'Inventra Highspeed Dual Role Controller (TI, ADI, AW, ...)'
But later I found it works perfectly in 'SUNXI USB2.0 Dual Role Controller support' when adding 'stall=0' (halt bulk endpoints) with the modprobe.
$ modprobe g_mass_storage file=/dev/mmcblk0p1,/dev/mmcblk0p2 stall=0
I am trying "stall=0", and it works as expected.
But, I have another problem. If I do modprobe with "stall=0" before connect Olimex USB to Ubuntu PC, PC can NOT recognize Olimex USB.
However, if I connect Olimex USB to PC first, then do "modprobe", and USB works fine.
Any comments?
Thanks.
<*> Inventra Highspeed Dual Role Controller (TI, ADI, AW, ...)
<*> Platform Glue Layer (Allwinner SUN4I/SUN5I/SUN7I) --->
MUSB DMA mode (Disable DMA (always use PIO)) --->
what is it use for???
at fisrt i do not add this driver:
when i run: modprobe g_mass_storage file=/dev/nanda,/dev/nandb removable=y
failed to modprobe.
this is log:
root@cubie:~# [sw_udc]: [sw_udc]: [sw_usb_udc]: binding gadget driver 'g_mass_storage'
[sw_usb_udc]: binding gadget driver 'g_mass_storage'
[sw_udc]: [sw_udc]: alloc request: ep(0xc089d898, ep0, 64), req(0xeeaf4400)
alloc request: ep(0xc089d898, ep0, 64), req(0xeeaf4400)
usb open backing file: /dev/nanda, 0xeeb24800
usb open backing file: /dev/nanda, 0xeeb24800
usb open backing file: /dev/nandb, 0xeeb249b0
usb open backing file: /dev/nandb, 0xeeb249b0
<6>g_mass_storage gadget: Mass Storage Function, version: 2009/09/11
g_mass_storage gadget: Mass Storage Function, version: 2009/09/11
<6>g_mass_storage gadget: Number of LUNs=2
g_mass_storage gadget: Number of LUNs=2
<6> lun0: LUN: removable file: /dev/nanda
lun0: LUN: removable file: /dev/nanda
<6> lun1: LUN: removable file: /dev/nandb
lun1: LUN: removable file: /dev/nandb
ep_matches, wrn: endpoint already claimed, ep(0xc089d8e4, 0xbf16c380, ep1-bulk)
ep_matches, wrn: endpoint already claimed, ep(0xc089d8e4, 0xbf16c380, ep1-bulk)
<6>g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
g_mass_storage gadget: Mass Storage Gadget, version: 2009/09/11
<4>g_mass_storage gadget: userspace failed to provide iSerialNumber
g_mass_storage gadget: userspace failed to provide iSerialNumber
<6>g_mass_storage gadget: g_mass_storage ready
g_mass_storage gadget: g_mass_storage ready
[sw_udc]: [sw_udc]: usbd_start_work
usbd_start_work
[sw_udc]: [sw_udc]: IRQ: suspend
IRQ: suspend
[sw_udc]: [sw_udc]: ERR: usb speed is unkown
ERR: usb speed is unkown
[sw_udc]: [sw_udc]: IRQ: reset
IRQ: reset
[sw_udc]: [sw_udc]: irq: reset happen, throw away all urb
irq: reset happen, throw away all urb
[sw_udc]: [sw_udc]:
+++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++
[sw_udc]: [sw_udc]: usb enter full speed.
usb enter full speed.
[sw_udc]: [sw_udc]:
+++++++++++++++++++++++++++++++++++++
+++++++++++++++++++++++++++++++++++++
[sw_udc]: [sw_udc]: IRQ: reset
IRQ: reset
[sw_udc]: [sw_udc]: irq: reset happen, throw away all urb
irq: reset happen, throw away all urb
[sw_udc]: [sw_udc]: Set address 7
Set address 7
WRN:L1041(/work/linux-sdk/linux-sunxi/drivers/usb/sunxi_usb/udc/sw_udc.c):WRN:L1041(/work/linux-sdk/linux-sunxi/drivers/usb/sunxi_usb/udc/sw_udc.c):ERR: Operation not supported
ERR: Operation not supported
WRN:L1041(/work/linux-sdk/linux-sunxi/drivers/usb/sunxi_usb/udc/sw_udc.c):WRN:L1041(/work/linux-sdk/linux-sunxi/drivers/usb/sunxi_usb/udc/sw_udc.c):ERR: Operation not supported
ERR: Operation not supported
WRN:L1041(/work/linux-sdk/linux-sunxi/drivers/usb/sunxi_usb/udc/sw_udc.c):WRN:L1041(/work/linux-sdk/linux-sunxi/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
g_mass_storage gadget: full-speed config #1: Linux File-Backed Storage
[sw_udc]: [sw_udc]: ep enable: ep1(0xc089d8e4, ep1-bulk, 128, 64)
ep enable: ep1(0xc089d8e4, ep1-bulk, 128, 64)
[sw_udc]: [sw_udc]: ep enable: ep2(0xc089d930, ep2-bulk, 0, 64)
ep enable: ep2(0xc089d930, ep2-bulk, 0, 64)
[sw_udc]: [sw_udc]: alloc request: ep(0xc089d8e4, ep1-bulk, 64), req(0xedc3ec80)
alloc request: ep(0xc089d8e4, ep1-bulk, 64), req(0xedc3ec80)
[sw_udc]: [sw_udc]: alloc request: ep(0xc089d930, ep2-bulk, 64), req(0xedc3e300)
alloc request: ep(0xc089d930, ep2-bulk, 64), req(0xedc3e300)
[sw_udc]: [sw_udc]: alloc request: ep(0xc089d8e4, ep1-bulk, 64), req(0xedc3ecc0)
alloc request: ep(0xc089d8e4, ep1-bulk, 64), req(0xedc3ecc0)
[sw_udc]: [sw_udc]: alloc request: ep(0xc089d930, ep2-bulk, 64), req(0xedc3e440)
alloc request: ep(0xc089d930, ep2-bulk, 64), req(0xedc3e440)
WRN:L1355(/work/linux-sdk/linux-sunxi/drivers/usb/sunxi_usb/udc/sw_udc.c):WRN:L1355(/work/linux-sdk/linux-sunxi/drivers/usb/sunxi_usb/udc/sw_udc.c):handle_ep0: ep0 setup end
handle_ep0: ep0 setup end
nuke: ep num is 0
nuke: ep num is 0
<3>INFO: rcu_preempt detected stalls on CPUs/tasks:INFO: rcu_preempt detected stalls on CPUs/tasks:<c>
<3> 0: (1 GPs behind) idle=df5/1/0 drain=0 . timer=-1
0: (1 GPs behind) idle=df5/1/0 drain=0 . timer=-1
<3> <c>(detected by 1, t=6015 jiffies)
(detected by 1, t=6015 jiffies)
<3>INFO: Stall ended before state dump start
INFO: Stall ended before state dump start
<3>INFO: rcu_preempt detected stalls on CPUs/tasks:INFO: rcu_preempt detected stalls on CPUs/tasks:<c>
<3> 0: (1 GPs behind) idle=df5/1/0 drain=0 . timer=-1
0: (1 GPs behind) idle=df5/1/0 drain=0 . timer=-1
<3> <c>(detected by 1, t=24022 jiffies)
(detected by 1, t=24022 jiffies)
<3>INFO: Stall ended before state dump start
INFO: Stall ended before state dump start
I use 3.4.79 - debian。
when I add this driver, and run:
modprobe g_mass_storage /dev/nanda,/dev/nandb removalbe=y or modprobe g_mass_storage
ERROR: could not insert 'g_mass_storage': No such device
it is strange, i can find /lib/modules/3.4.79/kernel/driver/usb/gadget/g_mass_storage.ko
does you see this??