imx6: wandboard: convert to DM_PMIC
authorAnatolij Gustschin <agust@denx.de>
Mon, 18 Mar 2019 22:29:45 +0000 (23:29 +0100)
committerStefano Babic <sbabic@denx.de>
Sat, 13 Apr 2019 18:30:09 +0000 (20:30 +0200)
Enable DM_PMIC_PFUZE100 driver and add PMIC description to DTS.
Rework power_init_board() code.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
arch/arm/dts/imx6qdl-wandboard.dtsi
board/wandboard/wandboard.c
configs/wandboard_defconfig
include/configs/wandboard.h

index 381bf61fcd284ad3c7052e799f9051901af0c6d8..4d03d49fde9393d75df0fd2f542f9a0a5d347236 100644 (file)
                VDDIO-supply = <&reg_3p3v>;
                lrclk-strength = <3>;
        };
+
+       pmic: pfuze100@8 {
+               compatible = "fsl,pfuze100";
+               reg = <0x08>;
+
+               regulators {
+                       sw1a_reg: sw1ab {
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw1c_reg: sw1c {
+                               regulator-min-microvolt = <300000>;
+                               regulator-max-microvolt = <1875000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw2_reg: sw2 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                               regulator-ramp-delay = <6250>;
+                       };
+
+                       sw3a_reg: sw3a {
+                               regulator-min-microvolt = <400000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw3b_reg: sw3b {
+                               regulator-min-microvolt = <400000>;
+                               regulator-max-microvolt = <1975000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       sw4_reg: sw4 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       swbst_reg: swbst {
+                               regulator-min-microvolt = <5000000>;
+                               regulator-max-microvolt = <5150000>;
+                       };
+
+                       snvs_reg: vsnvs {
+                               regulator-min-microvolt = <1000000>;
+                               regulator-max-microvolt = <3000000>;
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vref_reg: vrefddr {
+                               regulator-boot-on;
+                               regulator-always-on;
+                       };
+
+                       vgen1_reg: vgen1 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                       };
+
+                       vgen2_reg: vgen2 {
+                               regulator-min-microvolt = <800000>;
+                               regulator-max-microvolt = <1550000>;
+                       };
+
+                       vgen3_reg: vgen3 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                       };
+
+                       vgen4_reg: vgen4 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen5_reg: vgen5 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+
+                       vgen6_reg: vgen6 {
+                               regulator-min-microvolt = <1800000>;
+                               regulator-max-microvolt = <3300000>;
+                               regulator-always-on;
+                       };
+               };
+       };
 };
 
 &iomuxc {
index e0d57691314d13384c9c8adac2e1ef8e15673349..23589df932e0feea1ac9ee0c0a9c82a30ddf879a 100644 (file)
@@ -453,24 +453,30 @@ int board_early_init_f(void)
 
 int power_init_board(void)
 {
-       struct pmic *p;
-       u32 reg;
-
-       /* configure PFUZE100 PMIC */
-       power_pfuze100_init(PMIC_I2C_BUS);
-       p = pmic_get("PFUZE100");
-       if (p && !pmic_probe(p)) {
-               pmic_reg_read(p, PFUZE100_DEVICEID, &reg);
-               printf("PMIC:  PFUZE100 ID=0x%02x\n", reg);
-               with_pmic = true;
-
-               /* Set VGEN2 to 1.5V and enable */
-               pmic_reg_read(p, PFUZE100_VGEN2VOL, &reg);
-               reg &= ~(LDO_VOL_MASK);
-               reg |= (LDOA_1_50V | (1 << (LDO_EN)));
-               pmic_reg_write(p, PFUZE100_VGEN2VOL, reg);
+       struct udevice *dev;
+       int reg, ret;
+
+       puts("PMIC:  ");
+
+       ret = pmic_get("pfuze100", &dev);
+       if (ret < 0) {
+               printf("pmic_get() ret %d\n", ret);
+               return 0;
        }
 
+       reg = pmic_reg_read(dev, PFUZE100_DEVICEID);
+       if (reg < 0) {
+               printf("pmic_reg_read() ret %d\n", reg);
+               return 0;
+       }
+       printf("PMIC:  PFUZE100 ID=0x%02x\n", reg);
+       with_pmic = true;
+
+       /* Set VGEN2 to 1.5V and enable */
+       reg = pmic_reg_read(dev, PFUZE100_VGEN2VOL);
+       reg &= ~(LDO_VOL_MASK);
+       reg |= (LDOA_1_50V | (1 << (LDO_EN)));
+       pmic_reg_write(dev, PFUZE100_VGEN2VOL, reg);
        return 0;
 }
 
index c4018cce4aa01d8567929065854c37e6d21d58c9..63f2639bd311e4dd205e52da8856325bef94dfe2 100644 (file)
@@ -44,6 +44,8 @@ CONFIG_PHYLIB=y
 CONFIG_MII=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_IMX6=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
 CONFIG_DM_THERMAL=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
index 13a9fd245013e35eca95288c1424ea24650414af..aeb66ad454b111c0921965b7193643673d9139cd 100644 (file)
 #define CONFIG_SYS_I2C_MXC_I2C3                /* enable I2C bus 3 */
 #define CONFIG_SYS_I2C_SPEED           100000
 
-/* PMIC */
-#define CONFIG_POWER
-#define CONFIG_POWER_I2C
-#define CONFIG_POWER_PFUZE100
-#define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08
-
 /* MMC Configuration */
 #define CONFIG_SYS_FSL_USDHC_NUM       2
 #define CONFIG_SYS_FSL_ESDHC_ADDR      0