diff options
author | Ken Lin | 2016-11-18 12:20:54 -0500 |
---|---|---|
committer | Stefano Babic | 2016-11-29 16:42:53 +0100 |
commit | 22d358da0b06a60d7163e56234dd7f166fdd7b73 (patch) | |
tree | d260a827b60068eb032925e04f15be0d3a09d10d | |
parent | a425bf72816abbc3996540e42c33a386e8b8a221 (diff) |
board: ge: bx50v3: add the PMIC configuration support
Change the PMIC bulk configuration from auto mode to sync mode to avoid
voltage dropout issue seen in auto mode.
Signed-off-by: Ken Lin <ken.lin@advantech.com.tw>
Signed-off-by: Akshay Bhat <akshay.bhat@timesys.com>
-rw-r--r-- | board/ge/bx50v3/bx50v3.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c index 7e62aef07e1..2fc1144cdae 100644 --- a/board/ge/bx50v3/bx50v3.c +++ b/board/ge/bx50v3/bx50v3.c @@ -596,6 +596,57 @@ static const struct boot_mode board_boot_modes[] = { }; #endif +void pmic_init(void) +{ +#define I2C_PMIC 0x2 +#define DA9063_I2C_ADDR 0x58 +#define DA9063_REG_BCORE2_CFG 0x9D +#define DA9063_REG_BCORE1_CFG 0x9E +#define DA9063_REG_BPRO_CFG 0x9F +#define DA9063_REG_BIO_CFG 0xA0 +#define DA9063_REG_BMEM_CFG 0xA1 +#define DA9063_REG_BPERI_CFG 0xA2 +#define DA9063_BUCK_MODE_MASK 0xC0 +#define DA9063_BUCK_MODE_MANUAL 0x00 +#define DA9063_BUCK_MODE_SLEEP 0x40 +#define DA9063_BUCK_MODE_SYNC 0x80 +#define DA9063_BUCK_MODE_AUTO 0xC0 + + uchar val; + + i2c_set_bus_num(I2C_PMIC); + + i2c_read(DA9063_I2C_ADDR, DA9063_REG_BCORE2_CFG, 1, &val, 1); + val &= ~DA9063_BUCK_MODE_MASK; + val |= DA9063_BUCK_MODE_SYNC; + i2c_write(DA9063_I2C_ADDR, DA9063_REG_BCORE2_CFG, 1, &val, 1); + + i2c_read(DA9063_I2C_ADDR, DA9063_REG_BCORE1_CFG, 1, &val, 1); + val &= ~DA9063_BUCK_MODE_MASK; + val |= DA9063_BUCK_MODE_SYNC; + i2c_write(DA9063_I2C_ADDR, DA9063_REG_BCORE1_CFG, 1, &val, 1); + + i2c_read(DA9063_I2C_ADDR, DA9063_REG_BPRO_CFG, 1, &val, 1); + val &= ~DA9063_BUCK_MODE_MASK; + val |= DA9063_BUCK_MODE_SYNC; + i2c_write(DA9063_I2C_ADDR, DA9063_REG_BPRO_CFG, 1, &val, 1); + + i2c_read(DA9063_I2C_ADDR, DA9063_REG_BIO_CFG, 1, &val, 1); + val &= ~DA9063_BUCK_MODE_MASK; + val |= DA9063_BUCK_MODE_SYNC; + i2c_write(DA9063_I2C_ADDR, DA9063_REG_BIO_CFG, 1, &val, 1); + + i2c_read(DA9063_I2C_ADDR, DA9063_REG_BMEM_CFG, 1, &val, 1); + val &= ~DA9063_BUCK_MODE_MASK; + val |= DA9063_BUCK_MODE_SYNC; + i2c_write(DA9063_I2C_ADDR, DA9063_REG_BMEM_CFG, 1, &val, 1); + + i2c_read(DA9063_I2C_ADDR, DA9063_REG_BPERI_CFG, 1, &val, 1); + val &= ~DA9063_BUCK_MODE_MASK; + val |= DA9063_BUCK_MODE_SYNC; + i2c_write(DA9063_I2C_ADDR, DA9063_REG_BPERI_CFG, 1, &val, 1); +} + int board_late_init(void) { #ifdef CONFIG_CMD_BMODE @@ -619,6 +670,9 @@ int board_late_init(void) pwm_enable(0); #endif + /* board specific pmic init */ + pmic_init(); + return 0; } |