2019-10-31 22:56:12

by Andreas Kemnade

[permalink] [raw]
Subject: [PATCH v2 0/5] Add rtc support for rn5t618 mfd

In the variant rc5t619 the mfd has a rtc. This patchset adds
support for it. To do so it adds the missing register defines in
rn5t618.h and general irq handling for that.
Probably the irq definitions are the same except missing rtc + charger
but due to missing information about that I do not add them.
There might be some oddity about the charger irq which should be
researched when adding the charger subdevice.

The rtc driver itself is based on
https://github.com/kobolabs/Kobo-Reader/blob/master/hw/imx6sll-clara/kernel.tar.bz2
but heavily reworked.

It was tested on the Kobo Clara HD.

Changes in v2:
- no dead code in irq code
- various improvements and cleanups in rtc driver itself

Andreas Kemnade (5):
mfd: rn5t618: prepare for irq handling
mfd: rn5t618: add irq support
mfd: rn5t618: add rtc related registers
mfd: rn5t618: add more subdevices
rtc: rtc-rc5t619: add ricoh rc5t619 RTC driver

drivers/mfd/Kconfig | 1 +
drivers/mfd/Makefile | 2 +
drivers/mfd/{rn5t618.c => rn5t618-core.c} | 49 ++-
drivers/mfd/rn5t618-irq.c | 85 ++++
drivers/rtc/Kconfig | 10 +
drivers/rtc/Makefile | 1 +
drivers/rtc/rtc-rc5t619.c | 488 ++++++++++++++++++++++
include/linux/mfd/rn5t618.h | 27 ++
8 files changed, 661 insertions(+), 2 deletions(-)
rename drivers/mfd/{rn5t618.c => rn5t618-core.c} (79%)
create mode 100644 drivers/mfd/rn5t618-irq.c
create mode 100644 drivers/rtc/rtc-rc5t619.c

--
2.20.1


2019-10-31 23:08:47

by Andreas Kemnade

[permalink] [raw]
Subject: [PATCH v2 3/5] mfd: rn5t618: add rtc related registers

Defines for some rtc related registers were missing, also
they were not included in the volatile register list

Signed-off-by: Andreas Kemnade <[email protected]>
---
drivers/mfd/rn5t618-core.c | 2 ++
include/linux/mfd/rn5t618.h | 11 +++++++++++
2 files changed, 13 insertions(+)

diff --git a/drivers/mfd/rn5t618-core.c b/drivers/mfd/rn5t618-core.c
index d4ed2865ed8b..0e3ec9dafb40 100644
--- a/drivers/mfd/rn5t618-core.c
+++ b/drivers/mfd/rn5t618-core.c
@@ -32,6 +32,8 @@ static bool rn5t618_volatile_reg(struct device *dev, unsigned int reg)
case RN5T618_IR_GPF:
case RN5T618_MON_IOIN:
case RN5T618_INTMON:
+ case RN5T618_RTC_CTRL1 ... RN5T618_RTC_CTRL2:
+ case RN5T618_RTC_SECONDS ... RN5T618_RTC_YEAR:
return true;
default:
return false;
diff --git a/include/linux/mfd/rn5t618.h b/include/linux/mfd/rn5t618.h
index edd2b6485e3b..26c36b58916c 100644
--- a/include/linux/mfd/rn5t618.h
+++ b/include/linux/mfd/rn5t618.h
@@ -139,6 +139,17 @@
#define RN5T618_INTPOL 0x9c
#define RN5T618_INTEN 0x9d
#define RN5T618_INTMON 0x9e
+
+#define RN5T618_RTC_SECONDS 0xA0
+#define RN5T618_RTC_MDAY 0xA4
+#define RN5T618_RTC_MONTH 0xA5
+#define RN5T618_RTC_YEAR 0xA6
+#define RN5T618_RTC_ADJUST 0xA7
+#define RN5T618_RTC_ALARM_Y_SEC 0xA8
+#define RN5T618_RTC_DAL_MONTH 0xAC
+#define RN5T618_RTC_CTRL1 0xAE
+#define RN5T618_RTC_CTRL2 0xAF
+
#define RN5T618_PREVINDAC 0xb0
#define RN5T618_BATDAC 0xb1
#define RN5T618_CHGCTL1 0xb3
--
2.20.1