[U-Boot] [PATCH v2 2/5] power: pmic: rk808: add RK818 support

Jacob Chen jacobchen110 at gmail.com
Tue May 2 07:19:38 UTC 2017


2017-05-02 14:54 GMT+08:00 Jacob Chen <jacob-chen at iotwrt.com>:
> The RK818 chip is a Power Management IC (PMIC) for multimedia and handheld
> devices.
>
> For boards use rk818, the input current should be set in the early stage, before
> ddr initialization.
>
> Signed-off-by: Jacob Chen <jacob-chen at iotwrt.com>
> ---
>
> Changes in v2:
> - remove input current selection in probe, it should be configured
> in board_init_f by manual.
>

Maybe we'd better provide a function here, like `rk808_spl_configure_buck`
It could be `rk8xx_spl_init(pmic, parm....)`


>  drivers/power/pmic/rk808.c | 16 ++++++++++++++++
>  include/power/rk808_pmic.h | 12 ++++++++++++
>  2 files changed, 28 insertions(+)
>
> diff --git a/drivers/power/pmic/rk808.c b/drivers/power/pmic/rk808.c
> index 3f5f316..582e456 100644
> --- a/drivers/power/pmic/rk808.c
> +++ b/drivers/power/pmic/rk808.c
> @@ -80,6 +80,20 @@ static int rk808_bind(struct udevice *dev)
>  }
>  #endif
>
> +static int rk808_probe(struct udevice *dev)
> +{
> +       struct rk808_priv *priv = dev_get_priv(dev);
> +       uint8_t msb, lsb;
> +
> +       /* read Chip variant */
> +       rk808_read(dev, ID_MSB, &msb, 1);
> +       rk808_read(dev, ID_LSB, &lsb, 1);
> +
> +       priv->variant = ((msb << 8) | lsb) & RK8XX_ID_MSK;
> +
> +       return 0;
> +}
> +
>  static struct dm_pmic_ops rk808_ops = {
>         .reg_count = rk808_reg_count,
>         .read = rk808_read,
> @@ -88,6 +102,7 @@ static struct dm_pmic_ops rk808_ops = {
>
>  static const struct udevice_id rk808_ids[] = {
>         { .compatible = "rockchip,rk808" },
> +       { .compatible = "rockchip,rk818" },
>         { }
>  };
>
> @@ -98,5 +113,6 @@ U_BOOT_DRIVER(pmic_rk808) = {
>  #if CONFIG_IS_ENABLED(PMIC_CHILDREN)
>         .bind = rk808_bind,
>  #endif
> +       .probe = rk808_probe,
>         .ops = &rk808_ops,
>  };
> diff --git a/include/power/rk808_pmic.h b/include/power/rk808_pmic.h
> index d29c2b3..c370c32 100644
> --- a/include/power/rk808_pmic.h
> +++ b/include/power/rk808_pmic.h
> @@ -170,12 +170,24 @@ enum {
>         RK808_NUM_OF_REGS,
>  };
>
> +enum {
> +       RK805_ID = 0x8050,
> +       RK808_ID = 0x0000,
> +       RK818_ID = 0x8180,
> +};
> +
> +#define RK8XX_ID_MSK   0xfff0
> +
>  struct rk808_reg_table {
>         char *name;
>         u8 reg_ctl;
>         u8 reg_vol;
>  };
>
> +struct rk808_priv {
> +       int variant;
> +};
> +
>  int rk808_spl_configure_buck(struct udevice *pmic, int buck, int uvolt);
>
>  #endif
> --
> 2.7.4
>


More information about the U-Boot mailing list