aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-at91rm9200.c2
-rw-r--r--drivers/rtc/rtc-at91rm9200.h75
-rw-r--r--drivers/rtc/rtc-at91sam9.c2
-rw-r--r--drivers/rtc/rtc-isl1208.c2
-rw-r--r--drivers/rtc/rtc-mxc.c34
-rw-r--r--drivers/rtc/rtc-s3c.c2
-rw-r--r--drivers/rtc/rtc-tps65910.c6
7 files changed, 113 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index fca9790c7de7..b6469e2cae89 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -31,7 +31,7 @@
31 31
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33 33
34#include <mach/at91_rtc.h> 34#include "rtc-at91rm9200.h"
35 35
36#define at91_rtc_read(field) \ 36#define at91_rtc_read(field) \
37 __raw_readl(at91_rtc_regs + field) 37 __raw_readl(at91_rtc_regs + field)
diff --git a/drivers/rtc/rtc-at91rm9200.h b/drivers/rtc/rtc-at91rm9200.h
new file mode 100644
index 000000000000..da1945e5f714
--- /dev/null
+++ b/drivers/rtc/rtc-at91rm9200.h
@@ -0,0 +1,75 @@
1/*
2 * arch/arm/mach-at91/include/mach/at91_rtc.h
3 *
4 * Copyright (C) 2005 Ivan Kokshaysky
5 * Copyright (C) SAN People
6 *
7 * Real Time Clock (RTC) - System peripheral registers.
8 * Based on AT91RM9200 datasheet revision E.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16#ifndef AT91_RTC_H
17#define AT91_RTC_H
18
19#define AT91_RTC_CR 0x00 /* Control Register */
20#define AT91_RTC_UPDTIM (1 << 0) /* Update Request Time Register */
21#define AT91_RTC_UPDCAL (1 << 1) /* Update Request Calendar Register */
22#define AT91_RTC_TIMEVSEL (3 << 8) /* Time Event Selection */
23#define AT91_RTC_TIMEVSEL_MINUTE (0 << 8)
24#define AT91_RTC_TIMEVSEL_HOUR (1 << 8)
25#define AT91_RTC_TIMEVSEL_DAY24 (2 << 8)
26#define AT91_RTC_TIMEVSEL_DAY12 (3 << 8)
27#define AT91_RTC_CALEVSEL (3 << 16) /* Calendar Event Selection */
28#define AT91_RTC_CALEVSEL_WEEK (0 << 16)
29#define AT91_RTC_CALEVSEL_MONTH (1 << 16)
30#define AT91_RTC_CALEVSEL_YEAR (2 << 16)
31
32#define AT91_RTC_MR 0x04 /* Mode Register */
33#define AT91_RTC_HRMOD (1 << 0) /* 12/24 Hour Mode */
34
35#define AT91_RTC_TIMR 0x08 /* Time Register */
36#define AT91_RTC_SEC (0x7f << 0) /* Current Second */
37#define AT91_RTC_MIN (0x7f << 8) /* Current Minute */
38#define AT91_RTC_HOUR (0x3f << 16) /* Current Hour */
39#define AT91_RTC_AMPM (1 << 22) /* Ante Meridiem Post Meridiem Indicator */
40
41#define AT91_RTC_CALR 0x0c /* Calendar Register */
42#define AT91_RTC_CENT (0x7f << 0) /* Current Century */
43#define AT91_RTC_YEAR (0xff << 8) /* Current Year */
44#define AT91_RTC_MONTH (0x1f << 16) /* Current Month */
45#define AT91_RTC_DAY (7 << 21) /* Current Day */
46#define AT91_RTC_DATE (0x3f << 24) /* Current Date */
47
48#define AT91_RTC_TIMALR 0x10 /* Time Alarm Register */
49#define AT91_RTC_SECEN (1 << 7) /* Second Alarm Enable */
50#define AT91_RTC_MINEN (1 << 15) /* Minute Alarm Enable */
51#define AT91_RTC_HOUREN (1 << 23) /* Hour Alarm Enable */
52
53#define AT91_RTC_CALALR 0x14 /* Calendar Alarm Register */
54#define AT91_RTC_MTHEN (1 << 23) /* Month Alarm Enable */
55#define AT91_RTC_DATEEN (1 << 31) /* Date Alarm Enable */
56
57#define AT91_RTC_SR 0x18 /* Status Register */
58#define AT91_RTC_ACKUPD (1 << 0) /* Acknowledge for Update */
59#define AT91_RTC_ALARM (1 << 1) /* Alarm Flag */
60#define AT91_RTC_SECEV (1 << 2) /* Second Event */
61#define AT91_RTC_TIMEV (1 << 3) /* Time Event */
62#define AT91_RTC_CALEV (1 << 4) /* Calendar Event */
63
64#define AT91_RTC_SCCR 0x1c /* Status Clear Command Register */
65#define AT91_RTC_IER 0x20 /* Interrupt Enable Register */
66#define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */
67#define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */
68
69#define AT91_RTC_VER 0x2c /* Valid Entry Register */
70#define AT91_RTC_NVTIM (1 << 0) /* Non valid Time */
71#define AT91_RTC_NVCAL (1 << 1) /* Non valid Calendar */
72#define AT91_RTC_NVTIMALR (1 << 2) /* Non valid Time Alarm */
73#define AT91_RTC_NVCALALR (1 << 3) /* Non valid Calendar Alarm */
74
75#endif
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c
index 2dfe7a2fb998..e981798e9a9b 100644
--- a/drivers/rtc/rtc-at91sam9.c
+++ b/drivers/rtc/rtc-at91sam9.c
@@ -19,8 +19,8 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/ioctl.h> 20#include <linux/ioctl.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/platform_data/atmel.h>
22 23
23#include <mach/board.h>
24#include <mach/at91_rtt.h> 24#include <mach/at91_rtt.h>
25#include <mach/cpu.h> 25#include <mach/cpu.h>
26 26
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index 26c81f233606..afb7cfa85ccc 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -118,7 +118,7 @@ isl1208_i2c_set_regs(struct i2c_client *client, u8 reg, u8 const buf[],
118 return ret; 118 return ret;
119} 119}
120 120
121/* simple check to see wether we have a isl1208 */ 121/* simple check to see whether we have a isl1208 */
122static int 122static int
123isl1208_i2c_validate_client(struct i2c_client *client) 123isl1208_i2c_validate_client(struct i2c_client *client)
124{ 124{
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c
index cd0106293a49..7304139934aa 100644
--- a/drivers/rtc/rtc-mxc.c
+++ b/drivers/rtc/rtc-mxc.c
@@ -17,8 +17,6 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19 19
20#include <mach/hardware.h>
21
22#define RTC_INPUT_CLK_32768HZ (0x00 << 5) 20#define RTC_INPUT_CLK_32768HZ (0x00 << 5)
23#define RTC_INPUT_CLK_32000HZ (0x01 << 5) 21#define RTC_INPUT_CLK_32000HZ (0x01 << 5)
24#define RTC_INPUT_CLK_38400HZ (0x02 << 5) 22#define RTC_INPUT_CLK_38400HZ (0x02 << 5)
@@ -72,14 +70,38 @@ static const u32 PIE_BIT_DEF[MAX_PIE_NUM][2] = {
72#define RTC_TEST2 0x2C /* 32bit rtc test reg 2 */ 70#define RTC_TEST2 0x2C /* 32bit rtc test reg 2 */
73#define RTC_TEST3 0x30 /* 32bit rtc test reg 3 */ 71#define RTC_TEST3 0x30 /* 32bit rtc test reg 3 */
74 72
73enum imx_rtc_type {
74 IMX1_RTC,
75 IMX21_RTC,
76};
77
75struct rtc_plat_data { 78struct rtc_plat_data {
76 struct rtc_device *rtc; 79 struct rtc_device *rtc;
77 void __iomem *ioaddr; 80 void __iomem *ioaddr;
78 int irq; 81 int irq;
79 struct clk *clk; 82 struct clk *clk;
80 struct rtc_time g_rtc_alarm; 83 struct rtc_time g_rtc_alarm;
84 enum imx_rtc_type devtype;
81}; 85};
82 86
87static struct platform_device_id imx_rtc_devtype[] = {
88 {
89 .name = "imx1-rtc",
90 .driver_data = IMX1_RTC,
91 }, {
92 .name = "imx21-rtc",
93 .driver_data = IMX21_RTC,
94 }, {
95 /* sentinel */
96 }
97};
98MODULE_DEVICE_TABLE(platform, imx_rtc_devtype);
99
100static inline int is_imx1_rtc(struct rtc_plat_data *data)
101{
102 return data->devtype == IMX1_RTC;
103}
104
83/* 105/*
84 * This function is used to obtain the RTC time or the alarm value in 106 * This function is used to obtain the RTC time or the alarm value in
85 * second. 107 * second.
@@ -278,10 +300,13 @@ static int mxc_rtc_read_time(struct device *dev, struct rtc_time *tm)
278 */ 300 */
279static int mxc_rtc_set_mmss(struct device *dev, unsigned long time) 301static int mxc_rtc_set_mmss(struct device *dev, unsigned long time)
280{ 302{
303 struct platform_device *pdev = to_platform_device(dev);
304 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
305
281 /* 306 /*
282 * TTC_DAYR register is 9-bit in MX1 SoC, save time and day of year only 307 * TTC_DAYR register is 9-bit in MX1 SoC, save time and day of year only
283 */ 308 */
284 if (cpu_is_mx1()) { 309 if (is_imx1_rtc(pdata)) {
285 struct rtc_time tm; 310 struct rtc_time tm;
286 311
287 rtc_time_to_tm(time, &tm); 312 rtc_time_to_tm(time, &tm);
@@ -360,6 +385,8 @@ static int __devinit mxc_rtc_probe(struct platform_device *pdev)
360 if (!pdata) 385 if (!pdata)
361 return -ENOMEM; 386 return -ENOMEM;
362 387
388 pdata->devtype = pdev->id_entry->driver_data;
389
363 if (!devm_request_mem_region(&pdev->dev, res->start, 390 if (!devm_request_mem_region(&pdev->dev, res->start,
364 resource_size(res), pdev->name)) 391 resource_size(res), pdev->name))
365 return -EBUSY; 392 return -EBUSY;
@@ -480,6 +507,7 @@ static struct platform_driver mxc_rtc_driver = {
480#endif 507#endif
481 .owner = THIS_MODULE, 508 .owner = THIS_MODULE,
482 }, 509 },
510 .id_table = imx_rtc_devtype,
483 .probe = mxc_rtc_probe, 511 .probe = mxc_rtc_probe,
484 .remove = __devexit_p(mxc_rtc_remove), 512 .remove = __devexit_p(mxc_rtc_remove),
485}; 513};
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 77823d21d314..a7a2a998fa91 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -186,7 +186,7 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
186 rtc_tm->tm_year = readb(base + S3C2410_RTCYEAR); 186 rtc_tm->tm_year = readb(base + S3C2410_RTCYEAR);
187 rtc_tm->tm_sec = readb(base + S3C2410_RTCSEC); 187 rtc_tm->tm_sec = readb(base + S3C2410_RTCSEC);
188 188
189 /* the only way to work out wether the system was mid-update 189 /* the only way to work out whether the system was mid-update
190 * when we read it is to check the second counter, and if it 190 * when we read it is to check the second counter, and if it
191 * is zero, then we re-try the entire read 191 * is zero, then we re-try the entire read
192 */ 192 */
diff --git a/drivers/rtc/rtc-tps65910.c b/drivers/rtc/rtc-tps65910.c
index 7a82337e4dee..073108dcf9e7 100644
--- a/drivers/rtc/rtc-tps65910.c
+++ b/drivers/rtc/rtc-tps65910.c
@@ -288,11 +288,11 @@ static int __devinit tps65910_rtc_probe(struct platform_device *pdev)
288static int __devexit tps65910_rtc_remove(struct platform_device *pdev) 288static int __devexit tps65910_rtc_remove(struct platform_device *pdev)
289{ 289{
290 /* leave rtc running, but disable irqs */ 290 /* leave rtc running, but disable irqs */
291 struct rtc_device *rtc = platform_get_drvdata(pdev); 291 struct tps65910_rtc *tps_rtc = platform_get_drvdata(pdev);
292 292
293 tps65910_rtc_alarm_irq_enable(&rtc->dev, 0); 293 tps65910_rtc_alarm_irq_enable(&pdev->dev, 0);
294 294
295 rtc_device_unregister(rtc); 295 rtc_device_unregister(tps_rtc->rtc);
296 return 0; 296 return 0;
297} 297}
298 298