[PATCH] U-Boot GTA02: Always enable charger on startup

Rask Ingemann Lambertsen ccc94453 at vip.cybercity.dk
Tue Aug 25 11:52:56 CEST 2009


   This patch changes U-Boot to always enable the charger on startup. We
currently seem to have two ways of disabling the charger, _even when it
was already enabled_:
1) Press power button briefly (<1 s) while off and connected to power.
2) Try to turn on the device (by power button or plugging in power) when the
   power source detected as 100 mA only with no (or discharged) battery
   inserted.

   There is no point in disabling the charger in these cases or in general.

Signed-off-by: Rask Ingemann Lambertsen <ccc94453 at vip.cybercity.dk>
---

Tested on GTA02 to confirm that we have bug 1) and that the patch fixes it.

diff --git a/board/neo1973/gta02/gta02.c b/board/neo1973/gta02/gta02.c
index a59a513..df41f5a 100644
--- a/board/neo1973/gta02/gta02.c
+++ b/board/neo1973/gta02/gta02.c
@@ -467,6 +467,8 @@ static int wait_for_power(void)
                 pcf50633_reg_write(PCF50633_REG_OOCSHDWN, 4);
 	}
 
+	pcf50633_reg_set_bit_mask(PCF50633_REG_MBCC1, 1, 1); /* charge ! */
+
 	/* switch off the AUX LED */
 	neo1973_led(GTA02_LED_AUX_RED, 0);
 
@@ -490,8 +492,6 @@ static void pcf50633_late_init(void)
 	pcf50633_reg_write(PCF50633_REG_LDO6ENA, recent);
 
 	pcf50633_reg_write(PCF50633_REG_MBCC5, 0xff); /* 1A USB fast charge */
-
-	pcf50633_reg_set_bit_mask(PCF50633_REG_MBCC1, 1, 1); /* charge ! */
 }
 
 int board_late_init(void)
diff --git a/board/neo1973/gta02/pcf50633.c b/board/neo1973/gta02/pcf50633.c
index 69d7fb0..f89ef06 100644
--- a/board/neo1973/gta02/pcf50633.c
+++ b/board/neo1973/gta02/pcf50633.c
@@ -89,7 +89,7 @@ const u_int8_t pcf50633_initial_regs[__NUM_PCF50633_REGS] = {
 
 	[PCF50633_REG_DCDCPFM]	= 0x00, /* off by default*/
 
-	[PCF50633_REG_MBCC1]	= 0xe6,
+	[PCF50633_REG_MBCC1]	= 0xe7, /* enable charger, 2 h limit */
 	[PCF50633_REG_MBCC2]	= 0x28,	/* Vbatconid=2.7V, Vmax=4.20V */
 	[PCF50633_REG_MBCC3]	= 0x19,	/* 25/255 == 98mA pre-charge */
 	[PCF50633_REG_MBCC4]	= 0xff, /* 255/255 == 1A adapter fast */


-- 
Rask Ingemann Lambertsen
Danish law requires addresses in e-mail to be logged and stored for a year



More information about the openmoko-kernel mailing list