arm: imx7s-warp: Convert to DM PMIC
authorBryan O'Donoghue <bryan.odonoghue@linaro.org>
Fri, 18 Jan 2019 17:40:14 +0000 (17:40 +0000)
committerStefano Babic <sbabic@denx.de>
Mon, 28 Jan 2019 19:55:46 +0000 (20:55 +0100)
This patch converts the warp7 and warp7_bl33 board ports over to using the
DM PMIC model.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
board/warp7/warp7.c
configs/warp7_bl33_defconfig
configs/warp7_defconfig
include/configs/warp7.h

index 19f0df4d097d5a5660cbb6dd0aaca244997bb126..6ebeb08e33144a4a606a0d2f9ee0ef2811bf1c9f 100644 (file)
@@ -64,29 +64,24 @@ int board_early_init_f(void)
        return 0;
 }
 
-#ifdef CONFIG_POWER
-#define I2C_PMIC       0
-static struct pmic *pfuze;
+#ifdef CONFIG_DM_PMIC
 int power_init_board(void)
 {
-       int ret;
-       unsigned int reg, rev_id;
+       struct udevice *dev;
+       int ret, dev_id, rev_id;
 
-       ret = power_pfuze3000_init(I2C_PMIC);
-       if (ret)
+       ret = pmic_get("pfuze3000", &dev);
+       if (ret == -ENODEV)
+               return 0;
+       if (ret != 0)
                return ret;
 
-       pfuze = pmic_get("PFUZE3000");
-       ret = pmic_probe(pfuze);
-       if (ret)
-               return ret;
-
-       pmic_reg_read(pfuze, PFUZE3000_DEVICEID, &reg);
-       pmic_reg_read(pfuze, PFUZE3000_REVID, &rev_id);
-       printf("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", reg, rev_id);
+       dev_id = pmic_reg_read(dev, PFUZE3000_DEVICEID);
+       rev_id = pmic_reg_read(dev, PFUZE3000_REVID);
+       printf("PMIC: PFUZE3000 DEV_ID=0x%x REV_ID=0x%x\n", dev_id, rev_id);
 
        /* disable Low Power Mode during standby mode */
-       pmic_reg_write(pfuze, PFUZE3000_LDOGCTL, 0x1);
+       pmic_clrsetbits(dev, PFUZE3000_LDOGCTL, 0, 1);
 
        return 0;
 }
index 4758d2bcfab6ee066d2e6414fbf2f4f1f1ae0bf1..05f40d05ecaa3e47e90bad4c2adcbd1782da8cc4 100644 (file)
@@ -46,3 +46,9 @@ CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX7=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_PFUZE100=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
index 25cf2786dfa2e8f65fe60c1e8670d07fc702f1d6..c01044b1a313d5087bc395056e480a4fd1fd7c77 100644 (file)
@@ -59,3 +59,9 @@ CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX7=y
 CONFIG_DM_GPIO=y
 CONFIG_DM_I2C=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_PFUZE100=y
+CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_DM_REGULATOR_GPIO=y
index 41eb8d7e1dd468c8c9b3190ed08d29331b30a719..043f2861b62d713f90147df08039bb37cde594eb 100644 (file)
 #define CONFIG_SYS_I2C_MXC
 #define CONFIG_SYS_I2C_SPEED           100000
 
-/* PMIC */
-#define CONFIG_POWER
-#define CONFIG_POWER_I2C
-#define CONFIG_POWER_PFUZE3000
-#define CONFIG_POWER_PFUZE3000_I2C_ADDR        0x08
-
 /* environment organization */
 #define CONFIG_ENV_SIZE                        SZ_8K