aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rtc/rtc-at91rm9200.c46
1 files changed, 38 insertions, 8 deletions
diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c
index eeeb73f1fc3b..ab2024b159fa 100644
--- a/drivers/rtc/rtc-at91rm9200.c
+++ b/drivers/rtc/rtc-at91rm9200.c
@@ -42,6 +42,10 @@
42 42
43#define AT91_RTC_EPOCH 1900UL /* just like arch/arm/common/rtctime.c */ 43#define AT91_RTC_EPOCH 1900UL /* just like arch/arm/common/rtctime.c */
44 44
45struct at91_rtc_config {
46};
47
48static const struct at91_rtc_config *at91_rtc_config;
45static DECLARE_COMPLETION(at91_rtc_updated); 49static DECLARE_COMPLETION(at91_rtc_updated);
46static unsigned int at91_alarm_year = AT91_RTC_EPOCH; 50static unsigned int at91_alarm_year = AT91_RTC_EPOCH;
47static void __iomem *at91_rtc_regs; 51static void __iomem *at91_rtc_regs;
@@ -250,6 +254,36 @@ static irqreturn_t at91_rtc_interrupt(int irq, void *dev_id)
250 return IRQ_NONE; /* not handled */ 254 return IRQ_NONE; /* not handled */
251} 255}
252 256
257static const struct at91_rtc_config at91rm9200_config = {
258};
259
260#ifdef CONFIG_OF
261static const struct of_device_id at91_rtc_dt_ids[] = {
262 {
263 .compatible = "atmel,at91rm9200-rtc",
264 .data = &at91rm9200_config,
265 }, {
266 /* sentinel */
267 }
268};
269MODULE_DEVICE_TABLE(of, at91_rtc_dt_ids);
270#endif
271
272static const struct at91_rtc_config *
273at91_rtc_get_config(struct platform_device *pdev)
274{
275 const struct of_device_id *match;
276
277 if (pdev->dev.of_node) {
278 match = of_match_node(at91_rtc_dt_ids, pdev->dev.of_node);
279 if (!match)
280 return NULL;
281 return (const struct at91_rtc_config *)match->data;
282 }
283
284 return &at91rm9200_config;
285}
286
253static const struct rtc_class_ops at91_rtc_ops = { 287static const struct rtc_class_ops at91_rtc_ops = {
254 .read_time = at91_rtc_readtime, 288 .read_time = at91_rtc_readtime,
255 .set_time = at91_rtc_settime, 289 .set_time = at91_rtc_settime,
@@ -268,6 +302,10 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
268 struct resource *regs; 302 struct resource *regs;
269 int ret = 0; 303 int ret = 0;
270 304
305 at91_rtc_config = at91_rtc_get_config(pdev);
306 if (!at91_rtc_config)
307 return -ENODEV;
308
271 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 309 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
272 if (!regs) { 310 if (!regs) {
273 dev_err(&pdev->dev, "no mmio resource defined\n"); 311 dev_err(&pdev->dev, "no mmio resource defined\n");
@@ -383,14 +421,6 @@ static int at91_rtc_resume(struct device *dev)
383 421
384static SIMPLE_DEV_PM_OPS(at91_rtc_pm_ops, at91_rtc_suspend, at91_rtc_resume); 422static SIMPLE_DEV_PM_OPS(at91_rtc_pm_ops, at91_rtc_suspend, at91_rtc_resume);
385 423
386#ifdef CONFIG_OF
387static const struct of_device_id at91_rtc_dt_ids[] = {
388 { .compatible = "atmel,at91rm9200-rtc" },
389 { /* sentinel */ }
390};
391MODULE_DEVICE_TABLE(of, at91_rtc_dt_ids);
392#endif
393
394static struct platform_driver at91_rtc_driver = { 424static struct platform_driver at91_rtc_driver = {
395 .remove = __exit_p(at91_rtc_remove), 425 .remove = __exit_p(at91_rtc_remove),
396 .driver = { 426 .driver = {