rtc: add support for EPSON TOYOCOM RTC-7301SF/DG
Subsystems (2)
PATCH v2 1/1 rtc: add support for EPSON TOYOCOM RTC-7301SF/DG
This adds support for EPSON TOYOCOM RTC-7301SF/DG which has parallel interface compatible with SRAM.
This driver supports basic clock, calendar and alarm functionality.
Tested with Microblaze linux running on Artix7 FPGA board with my own custom IP for RTC-7301.
---
* Changes from v1
- Add interrupt-parent property in the DT example
- Fix typo for RTC7301_TIMER_CONTROL_* register bit field names
- Don't forcibly disable alarm in the initialization
.../devicetree/bindings/rtc/epson,rtc7301.txt | 16 + drivers/rtc/Kconfig | 11 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-r7301.c | 455 +++++++++++++++++++++ 4 files changed, 483 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/epson,rtc7301.txt create mode 100644 drivers/rtc/rtc-r7301.c
Documentation/devicetree/bindings/rtc/epson,rtc7301.txt new file +16 -0
@@ -0,0 +1,16 @@ +EPSON TOYOCOM RTC-7301SF/DG + +Required properties: + +- compatible: Should be "epson,rtc7301sf" or "epson,rtc7301dg" +- reg: Specifies base physical address and size of the registers. +- interrupts: A single interrupt specifier. + +Example: + +rtc: rtc@44a00000 { + compatible = "epson,rtc7301dg"; + reg = <0x44a00000 0x10000>; + interrupt-parent = <&axi_intc_0>; + interrupts = <3 2>; +};
drivers/rtc/Kconfig +11 -0
@@ -1705,6 +1705,17 @@ config RTC_DRV_PIC32 This driver can also be built as a module. If so, the module will be called rtc-pic32 +config RTC_DRV_R7301 + tristate "EPSON TOYOCOM RTC-7301SF/DG" + select REGMAP_MMIO + depends on OF && HAS_IOMEM + help + If you say yes here you get support for the EPSON TOYOCOM + RTC-7301SF/DG chips. + + This driver can also be built as a module. If so, the module + will be called rtc-r7301. + comment "HID Sensor RTC drivers" config RTC_DRV_HID_SENSOR_TIME
drivers/rtc/Makefile +1 -0
@@ -120,6 +120,7 @@ obj-$(CONFIG_RTC_DRV_PM8XXX) += rtc-pm8xxx.o obj-$(CONFIG_RTC_DRV_PS3) += rtc-ps3.o obj-$(CONFIG_RTC_DRV_PUV3) += rtc-puv3.o obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o +obj-$(CONFIG_RTC_DRV_R7301) += rtc-r7301.o obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o obj-$(CONFIG_RTC_DRV_RC5T583) += rtc-rc5t583.o obj-$(CONFIG_RTC_DRV_RK808) += rtc-rk808.o
drivers/rtc/rtc-r7301.c new file +455 -0
455 lines not on this page · raw message
Signature · 11 lines
2.7.4 -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.
A message that is not in the archive (sent off-list or not yet received): 1480781636-15653-1-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Hi,
Quoted 46 lines · Akinobu Mita
drivers/rtc/rtc-r7301.c new file +40
-0@@ -0,0 +1,455 @@ +/* +* EPSON TOYOCOM RTC-7301SF/DG Driver +* +* Copyright (c) 2016 Akinobu Mita <[email protected]> +* +* Based on rtc-rp5c01.c +* +* Datasheet: http://www5.epsondevice.com/en/products/parallel/rtc7301sf.html +*/ + +#include <linux/io.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/regmap.h> +#include <linux/platform_device.h> +#include <linux/rtc.h> + +#define DRV_NAME "rtc-r7301" + +enum { +RTC7301_1_SEC =0x0 ,/* Bank 0 and Band 1 */ +RTC7301_10_SEC =0x1 ,/* Bank 0 and Band 1 */ +RTC7301_AE =BIT (3 ), +RTC7301_1_MIN =0x2 ,/* Bank 0 and Band 1 */ +RTC7301_10_MIN =0x3 ,/* Bank 0 and Band 1 */ +RTC7301_1_HOUR =0x4 ,/* Bank 0 and Band 1 */ +RTC7301_10_HOUR =0x5 ,/* Bank 0 and Band 1 */ +RTC7301_DAY_OF_WEEK =0x6 ,/* Bank 0 and Band 1 */ +RTC7301_1_DAY =0x7 ,/* Bank 0 and Band 1 */ +RTC7301_10_DAY =0x8 ,/* Bank 0 and Band 1 */ +RTC7301_1_MONTH =0x9 ,/* Bank 0 */ +RTC7301_10_MONTH =0xa ,/* Bank 0 */ +RTC7301_1_YEAR =0xb ,/* Bank 0 */ +RTC7301_10_YEAR =0xc ,/* Bank 0 */ +RTC7301_100_YEAR =0xd ,/* Bank 0 */ +RTC7301_1000_YEAR =0xe ,/* Bank 0 */ +RTC7301_ALARM_CONTROL =0xe ,/* Bank 1 */ +RTC7301_ALARM_CONTROL_AIE =BIT (0 ), +RTC7301_ALARM_CONTROL_AF =BIT (1 ),
drivers/rtc/rtc-r7301.c line 50
Quoted 10 lines
drivers/rtc/rtc-r7301.c new file +10
-0+RTC7301_TIMER_CONTROL =0xe ,/* Bank 2 */ +RTC7301_TIMER_CONTROL_TIE =BIT (0 ), +RTC7301_TIMER_CONTROL_TF =BIT (1 ), +RTC7301_CONTROL =0xf ,/* All banks */ +RTC7301_CONTROL_BUSY =BIT (0 ), +RTC7301_CONTROL_STOP =BIT (1 ), +RTC7301_CONTROL_BANK_SEL_0 =BIT (2 ), + RTC7301_CONTROL_BANK_SEL_1 = BIT(3), +}; +
Well, I'm still not convinced this enum is useful, please change those to #defines.
Else, this seems good to me.
Signature · 13 lines
Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com -- You received this message because you are subscribed to "rtc-linux". Membership options at http://groups.google.com/group/rtc-linux . Please read http://groups.google.com/group/rtc-linux/web/checklist before submitting a driver. --- You received this message because you are subscribed to the Google Groups "rtc-linux" group. To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] For more options, visit https://groups.google.com/d/optout.