summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2016-03-21 18:18:11 -0700
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2016-03-30 18:10:39 +0200
commit2812e5421d20ff226540f0790b991c81dce74275 (patch)
tree7bff6a1fd465f30411704ec061628b592e067373
parent7f946663c11fd5e580eb7e4f15bcc14d47ce47ad (diff)
power: pmic: add Ricoh RN5T567 PMIC support
Add power driver for Ricoh PMIC used on Colibri iMX7. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r--drivers/power/pmic/Makefile1
-rw-r--r--drivers/power/pmic/pmic_rn5t567.c32
-rw-r--r--include/power/rn5t567_pmic.h115
3 files changed, 148 insertions, 0 deletions
diff --git a/drivers/power/pmic/Makefile b/drivers/power/pmic/Makefile
index b6257c9697..49d6c5a517 100644
--- a/drivers/power/pmic/Makefile
+++ b/drivers/power/pmic/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
obj-$(CONFIG_POWER_MAX77686) += pmic_max77686.o
obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o
obj-$(CONFIG_POWER_PFUZE300) += pmic_pfuze300.o
+obj-$(CONFIG_POWER_RN5T567) += pmic_rn5t567.o
obj-$(CONFIG_POWER_TPS65090_I2C) += pmic_tps65090.o
obj-$(CONFIG_POWER_TPS65090_EC) += pmic_tps65090_ec.o
obj-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o
diff --git a/drivers/power/pmic/pmic_rn5t567.c b/drivers/power/pmic/pmic_rn5t567.c
new file mode 100644
index 0000000000..1aa2f8628b
--- /dev/null
+++ b/drivers/power/pmic/pmic_rn5t567.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2016 Toradex AG
+ * Stefan Agner <stefan.agner@toradex.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <errno.h>
+#include <i2c.h>
+#include <power/pmic.h>
+#include <power/rn5t567_pmic.h>
+
+int power_rn5t567_init(unsigned char bus)
+{
+ static const char name[] = "RN5T567";
+ struct pmic *p = pmic_alloc();
+
+ if (!p) {
+ printf("%s: POWER allocation error!\n", __func__);
+ return -ENOMEM;
+ }
+
+ p->name = name;
+ p->interface = PMIC_I2C;
+ p->number_of_regs = PMIC_NUM_OF_REGS;
+ p->hw.i2c.addr = CONFIG_POWER_RN5T567_I2C_ADDR;
+ p->hw.i2c.tx_num = 1;
+ p->bus = bus;
+
+ return 0;
+}
diff --git a/include/power/rn5t567_pmic.h b/include/power/rn5t567_pmic.h
new file mode 100644
index 0000000000..aa5504b183
--- /dev/null
+++ b/include/power/rn5t567_pmic.h
@@ -0,0 +1,115 @@
+/*
+ * Copyright (C) 2016 Toradex AG
+ * Stefan Agner <stefan.agner@toradex.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+#ifndef __RN5T567_PMIC_H_
+#define __RN5T567_PMIC_H_
+
+/* RN5T567 registers */
+enum {
+ RN5T567_LSIVER = 0x00,
+ RN5T567_OTPVER = 0x01,
+ RN5T567_IODAC = 0x02,
+ RN5T567_VINDAC = 0x03,
+ RN5T567_OUT32KEN = 0x05,
+
+ RN5T567_CPUCNT = 0x06,
+
+ RN5T567_PSWR = 0x07,
+ RN5T567_PONHIS = 0x09,
+ RN5T567_POFFHIS = 0x0A,
+ RN5T567_WATCHDOG = 0x0B,
+ RN5T567_WATCHDOGCNT = 0x0C,
+ RN5T567_PWRFUNC = 0x0D,
+ RN5T567_SLPCNT = 0x0E,
+ RN5T567_REPCNT = 0x0F,
+ RN5T567_PWRONTIMSET = 0x10,
+ RN5T567_NOETIMSETCNT = 0x11,
+ RN5T567_PWRIREN = 0x12,
+ RN5T567_PWRIRQ = 0x13,
+ RN5T567_PWRMON = 0x14,
+ RN5T567_PWRIRSEL = 0x15,
+
+ RN5T567_DC1_SLOT = 0x16,
+ RN5T567_DC2_SLOT = 0x17,
+ RN5T567_DC3_SLOT = 0x18,
+ RN5T567_DC4_SLOT = 0x19,
+
+ RN5T567_LDO1_SLOT = 0x1B,
+ RN5T567_LDO2_SLOT = 0x1C,
+ RN5T567_LDO3_SLOT = 0x1D,
+ RN5T567_LDO4_SLOT = 0x1E,
+ RN5T567_LDO5_SLOT = 0x1F,
+
+ RN5T567_PSO0_SLOT = 0x25,
+ RN5T567_PSO1_SLOT = 0x26,
+ RN5T567_PSO2_SLOT = 0x27,
+ RN5T567_PSO3_SLOT = 0x28,
+
+ RN5T567_LDORTC1_SLOT = 0x2A,
+
+ RN5T567_DC1CTL = 0x2C,
+ RN5T567_DC1CTL2 = 0x2D,
+ RN5T567_DC2CTL = 0x2E,
+ RN5T567_DC2CTL2 = 0x2F,
+ RN5T567_DC3CTL = 0x30,
+ RN5T567_DC3CTL2 = 0x31,
+ RN5T567_DC4CTL = 0x32,
+ RN5T567_DC4CTL2 = 0x33,
+
+ RN5T567_DC1DAC = 0x36,
+ RN5T567_DC2DAC = 0x37,
+ RN5T567_DC3DAC = 0x38,
+ RN5T567_DC4DAC = 0x39,
+
+ RN5T567_DC1DAC_SLP = 0x3B,
+ RN5T567_DC2DAC_SLP = 0x3C,
+ RN5T567_DC3DAC_SLP = 0x3D,
+ RN5T567_DC4DAC_SLP = 0x3E,
+
+ RN5T567_DCIREN = 0x40,
+ RN5T567_DCIRQ = 0x41,
+ RN5T567_DCIRMON = 0x42,
+
+ RN5T567_LDOEN1 = 0x44,
+ RN5T567_LDOEN2 = 0x45,
+ RN5T567_LDODIS1 = 0x46,
+
+ RN5T567_LDO1DAC = 0x4C,
+ RN5T567_LDO2DAC = 0x4D,
+ RN5T567_LDO3DAC = 0x4E,
+ RN5T567_LDO4DAC = 0x4F,
+ RN5T567_LDO5DAC = 0x50,
+
+ RN5T567_LDORTC1DAC = 0x56,
+ RN5T567_LDORTC2DAC = 0x57,
+
+ RN5T567_LDO1DAC_SLP = 0x58,
+ RN5T567_LDO2DAC_SLP = 0x59,
+ RN5T567_LDO3DAC_SLP = 0x5A,
+ RN5T567_LDO4DAC_SLP = 0x5B,
+ RN5T567_LDO5DAC_SLP = 0x5C,
+
+ RN5T567_IOSEL = 0x90,
+ RN5T567_IOOUT = 0x91,
+ RN5T567_GPEDGE1 = 0x92,
+ RN5T567_EN_GPIR = 0x94,
+ RN5T567_IR_GPR = 0x95,
+ RN5T567_IR_GPF = 0x96,
+ RN5T567_MON_IOIN = 0x97,
+ RN5T567_GPLED_FUNC = 0x98,
+ RN5T567_INTPOL = 0x9C,
+ RN5T567_INTEN = 0x9D,
+ RN5T567_INTMON = 0x9E,
+
+ RN5T567_PREVINDAC = 0xB0,
+ RN5T567_OVTEMP = 0xBC,
+
+ PMIC_NUM_OF_REGS = 0xBF,
+};
+
+int power_rn5t567_init(unsigned char bus);
+
+#endif