[U-Boot] [PATCH V2 3/3] imx: mx6ul_evk: convert to use Driver model for power and i2c
Peng Fan
van.freenix at gmail.com
Wed Mar 9 10:12:22 CET 2016
Convert to use DM_PMIC/DM_REGULATOR/DM_I2C for mx6ul evk.
To mx6ul_14x14_evk, there is no pmic on board, so only enable DM_I2C.
Since we have PINCTRL driver and DM_I2C enabled, we could discard
the pinmux setting in board file, but we can not do this, because
still some dependency in arch/arm/imx-common/i2c-mxv7.c. Later
we may need to find out a way to refine this.
To avoid SPL build warning, disable mxc_i2c driver for SPL part.
Signed-off-by: Peng Fan <van.freenix at gmail.com>
Cc: Stefano Babic <sbabic at denx.de>
Cc: Fabio Estevam <fabio.estevam at nxp.com>
---
board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c | 38 +++++++++--------------
configs/mx6ul_14x14_evk_defconfig | 1 +
configs/mx6ul_9x9_evk_defconfig | 8 +++++
include/configs/mx6ul_14x14_evk.h | 11 ++-----
4 files changed, 25 insertions(+), 33 deletions(-)
diff --git a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
index 98d5675..62a3e68 100644
--- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
+++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
@@ -174,45 +174,35 @@ static struct i2c_pads_info i2c_pad_info1 = {
},
};
-#ifdef CONFIG_POWER
-#define I2C_PMIC 0
+#ifdef CONFIG_DM_PMIC
int power_init_board(void)
{
if (is_mx6ul_9x9_evk()) {
- struct pmic *pfuze;
- 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;
+ else if (ret != 0)
return ret;
- pfuze = pmic_get("PFUZE3000");
- ret = pmic_probe(pfuze);
- if (ret)
- return ret;
-
- pmic_reg_read(pfuze, PFUZE3000_DEVICEID, ®);
- pmic_reg_read(pfuze, PFUZE3000_REVID, &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",
- reg, rev_id);
+ dev_id, rev_id);
/* disable Low Power Mode during standby mode */
- pmic_reg_read(pfuze, PFUZE3000_LDOGCTL, ®);
- reg |= 0x1;
- pmic_reg_write(pfuze, PFUZE3000_LDOGCTL, reg);
+ pmic_clrsetbits(dev, PFUZE3000_LDOGCTL, 0, 1);
/* SW1B step ramp up time from 2us to 4us/25mV */
- reg = 0x40;
- pmic_reg_write(pfuze, PFUZE3000_SW1BCONF, reg);
+ pmic_reg_write(dev, PFUZE3000_SW1BCONF, 0x40);
/* SW1B mode to APS/PFM */
- reg = 0xc;
- pmic_reg_write(pfuze, PFUZE3000_SW1BMODE, reg);
+ pmic_reg_write(dev, PFUZE3000_SW1BMODE, 0xc);
/* SW1B standby voltage set to 0.975V */
- reg = 0xb;
- pmic_reg_write(pfuze, PFUZE3000_SW1BSTBY, reg);
+ pmic_reg_write(dev, PFUZE3000_SW1BSTBY, 0xb);
}
return 0;
diff --git a/configs/mx6ul_14x14_evk_defconfig b/configs/mx6ul_14x14_evk_defconfig
index a756de7..b67e0cb 100644
--- a/configs/mx6ul_14x14_evk_defconfig
+++ b/configs/mx6ul_14x14_evk_defconfig
@@ -4,6 +4,7 @@ CONFIG_CMD_DHCP=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_PING=y
CONFIG_DEFAULT_DEVICE_TREE="imx6ul-14x14-evk"
+CONFIG_DM_I2C=y
CONFIG_OF_CONTROL=y
CONFIG_PINCTRL=y
CONFIG_PINCTRL_FULL=y
diff --git a/configs/mx6ul_9x9_evk_defconfig b/configs/mx6ul_9x9_evk_defconfig
index fed0254..cebfbdd 100644
--- a/configs/mx6ul_9x9_evk_defconfig
+++ b/configs/mx6ul_9x9_evk_defconfig
@@ -3,7 +3,15 @@ CONFIG_ARM=y
CONFIG_CMD_DHCP=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_PING=y
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
CONFIG_DEFAULT_DEVICE_TREE="imx6ul-9x9-evk"
+CONFIG_DM_I2C=y
+CONFIG_DM_PMIC=y
+CONFIG_DM_PMIC_PFUZE100=y
+CONFIG_DM_REGULATOR=y
+CONFIG_DM_REGULATOR_PFUZE100=y
+CONFIG_ERRNO_STR=y
CONFIG_OF_CONTROL=y
CONFIG_PINCTRL=y
CONFIG_PINCTRL_FULL=y
diff --git a/include/configs/mx6ul_14x14_evk.h b/include/configs/mx6ul_14x14_evk.h
index c7e10f9..f6f8240 100644
--- a/include/configs/mx6ul_14x14_evk.h
+++ b/include/configs/mx6ul_14x14_evk.h
@@ -50,19 +50,12 @@
#endif
/* I2C configs */
+#ifndef CONFIG_SPL_BUILD
#define CONFIG_CMD_I2C
#ifdef CONFIG_CMD_I2C
-#define CONFIG_SYS_I2C
#define CONFIG_SYS_I2C_MXC
-#define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */
-#define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */
#define CONFIG_SYS_I2C_SPEED 100000
-
-/* PMIC only for 9X9 EVK */
-#define CONFIG_POWER
-#define CONFIG_POWER_I2C
-#define CONFIG_POWER_PFUZE3000
-#define CONFIG_POWER_PFUZE3000_I2C_ADDR 0x08
+#endif
#endif
#define CONFIG_SYS_MMC_IMG_LOAD_PART 1
--
2.6.2
More information about the U-Boot
mailing list