[U-Boot] [PATCH 08/12] imx:mx6slevk add ldo mode set function
Peng Fan
Peng.Fan at freescale.com
Fri Jan 9 09:59:43 CET 2015
Add ldo_mode_set function. If ldo_bypass is true, it will adjust voltage.
If not, do nothing.
This function is board specific, so implement it in board file.
Signed-off-by: Peng Fan <Peng.Fan at freescale.com>
Signed-off-by: Robin Gong <b38343 at freescale.com>
---
board/freescale/mx6slevk/mx6slevk.c | 61 ++++++++++++++++++++++++++++++++++---
include/configs/mx6slevk.h | 2 ++
2 files changed, 59 insertions(+), 4 deletions(-)
diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c
index f74b237..fdb6672 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -247,16 +247,69 @@ struct i2c_pads_info i2c_pad_info1 = {
},
};
+static struct pmic *pfuze;
+
+#ifdef CONFIG_LDO_BYPASS_CHECK
+void ldo_mode_set(int ldo_bypass)
+{
+ u32 value;
+ int is_400M;
+ struct pmic *p = pfuze;
+
+ if (!p)
+ return;
+
+ /* swith to ldo_bypass mode */
+ if (ldo_bypass) {
+ prep_anatop_bypass();
+
+ /* decrease VDDARM to 1.1V */
+ pmic_reg_read(p, PFUZE100_SW1ABVOL, &value);
+ value &= ~0x3f;
+ value |= PFUZE100_SW1ABC_SETP(11000);
+ pmic_reg_write(p, PFUZE100_SW1ABVOL, value);
+
+ /* increase VDDSOC to 1.3V */
+ pmic_reg_read(p, PFUZE100_SW1CVOL, &value);
+ value &= ~0x3f;
+ value |= PFUZE100_SW1ABC_SETP(13000);
+ pmic_reg_write(p, PFUZE100_SW1CVOL, value);
+
+ is_400M = set_anatop_bypass(0);
+
+ /*
+ * MX6SL: VDDARM:1.175V at 800M; VDDSOC:1.175V at 800M
+ * VDDARM:0.975V at 400M; VDDSOC:1.175V at 400M
+ */
+ pmic_reg_read(p, PFUZE100_SW1ABVOL, &value);
+ value &= ~0x3f;
+ if (is_400M)
+ value |= PFUZE100_SW1ABC_SETP(9750);
+ else
+ value |= PFUZE100_SW1ABC_SETP(11750);
+ pmic_reg_write(p, PFUZE100_SW1ABVOL, value);
+
+ /* decrease VDDSOC to 1.175V */
+ pmic_reg_read(p, PFUZE100_SW1CVOL, &value);
+ value &= ~0x3f;
+ value |= PFUZE100_SW1ABC_SETP(11750);
+ pmic_reg_write(p, PFUZE100_SW1CVOL, value);
+
+ finish_anatop_bypass();
+ printf("switch to ldo_bypass mode!\n");
+ }
+}
+#endif
+
int power_init_board(void)
{
- struct pmic *p;
unsigned int ret;
- p = pfuze_common_init(I2C_PMIC);
- if (!p)
+ pfuze = pfuze_common_init(I2C_PMIC);
+ if (!pfuze)
return -ENODEV;
- ret = pfuze_mode_init(p, APS_PFM);
+ ret = pfuze_mode_init(pfuze, APS_PFM);
if (ret < 0)
return -EIO;
diff --git a/include/configs/mx6slevk.h b/include/configs/mx6slevk.h
index 9fd7619..56c2faf 100644
--- a/include/configs/mx6slevk.h
+++ b/include/configs/mx6slevk.h
@@ -60,6 +60,8 @@
#define CONFIG_POWER_PFUZE100
#define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
+#define CONFIG_LDO_BYPASS_CHECK
+
#define CONFIG_CMD_PING
#define CONFIG_CMD_DHCP
#define CONFIG_CMD_MII
--
1.8.4
More information about the U-Boot
mailing list