[Gta04-owner] USB questions

NeilBrown neilb at suse.de
Fri Mar 16 01:16:42 CET 2012

On Wed, 14 Mar 2012 09:22:07 +0100 Andreas Kemnade <andreas at kemnade.info>

> Hi,
> I have some questions regarding USB.
> 1. The most critical thing and the most annoying problem with the GTA04 in
> general is the fact that GTA04 does not cope with power supplies which cannot
> provide the full current at some time. Voltage breaks down and the GTA04 does 
> not use the power supply at all. So the voltage goes up again. Seen with 3.2
> kernels and 2.6.32. In contrairy GTA02 does not stop drawing power in such 
> situations. What can be done here? Simply ignore VBus disconnect events 
> (perhaps until iD is low)?


The current code always programs the GTA04 to draw (up to) 600mA from the USB
if 5V appears.  The commandline parameter twl4030_charger.allow_usb=1 says
this is OK to do.

If you
  echo 0 > /sys/modules/twl4030_charger/parameters/allow_usb

it will stop doing this - then it won't change at all.

If you change "TWL4030_USBFASTMCHG" in drivers/power/twl4030_charger.c to
#define TWL4030_USBSLOWMCHG BIT(1)
it should use 100mA ... I think.

We really should detect how much current the host is willing to supply and
only use that.  This is easier said than done.  There are multiple standards,
both defacto and dejure, for determining how much current you can draw.
 - whether D+ and D- are shorted
 - the resistance between ID and GND
 - the voltage of D+ and D-
 - USB commands received from the host

I think you can even try increasing the current in small increments until the
voltage drops below some set level - then backing off a bit.

And once you know what current you can draw, you would need to program the
TWL4030 to allow that an now more.  This is not straight forward except.

I suggest you read the  TWL4030 data sheets - the battery charger interface
section.  Read it several times.  Then go find something easier to play
with :-) that is what I did.

> 2. The usb mode sysfs control does not evaluate what is written to it or
> am I missing something? (in both 3.2 and 2.6.32). What's going on there?
> in musb_core.c the platform mode callback is called is called and passed on to
> but in musb/omap2430.c musb_platform_set_mode() does not evaulate the mode
> parameter.

I don't think you can just arbitrarily switch between 'host' and 'gadget'
mode - which I think is what you are talking about.
If the ID pin is shorted to ground, you get HOST mode.  If not you get gadget
I think this is a way to swap ends - pulsing the power line or something.
I think more reading about "OTG" is probably needed.

> 3. In 2.6.32 there is code in otg/twl4030_usb.c commented out dealing with
> the OTG_CTRL_DRVVBUS because it is done in mbus. But I cannot find it there.
> Where is it done?

drivers/usb/otg/ulpi.c ??


> Anyway I found out that clearing DRVVBUS after ID is pulled low gives the
> opportunity to use it as unpowered and so you can reuse stuff like old special
> cables created for GTA02 (including USB hubs giving out power to the host side)
>  if ID pin is low.
> Greetings
> Andreas Kemnade
> PS: I have not forgotten that si4721 stuff.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: not available
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20120316/1164206a/attachment.bin>

More information about the Gta04-owner mailing list