Re: [linux-sunxi] USB-ethernet and mass storage gadgets

1,211 views
Skip to first unread message

Dmitriy B.

unread,
Jan 21, 2013, 6:28:10 AM1/21/13
to linux...@googlegroups.com
USB Gadgets framework is heavily customized by Allwinner and everything except file_backed_storage doesnt work. You are welcome to rewrite it to working state.

2013/1/21 Dmitriy Alekseev <deathon...@gmail.com>
Hello! I'm attempting to build kernel for mk802 (A10, 1Gb) with working g_ether and g_mass_storage/g_file_storage modules.

I dealed with linux versions 2.6.36, 3.0.36, 3.0.57, 3.4.24, CodeSourcery's toolchains 2010.09 and 2011.03, but no luck. 
In some cases, I have compiler errors, or successfully kernel builds, but gadget usb modules do not work.

Need Your advice to do solve it! Thanks!

--
 
 

Dmitriy Alekseev

unread,
Jan 21, 2013, 7:18:09 AM1/21/13
to linux...@googlegroups.com
Sadly there is no suitable Technical Reference Manual on this processor.

понедельник, 21 января 2013 г., 15:28:10 UTC+4 пользователь Dmitriy B. написал:

Dmitriy Alekseev

unread,
May 6, 2013, 5:06:05 AM5/6/13
to linux...@googlegroups.com
The article say that gadget is working:
http://linux-sunxi.org/USB_Gadget
Could anybody confirm it? I returned to subject, but still have no success for me.

понедельник, 21 января 2013 г., 15:09:53 UTC+4 пользователь Dmitriy Alekseev написал:

Michal Suchanek

unread,
May 6, 2013, 12:39:55 PM5/6/13
to linux-sunxi
On 6 May 2013 11:06, Dmitriy Alekseev <deathon...@gmail.com> wrote:
> The article say that gadget is working:
> http://linux-sunxi.org/USB_Gadget
> Could anybody confirm it? I returned to subject, but still have no success
> for me.
>

g_ether is working for me.

I did not try the mass storage gadget.

I don't think you can have both working at the same time.

Thanks

Michal

Dmitriy Alekseev

unread,
May 8, 2013, 3:51:11 AM5/8/13
to linux...@googlegroups.com
Hi, Michal.

Could You provide your .config and kernel version number You are using?

Thank You!

понедельник, 6 мая 2013 г., 20:39:55 UTC+4 пользователь Michal Suchanek написал:

Dmitriy Alekseev

unread,
May 14, 2013, 8:05:45 AM5/14/13
to linux...@googlegroups.com
Dear Hackers.
Please, take a look what is my problem. 

~# uname -a
Linux a10 3.4.43 #9 PREEMPT Tue May 14 15:34:50 MSK 2013 armv7l GNU/Linux
~# modprobe g_ether
<7>couldn't find an available UDC
ERROR: could not insert 'g_ether': No such device

Config attached.

среда, 8 мая 2013 г., 11:51:11 UTC+4 пользователь Dmitriy Alekseev написал:
config-gadget.txt

Bastiaan van den Berg

unread,
May 14, 2013, 8:13:28 AM5/14/13
to linux-sunxi
On Tue, May 14, 2013 at 2:05 PM, Dmitriy Alekseev <deathon...@gmail.com> wrote:
Dear Hackers.
Please, take a look what is my problem. 


Did you do make modules_install ?

--
buZz 

Dmitriy Alekseev

unread,
May 14, 2013, 8:32:23 AM5/14/13
to linux...@googlegroups.com
I cross compiled, installed to special directory on PC and then copied it to /lib/modules on device's rootfs.

make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm clean &&
make -j2 CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm uImage &&
make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- -j2 INSTALL_MOD_PATH=a10_mod_path modules &&
make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- -j2 INSTALL_MOD_PATH=a10_mod_path modules_install

May be the reason is in fex script? I am using default mele_a1000.fex.

вторник, 14 мая 2013 г., 16:13:28 UTC+4 пользователь Bastiaan van den Berg написал:

Dmitriy Alekseev

unread,
May 14, 2013, 8:32:29 AM5/14/13
to linux...@googlegroups.com
I cross compiled, installed to special directory on PC and then copied it to /lib/modules on device's rootfs.

make CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm clean &&
make -j2 CROSS_COMPILE=arm-arago-linux-gnueabi- ARCH=arm uImage &&
make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- -j2 INSTALL_MOD_PATH=a10_mod_path modules &&
make ARCH=arm CROSS_COMPILE=arm-arago-linux-gnueabi- -j2 INSTALL_MOD_PATH=a10_mod_path modules_install

