[U-Boot] [PATCH v3 4/4] imx: mx6: Set Pfuze mode to decrease power number for DSM

Ye.Li B37916 at freescale.com
Thu Sep 11 05:13:49 CEST 2014


Set all switches APS mode in normal and PFM mode in standby. So when
mx6 entering DSM mode, the power number can be decreased. There is
no impact for mx6 in run mode.

Changes for boards:
-mx6 sabreauto
-mx6 sabresd
-mx6slevk
-mx6sxsabresd

Signed-off-by: Ye.Li <B37916 at freescale.com>
---
Changes since v1:
- Try to correct the return code per Fabio's comments, but send out a false patch 

Changes since v2:
- Correct the return code

 board/freescale/mx6qsabreauto/mx6qsabreauto.c |   41 +++++++++++++++++++++++++
 board/freescale/mx6sabresd/mx6sabresd.c       |   41 +++++++++++++++++++++++++
 board/freescale/mx6slevk/mx6slevk.c           |   41 +++++++++++++++++++++++++
 board/freescale/mx6sxsabresd/mx6sxsabresd.c   |   40 ++++++++++++++++++++++++
 4 files changed, 163 insertions(+), 0 deletions(-)

diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
index 76b024b..df7f845 100644
--- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c
+++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
@@ -263,6 +263,41 @@ int board_init(void)
 	return 0;
 }
 
