diff options
Diffstat (limited to 'drivers/rtc/rtc-pxa.c')
-rw-r--r-- | drivers/rtc/rtc-pxa.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c index f771b2ee4b18..03c85ee719a7 100644 --- a/drivers/rtc/rtc-pxa.c +++ b/drivers/rtc/rtc-pxa.c | |||
@@ -62,6 +62,10 @@ | |||
62 | #define RYxR_MONTH_S 5 | 62 | #define RYxR_MONTH_S 5 |
63 | #define RYxR_MONTH_MASK (0xf << RYxR_MONTH_S) | 63 | #define RYxR_MONTH_MASK (0xf << RYxR_MONTH_S) |
64 | #define RYxR_DAY_MASK 0x1f | 64 | #define RYxR_DAY_MASK 0x1f |
65 | #define RDxR_WOM_S 20 | ||
66 | #define RDxR_WOM_MASK (0x7 << RDxR_WOM_S) | ||
67 | #define RDxR_DOW_S 17 | ||
68 | #define RDxR_DOW_MASK (0x7 << RDxR_DOW_S) | ||
65 | #define RDxR_HOUR_S 12 | 69 | #define RDxR_HOUR_S 12 |
66 | #define RDxR_HOUR_MASK (0x1f << RDxR_HOUR_S) | 70 | #define RDxR_HOUR_MASK (0x1f << RDxR_HOUR_S) |
67 | #define RDxR_MIN_S 6 | 71 | #define RDxR_MIN_S 6 |
@@ -91,6 +95,7 @@ struct pxa_rtc { | |||
91 | spinlock_t lock; /* Protects this structure */ | 95 | spinlock_t lock; /* Protects this structure */ |
92 | }; | 96 | }; |
93 | 97 | ||
98 | |||
94 | static u32 ryxr_calc(struct rtc_time *tm) | 99 | static u32 ryxr_calc(struct rtc_time *tm) |
95 | { | 100 | { |
96 | return ((tm->tm_year + 1900) << RYxR_YEAR_S) | 101 | return ((tm->tm_year + 1900) << RYxR_YEAR_S) |
@@ -100,7 +105,10 @@ static u32 ryxr_calc(struct rtc_time *tm) | |||
100 | 105 | ||
101 | static u32 rdxr_calc(struct rtc_time *tm) | 106 | static u32 rdxr_calc(struct rtc_time *tm) |
102 | { | 107 | { |
103 | return (tm->tm_hour << RDxR_HOUR_S) | (tm->tm_min << RDxR_MIN_S) | 108 | return ((((tm->tm_mday + 6) / 7) << RDxR_WOM_S) & RDxR_WOM_MASK) |
109 | | (((tm->tm_wday + 1) << RDxR_DOW_S) & RDxR_DOW_MASK) | ||
110 | | (tm->tm_hour << RDxR_HOUR_S) | ||
111 | | (tm->tm_min << RDxR_MIN_S) | ||
104 | | tm->tm_sec; | 112 | | tm->tm_sec; |
105 | } | 113 | } |
106 | 114 | ||
@@ -109,6 +117,7 @@ static void tm_calc(u32 rycr, u32 rdcr, struct rtc_time *tm) | |||
109 | tm->tm_year = ((rycr & RYxR_YEAR_MASK) >> RYxR_YEAR_S) - 1900; | 117 | tm->tm_year = ((rycr & RYxR_YEAR_MASK) >> RYxR_YEAR_S) - 1900; |
110 | tm->tm_mon = (((rycr & RYxR_MONTH_MASK) >> RYxR_MONTH_S)) - 1; | 118 | tm->tm_mon = (((rycr & RYxR_MONTH_MASK) >> RYxR_MONTH_S)) - 1; |
111 | tm->tm_mday = (rycr & RYxR_DAY_MASK); | 119 | tm->tm_mday = (rycr & RYxR_DAY_MASK); |
120 | tm->tm_wday = ((rycr & RDxR_DOW_MASK) >> RDxR_DOW_S) - 1; | ||
112 | tm->tm_hour = (rdcr & RDxR_HOUR_MASK) >> RDxR_HOUR_S; | 121 | tm->tm_hour = (rdcr & RDxR_HOUR_MASK) >> RDxR_HOUR_S; |
113 | tm->tm_min = (rdcr & RDxR_MIN_MASK) >> RDxR_MIN_S; | 122 | tm->tm_min = (rdcr & RDxR_MIN_MASK) >> RDxR_MIN_S; |
114 | tm->tm_sec = rdcr & RDxR_SEC_MASK; | 123 | tm->tm_sec = rdcr & RDxR_SEC_MASK; |
@@ -300,8 +309,6 @@ static int pxa_rtc_proc(struct device *dev, struct seq_file *seq) | |||
300 | } | 309 | } |
301 | 310 | ||
302 | static const struct rtc_class_ops pxa_rtc_ops = { | 311 | static const struct rtc_class_ops pxa_rtc_ops = { |
303 | .open = pxa_rtc_open, | ||
304 | .release = pxa_rtc_release, | ||
305 | .read_time = pxa_rtc_read_time, | 312 | .read_time = pxa_rtc_read_time, |
306 | .set_time = pxa_rtc_set_time, | 313 | .set_time = pxa_rtc_set_time, |
307 | .read_alarm = pxa_rtc_read_alarm, | 314 | .read_alarm = pxa_rtc_read_alarm, |
@@ -341,7 +348,7 @@ static int __init pxa_rtc_probe(struct platform_device *pdev) | |||
341 | dev_err(dev, "No alarm IRQ resource defined\n"); | 348 | dev_err(dev, "No alarm IRQ resource defined\n"); |
342 | goto err_ress; | 349 | goto err_ress; |
343 | } | 350 | } |
344 | 351 | pxa_rtc_open(dev); | |
345 | ret = -ENOMEM; | 352 | ret = -ENOMEM; |
346 | pxa_rtc->base = ioremap(pxa_rtc->ress->start, | 353 | pxa_rtc->base = ioremap(pxa_rtc->ress->start, |
347 | resource_size(pxa_rtc->ress)); | 354 | resource_size(pxa_rtc->ress)); |
@@ -387,6 +394,9 @@ static int __exit pxa_rtc_remove(struct platform_device *pdev) | |||
387 | { | 394 | { |
388 | struct pxa_rtc *pxa_rtc = platform_get_drvdata(pdev); | 395 | struct pxa_rtc *pxa_rtc = platform_get_drvdata(pdev); |
389 | 396 | ||
397 | struct device *dev = &pdev->dev; | ||
398 | pxa_rtc_release(dev); | ||
399 | |||
390 | rtc_device_unregister(pxa_rtc->rtc); | 400 | rtc_device_unregister(pxa_rtc->rtc); |
391 | 401 | ||
392 | spin_lock_irq(&pxa_rtc->lock); | 402 | spin_lock_irq(&pxa_rtc->lock); |
@@ -444,10 +454,7 @@ static struct platform_driver pxa_rtc_driver = { | |||
444 | 454 | ||
445 | static int __init pxa_rtc_init(void) | 455 | static int __init pxa_rtc_init(void) |
446 | { | 456 | { |
447 | if (cpu_is_pxa27x() || cpu_is_pxa3xx()) | 457 | return platform_driver_probe(&pxa_rtc_driver, pxa_rtc_probe); |
448 | return platform_driver_probe(&pxa_rtc_driver, pxa_rtc_probe); | ||
449 | |||
450 | return -ENODEV; | ||
451 | } | 458 | } |
452 | 459 | ||
453 | static void __exit pxa_rtc_exit(void) | 460 | static void __exit pxa_rtc_exit(void) |