[U-Boot] [PATCH 10/12] imx:mx6sxsabresd add ldo mode set function

Peng Fan Peng.Fan at freescale.com
Fri Jan 9 09:59:45 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/mx6sxsabresd/mx6sxsabresd.c | 50 +++++++++++++++++++++++++++++
 include/configs/mx6sxsabresd.h              |  2 ++
 2 files changed, 52 insertions(+)

diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
index fbf3337..36432c4 100644
--- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
+++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
@@ -196,6 +196,7 @@ static struct i2c_pads_info i2c_pad_info1 = {
 	},
 };
 
+static struct pmic *pfuze;
 int power_init_board(void)
 {
 	struct pmic *p;
@@ -204,6 +205,7 @@ int power_init_board(void)
 	p = pfuze_common_init(I2C_PMIC);
 	if (!p)
 		return -ENODEV;
+	pfuze = p;
 
 	ret = pfuze_mode_init(p, APS_PFM);
 	if (ret < 0)
@@ -218,6 +220,54 @@ int power_init_board(void)
 	return 0;
 }
 
+#ifdef CONFIG_LDO_BYPASS_CHECK
+void ldo_mode_set(int ldo_bypass)
+{
+	unsigned int value;
+	int is_400M;
+	u32 vddarm;
+	struct pmic *p = pfuze;
+
+	if (!p)
+		return;
+
+	/* switch to ldo_bypass mode */
+	if (ldo_bypass) {
+		prep_anatop_bypass();
+		/* decrease VDDARM to 1.275V */
+		pmic_reg_read(p, PFUZE100_SW1ABVOL, &value);
+		value &= ~0x3f;
+		value |= PFUZE100_SW1ABC_SETP(12750);
+		pmic_reg_write(p, PFUZE100_SW1ABVOL, value);
+
+		/* decrease 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(1);
+		if (is_400M)
+			vddarm = PFUZE100_SW1ABC_SETP(10750);
+		else
+			vddarm = PFUZE100_SW1ABC_SETP(11750);
+
+		pmic_reg_read(p, PFUZE100_SW1ABVOL, &value);
+		value &= ~0x3f;
+		value |= vddarm;
+		pmic_reg_write(p, PFUZE100_SW1ABVOL, value);
+
+		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
+
 #ifdef CONFIG_USB_EHCI_MX6
 #define USB_OTHERREGS_OFFSET	0x800
 #define UCTRL_PWR_POL		(1 << 9)
diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
index 469d250..d69310e 100644
--- a/include/configs/mx6sxsabresd.h
+++ b/include/configs/mx6sxsabresd.h
@@ -181,6 +181,8 @@
 #define CONFIG_POWER_PFUZE100
 #define CONFIG_POWER_PFUZE100_I2C_ADDR	0x08
 
+#define CONFIG_LDO_BYPASS_CHECK
+
 /* Network */
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
-- 
1.8.4




More information about the U-Boot mailing list