May be the reason is in fex script? I am using default mele_a1000.fex.

вторник, 14 мая 2013 г., 16:13:28 UTC+4 пользователь Bastiaan van den Berg написал:
On Tue, May 14, 2013 at 2:05 PM, Dmitriy Alekseev <deathon...@gmail.com> wrote:

Bastiaan van den Berg

unread,
May 14, 2013, 8:38:04 AM5/14/13
to linux-sunxi
On Tue, May 14, 2013 at 2:32 PM, Dmitriy Alekseev <deathon...@gmail.com> wrote:
I cross compiled, installed to special directory on PC and then copied it to /lib/modules on device's rootfs.

And you did do depmod -a after copying the modules to the proper (/lib/modules/KERNELVERSIONNUMBER/) directory? 

--
buZz

Dmitriy Alekseev

unread,
May 14, 2013, 8:46:25 AM5/14/13
to linux...@googlegroups.com
"depmod -a" does not help.

вторник, 14 мая 2013 г., 16:38:04 UTC+4 пользователь Bastiaan van den Berg написал:

Michal Suchanek

unread,
May 14, 2013, 11:10:40 AM5/14/13
to linux-sunxi
On 14 May 2013 14:05, Dmitriy Alekseev <deathon...@gmail.com> wrote:
> Dear Hackers.
> Please, take a look what is my problem.
>
> ~# uname -a
> Linux a10 3.4.43 #9 PREEMPT Tue May 14 15:34:50 MSK 2013 armv7l GNU/Linux
> ~# modprobe g_ether
> <7>couldn't find an available UDC

This sounds like an error from the USB driver.

I am using 2.4.29+ kernel (somewhat patched - based off 7e2c42297
disp: track layers created by ioctl. - I think this is the last commit
of sunxi staging branch I have).

I did not get to testing that g_ether actually works still but
somewhere around 3d0ef72f2a sunxi:udc: fix gadget driver reload
should be working version.

Attaching a config which includes the USB bits.

Especially check that you have OTG or DEVICE_ONLY mode enabled.

Thanks

Michal
sun4i-config.gz

Dmitriy Alekseev

unread,
May 15, 2013, 6:00:55 AM5/15/13
to linux...@googlegroups.com
Michal, thank You, I found a mistake in my fex script.

Really 2.4.29+ ? Did You mean 3.4.29?


вторник, 14 мая 2013 г., 19:10:40 UTC+4 пользователь Michal Suchanek написал:

Michal Suchanek

unread,
May 15, 2013, 7:19:10 AM5/15/13
to linux-sunxi
On 15 May 2013 12:00, Dmitriy Alekseev <deathon...@gmail.com> wrote:
> Michal, thank You, I found a mistake in my fex script.
>
> Really 2.4.29+ ? Did You mean 3.4.29?

The + is reported by the kernel because it's not really 3.4.29 kernel
release but a git tree based on 3.4.29 (in case of sunxi kernels quite
loosely).

Thanks

Michal

josef...@gmail.com

unread,
Sep 16, 2013, 9:18:55 AM9/16/13
to linux...@googlegroups.com

Helllo,

I have hackberry Allwinner A10 and I tried to get working g_serial or g_printer gadgets.

I built latest version of linux-sunxi 3.4.61+ (I have in menuconfig enabled OTG support and all gadgets) and after call:

insmod /lib/modules/3.4.61+/drivers/usb/gadget/g_printer.ko idVendor=0x154f idProduct=0x1300

Error: could not insert module /lib/modules/3.4.61+/drivers/usb/gadget/g_printer.ko: No such device

dmesg shows:


couldn't find an available UDC

[ 1082.173700] Printer Gadget: usb_gadget_probe_driver ffffffed

same is for another gadget

Is there problem in my steps or in udc driver? Thank you for response. Josef

Michal Suchanek

unread,
Sep 17, 2013, 2:48:29 AM9/17/13
to linux-sunxi
Hello,

On 16 September 2013 15:18, <josef...@gmail.com> wrote:
> On Wednesday, May 15, 2013 1:19:10 PM UTC+2, Michal Suchanek wrote:
>> On 15 May 2013 12:00, Dmitriy Alekseev <deathon...@gmail.com> wrote:
>>
>> > Michal, thank You, I found a mistake in my fex script.
>>
>> >
>>
>> > Really 2.4.29+ ? Did You mean 3.4.29?
>>
>>
>>
>> The + is reported by the kernel because it's not really 3.4.29 kernel
>>
>> release but a git tree based on 3.4.29 (in case of sunxi kernels quite
>>
>> loosely).
>>
>>
>>
>> Thanks
>>
>>
>>
>> Michal
>
> Helllo,
>
> I have hackberry Allwinner A10 and I tried to get working g_serial or g_printer gadgets.
>
> I built latest version of linux-sunxi 3.4.61+ (I have in menuconfig enabled OTG support and all gadgets) and after call:
>
> insmod /lib/modules/3.4.61+/drivers/usb/gadget/g_printer.ko idVendor=0x154f idProduct=0x1300
>
> Error: could not insert module /lib/modules/3.4.61+/drivers/usb/gadget/g_printer.ko: No such device

