Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 1 | /* drivers/rtc/rtc-s3c.c |
| 2 | * |
Atul Dahiya | e48add8 | 2010-07-20 12:19:14 +0530 | [diff] [blame^] | 3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. |
| 4 | * http://www.samsung.com/ |
| 5 | * |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 6 | * Copyright (c) 2004,2006 Simtec Electronics |
| 7 | * Ben Dooks, <ben@simtec.co.uk> |
| 8 | * http://armlinux.simtec.co.uk/ |
| 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 version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | * |
| 14 | * S3C2410/S3C2440/S3C24XX Internal RTC Driver |
| 15 | */ |
| 16 | |
| 17 | #include <linux/module.h> |
| 18 | #include <linux/fs.h> |
| 19 | #include <linux/string.h> |
| 20 | #include <linux/init.h> |
| 21 | #include <linux/platform_device.h> |
| 22 | #include <linux/interrupt.h> |
| 23 | #include <linux/rtc.h> |
| 24 | #include <linux/bcd.h> |
| 25 | #include <linux/clk.h> |
Robert P. J. Day | 9974b6e | 2008-02-06 01:38:42 -0800 | [diff] [blame] | 26 | #include <linux/log2.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 27 | #include <linux/slab.h> |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 28 | |
Russell King | a09e64f | 2008-08-05 16:14:15 +0100 | [diff] [blame] | 29 | #include <mach/hardware.h> |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 30 | #include <asm/uaccess.h> |
| 31 | #include <asm/io.h> |
| 32 | #include <asm/irq.h> |
Ben Dooks | e2cd00c | 2008-10-30 10:14:34 +0000 | [diff] [blame] | 33 | #include <plat/regs-rtc.h> |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 34 | |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 35 | enum s3c_cpu_type { |
| 36 | TYPE_S3C2410, |
| 37 | TYPE_S3C64XX, |
| 38 | }; |
| 39 | |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 40 | /* I have yet to find an S3C implementation with more than one |
| 41 | * of these rtc blocks in */ |
| 42 | |
| 43 | static struct resource *s3c_rtc_mem; |
| 44 | |
Atul Dahiya | e48add8 | 2010-07-20 12:19:14 +0530 | [diff] [blame^] | 45 | static struct clk *rtc_clk; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 46 | static void __iomem *s3c_rtc_base; |
| 47 | static int s3c_rtc_alarmno = NO_IRQ; |
| 48 | static int s3c_rtc_tickno = NO_IRQ; |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 49 | static enum s3c_cpu_type s3c_rtc_cpu_type; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 50 | |
| 51 | static DEFINE_SPINLOCK(s3c_rtc_pie_lock); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 52 | |
| 53 | /* IRQ Handlers */ |
| 54 | |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 55 | static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 56 | { |
| 57 | struct rtc_device *rdev = id; |
| 58 | |
David Brownell | ab6a2d7 | 2007-05-08 00:33:30 -0700 | [diff] [blame] | 59 | rtc_update_irq(rdev, 1, RTC_AF | RTC_IRQF); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 60 | return IRQ_HANDLED; |
| 61 | } |
| 62 | |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 63 | static irqreturn_t s3c_rtc_tickirq(int irq, void *id) |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 64 | { |
| 65 | struct rtc_device *rdev = id; |
| 66 | |
Ben Dooks | 773be7e | 2008-07-23 21:30:45 -0700 | [diff] [blame] | 67 | rtc_update_irq(rdev, 1, RTC_PF | RTC_IRQF); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 68 | return IRQ_HANDLED; |
| 69 | } |
| 70 | |
| 71 | /* Update control registers */ |
| 72 | static void s3c_rtc_setaie(int to) |
| 73 | { |
| 74 | unsigned int tmp; |
| 75 | |
Harvey Harrison | 2a4e2b878 | 2008-04-28 02:12:00 -0700 | [diff] [blame] | 76 | pr_debug("%s: aie=%d\n", __func__, to); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 77 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 78 | tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 79 | |
| 80 | if (to) |
| 81 | tmp |= S3C2410_RTCALM_ALMEN; |
| 82 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 83 | writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 84 | } |
| 85 | |
Ben Dooks | 773be7e | 2008-07-23 21:30:45 -0700 | [diff] [blame] | 86 | static int s3c_rtc_setpie(struct device *dev, int enabled) |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 87 | { |
| 88 | unsigned int tmp; |
| 89 | |
Ben Dooks | 773be7e | 2008-07-23 21:30:45 -0700 | [diff] [blame] | 90 | pr_debug("%s: pie=%d\n", __func__, enabled); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 91 | |
| 92 | spin_lock_irq(&s3c_rtc_pie_lock); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 93 | |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 94 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
| 95 | tmp = readb(s3c_rtc_base + S3C2410_RTCCON); |
| 96 | tmp &= ~S3C64XX_RTCCON_TICEN; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 97 | |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 98 | if (enabled) |
| 99 | tmp |= S3C64XX_RTCCON_TICEN; |
| 100 | |
| 101 | writeb(tmp, s3c_rtc_base + S3C2410_RTCCON); |
| 102 | } else { |
| 103 | tmp = readb(s3c_rtc_base + S3C2410_TICNT); |
| 104 | tmp &= ~S3C2410_TICNT_ENABLE; |
| 105 | |
| 106 | if (enabled) |
| 107 | tmp |= S3C2410_TICNT_ENABLE; |
| 108 | |
| 109 | writeb(tmp, s3c_rtc_base + S3C2410_TICNT); |
| 110 | } |
| 111 | |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 112 | spin_unlock_irq(&s3c_rtc_pie_lock); |
Ben Dooks | 773be7e | 2008-07-23 21:30:45 -0700 | [diff] [blame] | 113 | |
| 114 | return 0; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 115 | } |
| 116 | |
Ben Dooks | 773be7e | 2008-07-23 21:30:45 -0700 | [diff] [blame] | 117 | static int s3c_rtc_setfreq(struct device *dev, int freq) |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 118 | { |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 119 | struct platform_device *pdev = to_platform_device(dev); |
| 120 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); |
| 121 | unsigned int tmp = 0; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 122 | |
Jonathan Cameron | 5d2a503 | 2009-01-06 14:42:12 -0800 | [diff] [blame] | 123 | if (!is_power_of_2(freq)) |
| 124 | return -EINVAL; |
| 125 | |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 126 | spin_lock_irq(&s3c_rtc_pie_lock); |
Ben Dooks | 773be7e | 2008-07-23 21:30:45 -0700 | [diff] [blame] | 127 | |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 128 | if (s3c_rtc_cpu_type == TYPE_S3C2410) { |
| 129 | tmp = readb(s3c_rtc_base + S3C2410_TICNT); |
| 130 | tmp &= S3C2410_TICNT_ENABLE; |
| 131 | } |
| 132 | |
| 133 | tmp |= (rtc_dev->max_user_freq / freq)-1; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 134 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 135 | writeb(tmp, s3c_rtc_base + S3C2410_TICNT); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 136 | spin_unlock_irq(&s3c_rtc_pie_lock); |
Ben Dooks | 773be7e | 2008-07-23 21:30:45 -0700 | [diff] [blame] | 137 | |
| 138 | return 0; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | /* Time read/write */ |
| 142 | |
| 143 | static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) |
| 144 | { |
| 145 | unsigned int have_retried = 0; |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 146 | void __iomem *base = s3c_rtc_base; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 147 | |
| 148 | retry_get_time: |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 149 | rtc_tm->tm_min = readb(base + S3C2410_RTCMIN); |
| 150 | rtc_tm->tm_hour = readb(base + S3C2410_RTCHOUR); |
| 151 | rtc_tm->tm_mday = readb(base + S3C2410_RTCDATE); |
| 152 | rtc_tm->tm_mon = readb(base + S3C2410_RTCMON); |
| 153 | rtc_tm->tm_year = readb(base + S3C2410_RTCYEAR); |
| 154 | rtc_tm->tm_sec = readb(base + S3C2410_RTCSEC); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 155 | |
| 156 | /* the only way to work out wether the system was mid-update |
| 157 | * when we read it is to check the second counter, and if it |
| 158 | * is zero, then we re-try the entire read |
| 159 | */ |
| 160 | |
| 161 | if (rtc_tm->tm_sec == 0 && !have_retried) { |
| 162 | have_retried = 1; |
| 163 | goto retry_get_time; |
| 164 | } |
| 165 | |
| 166 | pr_debug("read time %02x.%02x.%02x %02x/%02x/%02x\n", |
| 167 | rtc_tm->tm_year, rtc_tm->tm_mon, rtc_tm->tm_mday, |
| 168 | rtc_tm->tm_hour, rtc_tm->tm_min, rtc_tm->tm_sec); |
| 169 | |
Adrian Bunk | fe20ba7 | 2008-10-18 20:28:41 -0700 | [diff] [blame] | 170 | rtc_tm->tm_sec = bcd2bin(rtc_tm->tm_sec); |
| 171 | rtc_tm->tm_min = bcd2bin(rtc_tm->tm_min); |
| 172 | rtc_tm->tm_hour = bcd2bin(rtc_tm->tm_hour); |
| 173 | rtc_tm->tm_mday = bcd2bin(rtc_tm->tm_mday); |
| 174 | rtc_tm->tm_mon = bcd2bin(rtc_tm->tm_mon); |
| 175 | rtc_tm->tm_year = bcd2bin(rtc_tm->tm_year); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 176 | |
| 177 | rtc_tm->tm_year += 100; |
| 178 | rtc_tm->tm_mon -= 1; |
| 179 | |
| 180 | return 0; |
| 181 | } |
| 182 | |
| 183 | static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) |
| 184 | { |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 185 | void __iomem *base = s3c_rtc_base; |
Ben Dooks | 641741e | 2006-08-27 01:23:27 -0700 | [diff] [blame] | 186 | int year = tm->tm_year - 100; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 187 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 188 | pr_debug("set time %02d.%02d.%02d %02d/%02d/%02d\n", |
| 189 | tm->tm_year, tm->tm_mon, tm->tm_mday, |
| 190 | tm->tm_hour, tm->tm_min, tm->tm_sec); |
| 191 | |
Ben Dooks | 641741e | 2006-08-27 01:23:27 -0700 | [diff] [blame] | 192 | /* we get around y2k by simply not supporting it */ |
| 193 | |
| 194 | if (year < 0 || year >= 100) { |
| 195 | dev_err(dev, "rtc only supports 100 years\n"); |
| 196 | return -EINVAL; |
| 197 | } |
| 198 | |
Adrian Bunk | fe20ba7 | 2008-10-18 20:28:41 -0700 | [diff] [blame] | 199 | writeb(bin2bcd(tm->tm_sec), base + S3C2410_RTCSEC); |
| 200 | writeb(bin2bcd(tm->tm_min), base + S3C2410_RTCMIN); |
| 201 | writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR); |
| 202 | writeb(bin2bcd(tm->tm_mday), base + S3C2410_RTCDATE); |
| 203 | writeb(bin2bcd(tm->tm_mon + 1), base + S3C2410_RTCMON); |
| 204 | writeb(bin2bcd(year), base + S3C2410_RTCYEAR); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 205 | |
| 206 | return 0; |
| 207 | } |
| 208 | |
| 209 | static int s3c_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm) |
| 210 | { |
| 211 | struct rtc_time *alm_tm = &alrm->time; |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 212 | void __iomem *base = s3c_rtc_base; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 213 | unsigned int alm_en; |
| 214 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 215 | alm_tm->tm_sec = readb(base + S3C2410_ALMSEC); |
| 216 | alm_tm->tm_min = readb(base + S3C2410_ALMMIN); |
| 217 | alm_tm->tm_hour = readb(base + S3C2410_ALMHOUR); |
| 218 | alm_tm->tm_mon = readb(base + S3C2410_ALMMON); |
| 219 | alm_tm->tm_mday = readb(base + S3C2410_ALMDATE); |
| 220 | alm_tm->tm_year = readb(base + S3C2410_ALMYEAR); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 221 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 222 | alm_en = readb(base + S3C2410_RTCALM); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 223 | |
David Brownell | a2db8df | 2006-12-13 00:35:08 -0800 | [diff] [blame] | 224 | alrm->enabled = (alm_en & S3C2410_RTCALM_ALMEN) ? 1 : 0; |
| 225 | |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 226 | pr_debug("read alarm %02x %02x.%02x.%02x %02x/%02x/%02x\n", |
| 227 | alm_en, |
| 228 | alm_tm->tm_year, alm_tm->tm_mon, alm_tm->tm_mday, |
| 229 | alm_tm->tm_hour, alm_tm->tm_min, alm_tm->tm_sec); |
| 230 | |
| 231 | |
| 232 | /* decode the alarm enable field */ |
| 233 | |
| 234 | if (alm_en & S3C2410_RTCALM_SECEN) |
Adrian Bunk | fe20ba7 | 2008-10-18 20:28:41 -0700 | [diff] [blame] | 235 | alm_tm->tm_sec = bcd2bin(alm_tm->tm_sec); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 236 | else |
| 237 | alm_tm->tm_sec = 0xff; |
| 238 | |
| 239 | if (alm_en & S3C2410_RTCALM_MINEN) |
Adrian Bunk | fe20ba7 | 2008-10-18 20:28:41 -0700 | [diff] [blame] | 240 | alm_tm->tm_min = bcd2bin(alm_tm->tm_min); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 241 | else |
| 242 | alm_tm->tm_min = 0xff; |
| 243 | |
| 244 | if (alm_en & S3C2410_RTCALM_HOUREN) |
Adrian Bunk | fe20ba7 | 2008-10-18 20:28:41 -0700 | [diff] [blame] | 245 | alm_tm->tm_hour = bcd2bin(alm_tm->tm_hour); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 246 | else |
| 247 | alm_tm->tm_hour = 0xff; |
| 248 | |
| 249 | if (alm_en & S3C2410_RTCALM_DAYEN) |
Adrian Bunk | fe20ba7 | 2008-10-18 20:28:41 -0700 | [diff] [blame] | 250 | alm_tm->tm_mday = bcd2bin(alm_tm->tm_mday); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 251 | else |
| 252 | alm_tm->tm_mday = 0xff; |
| 253 | |
| 254 | if (alm_en & S3C2410_RTCALM_MONEN) { |
Adrian Bunk | fe20ba7 | 2008-10-18 20:28:41 -0700 | [diff] [blame] | 255 | alm_tm->tm_mon = bcd2bin(alm_tm->tm_mon); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 256 | alm_tm->tm_mon -= 1; |
| 257 | } else { |
| 258 | alm_tm->tm_mon = 0xff; |
| 259 | } |
| 260 | |
| 261 | if (alm_en & S3C2410_RTCALM_YEAREN) |
Adrian Bunk | fe20ba7 | 2008-10-18 20:28:41 -0700 | [diff] [blame] | 262 | alm_tm->tm_year = bcd2bin(alm_tm->tm_year); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 263 | else |
| 264 | alm_tm->tm_year = 0xffff; |
| 265 | |
| 266 | return 0; |
| 267 | } |
| 268 | |
| 269 | static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) |
| 270 | { |
| 271 | struct rtc_time *tm = &alrm->time; |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 272 | void __iomem *base = s3c_rtc_base; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 273 | unsigned int alrm_en; |
| 274 | |
| 275 | pr_debug("s3c_rtc_setalarm: %d, %02x/%02x/%02x %02x.%02x.%02x\n", |
| 276 | alrm->enabled, |
| 277 | tm->tm_mday & 0xff, tm->tm_mon & 0xff, tm->tm_year & 0xff, |
| 278 | tm->tm_hour & 0xff, tm->tm_min & 0xff, tm->tm_sec); |
| 279 | |
| 280 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 281 | alrm_en = readb(base + S3C2410_RTCALM) & S3C2410_RTCALM_ALMEN; |
| 282 | writeb(0x00, base + S3C2410_RTCALM); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 283 | |
| 284 | if (tm->tm_sec < 60 && tm->tm_sec >= 0) { |
| 285 | alrm_en |= S3C2410_RTCALM_SECEN; |
Adrian Bunk | fe20ba7 | 2008-10-18 20:28:41 -0700 | [diff] [blame] | 286 | writeb(bin2bcd(tm->tm_sec), base + S3C2410_ALMSEC); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | if (tm->tm_min < 60 && tm->tm_min >= 0) { |
| 290 | alrm_en |= S3C2410_RTCALM_MINEN; |
Adrian Bunk | fe20ba7 | 2008-10-18 20:28:41 -0700 | [diff] [blame] | 291 | writeb(bin2bcd(tm->tm_min), base + S3C2410_ALMMIN); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 292 | } |
| 293 | |
| 294 | if (tm->tm_hour < 24 && tm->tm_hour >= 0) { |
| 295 | alrm_en |= S3C2410_RTCALM_HOUREN; |
Adrian Bunk | fe20ba7 | 2008-10-18 20:28:41 -0700 | [diff] [blame] | 296 | writeb(bin2bcd(tm->tm_hour), base + S3C2410_ALMHOUR); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 297 | } |
| 298 | |
| 299 | pr_debug("setting S3C2410_RTCALM to %08x\n", alrm_en); |
| 300 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 301 | writeb(alrm_en, base + S3C2410_RTCALM); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 302 | |
Ben Dooks | 773be7e | 2008-07-23 21:30:45 -0700 | [diff] [blame] | 303 | s3c_rtc_setaie(alrm->enabled); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 304 | |
| 305 | if (alrm->enabled) |
| 306 | enable_irq_wake(s3c_rtc_alarmno); |
| 307 | else |
| 308 | disable_irq_wake(s3c_rtc_alarmno); |
| 309 | |
| 310 | return 0; |
| 311 | } |
| 312 | |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 313 | static int s3c_rtc_proc(struct device *dev, struct seq_file *seq) |
| 314 | { |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 315 | unsigned int ticnt; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 316 | |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 317 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
| 318 | ticnt = readb(s3c_rtc_base + S3C2410_RTCCON); |
| 319 | ticnt &= S3C64XX_RTCCON_TICEN; |
| 320 | } else { |
| 321 | ticnt = readb(s3c_rtc_base + S3C2410_TICNT); |
| 322 | ticnt &= S3C2410_TICNT_ENABLE; |
| 323 | } |
| 324 | |
| 325 | seq_printf(seq, "periodic_IRQ\t: %s\n", ticnt ? "yes" : "no"); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 326 | return 0; |
| 327 | } |
| 328 | |
| 329 | static int s3c_rtc_open(struct device *dev) |
| 330 | { |
| 331 | struct platform_device *pdev = to_platform_device(dev); |
| 332 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); |
| 333 | int ret; |
| 334 | |
| 335 | ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq, |
Thomas Gleixner | 38515e9 | 2007-02-14 00:33:16 -0800 | [diff] [blame] | 336 | IRQF_DISABLED, "s3c2410-rtc alarm", rtc_dev); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 337 | |
| 338 | if (ret) { |
| 339 | dev_err(dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret); |
| 340 | return ret; |
| 341 | } |
| 342 | |
| 343 | ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq, |
Thomas Gleixner | 38515e9 | 2007-02-14 00:33:16 -0800 | [diff] [blame] | 344 | IRQF_DISABLED, "s3c2410-rtc tick", rtc_dev); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 345 | |
| 346 | if (ret) { |
| 347 | dev_err(dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret); |
| 348 | goto tick_err; |
| 349 | } |
| 350 | |
| 351 | return ret; |
| 352 | |
| 353 | tick_err: |
| 354 | free_irq(s3c_rtc_alarmno, rtc_dev); |
| 355 | return ret; |
| 356 | } |
| 357 | |
| 358 | static void s3c_rtc_release(struct device *dev) |
| 359 | { |
| 360 | struct platform_device *pdev = to_platform_device(dev); |
| 361 | struct rtc_device *rtc_dev = platform_get_drvdata(pdev); |
| 362 | |
| 363 | /* do not clear AIE here, it may be needed for wake */ |
| 364 | |
Ben Dooks | 773be7e | 2008-07-23 21:30:45 -0700 | [diff] [blame] | 365 | s3c_rtc_setpie(dev, 0); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 366 | free_irq(s3c_rtc_alarmno, rtc_dev); |
| 367 | free_irq(s3c_rtc_tickno, rtc_dev); |
| 368 | } |
| 369 | |
David Brownell | ff8371a | 2006-09-30 23:28:17 -0700 | [diff] [blame] | 370 | static const struct rtc_class_ops s3c_rtcops = { |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 371 | .open = s3c_rtc_open, |
| 372 | .release = s3c_rtc_release, |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 373 | .read_time = s3c_rtc_gettime, |
| 374 | .set_time = s3c_rtc_settime, |
| 375 | .read_alarm = s3c_rtc_getalarm, |
| 376 | .set_alarm = s3c_rtc_setalarm, |
Ben Dooks | 773be7e | 2008-07-23 21:30:45 -0700 | [diff] [blame] | 377 | .irq_set_freq = s3c_rtc_setfreq, |
| 378 | .irq_set_state = s3c_rtc_setpie, |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 379 | .proc = s3c_rtc_proc, |
| 380 | }; |
| 381 | |
| 382 | static void s3c_rtc_enable(struct platform_device *pdev, int en) |
| 383 | { |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 384 | void __iomem *base = s3c_rtc_base; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 385 | unsigned int tmp; |
| 386 | |
| 387 | if (s3c_rtc_base == NULL) |
| 388 | return; |
| 389 | |
| 390 | if (!en) { |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 391 | tmp = readb(base + S3C2410_RTCCON); |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 392 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) |
| 393 | tmp &= ~S3C64XX_RTCCON_TICEN; |
| 394 | tmp &= ~S3C2410_RTCCON_RTCEN; |
| 395 | writeb(tmp, base + S3C2410_RTCCON); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 396 | |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 397 | if (s3c_rtc_cpu_type == TYPE_S3C2410) { |
| 398 | tmp = readb(base + S3C2410_TICNT); |
| 399 | tmp &= ~S3C2410_TICNT_ENABLE; |
| 400 | writeb(tmp, base + S3C2410_TICNT); |
| 401 | } |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 402 | } else { |
| 403 | /* re-enable the device, and check it is ok */ |
| 404 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 405 | if ((readb(base+S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){ |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 406 | dev_info(&pdev->dev, "rtc disabled, re-enabling\n"); |
| 407 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 408 | tmp = readb(base + S3C2410_RTCCON); |
| 409 | writeb(tmp|S3C2410_RTCCON_RTCEN, base+S3C2410_RTCCON); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 410 | } |
| 411 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 412 | if ((readb(base + S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){ |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 413 | dev_info(&pdev->dev, "removing RTCCON_CNTSEL\n"); |
| 414 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 415 | tmp = readb(base + S3C2410_RTCCON); |
| 416 | writeb(tmp& ~S3C2410_RTCCON_CNTSEL, base+S3C2410_RTCCON); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 417 | } |
| 418 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 419 | if ((readb(base + S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){ |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 420 | dev_info(&pdev->dev, "removing RTCCON_CLKRST\n"); |
| 421 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 422 | tmp = readb(base + S3C2410_RTCCON); |
| 423 | writeb(tmp & ~S3C2410_RTCCON_CLKRST, base+S3C2410_RTCCON); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 424 | } |
| 425 | } |
| 426 | } |
| 427 | |
Ben Dooks | 4cd0c5c | 2008-07-23 21:30:44 -0700 | [diff] [blame] | 428 | static int __devexit s3c_rtc_remove(struct platform_device *dev) |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 429 | { |
| 430 | struct rtc_device *rtc = platform_get_drvdata(dev); |
| 431 | |
| 432 | platform_set_drvdata(dev, NULL); |
| 433 | rtc_device_unregister(rtc); |
| 434 | |
Ben Dooks | 773be7e | 2008-07-23 21:30:45 -0700 | [diff] [blame] | 435 | s3c_rtc_setpie(&dev->dev, 0); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 436 | s3c_rtc_setaie(0); |
| 437 | |
Atul Dahiya | e48add8 | 2010-07-20 12:19:14 +0530 | [diff] [blame^] | 438 | clk_disable(rtc_clk); |
| 439 | clk_put(rtc_clk); |
| 440 | rtc_clk = NULL; |
| 441 | |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 442 | iounmap(s3c_rtc_base); |
| 443 | release_resource(s3c_rtc_mem); |
| 444 | kfree(s3c_rtc_mem); |
| 445 | |
| 446 | return 0; |
| 447 | } |
| 448 | |
Ben Dooks | 4cd0c5c | 2008-07-23 21:30:44 -0700 | [diff] [blame] | 449 | static int __devinit s3c_rtc_probe(struct platform_device *pdev) |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 450 | { |
| 451 | struct rtc_device *rtc; |
| 452 | struct resource *res; |
| 453 | int ret; |
| 454 | |
Harvey Harrison | 2a4e2b878 | 2008-04-28 02:12:00 -0700 | [diff] [blame] | 455 | pr_debug("%s: probe=%p\n", __func__, pdev); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 456 | |
| 457 | /* find the IRQs */ |
| 458 | |
| 459 | s3c_rtc_tickno = platform_get_irq(pdev, 1); |
| 460 | if (s3c_rtc_tickno < 0) { |
| 461 | dev_err(&pdev->dev, "no irq for rtc tick\n"); |
| 462 | return -ENOENT; |
| 463 | } |
| 464 | |
| 465 | s3c_rtc_alarmno = platform_get_irq(pdev, 0); |
| 466 | if (s3c_rtc_alarmno < 0) { |
| 467 | dev_err(&pdev->dev, "no irq for alarm\n"); |
| 468 | return -ENOENT; |
| 469 | } |
| 470 | |
| 471 | pr_debug("s3c2410_rtc: tick irq %d, alarm irq %d\n", |
| 472 | s3c_rtc_tickno, s3c_rtc_alarmno); |
| 473 | |
| 474 | /* get the memory region */ |
| 475 | |
| 476 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 477 | if (res == NULL) { |
| 478 | dev_err(&pdev->dev, "failed to get memory region resource\n"); |
| 479 | return -ENOENT; |
| 480 | } |
| 481 | |
| 482 | s3c_rtc_mem = request_mem_region(res->start, |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 483 | res->end-res->start+1, |
| 484 | pdev->name); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 485 | |
| 486 | if (s3c_rtc_mem == NULL) { |
| 487 | dev_err(&pdev->dev, "failed to reserve memory region\n"); |
| 488 | ret = -ENOENT; |
| 489 | goto err_nores; |
| 490 | } |
| 491 | |
| 492 | s3c_rtc_base = ioremap(res->start, res->end - res->start + 1); |
| 493 | if (s3c_rtc_base == NULL) { |
| 494 | dev_err(&pdev->dev, "failed ioremap()\n"); |
| 495 | ret = -EINVAL; |
| 496 | goto err_nomap; |
| 497 | } |
| 498 | |
Atul Dahiya | e48add8 | 2010-07-20 12:19:14 +0530 | [diff] [blame^] | 499 | rtc_clk = clk_get(&pdev->dev, "rtc"); |
| 500 | if (IS_ERR(rtc_clk)) { |
| 501 | dev_err(&pdev->dev, "failed to find rtc clock source\n"); |
| 502 | ret = PTR_ERR(rtc_clk); |
| 503 | rtc_clk = NULL; |
| 504 | goto err_clk; |
| 505 | } |
| 506 | |
| 507 | clk_enable(rtc_clk); |
| 508 | |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 509 | /* check to see if everything is setup correctly */ |
| 510 | |
| 511 | s3c_rtc_enable(pdev, 1); |
| 512 | |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 513 | pr_debug("s3c2410_rtc: RTCCON=%02x\n", |
| 514 | readb(s3c_rtc_base + S3C2410_RTCCON)); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 515 | |
Yauhen Kharuzhy | 51b7616 | 2008-10-29 14:01:16 -0700 | [diff] [blame] | 516 | device_init_wakeup(&pdev->dev, 1); |
| 517 | |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 518 | /* register RTC and exit */ |
| 519 | |
| 520 | rtc = rtc_device_register("s3c", &pdev->dev, &s3c_rtcops, |
| 521 | THIS_MODULE); |
| 522 | |
| 523 | if (IS_ERR(rtc)) { |
| 524 | dev_err(&pdev->dev, "cannot attach rtc\n"); |
| 525 | ret = PTR_ERR(rtc); |
| 526 | goto err_nortc; |
| 527 | } |
| 528 | |
Maurus Cuelenaere | eaa6e4d | 2010-06-04 14:14:46 -0700 | [diff] [blame] | 529 | s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data; |
| 530 | |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 531 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) |
| 532 | rtc->max_user_freq = 32768; |
| 533 | else |
| 534 | rtc->max_user_freq = 128; |
| 535 | |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 536 | platform_set_drvdata(pdev, rtc); |
Maurus Cuelenaere | e893de5 | 2010-06-04 14:14:44 -0700 | [diff] [blame] | 537 | |
| 538 | s3c_rtc_setfreq(&pdev->dev, 1); |
| 539 | |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 540 | return 0; |
| 541 | |
| 542 | err_nortc: |
| 543 | s3c_rtc_enable(pdev, 0); |
Atul Dahiya | e48add8 | 2010-07-20 12:19:14 +0530 | [diff] [blame^] | 544 | clk_disable(rtc_clk); |
| 545 | clk_put(rtc_clk); |
| 546 | |
| 547 | err_clk: |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 548 | iounmap(s3c_rtc_base); |
| 549 | |
| 550 | err_nomap: |
| 551 | release_resource(s3c_rtc_mem); |
| 552 | |
| 553 | err_nores: |
| 554 | return ret; |
| 555 | } |
| 556 | |
| 557 | #ifdef CONFIG_PM |
| 558 | |
| 559 | /* RTC Power management control */ |
| 560 | |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 561 | static int ticnt_save, ticnt_en_save; |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 562 | |
| 563 | static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) |
| 564 | { |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 565 | /* save TICNT for anyone using periodic interrupts */ |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 566 | ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT); |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 567 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { |
| 568 | ticnt_en_save = readb(s3c_rtc_base + S3C2410_RTCCON); |
| 569 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; |
| 570 | } |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 571 | s3c_rtc_enable(pdev, 0); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 572 | return 0; |
| 573 | } |
| 574 | |
| 575 | static int s3c_rtc_resume(struct platform_device *pdev) |
| 576 | { |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 577 | unsigned int tmp; |
| 578 | |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 579 | s3c_rtc_enable(pdev, 1); |
Ben Dooks | 9a65451 | 2006-08-27 01:23:22 -0700 | [diff] [blame] | 580 | writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT); |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 581 | if (s3c_rtc_cpu_type == TYPE_S3C64XX && ticnt_en_save) { |
| 582 | tmp = readb(s3c_rtc_base + S3C2410_RTCCON); |
| 583 | writeb(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); |
| 584 | } |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 585 | return 0; |
| 586 | } |
| 587 | #else |
| 588 | #define s3c_rtc_suspend NULL |
| 589 | #define s3c_rtc_resume NULL |
| 590 | #endif |
| 591 | |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 592 | static struct platform_device_id s3c_rtc_driver_ids[] = { |
| 593 | { |
| 594 | .name = "s3c2410-rtc", |
| 595 | .driver_data = TYPE_S3C2410, |
| 596 | }, { |
| 597 | .name = "s3c64xx-rtc", |
| 598 | .driver_data = TYPE_S3C64XX, |
| 599 | }, |
| 600 | { } |
| 601 | }; |
| 602 | |
| 603 | MODULE_DEVICE_TABLE(platform, s3c_rtc_driver_ids); |
| 604 | |
| 605 | static struct platform_driver s3c_rtc_driver = { |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 606 | .probe = s3c_rtc_probe, |
Ben Dooks | 4cd0c5c | 2008-07-23 21:30:44 -0700 | [diff] [blame] | 607 | .remove = __devexit_p(s3c_rtc_remove), |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 608 | .suspend = s3c_rtc_suspend, |
| 609 | .resume = s3c_rtc_resume, |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 610 | .id_table = s3c_rtc_driver_ids, |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 611 | .driver = { |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 612 | .name = "s3c-rtc", |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 613 | .owner = THIS_MODULE, |
| 614 | }, |
| 615 | }; |
| 616 | |
| 617 | static char __initdata banner[] = "S3C24XX RTC, (c) 2004,2006 Simtec Electronics\n"; |
| 618 | |
| 619 | static int __init s3c_rtc_init(void) |
| 620 | { |
| 621 | printk(banner); |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 622 | return platform_driver_register(&s3c_rtc_driver); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 623 | } |
| 624 | |
| 625 | static void __exit s3c_rtc_exit(void) |
| 626 | { |
Maurus Cuelenaere | 9f4123b | 2010-05-24 14:33:43 -0700 | [diff] [blame] | 627 | platform_driver_unregister(&s3c_rtc_driver); |
Ben Dooks | 1add678 | 2006-07-01 04:36:26 -0700 | [diff] [blame] | 628 | } |
| 629 | |
| 630 | module_init(s3c_rtc_init); |
| 631 | module_exit(s3c_rtc_exit); |
| 632 | |
| 633 | MODULE_DESCRIPTION("Samsung S3C RTC Driver"); |
| 634 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); |
| 635 | MODULE_LICENSE("GPL"); |
Kay Sievers | ad28a07 | 2008-04-10 21:29:25 -0700 | [diff] [blame] | 636 | MODULE_ALIAS("platform:s3c2410-rtc"); |