+/* set all switches APS in normal and PFM mode in standby */
+static int pfuze_setup_mode(struct pmic *p, int chip)
+{
+	unsigned char offset, i, switch_num, value;
+	int ret;
+
+	if (!chip) {
+		/* pfuze100 */
+		switch_num = 6;
+		offset = 0x31;
+	} else {
+		/* pfuze200 */
+		switch_num = 4;
+		offset = 0x38;
+	}
+
+	value = 0xc;
+	ret = pmic_reg_write(p, 0x23, value);
+	if (ret) {
+		printf("Set SW1AB mode error: %d!\n", ret);
+		return ret;
+	}
+
+	for (i = 0; i < switch_num - 1; i++) {
+		ret = pmic_reg_write(p, offset + i * 7, value);
+		if (ret) {
+			printf("Set switch%x mode error: %d!\n", offset, ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+
 static int pfuze_init(void)
 {
 	struct pmic *p;
@@ -281,6 +316,12 @@ static int pfuze_init(void)
 	pmic_reg_read(p, PFUZE100_DEVICEID, &reg);
 	printf("PMIC:  PFUZE100 ID=0x%02x\n", reg);
 
+	ret = pfuze_setup_mode(p, (reg & 0xf));
+	if (ret) {
+		printf("setup pfuze mode error: %d!\n", ret);
+		return ret;
+	}
+
 	/* Set SW1AB stanby volage to 0.975V */
 	pmic_reg_read(p, PFUZE100_SW1ABSTBY, &reg);
 	reg &= ~0x3f;
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index 72d6562..e0f0d2c 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -456,6 +456,41 @@ int board_init(void)
 	return 0;
 }
 
+/* set all switches APS in normal and PFM mode in standby */
+static int pfuze_setup_mode(struct pmic *p, int chip)
+{
+	unsigned char offset, i, switch_num, value;
+	int ret;
+
+	if (!chip) {
+		/* pfuze100 */
+		switch_num = 6;
+		offset = 0x31;
+	} else {
+		/* pfuze200 */
+		switch_num = 4;
+		offset = 0x38;
+	}
+
+	value = 0xc;
+	ret = pmic_reg_write(p, 0x23, value);
+	if (ret) {
+		printf("Set SW1AB mode error: %d!\n", ret);
+		return ret;
+	}
+
+	for (i = 0; i < switch_num - 1; i++) {
+		ret = pmic_reg_write(p, offset + i * 7, value);
+		if (ret) {
+			printf("Set switch%x mode error: %d!\n", offset, ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+
 static int pfuze_init(void)
 {
 	struct pmic *p;
@@ -475,6 +510,12 @@ static int pfuze_init(void)
 	printf("PMIC:  PFUZE%s ID=0x%02x\n",
 		((reg & 0xf) == 0) ? "100" : "200", reg);
 
+	ret = pfuze_setup_mode(p, (reg & 0xf));
+	if (ret) {
+		printf("setup pfuze mode error: %d!\n", ret);
+		return ret;
+	}
+
 	/* Increase VGEN3 from 2.5 to 2.8V */
 	pmic_reg_read(p, PFUZE100_VGEN3VOL, &reg);
 	reg &= ~0xf;
diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c
index 8b6a79c..8fa58c4 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -195,6 +195,41 @@ int board_init(void)
 	return 0;
 }
 
+/* set all switches APS in normal and PFM mode in standby */
+static int pfuze_setup_mode(struct pmic *p, int chip)
+{
+	unsigned char offset, i, switch_num, value;
+	int ret;
+
+	if (!chip) {
+		/* pfuze100 */
+		switch_num = 6;
+		offset = 0x31;
+	} else {
+		/* pfuze200 */
+		switch_num = 4;
+		offset = 0x38;
+	}
+
+	value = 0xc;
+	ret = pmic_reg_write(p, 0x23, value);
+	if (ret) {
+		printf("Set SW1AB mode error: %d!\n", ret);
+		return ret;
+	}
+
+	for (i = 0; i < switch_num - 1; i++) {
+		ret = pmic_reg_write(p, offset + i * 7, value);
+		if (ret) {
+			printf("Set switch%x mode error: %d!\n", offset, ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
+
 static int pfuze_init(void)
 {
 	struct pmic *p;
@@ -214,6 +249,12 @@ static int pfuze_init(void)
 	printf("PMIC:  PFUZE%s ID=0x%02x\n",
 		((reg & 0xf) == 0) ? "100" : "200", reg);
 
+	ret = pfuze_setup_mode(p, (reg & 0xf));
+	if (ret) {
+		printf("setup pfuze mode error: %d!\n", ret);
+		return ret;
+	}
+
 	/* Set SW1AB stanby volage to 0.975V */
 	pmic_reg_read(p, PFUZE100_SW1ABSTBY, &reg);
 	reg &= ~0x3f;
diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
index 80d2d99..a76a8ef 100644
--- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
+++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
@@ -170,6 +170,40 @@ struct i2c_pads_info i2c_pad_info1 = {
 	},
 };
 
+/* set all switches APS in normal and PFM mode in standby */
+static int pfuze_setup_mode(struct pmic *p, int chip)
+{
+	unsigned char offset, i, switch_num, value;
+	int ret;
+
+	if (!chip) {
+		/* pfuze100 */
+		switch_num = 6;
+		offset = 0x31;
+	} else {
+		/* pfuze200 */
+		switch_num = 4;
+		offset = 0x38;
+	}
+
+	value = 0xc;
+	ret = pmic_reg_write(p, 0x23, value);
+	if (ret) {
+		printf("Set SW1AB mode error: %d!\n", ret);
+		return ret;
+	}
+
+	for (i = 0; i < switch_num - 1; i++) {
+		ret = pmic_reg_write(p, offset + i * 7, value);
+		if (ret) {
+			printf("Set switch%x mode error: %d!\n", offset, ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
 static int pfuze_init(void)
 {
 	struct pmic *p;
@@ -188,6 +222,12 @@ static int pfuze_init(void)
 	pmic_reg_read(p, PFUZE100_DEVICEID, &reg);
 	printf("PMIC:  PFUZE100 ID=0x%02x\n", reg);
 
+	ret = pfuze_setup_mode(p, (reg & 0xf));
+	if (ret) {
+		printf("setup pfuze mode error: %d!\n", ret);
+		return ret;
+	}
+
 	/* Set SW1AB standby voltage to 0.975V */
 	pmic_reg_read(p, PFUZE100_SW1ABSTBY, &reg);
 	reg &= ~0x3f;
-- 
1.7.4.1



More information about the U-Boot mailing list