'i2c read failed' problem

Harald Welte laforge at openmoko.org
Sat Apr 14 13:42:07 CEST 2007

Ok, seems like I've managed to hunt down this problem.

Once a 500mA capable configuration has been selected by the USB host,
the usbtty driver callback function board/neo1973/udc.c:udc_ctrl(),
calls pcf50606_charge_autofast(), which in turn uses the i2c bus.

Now if this happens while e.g. the core board_late_init() code is still
initializing the pcf50606 initial register set, or (even worse) we're in
the boot menu which constantly polls the pcf50606 for a keypress rather
than using interrupts, then we have a synchronization problem.

Now in order to cleanly solve this problems we would need some delayed
execution mechanism.  Something like a flag that gets marked.  If it is
detected later on from the idle/main loop executes the i2c command to do
500mA charging.

However, there is no u-boot api for doing so without hacking the main
loop itself :(

Another possible solution was for the bootmenu code to use interrupts,
and to delay the usb pullup until the pcf50606 initial register setting
is completed - thus elimintating both cases.

I would be happy if somebody had either better ideas how to address
this, or finds the time to implement either of those solutions.  I'd
rather look at the GSM stuff before returning to Germany in one day,
after which I will again have lots of other tasks, including hxd8
hardware on my agenda.

- Harald Welte <laforge at openmoko.org>          	        http://openmoko.org/
Software for the world's first truly open Free Software mobile phone

More information about the openmoko-uboot mailing list