diff options
Diffstat (limited to 'drivers/rtc/rtc-vt8500.c')
-rw-r--r-- | drivers/rtc/rtc-vt8500.c | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c index b8bc862903ae..efd6066b5cd2 100644 --- a/drivers/rtc/rtc-vt8500.c +++ b/drivers/rtc/rtc-vt8500.c | |||
@@ -78,7 +78,6 @@ struct vt8500_rtc { | |||
78 | void __iomem *regbase; | 78 | void __iomem *regbase; |
79 | struct resource *res; | 79 | struct resource *res; |
80 | int irq_alarm; | 80 | int irq_alarm; |
81 | int irq_hz; | ||
82 | struct rtc_device *rtc; | 81 | struct rtc_device *rtc; |
83 | spinlock_t lock; /* Protects this structure */ | 82 | spinlock_t lock; /* Protects this structure */ |
84 | }; | 83 | }; |
@@ -100,10 +99,6 @@ static irqreturn_t vt8500_rtc_irq(int irq, void *dev_id) | |||
100 | if (isr & 1) | 99 | if (isr & 1) |
101 | events |= RTC_AF | RTC_IRQF; | 100 | events |= RTC_AF | RTC_IRQF; |
102 | 101 | ||
103 | /* Only second/minute interrupts are supported */ | ||
104 | if (isr & 2) | ||
105 | events |= RTC_UF | RTC_IRQF; | ||
106 | |||
107 | rtc_update_irq(vt8500_rtc->rtc, 1, events); | 102 | rtc_update_irq(vt8500_rtc->rtc, 1, events); |
108 | 103 | ||
109 | return IRQ_HANDLED; | 104 | return IRQ_HANDLED; |
@@ -199,27 +194,12 @@ static int vt8500_alarm_irq_enable(struct device *dev, unsigned int enabled) | |||
199 | return 0; | 194 | return 0; |
200 | } | 195 | } |
201 | 196 | ||
202 | static int vt8500_update_irq_enable(struct device *dev, unsigned int enabled) | ||
203 | { | ||
204 | struct vt8500_rtc *vt8500_rtc = dev_get_drvdata(dev); | ||
205 | unsigned long tmp = readl(vt8500_rtc->regbase + VT8500_RTC_CR); | ||
206 | |||
207 | if (enabled) | ||
208 | tmp |= VT8500_RTC_CR_SM_SEC | VT8500_RTC_CR_SM_ENABLE; | ||
209 | else | ||
210 | tmp &= ~VT8500_RTC_CR_SM_ENABLE; | ||
211 | |||
212 | writel(tmp, vt8500_rtc->regbase + VT8500_RTC_CR); | ||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | static const struct rtc_class_ops vt8500_rtc_ops = { | 197 | static const struct rtc_class_ops vt8500_rtc_ops = { |
217 | .read_time = vt8500_rtc_read_time, | 198 | .read_time = vt8500_rtc_read_time, |
218 | .set_time = vt8500_rtc_set_time, | 199 | .set_time = vt8500_rtc_set_time, |
219 | .read_alarm = vt8500_rtc_read_alarm, | 200 | .read_alarm = vt8500_rtc_read_alarm, |
220 | .set_alarm = vt8500_rtc_set_alarm, | 201 | .set_alarm = vt8500_rtc_set_alarm, |
221 | .alarm_irq_enable = vt8500_alarm_irq_enable, | 202 | .alarm_irq_enable = vt8500_alarm_irq_enable, |
222 | .update_irq_enable = vt8500_update_irq_enable, | ||
223 | }; | 203 | }; |
224 | 204 | ||
225 | static int __devinit vt8500_rtc_probe(struct platform_device *pdev) | 205 | static int __devinit vt8500_rtc_probe(struct platform_device *pdev) |
@@ -248,13 +228,6 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev) | |||
248 | goto err_free; | 228 | goto err_free; |
249 | } | 229 | } |
250 | 230 | ||
251 | vt8500_rtc->irq_hz = platform_get_irq(pdev, 1); | ||
252 | if (vt8500_rtc->irq_hz < 0) { | ||
253 | dev_err(&pdev->dev, "No 1Hz IRQ resource defined\n"); | ||
254 | ret = -ENXIO; | ||
255 | goto err_free; | ||
256 | } | ||
257 | |||
258 | vt8500_rtc->res = request_mem_region(vt8500_rtc->res->start, | 231 | vt8500_rtc->res = request_mem_region(vt8500_rtc->res->start, |
259 | resource_size(vt8500_rtc->res), | 232 | resource_size(vt8500_rtc->res), |
260 | "vt8500-rtc"); | 233 | "vt8500-rtc"); |
@@ -272,9 +245,8 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev) | |||
272 | goto err_release; | 245 | goto err_release; |
273 | } | 246 | } |
274 | 247 | ||
275 | /* Enable the second/minute interrupt generation and enable RTC */ | 248 | /* Enable RTC and set it to 24-hour mode */ |
276 | writel(VT8500_RTC_CR_ENABLE | VT8500_RTC_CR_24H | 249 | writel(VT8500_RTC_CR_ENABLE | VT8500_RTC_CR_24H, |
277 | | VT8500_RTC_CR_SM_ENABLE | VT8500_RTC_CR_SM_SEC, | ||
278 | vt8500_rtc->regbase + VT8500_RTC_CR); | 250 | vt8500_rtc->regbase + VT8500_RTC_CR); |
279 | 251 | ||
280 | vt8500_rtc->rtc = rtc_device_register("vt8500-rtc", &pdev->dev, | 252 | vt8500_rtc->rtc = rtc_device_register("vt8500-rtc", &pdev->dev, |
@@ -286,26 +258,16 @@ static int __devinit vt8500_rtc_probe(struct platform_device *pdev) | |||
286 | goto err_unmap; | 258 | goto err_unmap; |
287 | } | 259 | } |
288 | 260 | ||
289 | ret = request_irq(vt8500_rtc->irq_hz, vt8500_rtc_irq, 0, | ||
290 | "rtc 1Hz", vt8500_rtc); | ||
291 | if (ret < 0) { | ||
292 | dev_err(&pdev->dev, "can't get irq %i, err %d\n", | ||
293 | vt8500_rtc->irq_hz, ret); | ||
294 | goto err_unreg; | ||
295 | } | ||
296 | |||
297 | ret = request_irq(vt8500_rtc->irq_alarm, vt8500_rtc_irq, 0, | 261 | ret = request_irq(vt8500_rtc->irq_alarm, vt8500_rtc_irq, 0, |
298 | "rtc alarm", vt8500_rtc); | 262 | "rtc alarm", vt8500_rtc); |
299 | if (ret < 0) { | 263 | if (ret < 0) { |
300 | dev_err(&pdev->dev, "can't get irq %i, err %d\n", | 264 | dev_err(&pdev->dev, "can't get irq %i, err %d\n", |
301 | vt8500_rtc->irq_alarm, ret); | 265 | vt8500_rtc->irq_alarm, ret); |
302 | goto err_free_hz; | 266 | goto err_unreg; |
303 | } | 267 | } |
304 | 268 | ||
305 | return 0; | 269 | return 0; |
306 | 270 | ||
307 | err_free_hz: | ||
308 | free_irq(vt8500_rtc->irq_hz, vt8500_rtc); | ||
309 | err_unreg: | 271 | err_unreg: |
310 | rtc_device_unregister(vt8500_rtc->rtc); | 272 | rtc_device_unregister(vt8500_rtc->rtc); |
311 | err_unmap: | 273 | err_unmap: |
@@ -323,7 +285,6 @@ static int __devexit vt8500_rtc_remove(struct platform_device *pdev) | |||
323 | struct vt8500_rtc *vt8500_rtc = platform_get_drvdata(pdev); | 285 | struct vt8500_rtc *vt8500_rtc = platform_get_drvdata(pdev); |
324 | 286 | ||
325 | free_irq(vt8500_rtc->irq_alarm, vt8500_rtc); | 287 | free_irq(vt8500_rtc->irq_alarm, vt8500_rtc); |
326 | free_irq(vt8500_rtc->irq_hz, vt8500_rtc); | ||
327 | 288 | ||
328 | rtc_device_unregister(vt8500_rtc->rtc); | 289 | rtc_device_unregister(vt8500_rtc->rtc); |
329 | 290 | ||