17 #include <linux/kernel.h>
21 #include <linux/rtc.h>
24 #include <linux/module.h>
26 #define DRV_VERSION "0.4"
40 #define RTC_CENTURY_MASK 0x3f
41 #define RTC_SECONDS_MASK 0x7f
42 #define RTC_DAY_MASK 0x07
45 #define RTC_WRITE 0x80
52 #define RTC_BATT_FLAG 0x80
89 static int ds1742_rtc_read_time(
struct device *dev,
struct rtc_time *tm)
121 dev_err(dev,
"retrieved date/time is not valid.\n");
128 .read_time = ds1742_rtc_read_time,
129 .set_time = ds1742_rtc_set_time,
142 for (count = 0; size > 0 && pos < pdata->
size_nvram; count++, size--)
143 *buf++ =
readb(ioaddr + pos++);
149 char *buf, loff_t pos,
size_t size)
157 for (count = 0; size > 0 && pos < pdata->
size_nvram; count++, size--)
158 writeb(*buf++, ioaddr + pos++);
166 unsigned int cen,
sec;
177 pdata->
size = resource_size(res);
210 platform_set_drvdata(pdev, pdata);
219 dev_err(&pdev->
dev,
"creating nvram file in sysfs failed\n");
235 .probe = ds1742_rtc_probe,
238 .name =
"rtc-ds1742",