summaryrefslogtreecommitdiff
path: root/board/freescale
diff options
context:
space:
mode:
authorRobin Gong <b38343@freescale.com>2014-06-19 17:57:17 +0800
committerRobin Gong <b38343@freescale.com>2014-06-20 14:04:04 +0800
commit0658ad78e5059e3cbe3c3b43d3b33b9400167a2e (patch)
tree92757417109fed14f466434058ced02acdb164ea /board/freescale
parent591100eec569dd1d54f61e9f49fe995f56a021eb (diff)
downloadu-boot-imx-0658ad78e5059e3cbe3c3b43d3b33b9400167a2e.zip
u-boot-imx-0658ad78e5059e3cbe3c3b43d3b33b9400167a2e.tar.gz
u-boot-imx-0658ad78e5059e3cbe3c3b43d3b33b9400167a2e.tar.bz2
ENGR00319241: imx6: pfuze: set pmic mode to decrease power number in DSM mode
Currently, kernel common regulator framework can't support setting pmic mode by common DTS, so move the related code to u-boot firstly. Signed-off-by: Robin Gong <b38343@freescale.com>
Diffstat (limited to 'board/freescale')
-rw-r--r--board/freescale/mx6qsabreauto/mx6qsabreauto.c36
-rw-r--r--board/freescale/mx6sabresd/mx6sabresd.c36
-rw-r--r--board/freescale/mx6slevk/mx6slevk.c35
-rw-r--r--board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c36
-rw-r--r--board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c35
-rw-r--r--board/freescale/mx6sxsabresd/mx6sxsabresd.c35
6 files changed, 213 insertions, 0 deletions
diff --git a/board/freescale/mx6qsabreauto/mx6qsabreauto.c b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
index 9779d38..ca2b290 100644
--- a/board/freescale/mx6qsabreauto/mx6qsabreauto.c
+++ b/board/freescale/mx6qsabreauto/mx6qsabreauto.c
@@ -186,6 +186,37 @@ iomux_v3_cfg_t const usdhc3_pads[] = {
};
#ifdef CONFIG_SYS_I2C_MXC
+/* set all switches APS in normal and PFM mode in standby */
+static int setup_pmic_mode(int chip)
+{
+ unsigned char offset, i, switch_num, value;
+
+ if (!chip) {
+ /* pfuze100 */
+ switch_num = 6;
+ offset = 0x31;
+ } else {
+ /* pfuze200 */
+ switch_num = 4;
+ offset = 0x38;
+ }
+
+ value = 0xc;
+ if (i2c_write(0x8, 0x23, 1, &value, 1)) {
+ printf("Set SW1AB mode error!\n");
+ return -1;
+ }
+
+ for (i = 0; i < switch_num - 1; i++) {
+ if (i2c_write(0x8, offset + i * 7, 1, &value, 1)) {
+ printf("Set switch%x mode error!\n", offset);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
static int setup_pmic_voltages(void)
{
unsigned char value, rev_id = 0 ;
@@ -200,6 +231,11 @@ static int setup_pmic_voltages(void)
return -1;
}
printf("Found PFUZE100! deviceid=%x,revid=%x\n", value, rev_id);
+
+ if (setup_pmic_mode(value & 0xf)) {
+ printf("setup pmic mode error!\n");
+ return -1;
+ }
/* set SW1AB staby volatage 0.975V*/
if (i2c_read(0x8, 0x21, 1, &value, 1)) {
printf("Read SW1ABSTBY error!\n");
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index 27a6993..4111e0d 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -253,6 +253,37 @@ static void setup_iomux_uart(void)
}
#ifdef CONFIG_SYS_I2C_MXC
+/* set all switches APS in normal and PFM mode in standby */
+static int setup_pmic_mode(int chip)
+{
+ unsigned char offset, i, switch_num, value;
+
+ if (!chip) {
+ /* pfuze100 */
+ switch_num = 6;
+ offset = 0x31;
+ } else {
+ /* pfuze200 */
+ switch_num = 4;
+ offset = 0x38;
+ }
+
+ value = 0xc;
+ if (i2c_write(0x8, 0x23, 1, &value, 1)) {
+ printf("Set SW1AB mode error!\n");
+ return -1;
+ }
+
+ for (i = 0; i < switch_num - 1; i++) {
+ if (i2c_write(0x8, offset + i * 7, 1, &value, 1)) {
+ printf("Set switch%x mode error!\n", offset);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
static int setup_pmic_voltages(void)
{
unsigned char value, rev_id = 0 ;
@@ -269,6 +300,11 @@ static int setup_pmic_voltages(void)
}
printf("Found PFUZE%s deviceid=%x,revid=%x\n",
((value & 0xf) == 0) ? "100" : "200", value, rev_id);
+
+ if (setup_pmic_mode(value & 0xf)) {
+ printf("setup pmic mode error!\n");
+ return -1;
+ }
/*For camera streaks issue,swap VGEN5 and VGEN3 to power camera.
*sperate VDDHIGH_IN and camera 2.8V power supply, after switch:
*VGEN5 for VDDHIGH_IN and increase to 3V to align with datasheet
diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c
index 7df58fc..752dad8 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -617,6 +617,37 @@ static int setup_fec(void)
#endif
#ifdef CONFIG_SYS_I2C_MXC
+/* set all switches APS in normal and PFM mode in standby */
+static int setup_pmic_mode(int chip)
+{
+ unsigned char offset, i, switch_num, value;
+
+ if (!chip) {
+ /* pfuze100 */
+ switch_num = 6;
+ offset = 0x31;
+ } else {
+ /* pfuze200 */
+ switch_num = 4;
+ offset = 0x38;
+ }
+
+ value = 0xc;
+ if (i2c_write(0x8, 0x23, 1, &value, 1)) {
+ printf("Set SW1AB mode error!\n");
+ return -1;
+ }
+
+ for (i = 0; i < switch_num - 1; i++) {
+ if (i2c_write(0x8, offset + i * 7, 1, &value, 1)) {
+ printf("Set switch%x mode error!\n", offset);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
static int setup_pmic_voltages(void)
{
unsigned char value, rev_id = 0;
@@ -634,6 +665,10 @@ static int setup_pmic_voltages(void)
printf("Found PFUZE%s deviceid=%x,revid=%x\n",
((value & 0xf) == 0) ? "100" : "200", value, rev_id);
+ if (setup_pmic_mode(value & 0xf)) {
+ printf("setup pmic mode error!\n");
+ return -1;
+ }
/* set SW1AB staby volatage 0.975V */
if (i2c_read(0x8, 0x21, 1, &value, 1)) {
printf("Read SW1ABSTBY error!\n");
diff --git a/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c b/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c
index 6a9788b..703db49 100644
--- a/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c
+++ b/board/freescale/mx6sx_17x17_arm2/mx6sx_17x17_arm2.c
@@ -499,6 +499,38 @@ int board_phy_config(struct phy_device *phydev)
#define PFUZE100_SW1CSTBY 0x2f
#define PFUZE100_SW1CCONF 0x32
#define PFUZE100_SW1ABC_SETP(x) ((x-3000)/250)
+
+/* set all switches APS in normal and PFM mode in standby */
+static int setup_pmic_mode(int chip)
+{
+ unsigned char offset, i, switch_num, value;
+
+ if (!chip) {
+ /* pfuze100 */
+ switch_num = 6;
+ offset = 0x31;
+ } else {
+ /* pfuze200 */
+ switch_num = 4;
+ offset = 0x38;
+ }
+
+ value = 0xc;
+ if (i2c_write(0x8, 0x23, 1, &value, 1)) {
+ printf("Set SW1AB mode error!\n");
+ return -1;
+ }
+
+ for (i = 0; i < switch_num - 1; i++) {
+ if (i2c_write(0x8, offset + i * 7, 1, &value, 1)) {
+ printf("Set switch%x mode error!\n", offset);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
static int setup_pmic_voltages(void)
{
unsigned char value, rev_id = 0;
@@ -516,6 +548,10 @@ static int setup_pmic_voltages(void)
}
printf("Found PFUZE100! deviceid 0x%x, revid 0x%x\n", value, rev_id);
+ if (setup_pmic_mode(value & 0xf)) {
+ printf("setup pmic mode error!\n");
+ return -1;
+ }
/* set SW1AB staby volatage 0.975V */
if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABSTBY, 1, &value, 1)) {
printf("Read SW1ABSTBY error!\n");
diff --git a/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c b/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c
index cd0a293..0b29b8c 100644
--- a/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c
+++ b/board/freescale/mx6sx_19x19_arm2/mx6sx_19x19_arm2.c
@@ -616,6 +616,37 @@ int board_phy_config(struct phy_device *phydev)
#define PFUZE100_SW1CCONF 0x32
#define PFUZE100_SW1ABC_SETP(x) ((x-3000)/250)
+/* set all switches APS in normal and PFM mode in standby */
+static int setup_pmic_mode(int chip)
+{
+ unsigned char offset, i, switch_num, value;
+
+ if (!chip) {
+ /* pfuze100 */
+ switch_num = 6;
+ offset = 0x31;
+ } else {
+ /* pfuze200 */
+ switch_num = 4;
+ offset = 0x38;
+ }
+
+ value = 0xc;
+ if (i2c_write(0x8, 0x23, 1, &value, 1)) {
+ printf("Set SW1AB mode error!\n");
+ return -1;
+ }
+
+ for (i = 0; i < switch_num - 1; i++) {
+ if (i2c_write(0x8, offset + i * 7, 1, &value, 1)) {
+ printf("Set switch%x mode error!\n", offset);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
static int setup_pmic_voltages(void)
{
unsigned char value, rev_id = 0;
@@ -634,6 +665,10 @@ static int setup_pmic_voltages(void)
printf("Found PFUZE%s deviceid=%x,revid=%x\n",
((value & 0xf) == 0) ? "100" : "200", value, rev_id);
+ if (setup_pmic_mode(value & 0xf)) {
+ printf("setup pmic mode error!\n");
+ return -1;
+ }
/* set SW1AB staby volatage 0.975V */
if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABSTBY, 1, &value, 1)) {
printf("Read SW1ABSTBY error!\n");
diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
index 9c785e0..c0f35f3 100644
--- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
+++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
@@ -625,6 +625,37 @@ int board_phy_config(struct phy_device *phydev)
#define PFUZE100_SW1ABC_SETP(x) ((x - 3000) / 250)
#define PFUZE100_VGEN5CTL 0x70
+/* set all switches APS in normal and PFM mode in standby */
+static int setup_pmic_mode(int chip)
+{
+ unsigned char offset, i, switch_num, value;
+
+ if (!chip) {
+ /* pfuze100 */
+ switch_num = 6;
+ offset = 0x31;
+ } else {
+ /* pfuze200 */
+ switch_num = 4;
+ offset = 0x38;
+ }
+
+ value = 0xc;
+ if (i2c_write(0x8, 0x23, 1, &value, 1)) {
+ printf("Set SW1AB mode error!\n");
+ return -1;
+ }
+
+ for (i = 0; i < switch_num - 1; i++) {
+ if (i2c_write(0x8, offset + i * 7, 1, &value, 1)) {
+ printf("Set switch%x mode error!\n", offset);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
static int setup_pmic_voltages(void)
{
unsigned char value, rev_id = 0;
@@ -643,6 +674,10 @@ static int setup_pmic_voltages(void)
}
printf("Found PFUZE100! deviceid 0x%x, revid 0x%x\n", value, rev_id);
+ if (setup_pmic_mode(value & 0xf)) {
+ printf("setup pmic mode error!\n");
+ return -1;
+ }
/* set SW1AB standby volatage 0.975V */
if (i2c_read(CONFIG_PMIC_I2C_SLAVE, PFUZE100_SW1ABSTBY, 1, &value, 1)) {
printf("Read SW1ABSTBY error!\n");