[Gta04-owner] USB-OTG hacking guide / how to be usb host

Andreas Kemnade andreas at kemnade.info
Tue May 8 17:23:26 CEST 2012


Hi,

I have some experience with the usb stuff now. Perhaps it is interesting for
other people, too, especially since the usb stuff is mostly excluded from
the SoC datasheet. I can also convert parts of the things below to clean patches.

One main difference is that Vbus handling is deeply integrated into the
hardware and many things are not software controlled. Basically the whole
usb otg state machine lives in the SoC in hardware, so you can not set host
role that easily.
The USB part in the SoC steers directly the configuration registers in the
twl4030. But the registers also can be accessed using I2C from the kernel.
Vbus power output can be controled using DRVVBUS in the OTG_CTRL register.
Charger settings override DRVVBUS.

Host with power from usb devices/y-cables (b_host):
Variant 1.
  1. connect the GTA04 to a usb host (id must not be grounded here)
  2. set MUSB_DEVCTL_HR in MUSB_DEVCTL
       (this would normally be done as a reaction of an USB request
       to the control endpoint to start HNP)
  3. Disconnect data lines from host, keep Vbus on
     GTA04 will switch on its own host pulldowns
  4. Connect the data lines to the peripheral
 
Variant 2:
  This mostly emulates some steps from above.
  1. provide power (again, the id pin must not be grounded)
  2. emulate a connection to an usb host by setting
     OTG_CTRL_DPPULLDOWN via i2c
  3. set MUSB_DEVCTL_HR in MUSB_DEVCTL
  4. emulate disconnection from host by clearing
     OTG_CTRL_DPPULLDOWN via i2c
  5. enable pulldown again by setting
     OTG_CTRL_DPPULLDOWN via i2c
     so that the phy can recognize connected devices.
  6. Connect data lines to the peripheral

Host gives out power (a_host):
standard variant:
  - connect usb device by using a cable with the ID pin grounded

If you do not have an usb mini plug with id grounded:
Variant 1
1. connect the openmoko charger to the GTA04 (not to
   the wall socket!)
2. disconnect it. (with 2.6.32 the usb system notices that,
   but not 3.x)
3. connect the device (tried that with usb-a to mini-b cables, and
   adapter usb a socket to usb a socket)

variant 2
   - fiddle with the MUSB_TEST_FORCE_HOST bit in the MUSB_TESTMODE register
     and connect the device. I do not understand that bit fully, so I do not
     give more precise instructions. In kernel 3.x, that bit can be accessed
     through debugfs.

Greetings
Andreas Kemnade
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20120508/48e84f27/attachment.bin>


More information about the Gta04-owner mailing list