Skip to contentSkip to conversation

Add support for Intersil ISL12057 I2C RTC/Alarm chip

RFC PATCH Superseded Arnaud Ebalard 1 participant 1 message Aug 2, 2013 Real time clock (RTC)

v0 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Add support for Intersil ISL12057 I2C RTC/Alarm chip

Hi,

Netgear ReadyNAS 102 (Armada 370-base) NAS includes an Intersil ISL12057 I2C RTC/Alarm chip. As part of an effort to get full support for the NAS in mainline kernel, I wrote a driver for the chip based on ISL1208 one developed by Hebert Valerio Riedel. This v0 is a first round to get some comments and advices.

Setting and retrieving time works as expected at startup and shutdown. Also, alarm bit is set in status register when the alarm is triggered. Nonetheless:

1) I found no way to test interrupt handling code which is supposed to get called when the alarm triggers and an interrupt occurs on pin 3 of the chip: I don't have the expected IRQ value on my platform. I already tried and assign some dummy handler to unassigned IRQ (i.e. unreferenced in /proc/interrupts) w/o luck. If you have any idea/direction, I'd be happy to test. ATM, for that reason, that part of the code is untested.

2) trying to interact w/ the clock using userland tools does not work:

 root@humble:/sys/class/rtc/rtc0# hwclock -r
 hwclock: select() to /dev/rtc0 to wait for clock tick timed out: Success
 root@humble:/tmp# gcc rtctest.c 
 root@humble:/tmp# ./a.out 

RTC Driver Test Example.

Counting 5 update (1/sec) interrupts from reading /dev/rtc0:

[ nothing happens ]

I tried and find some documentation on the topic to understand where the issue comes from but found nothing obvious.

I intend to provide some documentation in next round and fix reported issues. Additionally, I wonder why ISL1208 code has no specific mutex protection for access and changes. I also followed that path in attached driver but I guess this is something that should be improved.

Comments welcome,

Cheers,

a+

---
 drivers/rtc/Kconfig        |   9 +
 drivers/rtc/Makefile       |   1 +
 drivers/rtc/rtc-isl12057.c | 641 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 651 insertions(+)
 create mode 100644 drivers/rtc/rtc-isl12057.c
drivers/rtc/Kconfig +9 -0
index 9e3498b..b3d4894 100644
@@ -294,6 +294,15 @@ config RTC_DRV_ISL12022
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-isl12022.
 
+config RTC_DRV_ISL12057
+       tristate "Intersil ISL12057"
+       help
+	  If you say yes here you get support for the Intersil ISL12057
+	  I2C RTC/Alarm chip.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-isl12057.
+
 config RTC_DRV_X1205
 	tristate "Xicor/Intersil X1205"
 	help
drivers/rtc/Makefile +1 -0
index d3b4488..2cbf8f9 100644
@@ -57,6 +57,7 @@ obj-$(CONFIG_RTC_DRV_HID_SENSOR_TIME) += rtc-hid-sensor-time.o
 obj-$(CONFIG_RTC_DRV_IMXDI)	+= rtc-imxdi.o
 obj-$(CONFIG_RTC_DRV_ISL1208)	+= rtc-isl1208.o
 obj-$(CONFIG_RTC_DRV_ISL12022)	+= rtc-isl12022.o
+obj-$(CONFIG_RTC_DRV_ISL12057)  += rtc-isl12057.o
 obj-$(CONFIG_RTC_DRV_JZ4740)	+= rtc-jz4740.o
 obj-$(CONFIG_RTC_DRV_LP8788)	+= rtc-lp8788.o
 obj-$(CONFIG_RTC_DRV_LPC32XX)	+= rtc-lpc32xx.o
drivers/rtc/rtc-isl12057.c new file +641 -0

641 lines not on this page · raw message

Signature · 1 line
1.8.3.1