fix-broken-usb-handed-to-linux.patch
commitc7994820c491ad1cdff28d5ff9b062d2c79d5f2c
authorAndy Green <andy@openmoko.com>
Fri, 1 Aug 2008 06:47:06 +0000 (1 07:47 +0100)
committerAndy Green <agreen@pads.home.warmcat.com>
Sun, 3 Aug 2008 18:34:30 +0000 (3 19:34 +0100)
tree19ef9f43af881a69449695886408a2fcfd33546c
parentba029a1426bfca169572bf80d50a8b190a6b0e19
fix-broken-usb-handed-to-linux.patch

The USB callback for udc / enumeration notification is very time
critical.  Recently, we started using this for PMU actions, which
occur on the ridiculously slow I2C bus and block the USB stack for
the duration.

This caused a very bad behaviour in the USB Device hardware of
spamming the USB bus at 6MHz for the entire session, even after
Linux had booted, rendering the USB interface not operational.
The chances were about 50:50 per boot you would have broken USB.

This patch removes the I2C action from the time critical path
and instead takes care to track it only if we are spinning
waiting for enumeration because we have a bad battery level.
The I2C transaction then takes place out of any time critical
code.

Enumeration is lost anyway as soon as we enter Linux where the
device is enumerated fresh and the Linux pcf50633 driver will
handle it.

One of the results of Insane Spam Mode on USB is not being able
to enumerate properly with host PC over USB.  And that leads
directly to not being able to charge the device for the whole
session.

Signed-off-by: Andy Green <andy@openmoko.com>
board/neo1973/common/udc.c
board/neo1973/gta02/gta02.c