summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gong <b38343@freescale.com>2014-08-07 18:09:44 +0800
committerRobin Gong <b38343@freescale.com>2014-08-26 14:38:41 +0800
commit404fd02e96d33840f58f83f88815e2a259cdc532 (patch)
tree66e809b112bf266ed5d305e72049605e958a0ca4
parent53118db42d201d36ca9067b4bb0e2702399e100b (diff)
downloadu-boot-imx-404fd02e96d33840f58f83f88815e2a259cdc532.zip
u-boot-imx-404fd02e96d33840f58f83f88815e2a259cdc532.tar.gz
u-boot-imx-404fd02e96d33840f58f83f88815e2a259cdc532.tar.bz2
ENGR00326277-1: imx6: ldo_bypass: fix VDDARM voltage setting violate datasheet
Current only set VDDARM_IN@1.175V/VDDSOC_IN@1.175V before ldo bypass switch. So untile ldo bypass switch happened, these voltage setting is set in ldo-enable mode. But in datasheet, we need 1.15V + 125mV = 1.275V for VDDARM_IN. We need to downgrade cpufreq to 400Mhz and restore after ldo bypass mode switch. Signed-off-by: Robin Gong <b38343@freescale.com>
-rw-r--r--arch/arm/cpu/armv7/mx6/soc.c45
-rw-r--r--arch/arm/include/asm/arch-mx6/sys_proto.h4
-rw-r--r--board/freescale/mx6sabresd/mx6sabresd.c61
-rw-r--r--board/freescale/mx6slevk/mx6slevk.c46
4 files changed, 145 insertions, 11 deletions
diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 50c867c..a3f2a2a 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -835,7 +835,41 @@ int check_1_2G(void)
return result;
}
-void set_anatop_bypass(void)
+static int arm_orig_podf;
+void set_arm_freq_400M(bool is_400M)
+{
+ struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
+
+ if (is_400M)
+ writel(0x1, &mxc_ccm->cacrr);
+ else
+ writel(arm_orig_podf, &mxc_ccm->cacrr);
+}
+
+void prep_anatop_bypass(void)
+{
+ struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
+
+ arm_orig_podf = readl(&mxc_ccm->cacrr);
+ /*
+ * Downgrade ARM speed to 400Mhz as half of boot 800Mhz before ldo
+ * bypassed, also downgrade internal vddarm ldo to 0.975V.
+ * VDDARM_IN 0.975V + 125mV = 1.1V < Max(1.3V)
+ * otherwise at 800Mhz(i.mx6dl):
+ * VDDARM_IN 1.175V + 125mV = 1.3V = Max(1.3V)
+ * We need provide enough gap in this case.
+ * skip if boot from 400M.
+ */
+ if (!arm_orig_podf)
+ set_arm_freq_400M(true);
+#ifndef CONFIG_MX6DL
+ set_ldo_voltage(LDO_ARM, 975);
+#else
+ set_ldo_voltage(LDO_ARM, 1150);
+#endif
+}
+
+int set_anatop_bypass(void)
{
struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
u32 reg = readl(&anatop->reg_core);
@@ -843,7 +877,16 @@ void set_anatop_bypass(void)
/* bypass VDDARM/VDDSOC */
reg = reg | (0x1F << 18) | 0x1F;
writel(reg, &anatop->reg_core);
+
+ return arm_orig_podf;
}
+
+void finish_anatop_bypass(void)
+{
+ if (!arm_orig_podf)
+ set_arm_freq_400M(false);
+}
+
#endif
#ifdef CONFIG_IMX_HDMI
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/arch-mx6/sys_proto.h
index f358c36..c8e5136 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -26,8 +26,10 @@ unsigned imx_ddr_size(void);
#ifdef CONFIG_LDO_BYPASS_CHECK
int check_ldo_bypass(void);
int check_1_2G(void);
-void set_anatop_bypass(void);
+int set_anatop_bypass(void);
void ldo_mode_set(int ldo_bypass);
+void prep_anatop_bypass(void);
+void finish_anatop_bypass(void);
#endif
#ifdef CONFIG_MX6SX
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index bf0c3db..994a9dd 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -387,6 +387,9 @@ static int setup_pmic_voltages(void)
void ldo_mode_set(int ldo_bypass)
{
unsigned char value;
+ int is_400M;
+ unsigned char vddarm;
+
/* increase VDDARM/VDDSOC to support 1.2G chip */
if (check_1_2G()) {
ldo_bypass = 0; /* ldo_enable on 1.2G chip */
@@ -416,18 +419,68 @@ void ldo_mode_set(int ldo_bypass)
}
/* switch to ldo_bypass mode , boot on 800Mhz */
if (ldo_bypass) {
- /* decrease VDDARM to 1.175V */
+ prep_anatop_bypass();
+
+ /* decrease VDDARM for 400Mhz DQ:1.1V, DL:1.275V */
if (i2c_read(0x8, 0x20, 1, &value, 1)) {
printf("Read SW1AB error!\n");
return;
}
value &= ~0x3f;
- value |= 0x23;
+#if defined(CONFIG_MX6DL)
+ value |= 0x27;
+#else
+ value |= 0x20;
+#endif
+ if (i2c_write(0x8, 0x20, 1, &value, 1)) {
+ printf("Set SW1AB error!\n");
+ return;
+ }
+ /* increase VDDSOC to 1.3V */
+ if (i2c_read(0x8, 0x2e, 1, &value, 1)) {
+ printf("Read SW1C error!\n");
+ return;
+ }
+ value &= ~0x3f;
+ value |= 0x28;
+ if (i2c_write(0x8, 0x2e, 1, &value, 1)) {
+ printf("Set SW1C error!\n");
+ return;
+ }
+
+ /*
+ * MX6Q:
+ * VDDARM:1.15V@800M; VDDSOC:1.175V@800M
+ * VDDARM:0.975V@400M; VDDSOC:1.175V@400M
+ * MX6DL:
+ * VDDARM:1.175V@800M; VDDSOC:1.175V@800M
+ * VDDARM:1.075V@400M; VDDSOC:1.175V@400M
+ */
+ is_400M = set_anatop_bypass();
+ if (is_400M)
+#if defined(CONFIG_MX6DL)
+ vddarm = 0x1f;
+#else
+ vddarm = 0x1b;
+#endif
+ else
+#if defined(CONFIG_MX6DL)
+ vddarm = 0x23;
+#else
+ vddarm = 0x22;
+#endif
+ if (i2c_read(0x8, 0x20, 1, &value, 1)) {
+ printf("Read SW1AB error!\n");
+ return;
+ }
+ value &= ~0x3f;
+ value |= vddarm;
if (i2c_write(0x8, 0x20, 1, &value, 1)) {
printf("Set SW1AB error!\n");
return;
}
- /* increase VDDSOC to 1.175V */
+
+ /* decrease VDDSOC to 1.175V */
if (i2c_read(0x8, 0x2e, 1, &value, 1)) {
printf("Read SW1C error!\n");
return;
@@ -439,7 +492,7 @@ void ldo_mode_set(int ldo_bypass)
return;
}
- set_anatop_bypass();
+ finish_anatop_bypass();
printf("switch to ldo_bypass mode!\n");
}
}
diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c
index 0fb22dc..21dc196 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -758,32 +758,68 @@ static int setup_pmic_voltages(void)
void ldo_mode_set(int ldo_bypass)
{
unsigned char value;
+ int is_400M;
+
/* swith to ldo_bypass mode */
if (ldo_bypass) {
- /* decrease VDDARM to 1.15V */
+ prep_anatop_bypass();
+
+ /* decrease VDDARM to 1.1V */
if (i2c_read(0x8, 0x20, 1, &value, 1)) {
printf("Read SW1AB error!\n");
return;
}
value &= ~0x3f;
- value |= 0x22;
+ value |= 0x20;
if (i2c_write(0x8, 0x20, 1, &value, 1)) {
printf("Set SW1AB error!\n");
return;
}
- /* increase VDDSOC to 1.15V */
+ /* increase VDDSOC to 1.3V */
+ if (i2c_read(0x8, 0x2e, 1, &value, 1)) {
+ printf("Read SW1C error!\n");
+ return;
+ }
+ value &= ~0x3f;
+ value |= 0x28;
+ if (i2c_write(0x8, 0x2e, 1, &value, 1)) {
+ printf("Set SW1C error!\n");
+ return;
+ }
+
+ is_400M = set_anatop_bypass();
+
+ /*
+ * MX6SL: VDDARM:1.175V@800M; VDDSOC:1.175V@800M
+ * VDDARM:0.975V@400M; VDDSOC:1.175V@400M
+ */
+ if (i2c_read(0x8, 0x20, 1, &value, 1)) {
+ printf("Read SW1AB error!\n");
+ return;
+ }
+ value &= ~0x3f;
+ if (is_400M)
+ value |= 0x1b;
+ else
+ value |= 0x23;
+ if (i2c_write(0x8, 0x20, 1, &value, 1)) {
+ printf("Set SW1AB error!\n");
+ return;
+ }
+
+ /* decrease VDDSOC to 1.175V */
if (i2c_read(0x8, 0x2e, 1, &value, 1)) {
printf("Read SW1C error!\n");
return;
}
value &= ~0x3f;
- value |= 0x22;
+ value |= 0x23;
if (i2c_write(0x8, 0x2e, 1, &value, 1)) {
printf("Set SW1C error!\n");
return;
}
- set_anatop_bypass();
+ finish_anatop_bypass();
printf("switch to ldo_bypass mode!\n");
}