I added Matt's ADC generalization and his power good check, and also added polling for the wall charger. The complete patch is here:
http://svn.openmoko.org/trunk/src/target/u-boot/patches/wait-for-power-DONTUSE.patch Andy, if you're still up, can you please comment if you agree with the changes to pcf50633_read_charger_type ? I've moved the ID resistor detection after the USB/adapter detection, such that we don't boot if the charger is connected but has no power, or, perhaps worse, something else and strange is there. wait-for-power-DONTUSE.patch: - drivers/misc/pcf50633.c (pcf50633_adc_read, pcf50633_read_charger_type): applied the rest of Matt's 3.6V threshold changes - board/neo1973/gta02/gta02.c (wait_for_power): added threshold checking, as suggested by Matt - board/neo1973/gta02/gta02.c (wait_for_power, poll_charger): look for the charger and enable 1A charging if found - drivers/misc/pcf50633.c (pcf50633_read_charger_type): test for charger/USB power before looking for the ID resistor - include/pcf50633.h: for a change, declare prototypes The patch goes to the end of series. I think the wait_for_power loop is pretty self-explanatory. We basically wait until we've found at least one good power source, and blink the red LED while waiting. Note that this doesn't change that u-boot is blissfully ignorant of what happens if USB is disconnected while waiting. - Werner