aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2018-03-22 06:18:30 -0400
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2018-03-27 04:45:05 -0400
commit7bbd523c73c9fe0dac7938065f7f5a7167f59b5d (patch)
tree8d1a213ef80bf98ae827d42078371e64b2b5e362
parentc7d50d2b728cc29535fbc1de7cae25ab14629642 (diff)
rtc: ab8500: Drop AB8540 support
The AB8540 was an evolved version of the AB8500, but it was never mass produced or put into products, only reference designs exist. The upstream support was never completed and it is unlikely that this will happen so drop the support for now to simplify maintenance of the AB8500. Cc: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r--drivers/rtc/rtc-ab8500.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c
index 98c7123cd7ba..e28f4401fd35 100644
--- a/drivers/rtc/rtc-ab8500.c
+++ b/drivers/rtc/rtc-ab8500.c
@@ -36,10 +36,6 @@
36#define AB8500_RTC_FORCE_BKUP_REG 0x0D 36#define AB8500_RTC_FORCE_BKUP_REG 0x0D
37#define AB8500_RTC_CALIB_REG 0x0E 37#define AB8500_RTC_CALIB_REG 0x0E
38#define AB8500_RTC_SWITCH_STAT_REG 0x0F 38#define AB8500_RTC_SWITCH_STAT_REG 0x0F
39#define AB8540_RTC_ALRM_SEC 0x22
40#define AB8540_RTC_ALRM_MIN_LOW_REG 0x23
41#define AB8540_RTC_ALRM_MIN_MID_REG 0x24
42#define AB8540_RTC_ALRM_MIN_HI_REG 0x25
43 39
44/* RtcReadRequest bits */ 40/* RtcReadRequest bits */
45#define RTC_READ_REQUEST 0x01 41#define RTC_READ_REQUEST 0x01
@@ -63,11 +59,6 @@ static const u8 ab8500_rtc_alarm_regs[] = {
63 AB8500_RTC_ALRM_MIN_LOW_REG 59 AB8500_RTC_ALRM_MIN_LOW_REG
64}; 60};
65 61
66static const u8 ab8540_rtc_alarm_regs[] = {
67 AB8540_RTC_ALRM_MIN_HI_REG, AB8540_RTC_ALRM_MIN_MID_REG,
68 AB8540_RTC_ALRM_MIN_LOW_REG, AB8540_RTC_ALRM_SEC
69};
70
71/* Calculate the seconds from 1970 to 01-01-2000 00:00:00 */ 62/* Calculate the seconds from 1970 to 01-01-2000 00:00:00 */
72static unsigned long get_elapsed_seconds(int year) 63static unsigned long get_elapsed_seconds(int year)
73{ 64{
@@ -277,43 +268,6 @@ static int ab8500_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
277 return ab8500_rtc_irq_enable(dev, alarm->enabled); 268 return ab8500_rtc_irq_enable(dev, alarm->enabled);
278} 269}
279 270
280static int ab8540_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
281{
282 int retval, i;
283 unsigned char buf[ARRAY_SIZE(ab8540_rtc_alarm_regs)];
284 unsigned long mins, secs = 0;
285
286 if (alarm->time.tm_year < (AB8500_RTC_EPOCH - 1900)) {
287 dev_dbg(dev, "year should be equal to or greater than %d\n",
288 AB8500_RTC_EPOCH);
289 return -EINVAL;
290 }
291
292 /* Get the number of seconds since 1970 */
293 rtc_tm_to_time(&alarm->time, &secs);
294
295 /*
296 * Convert it to the number of seconds since 01-01-2000 00:00:00
297 */
298 secs -= get_elapsed_seconds(AB8500_RTC_EPOCH);
299 mins = secs / 60;
300
301 buf[3] = secs % 60;
302 buf[2] = mins & 0xFF;
303 buf[1] = (mins >> 8) & 0xFF;
304 buf[0] = (mins >> 16) & 0xFF;
305
306 /* Set the alarm time */
307 for (i = 0; i < ARRAY_SIZE(ab8540_rtc_alarm_regs); i++) {
308 retval = abx500_set_register_interruptible(dev, AB8500_RTC,
309 ab8540_rtc_alarm_regs[i], buf[i]);
310 if (retval < 0)
311 return retval;
312 }
313
314 return ab8500_rtc_irq_enable(dev, alarm->enabled);
315}
316
317static int ab8500_rtc_set_calibration(struct device *dev, int calibration) 271static int ab8500_rtc_set_calibration(struct device *dev, int calibration)
318{ 272{
319 int retval; 273 int retval;
@@ -435,17 +389,8 @@ static const struct rtc_class_ops ab8500_rtc_ops = {
435 .alarm_irq_enable = ab8500_rtc_irq_enable, 389 .alarm_irq_enable = ab8500_rtc_irq_enable,
436}; 390};
437 391
438static const struct rtc_class_ops ab8540_rtc_ops = {
439 .read_time = ab8500_rtc_read_time,
440 .set_time = ab8500_rtc_set_time,
441 .read_alarm = ab8500_rtc_read_alarm,
442 .set_alarm = ab8540_rtc_set_alarm,
443 .alarm_irq_enable = ab8500_rtc_irq_enable,
444};
445
446static const struct platform_device_id ab85xx_rtc_ids[] = { 392static const struct platform_device_id ab85xx_rtc_ids[] = {
447 { "ab8500-rtc", (kernel_ulong_t)&ab8500_rtc_ops, }, 393 { "ab8500-rtc", (kernel_ulong_t)&ab8500_rtc_ops, },
448 { "ab8540-rtc", (kernel_ulong_t)&ab8540_rtc_ops, },
449 { /* sentinel */ } 394 { /* sentinel */ }
450}; 395};
451MODULE_DEVICE_TABLE(platform, ab85xx_rtc_ids); 396MODULE_DEVICE_TABLE(platform, ab85xx_rtc_ids);