Setting up OTG gadget mode in linux-omap-2.6

Hello folks.

I'm trying to configure my BeagleBoard's OTG port to operate under
gadget mode so I can to an ethernet-over-USB bridge.

I've used the Angstrom demo image and its 2.6.27 kernel, but it fails
miserably. g_ether doesn't even want to load (claims there's "No such
device"), on the PC I get are descriptor read errors, and on the
BeagleBoard it prints some timeout errors (probably waiting for the PC
to respond in some way). The output on the PC looks something like
this:

Jan 25 18:48:56 jacob-gdesktop usb 1-6.1: new high speed USB device
using ehci_hcd and address 5
Jan 25 18:48:56 jacob-gdesktop usb 1-6.1: device descriptor read/64,
error -71
Jan 25 18:48:56 jacob-gdesktop usb 1-6.1: device descriptor read/64,
error -71
Jan 25 18:48:56 jacob-gdesktop usb 1-6.1: new high speed USB device
using ehci_hcd and address 6
Jan 25 18:48:56 jacob-gdesktop usb 1-6.1: device descriptor read/64,
error -71
Jan 25 18:48:56 jacob-gdesktop usb 1-6.1: device descriptor read/64,
error -71
Jan 25 18:48:57 jacob-gdesktop usb 1-6.1: new high speed USB device
using ehci_hcd and address 7
Jan 25 18:48:57 jacob-gdesktop usb 1-6.1: device not accepting address
7, error -71
Jan 25 18:48:57 jacob-gdesktop usb 1-6.1: new high speed USB device
using ehci_hcd and address 8
Jan 25 18:48:58 jacob-gdesktop usb 1-6.1: device not accepting address
8, error -71
Jan 25 18:48:58 jacob-gdesktop hub 1-6:1.0: unable to enumerate USB
device on port 1

I compiled 2.6.29 from git, with the default omap3 beagle
configuration. The only changes I made were to turn off USB host mode,
and double-check that USB gadget and its ethernet driver was turned
on. I installed its uImage in place of the 2.6.27 version, and copied
the proper /lib/modules/ folder into the root FS partition. I booted
that mix up, and g_ether loads just fine. I modprobed "bridge" on the
PC, as well. However, when I connect it to the PC, I get this:

Jan 26 07:44:13 jacob-gdesktop usb 1-6.1: new high speed USB device
using ehci_hcd and address 5
Jan 26 07:44:13 jacob-gdesktop usb 1-6.1: unable to read config index
0 descriptor/all
Jan 26 07:44:13 jacob-gdesktop usb 1-6.1: can't read configurations,
error -71
Jan 26 07:44:13 jacob-gdesktop usb 1-6.1: new high speed USB device
using ehci_hcd and address 6
Jan 26 07:44:13 jacob-gdesktop usb 1-6.1: unable to read config index
0 descriptor/start: -71
Jan 26 07:44:13 jacob-gdesktop usb 1-6.1: chopping to 0 config(s)
Jan 26 07:44:13 jacob-gdesktop usb 1-6.1: string descriptor 0 read
error: -71
Jan 26 07:44:13 jacob-gdesktop usb 1-6.1: string descriptor 0 read
error: -71
Jan 26 07:44:13 jacob-gdesktop usb 1-6.1: no configuration chosen from
0 choices

As far as I know, there could be three possibilities: the kernel on
the BB is buggy (being the latest git), the kernel on the PC is
misconfigured (but how?), or the mini-USB 2.0 to USB 2.0 hub to USB
1.1 port is messing up because the kernel says it's high speed, when
really the PC port is USB 1.1. (However, other devices load just fine
using the ehci_hcd driver.)

I'm really just pushing random buttons at this point, so any tips, at
all, would be great. It would give me a sense of direction, at the
very least. :stuck_out_tongue:

The 2.6.27 kernel is hardwired to host due to MUSB bugs. Try 2.6.26 or 2.6.28 if you want it to be OTG. Your other option is to recompile the kernel with musb hardwired to device.

regards,

Koen