aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatolij Gustschin <agust@denx.de>2019-03-18 23:29:45 +0100
committerStefano Babic <sbabic@denx.de>2019-04-13 20:30:09 +0200
commitec837c82d7093140d834ff17995ec0a5417e88aa (patch)
tree5635b9033206d4a8316bf47233fcf458ff81ed4e
parentf99cd5a787208227e665a76002322a17fad2f1b2 (diff)
downloadu-boot-ec837c82d7093140d834ff17995ec0a5417e88aa.zip
u-boot-ec837c82d7093140d834ff17995ec0a5417e88aa.tar.gz
u-boot-ec837c82d7093140d834ff17995ec0a5417e88aa.tar.bz2
imx6: wandboard: convert to DM_PMIC
Enable DM_PMIC_PFUZE100 driver and add PMIC description to DTS. Rework power_init_board() code. Signed-off-by: Anatolij Gustschin <agust@denx.de>
-rw-r--r--arch/arm/dts/imx6qdl-wandboard.dtsi101
-rw-r--r--board/wandboard/wandboard.c38
-rw-r--r--configs/wandboard_defconfig2
-rw-r--r--include/configs/wandboard.h6
4 files changed, 125 insertions, 22 deletions
diff --git a/arch/arm/dts/imx6qdl-wandboard.dtsi b/arch/arm/dts/imx6qdl-wandboard.dtsi
index 381bf61..4d03d49 100644
--- a/arch/arm/dts/imx6qdl-wandboard.dtsi
+++ b/arch/arm/dts/imx6qdl-wandboard.dtsi
@@ -90,6 +90,107 @@
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 {
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index e0d5769..23589df 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -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;
}
diff --git a/configs/wandboard_defconfig b/configs/wandboard_defconfig
index c4018cc..63f2639 100644
--- a/configs/wandboard_defconfig
+++ b/configs/wandboard_defconfig
@@ -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
diff --git a/include/configs/wandboard.h b/include/configs/wandboard.h
index 13a9fd2..aeb66ad 100644
--- a/include/configs/wandboard.h
+++ b/include/configs/wandboard.h
@@ -40,12 +40,6 @@
#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