misc:pmic:trats: Correct procedure of enabling/disabling USB regulators
authorŁukasz Majewski <l.majewski@samsung.com>
Wed, 25 Apr 2012 23:30:18 +0000 (23:30 +0000)
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>
Sat, 7 Jul 2012 12:07:25 +0000 (14:07 +0200)
In the MAX8997, LDO regulators needs to preserve previously set voltage
values.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
board/samsung/trats/trats.c

index 08ca63d75ff8d1ec2af5cce0f51849c25a55280a..a8b2b11c4cb445613482d3049eb826c64716b015 100644 (file)
@@ -220,6 +220,7 @@ int board_mmc_init(bd_t *bis)
 static int s5pc210_phy_control(int on)
 {
        int ret = 0;
+       u32 val = 0;
        struct pmic *p = get_pmic();
 
        if (pmic_probe(p))
@@ -228,11 +229,17 @@ static int s5pc210_phy_control(int on)
        if (on) {
                ret |= pmic_set_output(p, MAX8997_REG_SAFEOUTCTRL,
                                      ENSAFEOUT1, LDO_ON);
-               ret |= pmic_reg_write(p, MAX8997_REG_LDO3CTRL, EN_LDO);
-               ret |= pmic_reg_write(p, MAX8997_REG_LDO8CTRL, EN_LDO);
+               ret |= pmic_reg_read(p, MAX8997_REG_LDO3CTRL, &val);
+               ret |= pmic_reg_write(p, MAX8997_REG_LDO3CTRL, EN_LDO | val);
+
+               ret |= pmic_reg_read(p, MAX8997_REG_LDO8CTRL, &val);
+               ret |= pmic_reg_write(p, MAX8997_REG_LDO8CTRL, EN_LDO | val);
        } else {
-               ret |= pmic_reg_write(p, MAX8997_REG_LDO8CTRL, DIS_LDO);
-               ret |= pmic_reg_write(p, MAX8997_REG_LDO3CTRL, DIS_LDO);
+               ret |= pmic_reg_read(p, MAX8997_REG_LDO8CTRL, &val);
+               ret |= pmic_reg_write(p, MAX8997_REG_LDO8CTRL, DIS_LDO | val);
+
+               ret |= pmic_reg_read(p, MAX8997_REG_LDO3CTRL, &val);
+               ret |= pmic_reg_write(p, MAX8997_REG_LDO3CTRL, DIS_LDO | val);
                ret |= pmic_set_output(p, MAX8997_REG_SAFEOUTCTRL,
                                      ENSAFEOUT1, LDO_OFF);
        }