Platform real time clock driver for Dallas 1511 chip.
PATCH 1/1 Platform real time clock driver for Dallas 1511 chip.
Add RTC support for DS1511 RTC/WDT chip.
Incorprate changes from feedback:
Remove noinline; Remove code checking/setting jiffies since last read; Remove enum typedef.
--- drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-ds1511.c | 656 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 667 insertions(+), 0 deletions(-)
drivers/rtc/Kconfig +10 -0
@@ -302,6 +302,16 @@ config RTC_DRV_DS1216 help If you say yes here you get support for the Dallas DS1216 RTC chips. +config RTC_DRV_DS1511 + tristate "Dallas DS1511" + depends on RTC_CLASS + help + If you say yes here you get support for the + Dallas DS1511 timekeeping/watchdog chip. + + This driver can also be built as a module. If so, the module + will be called rtc-ds1511. + config RTC_DRV_DS1553 tristate "Dallas DS1553" help
drivers/rtc/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_RTC_DRV_CMOS) += rtc-cmos.o obj-$(CONFIG_RTC_DRV_DS1216) += rtc-ds1216.o obj-$(CONFIG_RTC_DRV_DS1307) += rtc-ds1307.o obj-$(CONFIG_RTC_DRV_DS1374) += rtc-ds1374.o +obj-$(CONFIG_RTC_DRV_DS1511) += rtc-ds1511.o obj-$(CONFIG_RTC_DRV_DS1553) += rtc-ds1553.o obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o obj-$(CONFIG_RTC_DRV_DS1742) += rtc-ds1742.o
drivers/rtc/rtc-ds1511.c new file +656 -0
656 lines not on this page · raw message
Quoted 6 lines · Andrew Sharp
drivers/rtc/rtc-ds1511.c new file +6
-0+struct rtc_plat_data { +struct rtc_device *rtc; +void __iomem *ioaddr;/* virtual base address */ +unsigned long baseaddr;/* physical base address */ +int size;/* amount of memory mapped */ +int irq;
drivers/rtc/rtc-ds1511.c line 102
Quoted 10 lines
drivers/rtc/rtc-ds1511.c new file +10
-0+unsigned int irqen; +int alrm_sec; +int alrm_min; +int alrm_hour; +int alrm_mday; +}; + +static DEFINE_SPINLOCK (ds1511_lock); + +static __iomem char *ds1511_base;
If you used ds1511_base, ioaddr in rtc_plat_data is not needed.
drivers/rtc/rtc-ds1511.c line 109
Quoted 5 lines
+ static noinline void
drivers/rtc/rtc-ds1511.c new file +4
-0+rtc_write(uint8_t val, uint32_t reg) +{ + writeb(val, ds1511_base + (reg * reg_spacing)); +}
Still "noinline" here and there.
drivers/rtc/rtc-ds1511.c line 504
Quoted 10 lines
drivers/rtc/rtc-ds1511.c new file +10
-0+static struct bin_attribute ds1511_nvram_attr = { + .attr = { + .name ="nvram" , + .mode =S_IRUGO |S_IWUGO , + .owner =THIS_MODULE , + }, + .size =DS1511_RAM_MAX , + .read = ds1511_nvram_read, + .write = ds1511_nvram_write, +};
It would be better to use S_IWUSR instead of S_IWUGO. Please check rtc-ds1553 changes in current git tree.
drivers/rtc/rtc-ds1511.c line 636
Quoted 8 lines
drivers/rtc/rtc-ds1511.c new file +8
-0+static struct platform_driver ds1511_rtc_driver = { + .probe = ds1511_rtc_probe, + .remove =__devexit_p (ds1511_rtc_remove), + .driver = { + .name ="ds1511" , + .owner =THIS_MODULE , + }, +};
Use "rtc-ds1511" for driver name for hotplugging. Please check rtc-ds1553 changes in current git tree.
drivers/rtc/rtc-ds1511.c line 648
Quoted 5 lines
+ static void
__exitdrivers/rtc/rtc-ds1511.c new file +4
-0+ds1511_rtc_exit (void) +{ +return platform_driver_unregister (&ds1511_rtc_driver); +}
Do not return void value. Please check rtc-ds1553 changes in current git tree.
---
Atsushi Nemoto