From e28661b64230b913978ea1090d7d744cc34ea1a7 Mon Sep 17 00:00:00 2001 From: Robin Gong Date: Wed, 17 Sep 2014 14:46:13 +0800 Subject: MLK-9640 ARM: imx6sx: enable ldo-bypass on mx6sxsabresd board enable ldo-bypass check on all mx6sxsabresd boards. Signed-off-by: Robin Gong --- arch/arm/cpu/armv7/mx6/soc.c | 2 +- .../freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c | 41 +++++++++++++++++++--- .../freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c | 41 +++++++++++++++++++--- board/freescale/mx6sxsabresd/mx6sxsabresd.c | 41 +++++++++++++++++++--- 4 files changed, 109 insertions(+), 16 deletions(-) diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c index aab2582..d7c109e 100644 --- a/arch/arm/cpu/armv7/mx6/soc.c +++ b/arch/arm/cpu/armv7/mx6/soc.c @@ -912,7 +912,7 @@ void prep_anatop_bypass(void) */ if (!arm_orig_podf) set_arm_freq_400M(true); -#ifndef CONFIG_MX6DL +#if !defined(CONFIG_MX6DL) && !defined(CONFIG_MX6SX) set_ldo_voltage(LDO_ARM, 975); #else set_ldo_voltage(LDO_ARM, 1150); diff --git a/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c b/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c index d1fdafc..cbb632a 100644 --- a/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c +++ b/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c @@ -715,32 +715,63 @@ static int setup_pmic_voltages(void) void ldo_mode_set(int ldo_bypass) { unsigned char value; + int is_400M; + u32 vddarm; /* swith to ldo_bypass mode */ if (ldo_bypass) { - /* decrease VDDARM to 1.15V */ + prep_anatop_bypass(); + /* decrease VDDARM to 1.275V */ if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { printf("Read SW1AB error!\n"); return; } value &= ~0x3f; - value |= PFUZE100_SW1ABC_SETP(11500); + value |= PFUZE100_SW1ABC_SETP(12750); if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { printf("Set SW1AB error!\n"); return; } - /* increase VDDSOC to 1.15V */ + /* decrease VDDSOC to 1.3V */ if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { printf("Read SW1C error!\n"); return; } value &= ~0x3f; - value |= PFUZE100_SW1ABC_SETP(11500); + value |= PFUZE100_SW1ABC_SETP(13000); if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { printf("Set SW1C error!\n"); return; } - set_anatop_bypass(1); + is_400M = set_anatop_bypass(1); + if (is_400M) + vddarm = PFUZE100_SW1ABC_SETP(10750); + else + vddarm = PFUZE100_SW1ABC_SETP(11750); + + if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { + printf("Read SW1AB error!\n"); + return; + } + value &= ~0x3f; + value |= vddarm; + if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { + printf("Set SW1AB error!\n"); + return; + } + + if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { + printf("Read SW1C error!\n"); + return; + } + value &= ~0x3f; + value |= PFUZE100_SW1ABC_SETP(11750); + if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { + printf("Set SW1C error!\n"); + return; + } + + finish_anatop_bypass(); printf("switch to ldo_bypass mode!\n"); } diff --git a/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c b/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c index 2d5c8fc..1ad19a2 100644 --- a/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c +++ b/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c @@ -759,32 +759,63 @@ static int setup_pmic_voltages(void) void ldo_mode_set(int ldo_bypass) { unsigned char value; + int is_400M; + u32 vddarm; /* swith to ldo_bypass mode */ if (ldo_bypass) { - /* decrease VDDARM to 1.15V */ + prep_anatop_bypass(); + /* decrease VDDARM to 1.275V */ if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { printf("Read SW1AB error!\n"); return; } value &= ~0x3f; - value |= PFUZE100_SW1ABC_SETP(11500); + value |= PFUZE100_SW1ABC_SETP(12750); if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { printf("Set SW1AB error!\n"); return; } - /* increase VDDSOC to 1.15V */ + /* decrease VDDSOC to 1.3V */ if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { printf("Read SW1C error!\n"); return; } value &= ~0x3f; - value |= PFUZE100_SW1ABC_SETP(11500); + value |= PFUZE100_SW1ABC_SETP(13000); if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { printf("Set SW1C error!\n"); return; } - set_anatop_bypass(1); + is_400M = set_anatop_bypass(1); + if (is_400M) + vddarm = PFUZE100_SW1ABC_SETP(10750); + else + vddarm = PFUZE100_SW1ABC_SETP(11750); + + if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { + printf("Read SW1AB error!\n"); + return; + } + value &= ~0x3f; + value |= vddarm; + if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { + printf("Set SW1AB error!\n"); + return; + } + + if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { + printf("Read SW1C error!\n"); + return; + } + value &= ~0x3f; + value |= PFUZE100_SW1ABC_SETP(11750); + if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { + printf("Set SW1C error!\n"); + return; + } + + finish_anatop_bypass(); printf("switch to ldo_bypass mode!\n"); } diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c index a6552de..5d9a225 100644 --- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c +++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c @@ -776,32 +776,63 @@ static int setup_pmic_voltages(void) void ldo_mode_set(int ldo_bypass) { unsigned char value; + int is_400M; + u32 vddarm; /* switch to ldo_bypass mode */ if (ldo_bypass) { - /* decrease VDDARM to 1.15V */ + prep_anatop_bypass(); + /* decrease VDDARM to 1.275V */ if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { printf("Read SW1AB error!\n"); return; } value &= ~0x3f; - value |= PFUZE100_SW1ABC_SETP(11500); + value |= PFUZE100_SW1ABC_SETP(12750); if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { printf("Set SW1AB error!\n"); return; } - /* increase VDDSOC to 1.15V */ + /* decrease VDDSOC to 1.3V */ if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { printf("Read SW1C error!\n"); return; } value &= ~0x3f; - value |= PFUZE100_SW1ABC_SETP(11500); + value |= PFUZE100_SW1ABC_SETP(13000); if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { printf("Set SW1C error!\n"); return; } - set_anatop_bypass(1); + is_400M = set_anatop_bypass(1); + if (is_400M) + vddarm = PFUZE100_SW1ABC_SETP(10750); + else + vddarm = PFUZE100_SW1ABC_SETP(11750); + + if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { + printf("Read SW1AB error!\n"); + return; + } + value &= ~0x3f; + value |= vddarm; + if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABVOL, 1, &value, 1)) { + printf("Set SW1AB error!\n"); + return; + } + + if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { + printf("Read SW1C error!\n"); + return; + } + value &= ~0x3f; + value |= PFUZE100_SW1ABC_SETP(11750); + if (i2c_write(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1CVOL, 1, &value, 1)) { + printf("Set SW1C error!\n"); + return; + } + + finish_anatop_bypass(); printf("switch to ldo_bypass mode!\n"); } -- cgit v1.1