diff options
author | Tom Rini <trini@konsulko.com> | 2018-12-10 10:19:09 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-12-10 10:19:09 -0500 |
commit | 8bf3c2442b59aedd1e58b7013fc12180cab0b541 (patch) | |
tree | 40aa7037d11543969c05a5fbd187b1ca4a3af050 /drivers/power/pmic | |
parent | 7ff485c68b7e5573e5a4a877066e98398283a24f (diff) | |
parent | eff43904b7f0c05ed316755e83b5474792059a5c (diff) | |
download | u-boot-8bf3c2442b59aedd1e58b7013fc12180cab0b541.tar.gz |
Merge tag 'for-master-20181210' of git://git.denx.de/u-boot-rockchip
Improvements:
- init DRAM for RK322x in SPL
- add FAN53555 PMIC/regulator driver
- update MicroCrystal RV3029 driver to Kconfig and sync from Linux
- add bootcount uclass and first DM-driver for bootcount
Diffstat (limited to 'drivers/power/pmic')
-rw-r--r-- | drivers/power/pmic/Kconfig | 14 | ||||
-rw-r--r-- | drivers/power/pmic/Makefile | 1 | ||||
-rw-r--r-- | drivers/power/pmic/fan53555.c | 82 |
3 files changed, 97 insertions, 0 deletions
diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig index cba48e12da..8cf60ebcf3 100644 --- a/drivers/power/pmic/Kconfig +++ b/drivers/power/pmic/Kconfig @@ -48,6 +48,20 @@ config PMIC_AS3722 interface and is designs to cover most of the power managementment required for a tablets or laptop. +config DM_PMIC_FAN53555 + bool "Enable support for OnSemi FAN53555" + depends on DM_PMIC && DM_REGULATOR && DM_I2C + select DM_REGULATOR_FAN53555 + help + This config enables implementation of driver-model PMIC + uclass features for the FAN53555 regulator. The FAN53555 is + a (family of) single-output regulators that supports + transitioning between two different output voltages based on + an voltage selection pin. + + The driver implements read/write operations for use with the FAN53555 + regulator driver and binds the regulator driver to its node. + config DM_PMIC_PFUZE100 bool "Enable Driver Model for PMIC PFUZE100" depends on DM_PMIC diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile index 29ca442933..637352ab2b 100644 --- a/drivers/power/pmic/Makefile +++ b/drivers/power/pmic/Makefile @@ -4,6 +4,7 @@ # Lukasz Majewski <l.majewski@samsung.com> obj-$(CONFIG_DM_PMIC) += pmic-uclass.o +obj-$(CONFIG_DM_PMIC_FAN53555) += fan53555.o obj-$(CONFIG_DM_PMIC_MAX77686) += max77686.o obj-$(CONFIG_DM_PMIC_MAX8998) += max8998.o obj-$(CONFIG_DM_PMIC_MC34708) += mc34708.o diff --git a/drivers/power/pmic/fan53555.c b/drivers/power/pmic/fan53555.c new file mode 100644 index 0000000000..1ca59c5f0c --- /dev/null +++ b/drivers/power/pmic/fan53555.c @@ -0,0 +1,82 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) 2018 Theobroma Systems Design und Consulting GmbH + */ + +#include <common.h> +#include <dm.h> +#include <dm/device-internal.h> +#include <dm/lists.h> +#include <i2c.h> +#include <power/pmic.h> +#include <power/regulator.h> + +static int pmic_fan53555_reg_count(struct udevice *dev) +{ + return 1; +}; + +static int pmic_fan53555_read(struct udevice *dev, uint reg, + u8 *buff, int len) +{ + if (dm_i2c_read(dev, reg, buff, len)) { + pr_err("%s: read error for register: %#x!", dev->name, reg); + return -EIO; + } + + return 0; +} + +static int pmic_fan53555_write(struct udevice *dev, uint reg, + const u8 *buff, int len) +{ + if (dm_i2c_write(dev, reg, buff, len)) { + pr_err("%s: write error for register: %#x!", dev->name, reg); + return -EIO; + } + + return 0; +} + +static int pmic_fan53555_bind(struct udevice *dev) +{ + /* + * The FAN53555 has only a single regulator and therefore doesn't + * have a subnode. So we have to rebind a child device (the one + * regulator) here. + */ + + const char *regulator_driver_name = "fan53555_regulator"; + struct udevice *child; + struct driver *drv; + + debug("%s\n", __func__); + + drv = lists_driver_lookup_name(regulator_driver_name); + if (!drv) { + dev_err(dev, "no driver '%s'\n", regulator_driver_name); + return -ENOENT; + } + + return device_bind_with_driver_data(dev, drv, "SW", 0, + dev_ofnode(dev), &child); +}; + +static struct dm_pmic_ops pmic_fan53555_ops = { + .reg_count = pmic_fan53555_reg_count, + .read = pmic_fan53555_read, + .write = pmic_fan53555_write, +}; + +static const struct udevice_id pmic_fan53555_match[] = { + { .compatible = "fcs,fan53555" }, + { }, +}; + +U_BOOT_DRIVER(pmic_fan53555) = { + .name = "pmic_fan53555", + .id = UCLASS_PMIC, + .of_match = pmic_fan53555_match, + .bind = pmic_fan53555_bind, + .ops = &pmic_fan53555_ops, +}; |