[U-Boot] [RFC 7/9] pico-imx7d: Convert to DM PMIC
Fabio Estevam
festevam at gmail.com
Thu Feb 14 12:20:49 UTC 2019
On Sun, Jan 20, 2019 at 8:14 PM Joris Offouga <offougajoris at gmail.com> wrote:
>
> This patch converts the pico-pi-imx7d to use the DM PMIC model.
>
> Signed-off-by: Joris Offouga <offougajoris at gmail.com>
> ---
> board/technexion/pico-imx7d/pico-imx7d.c | 44 ++++++++++++--------------------
> configs/pico-pi-imx7d_defconfig | 6 +++++
> include/configs/pico-imx7d.h | 6 -----
> 3 files changed, 23 insertions(+), 33 deletions(-)
>
> diff --git a/board/technexion/pico-imx7d/pico-imx7d.c b/board/technexion/pico-imx7d/pico-imx7d.c
> index cd7d5b1..095242d 100644
> --- a/board/technexion/pico-imx7d/pico-imx7d.c
> +++ b/board/technexion/pico-imx7d/pico-imx7d.c
> @@ -40,47 +40,37 @@ int dram_init(void)
> return 0;
> }
>
> -#ifdef CONFIG_POWER
> -#define I2C_PMIC 3
> +#ifdef CONFIG_DM_PMIC
> int power_init_board(void)
> {
> - struct pmic *p;
> - int ret;
> - unsigned int reg, rev_id;
> + struct udevice *dev;
> + int ret=0, dev_id=0, rev_id=0, reg=0;
>
> - ret = power_pfuze3000_init(I2C_PMIC);
> - if (ret)
> - return ret;
> + ret = pmic_get("pfuze3000", &dev);
> + if (ret == -ENODEV)
> + return 0;
> + if (ret != 0)
>
> - p = pmic_get("PFUZE3000");
> - ret = pmic_probe(p);
> - if (ret)
> - return ret;
> -
> - pmic_reg_read(p, PFUZE3000_DEVICEID, ®);
> - pmic_reg_read(p, 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_read(p, PFUZE3000_LDOGCTL, ®);
> - reg |= 0x1;
> - pmic_reg_write(p, PFUZE3000_LDOGCTL, reg);
> + pmic_clrsetbits(dev, PFUZE3000_LDOGCTL, 0, 1);
The mask 0 does not look correct. I will fix it in the warp board code as well.
You could simply write:
pmic_clrsetbits(dev, PFUZE3000_LDOGCTL, 1, 1);
or keep using pmic_reg_read(), modify and pmic_reg_write().
More information about the U-Boot
mailing list