arm:trats:pmic: Default PMIC(MAX8997) initialization for Samsung's TRATS board

Default PMIC (MAX8997) initialization for Samsung's TRATS development board.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
This commit is contained in:
Łukasz Majewski 2012-11-13 03:22:05 +00:00 committed by Anatolij Gustschin
parent bf995a9a28
commit a52a7b1477
2 changed files with 160 additions and 0 deletions

View file

@ -86,11 +86,162 @@ void i2c_init_board(void)
s5p_gpio_direction_output(&gpio2->y4, 1, 1);
}
static int pmic_init_max8997(void)
{
struct pmic *p = pmic_get("MAX8997_PMIC");
int i = 0, ret = 0;
u32 val;
if (pmic_probe(p))
return -1;
/* BUCK1 VARM: 1.2V */
val = (1200000 - 650000) / 25000;
ret |= pmic_reg_write(p, MAX8997_REG_BUCK1DVS1, val);
val = ENBUCK | ACTIVE_DISCHARGE; /* DVS OFF */
ret |= pmic_reg_write(p, MAX8997_REG_BUCK1CTRL, val);
/* BUCK2 VINT: 1.1V */
val = (1100000 - 650000) / 25000;
ret |= pmic_reg_write(p, MAX8997_REG_BUCK2DVS1, val);
val = ENBUCK | ACTIVE_DISCHARGE; /* DVS OFF */
ret |= pmic_reg_write(p, MAX8997_REG_BUCK2CTRL, val);
/* BUCK3 G3D: 1.1V - OFF */
ret |= pmic_reg_read(p, MAX8997_REG_BUCK3CTRL, &val);
val &= ~ENBUCK;
ret |= pmic_reg_write(p, MAX8997_REG_BUCK3CTRL, val);
val = (1100000 - 750000) / 50000;
ret |= pmic_reg_write(p, MAX8997_REG_BUCK3DVS, val);
/* BUCK4 CAMISP: 1.2V - OFF */
ret |= pmic_reg_read(p, MAX8997_REG_BUCK4CTRL, &val);
val &= ~ENBUCK;
ret |= pmic_reg_write(p, MAX8997_REG_BUCK4CTRL, val);
val = (1200000 - 650000) / 25000;
ret |= pmic_reg_write(p, MAX8997_REG_BUCK4DVS, val);
/* BUCK5 VMEM: 1.2V */
val = (1200000 - 650000) / 25000;
for (i = 0; i < 8; i++)
ret |= pmic_reg_write(p, MAX8997_REG_BUCK5DVS1 + i, val);
val = ENBUCK | ACTIVE_DISCHARGE; /* DVS OFF */
ret |= pmic_reg_write(p, MAX8997_REG_BUCK5CTRL, val);
/* BUCK6 CAM AF: 2.8V */
/* No Voltage Setting Register */
/* GNSLCT 3.0X */
val = GNSLCT;
ret |= pmic_reg_write(p, MAX8997_REG_BUCK6CTRL, val);
/* BUCK7 VCC_SUB: 2.0V */
val = (2000000 - 750000) / 50000;
ret |= pmic_reg_write(p, MAX8997_REG_BUCK7DVS, val);
/* LDO1 VADC: 3.3V */
val = max8997_reg_ldo(3300000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO1CTRL, val);
/* LDO1 Disable active discharging */
ret |= pmic_reg_read(p, MAX8997_REG_LDO1CONFIG, &val);
val &= ~LDO_ADE;
ret |= pmic_reg_write(p, MAX8997_REG_LDO1CONFIG, val);
/* LDO2 VALIVE: 1.1V */
val = max8997_reg_ldo(1100000) | EN_LDO;
ret |= pmic_reg_write(p, MAX8997_REG_LDO2CTRL, val);
/* LDO3 VUSB/MIPI: 1.1V */
val = max8997_reg_ldo(1100000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO3CTRL, val);
/* LDO4 VMIPI: 1.8V */
val = max8997_reg_ldo(1800000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO4CTRL, val);
/* LDO5 VHSIC: 1.2V */
val = max8997_reg_ldo(1200000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO5CTRL, val);
/* LDO6 VCC_1.8V_PDA: 1.8V */
val = max8997_reg_ldo(1800000) | EN_LDO;
ret |= pmic_reg_write(p, MAX8997_REG_LDO6CTRL, val);
/* LDO7 CAM_ISP: 1.8V */
val = max8997_reg_ldo(1800000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO7CTRL, val);
/* LDO8 VDAC/VUSB: 3.3V */
val = max8997_reg_ldo(3300000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO8CTRL, val);
/* LDO9 VCC_2.8V_PDA: 2.8V */
val = max8997_reg_ldo(2800000) | EN_LDO;
ret |= pmic_reg_write(p, MAX8997_REG_LDO9CTRL, val);
/* LDO10 VPLL: 1.1V */
val = max8997_reg_ldo(1100000) | EN_LDO;
ret |= pmic_reg_write(p, MAX8997_REG_LDO10CTRL, val);
/* LDO11 TOUCH: 2.8V */
val = max8997_reg_ldo(2800000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO11CTRL, val);
/* LDO12 VTCAM: 1.8V */
val = max8997_reg_ldo(1800000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO12CTRL, val);
/* LDO13 VCC_3.0_LCD: 3.0V */
val = max8997_reg_ldo(3000000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO13CTRL, val);
/* LDO14 MOTOR: 3.0V */
val = max8997_reg_ldo(3000000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO14CTRL, val);
/* LDO15 LED_A: 2.8V */
val = max8997_reg_ldo(2800000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO15CTRL, val);
/* LDO16 CAM_SENSOR: 1.8V */
val = max8997_reg_ldo(1800000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO16CTRL, val);
/* LDO17 VTF: 2.8V */
val = max8997_reg_ldo(2800000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO17CTRL, val);
/* LDO18 TOUCH_LED 3.3V */
val = max8997_reg_ldo(3300000) | DIS_LDO; /* OFF */
ret |= pmic_reg_write(p, MAX8997_REG_LDO18CTRL, val);
/* LDO21 VDDQ: 1.2V */
val = max8997_reg_ldo(1200000) | EN_LDO;
ret |= pmic_reg_write(p, MAX8997_REG_LDO21CTRL, val);
/* SAFEOUT for both 1 and 2: 4.9V, Active discharge, Enable */
val = (SAFEOUT_4_90V << 0) | (SAFEOUT_4_90V << 2) |
ACTDISSAFEO1 | ACTDISSAFEO2 | ENSAFEOUT1 | ENSAFEOUT2;
ret |= pmic_reg_write(p, MAX8997_REG_SAFEOUTCTRL, val);
if (ret) {
puts("MAX8997 PMIC setting error!\n");
return -1;
}
return 0;
}
int power_init_board(void)
{
int ret;
ret = pmic_init(I2C_5);
ret |= pmic_init_max8997();
if (ret)
return ret;

View file

@ -176,6 +176,15 @@ enum {
#define ENSAFEOUT1 (1 << 6)
#define ENSAFEOUT2 (1 << 7)
#define ENBUCK (1 << 0)
#define ACTIVE_DISCHARGE (1 << 3)
#define GNSLCT (1 << 2)
#define LDO_ADE (1 << 1)
#define SAFEOUT_4_85V 0x00
#define SAFEOUT_4_90V 0x01
#define SAFEOUT_4_95V 0x02
#define SAFEOUT_3_30V 0x03
/* Charger */
enum {CHARGER_ENABLE, CHARGER_DISABLE};
#define DETBAT (1 << 2)