g_ethernet should work and give assortment of error messages also. I
am not sure if the other gadgets are broken or need some more setup.
eg. you can't possibly load mass storage emulation without telling it
what to use for storage somehow. Maybe the printer gadget is similar
or it's just broken. Maybe you can build the testing OTG driver and
try on that as well. That one should not have driver issues.

Thanks

MIchal

josef...@gmail.com

unread,
Sep 17, 2013, 8:15:53 AM9/17/13
to linux...@googlegroups.com

Thank you for response.

Can you send me link to testing OTG driver? A have now latest version from linux-sunxi repository.
I tried to load g_ether driver and got same result:


"couldn't find an available UDC"

It seems OTG doesn't switch to device mode?

thank you

Josef

Michal Suchanek

unread,
Sep 17, 2013, 10:01:03 AM9/17/13
to linux-sunxi
It does for me:

[1127404.571387]
WRN:L2728(/scratch/build/linux-2.6/drivers/usb/sunxi_usb/udc/sw_udc.c):ERR:
usb device is not active
[1127404.591395] g_ether gadget: using random self ethernet address
[1127404.603923] g_ether gadget: using random host ethernet address
[1127404.618525] usb0: MAC 9e:3a:ce:16:7e:24
[1127404.638772] usb0: HOST MAC 0a:f7:8b:e8:98:78
[1127404.663491] ep_matches, wrn: endpoint already claimed,
ep(0xc0852b6c, 0xee01df40, ep1-bulk)
[1127404.701399] ep_matches, wrn: endpoint already claimed,
ep(0xc0852b6c, 0xee01df40, ep1-bulk)
[1127404.741376] ep_matches, wrn: endpoint already claimed,
ep(0xc0852bb8, 0xee01df40, ep2-bulk)
[1127404.771406] ep_matches, wrn: endpoint already claimed,
ep(0xc0852b6c, 0xee01df40, ep1-bulk)
[1127404.796274] g_ether gadget: Ethernet Gadget, version: Memorial Day 2008
[1127404.818045] g_ether gadget: g_ether ready
[1127404.828416]
WRN:L2761(/scratch/build/linux-2.6/drivers/usb/sunxi_usb/udc/sw_udc.c):ERR:
usb device is not active
root@A10:/opt/sunxi-mali# uname -a
Linux A10 3.4.43+ #13 PREEMPT Mon Sep 2 23:21:51 CEST 2013 armv7l GNU/Linux

I obviously don't have the latest kernel and also don't have the OTG
cable connected anywhere which is probably what the 'usb device is not
active' probably refers to.

Thanks

Michal

Arokux X

unread,
Sep 17, 2013, 11:00:47 AM9/17/13
to linux...@googlegroups.com, Jussi Kivilinna
Hi guys,

there was some effort on adding sunxi_usb code to mainline musb done by Jussi Kivinna so I'm CC'ing him.

@Michal: Can you try the latest kernel (sunxi-3.4) if it still works?

Thanks,
Arokux

Michal Suchanek

unread,
Sep 17, 2013, 1:28:34 PM9/17/13
to linux-sunxi
On 8 May 2013 09:51, Dmitriy Alekseev <deathon...@gmail.com> wrote:
> Hi, Michal.
>
> Could You provide your .config and kernel version number You are using?
>

Attaching the config

I don't have exact version but the build date is 2 Sept so some
checkout from around that date from stage/sunxi-3.4. Stage has been
updated so maybe you can find something like that in the stable 3.4
branch.

HTH

Michal
sun4i-3.4.43-config.txt

Michal Suchanek

unread,
Sep 17, 2013, 1:31:16 PM9/17/13
to linux-sunxi, Jussi Kivilinna
I tried stage/sunxi-3.4.

It loads the ehernet gadget just fine with about the same messages as
the earlier kernel but the other side does not see an USB device at
all. Looks like the port is not enabled.

Needs more investigation I guess.

Thanks

Michal
Reply all
Reply to author
Forward
0 new messages