summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2016-10-05 15:27:09 -0700
committerStefano Babic <sbabic@denx.de>2016-10-07 12:26:15 +0200
commitc571d6828d980e555ba40baf85aab45b39e118ee (patch)
tree182c5b63cff0e692de06d5efec2463f1c417aaaa /drivers
parentaa723b8dbfbd61f12d400650f34d47ac1db04820 (diff)
downloadu-boot-imx-c571d6828d980e555ba40baf85aab45b39e118ee.zip
u-boot-imx-c571d6828d980e555ba40baf85aab45b39e118ee.tar.gz
u-boot-imx-c571d6828d980e555ba40baf85aab45b39e118ee.tar.bz2
power: pmic: add Ricoh RN5T567 PMIC support
Add device model enabled PMIC driver for Ricoh RN5T567 PMIC used on Colibri iMX7. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/power/pmic/Kconfig8
-rw-r--r--drivers/power/pmic/Makefile1
-rw-r--r--drivers/power/pmic/rn5t567.c64
3 files changed, 73 insertions, 0 deletions
diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig
index 69f8d51..13d293a 100644
--- a/drivers/power/pmic/Kconfig
+++ b/drivers/power/pmic/Kconfig
@@ -127,6 +127,14 @@ config PMIC_S5M8767
driver provides basic register access and sets up the attached
regulators if regulator support is enabled.
+config PMIC_RN5T567
+ bool "Enable driver for Ricoh RN5T567 PMIC"
+ depends on DM_PMIC
+ ---help---
+ The RN5T567 is a PMIC with 4 step-down DC/DC converters, 5 LDO
+ regulators Real-Time Clock and 4 GPIOs. This driver provides
+ register access only.
+
config PMIC_TPS65090
bool "Enable driver for Texas Instruments TPS65090 PMIC"
depends on DM_PMIC
diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index 52b4f71..37d9eb5 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_DM_PMIC_SANDBOX) += sandbox.o i2c_pmic_emul.o
obj-$(CONFIG_PMIC_ACT8846) += act8846.o
obj-$(CONFIG_PMIC_PM8916) += pm8916.o
obj-$(CONFIG_PMIC_RK808) += rk808.o
+obj-$(CONFIG_PMIC_RN5T567) += rn5t567.o
obj-$(CONFIG_PMIC_TPS65090) += tps65090.o
obj-$(CONFIG_PMIC_S5M8767) += s5m8767.o
diff --git a/drivers/power/pmic/rn5t567.c b/drivers/power/pmic/rn5t567.c
new file mode 100644
index 0000000..001e695
--- /dev/null
+++ b/drivers/power/pmic/rn5t567.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2016 Toradex AG
+ * Stefan Agner <stefan.agner@toradex.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <errno.h>
+#include <fdtdec.h>
+#include <libfdt.h>
+#include <power/rn5t567_pmic.h>
+#include <power/pmic.h>
+
+static int rn5t567_reg_count(struct udevice *dev)
+{
+ return RN5T567_NUM_OF_REGS;
+}
+
+static int rn5t567_write(struct udevice *dev, uint reg, const uint8_t *buff,
+ int len)
+{
+ int ret;
+
+ ret = dm_i2c_write(dev, reg, buff, len);
+ if (ret) {
+ debug("write error to device: %p register: %#x!", dev, reg);
+ return ret;
+ }
+
+ return 0;
+}
+
+static int rn5t567_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
+{
+ int ret;
+
+ ret = dm_i2c_read(dev, reg, buff, len);
+ if (ret) {
+ debug("read error from device: %p register: %#x!", dev, reg);
+ return ret;
+ }
+
+ return 0;
+}
+
+static struct dm_pmic_ops rn5t567_ops = {
+ .reg_count = rn5t567_reg_count,
+ .read = rn5t567_read,
+ .write = rn5t567_write,
+};
+
+static const struct udevice_id rn5t567_ids[] = {
+ { .compatible = "ricoh,rn5t567" },
+ { }
+};
+
+U_BOOT_DRIVER(pmic_rn5t567) = {
+ .name = "rn5t567 pmic",
+ .id = UCLASS_PMIC,
+ .of_match = rn5t567_ids,
+ .ops = &rn5t567_ops,
+};