From 56841f9f5d3146e56f8b0ab38bfe37ae675b1d10 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Fri, 28 Nov 2008 10:16:42 +0000 Subject: [PATCH] qi-gta03-add-pmu-init.patch Signed-off-by: Andy Green --- qiboot/include/pcf50633.h | 5 +++ qiboot/src/cpu/s3c2442/gta02.c | 5 --- qiboot/src/cpu/s3c6410/gta03.c | 56 +++++++++++++++++++++++++--------- 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/qiboot/include/pcf50633.h b/qiboot/include/pcf50633.h index 73e233a..51da119 100644 --- a/qiboot/include/pcf50633.h +++ b/qiboot/include/pcf50633.h @@ -383,5 +383,10 @@ enum pcf50633_reg_mbcs3 { PCF50633_MBCS3_VRES = 0x80, /* 1: Vbat > Vth(RES) */ }; +struct pcf50633_init { + u8 index; + u8 value; +}; + #endif /* _PCF50633_H */ diff --git a/qiboot/src/cpu/s3c2442/gta02.c b/qiboot/src/cpu/s3c2442/gta02.c index 3e5b02e..06d270f 100644 --- a/qiboot/src/cpu/s3c2442/gta02.c +++ b/qiboot/src/cpu/s3c2442/gta02.c @@ -35,11 +35,6 @@ #define PCF50633_I2C_ADS 0x73 #define BOOST_TO_400MHZ 1 -struct pcf50633_init { - u8 index; - u8 value; -}; - const struct pcf50633_init pcf50633_init[] = { { PCF50633_REG_OOCWAKE, 0xd3 }, /* wake from ONKEY,EXTON!,RTC,USB,ADP */ diff --git a/qiboot/src/cpu/s3c6410/gta03.c b/qiboot/src/cpu/s3c6410/gta03.c index 0214e6e..d2141ca 100644 --- a/qiboot/src/cpu/s3c6410/gta03.c +++ b/qiboot/src/cpu/s3c6410/gta03.c @@ -2,14 +2,49 @@ #include #include #include -//#include -//#include +#include #include #define GTA03_DEBUG_UART 3 #define PCF50633_I2C_ADS 0x73 +const struct pcf50633_init gta03_pcf50633_init[] = { + + { PCF50633_REG_OOCWAKE, 0xd3 }, /* wake from ONKEY,EXTON!,RTC,USB,ADP */ + { PCF50633_REG_OOCTIM1, 0xaa }, /* debounce 14ms everything */ + { PCF50633_REG_OOCTIM2, 0x4a }, + { PCF50633_REG_OOCMODE, 0x55 }, + { PCF50633_REG_OOCCTL, 0x47 }, + + { PCF50633_REG_SVMCTL, 0x08 }, /* 3.10V SYS voltage thresh. */ + { PCF50633_REG_BVMCTL, 0x02 }, /* 2.80V BAT voltage thresh. */ + + { PCF50633_REG_AUTOENA, 0x01 }, /* always on */ + + { PCF50633_REG_DOWN1OUT, 0x17 }, /* 1.2V (0x17 * .025V + 0.625V) */ + { PCF50633_REG_DOWN1ENA, 0x02 }, /* enabled if GPIO1 = HIGH */ + { PCF50633_REG_LDO6ENA, 0x01 }, /* LCM power off */ + + { PCF50633_REG_INT1M, 0x00 }, + { PCF50633_REG_INT2M, 0x00 }, + { PCF50633_REG_INT3M, 0x00 }, + { PCF50633_REG_INT4M, 0x00 }, + { PCF50633_REG_INT5M, 0x00 }, + + { 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 */ + { PCF50633_REG_MBCC5, 0x19 }, /* 25/255 == 98mA soft-start usb fast */ + { PCF50633_REG_MBCC6, 0x00 }, /* cutoff current 1/32 * Ichg */ + { PCF50633_REG_MBCC7, 0x00 }, /* 1.6A max bat curr, USB 100mA */ + { PCF50633_REG_MBCC8, 0x00 }, + { PCF50633_REG_MBCC1, 0xff }, /* chgena */ + + { PCF50633_REG_BBCCTL, 0x19 }, /* 3V, 200uA, on */ + { PCF50633_REG_OOCSHDWN, 0x04 }, /* defeat 8s death from lowsys on A5 */ + +}; static const struct board_variant board_variants[] = { [0] = { @@ -20,6 +55,7 @@ static const struct board_variant board_variants[] = { void port_init_gta03(void) { + int n; /* ---------------------------- Port A ---------------------------- */ @@ -732,22 +768,14 @@ void port_init_gta03(void) (0 << 30) /* GPQ15 - no pull up or down */ ; -#if 0 /* * We have to talk to the PMU a little bit */ - /* We need SD Card rail (HCLDO) at 3.0V */ - i2c_write_sync(&bb_s3c24xx, PCF50633_I2C_ADS, PCF50633_REG_HCLDOOUT, - 21); - - /* switch HCLDO on */ - i2c_write_sync(&bb_s3c24xx, PCF50633_I2C_ADS, PCF50633_REG_HCLDOENA, 1); - - /* push DOWN1 (CPU Core rail) to 1.7V, allowing 533MHz */ - i2c_write_sync(&bb_s3c24xx, PCF50633_I2C_ADS, PCF50633_REG_DOWN1OUT, - 0x2b); -#endif + for (n = 0; n < ARRAY_SIZE(gta03_pcf50633_init); n++) + i2c_write_sync(&bb_s3c6410, PCF50633_I2C_ADS, + gta03_pcf50633_init[n].index, + gta03_pcf50633_init[n].value); }