Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Driver for the RTC in Marvell SoCs. |
| 3 | * |
| 4 | * This file is licensed under the terms of the GNU General Public |
| 5 | * License version 2. This program is licensed "as is" without any |
| 6 | * warranty of any kind, whether express or implied. |
| 7 | */ |
| 8 | |
| 9 | #include <linux/init.h> |
| 10 | #include <linux/kernel.h> |
| 11 | #include <linux/rtc.h> |
| 12 | #include <linux/bcd.h> |
Alexandre Belloni | fe56133 | 2015-06-08 16:16:14 +0200 | [diff] [blame] | 13 | #include <linux/bitops.h> |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 14 | #include <linux/io.h> |
| 15 | #include <linux/platform_device.h> |
Jason Cooper | ea983ede | 2012-03-06 23:53:57 +0000 | [diff] [blame] | 16 | #include <linux/of.h> |
Nicolas Pitre | 9d1d4f9 | 2009-03-23 20:42:29 -0400 | [diff] [blame] | 17 | #include <linux/delay.h> |
Andrew Lunn | 89c58c1 | 2013-02-03 12:32:06 +0100 | [diff] [blame] | 18 | #include <linux/clk.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 19 | #include <linux/gfp.h> |
Paul Gortmaker | 2113852 | 2011-05-27 09:57:25 -0400 | [diff] [blame] | 20 | #include <linux/module.h> |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 21 | |
| 22 | |
| 23 | #define RTC_TIME_REG_OFFS 0 |
| 24 | #define RTC_SECONDS_OFFS 0 |
| 25 | #define RTC_MINUTES_OFFS 8 |
| 26 | #define RTC_HOURS_OFFS 16 |
| 27 | #define RTC_WDAY_OFFS 24 |
Alexandre Belloni | fe56133 | 2015-06-08 16:16:14 +0200 | [diff] [blame] | 28 | #define RTC_HOURS_12H_MODE BIT(22) /* 12 hour mode */ |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 29 | |
| 30 | #define RTC_DATE_REG_OFFS 4 |
| 31 | #define RTC_MDAY_OFFS 0 |
| 32 | #define RTC_MONTH_OFFS 8 |
| 33 | #define RTC_YEAR_OFFS 16 |
| 34 | |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 35 | #define RTC_ALARM_TIME_REG_OFFS 8 |
| 36 | #define RTC_ALARM_DATE_REG_OFFS 0xc |
Alexandre Belloni | fe56133 | 2015-06-08 16:16:14 +0200 | [diff] [blame] | 37 | #define RTC_ALARM_VALID BIT(7) |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 38 | |
| 39 | #define RTC_ALARM_INTERRUPT_MASK_REG_OFFS 0x10 |
| 40 | #define RTC_ALARM_INTERRUPT_CASUE_REG_OFFS 0x14 |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 41 | |
| 42 | struct rtc_plat_data { |
| 43 | struct rtc_device *rtc; |
| 44 | void __iomem *ioaddr; |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 45 | int irq; |
Andrew Lunn | 89c58c1 | 2013-02-03 12:32:06 +0100 | [diff] [blame] | 46 | struct clk *clk; |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 47 | }; |
| 48 | |
| 49 | static int mv_rtc_set_time(struct device *dev, struct rtc_time *tm) |
| 50 | { |
| 51 | struct rtc_plat_data *pdata = dev_get_drvdata(dev); |
| 52 | void __iomem *ioaddr = pdata->ioaddr; |
| 53 | u32 rtc_reg; |
| 54 | |
| 55 | rtc_reg = (bin2bcd(tm->tm_sec) << RTC_SECONDS_OFFS) | |
| 56 | (bin2bcd(tm->tm_min) << RTC_MINUTES_OFFS) | |
| 57 | (bin2bcd(tm->tm_hour) << RTC_HOURS_OFFS) | |
| 58 | (bin2bcd(tm->tm_wday) << RTC_WDAY_OFFS); |
| 59 | writel(rtc_reg, ioaddr + RTC_TIME_REG_OFFS); |
| 60 | |
| 61 | rtc_reg = (bin2bcd(tm->tm_mday) << RTC_MDAY_OFFS) | |
| 62 | (bin2bcd(tm->tm_mon + 1) << RTC_MONTH_OFFS) | |
| 63 | (bin2bcd(tm->tm_year % 100) << RTC_YEAR_OFFS); |
| 64 | writel(rtc_reg, ioaddr + RTC_DATE_REG_OFFS); |
| 65 | |
| 66 | return 0; |
| 67 | } |
| 68 | |
| 69 | static int mv_rtc_read_time(struct device *dev, struct rtc_time *tm) |
| 70 | { |
| 71 | struct rtc_plat_data *pdata = dev_get_drvdata(dev); |
| 72 | void __iomem *ioaddr = pdata->ioaddr; |
| 73 | u32 rtc_time, rtc_date; |
| 74 | unsigned int year, month, day, hour, minute, second, wday; |
| 75 | |
| 76 | rtc_time = readl(ioaddr + RTC_TIME_REG_OFFS); |
| 77 | rtc_date = readl(ioaddr + RTC_DATE_REG_OFFS); |
| 78 | |
| 79 | second = rtc_time & 0x7f; |
| 80 | minute = (rtc_time >> RTC_MINUTES_OFFS) & 0x7f; |
Alexandre Belloni | 4042a14 | 2015-06-08 16:16:15 +0200 | [diff] [blame] | 81 | hour = (rtc_time >> RTC_HOURS_OFFS) & 0x3f; /* assume 24 hour mode */ |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 82 | wday = (rtc_time >> RTC_WDAY_OFFS) & 0x7; |
| 83 | |
| 84 | day = rtc_date & 0x3f; |
| 85 | month = (rtc_date >> RTC_MONTH_OFFS) & 0x3f; |
| 86 | year = (rtc_date >> RTC_YEAR_OFFS) & 0xff; |
| 87 | |
| 88 | tm->tm_sec = bcd2bin(second); |
| 89 | tm->tm_min = bcd2bin(minute); |
| 90 | tm->tm_hour = bcd2bin(hour); |
| 91 | tm->tm_mday = bcd2bin(day); |
| 92 | tm->tm_wday = bcd2bin(wday); |
| 93 | tm->tm_mon = bcd2bin(month) - 1; |
| 94 | /* hw counts from year 2000, but tm_year is relative to 1900 */ |
| 95 | tm->tm_year = bcd2bin(year) + 100; |
| 96 | |
Alexandre Belloni | 22652ba | 2018-02-19 16:23:56 +0100 | [diff] [blame] | 97 | return 0; |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 98 | } |
| 99 | |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 100 | static int mv_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm) |
| 101 | { |
| 102 | struct rtc_plat_data *pdata = dev_get_drvdata(dev); |
| 103 | void __iomem *ioaddr = pdata->ioaddr; |
| 104 | u32 rtc_time, rtc_date; |
| 105 | unsigned int year, month, day, hour, minute, second, wday; |
| 106 | |
| 107 | rtc_time = readl(ioaddr + RTC_ALARM_TIME_REG_OFFS); |
| 108 | rtc_date = readl(ioaddr + RTC_ALARM_DATE_REG_OFFS); |
| 109 | |
| 110 | second = rtc_time & 0x7f; |
| 111 | minute = (rtc_time >> RTC_MINUTES_OFFS) & 0x7f; |
Alexandre Belloni | 4042a14 | 2015-06-08 16:16:15 +0200 | [diff] [blame] | 112 | hour = (rtc_time >> RTC_HOURS_OFFS) & 0x3f; /* assume 24 hour mode */ |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 113 | wday = (rtc_time >> RTC_WDAY_OFFS) & 0x7; |
| 114 | |
| 115 | day = rtc_date & 0x3f; |
| 116 | month = (rtc_date >> RTC_MONTH_OFFS) & 0x3f; |
| 117 | year = (rtc_date >> RTC_YEAR_OFFS) & 0xff; |
| 118 | |
| 119 | alm->time.tm_sec = bcd2bin(second); |
| 120 | alm->time.tm_min = bcd2bin(minute); |
| 121 | alm->time.tm_hour = bcd2bin(hour); |
| 122 | alm->time.tm_mday = bcd2bin(day); |
| 123 | alm->time.tm_wday = bcd2bin(wday); |
| 124 | alm->time.tm_mon = bcd2bin(month) - 1; |
| 125 | /* hw counts from year 2000, but tm_year is relative to 1900 */ |
| 126 | alm->time.tm_year = bcd2bin(year) + 100; |
| 127 | |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 128 | alm->enabled = !!readl(ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); |
Alexandre Belloni | 959e8b7 | 2018-10-02 00:05:25 +0200 | [diff] [blame^] | 129 | |
| 130 | return rtc_valid_tm(&alm->time); |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | static int mv_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm) |
| 134 | { |
| 135 | struct rtc_plat_data *pdata = dev_get_drvdata(dev); |
| 136 | void __iomem *ioaddr = pdata->ioaddr; |
| 137 | u32 rtc_reg = 0; |
| 138 | |
| 139 | if (alm->time.tm_sec >= 0) |
| 140 | rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_sec)) |
| 141 | << RTC_SECONDS_OFFS; |
| 142 | if (alm->time.tm_min >= 0) |
| 143 | rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_min)) |
| 144 | << RTC_MINUTES_OFFS; |
| 145 | if (alm->time.tm_hour >= 0) |
| 146 | rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_hour)) |
| 147 | << RTC_HOURS_OFFS; |
| 148 | |
| 149 | writel(rtc_reg, ioaddr + RTC_ALARM_TIME_REG_OFFS); |
| 150 | |
| 151 | if (alm->time.tm_mday >= 0) |
| 152 | rtc_reg = (RTC_ALARM_VALID | bin2bcd(alm->time.tm_mday)) |
| 153 | << RTC_MDAY_OFFS; |
| 154 | else |
| 155 | rtc_reg = 0; |
| 156 | |
| 157 | if (alm->time.tm_mon >= 0) |
| 158 | rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_mon + 1)) |
| 159 | << RTC_MONTH_OFFS; |
| 160 | |
| 161 | if (alm->time.tm_year >= 0) |
| 162 | rtc_reg |= (RTC_ALARM_VALID | bin2bcd(alm->time.tm_year % 100)) |
| 163 | << RTC_YEAR_OFFS; |
| 164 | |
| 165 | writel(rtc_reg, ioaddr + RTC_ALARM_DATE_REG_OFFS); |
| 166 | writel(0, ioaddr + RTC_ALARM_INTERRUPT_CASUE_REG_OFFS); |
| 167 | writel(alm->enabled ? 1 : 0, |
| 168 | ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); |
| 169 | |
| 170 | return 0; |
| 171 | } |
| 172 | |
John Stultz | 16380c1 | 2011-02-02 17:02:41 -0800 | [diff] [blame] | 173 | static int mv_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled) |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 174 | { |
Wolfram Sang | 85368bb | 2018-04-19 16:06:14 +0200 | [diff] [blame] | 175 | struct rtc_plat_data *pdata = dev_get_drvdata(dev); |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 176 | void __iomem *ioaddr = pdata->ioaddr; |
| 177 | |
| 178 | if (pdata->irq < 0) |
John Stultz | 16380c1 | 2011-02-02 17:02:41 -0800 | [diff] [blame] | 179 | return -EINVAL; /* fall back into rtc-dev's emulation */ |
| 180 | |
| 181 | if (enabled) |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 182 | writel(1, ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); |
John Stultz | 16380c1 | 2011-02-02 17:02:41 -0800 | [diff] [blame] | 183 | else |
| 184 | writel(0, ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 185 | return 0; |
| 186 | } |
| 187 | |
| 188 | static irqreturn_t mv_rtc_interrupt(int irq, void *data) |
| 189 | { |
| 190 | struct rtc_plat_data *pdata = data; |
| 191 | void __iomem *ioaddr = pdata->ioaddr; |
| 192 | |
| 193 | /* alarm irq? */ |
| 194 | if (!readl(ioaddr + RTC_ALARM_INTERRUPT_CASUE_REG_OFFS)) |
| 195 | return IRQ_NONE; |
| 196 | |
| 197 | /* clear interrupt */ |
| 198 | writel(0, ioaddr + RTC_ALARM_INTERRUPT_CASUE_REG_OFFS); |
| 199 | rtc_update_irq(pdata->rtc, 1, RTC_IRQF | RTC_AF); |
| 200 | return IRQ_HANDLED; |
| 201 | } |
| 202 | |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 203 | static const struct rtc_class_ops mv_rtc_ops = { |
| 204 | .read_time = mv_rtc_read_time, |
| 205 | .set_time = mv_rtc_set_time, |
| 206 | }; |
| 207 | |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 208 | static const struct rtc_class_ops mv_rtc_alarm_ops = { |
| 209 | .read_time = mv_rtc_read_time, |
| 210 | .set_time = mv_rtc_set_time, |
| 211 | .read_alarm = mv_rtc_read_alarm, |
| 212 | .set_alarm = mv_rtc_set_alarm, |
John Stultz | 16380c1 | 2011-02-02 17:02:41 -0800 | [diff] [blame] | 213 | .alarm_irq_enable = mv_rtc_alarm_irq_enable, |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 214 | }; |
| 215 | |
Jingoo Han | b69af43 | 2013-04-29 16:18:21 -0700 | [diff] [blame] | 216 | static int __init mv_rtc_probe(struct platform_device *pdev) |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 217 | { |
| 218 | struct resource *res; |
| 219 | struct rtc_plat_data *pdata; |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 220 | u32 rtc_time; |
Andrew Lunn | 89c58c1 | 2013-02-03 12:32:06 +0100 | [diff] [blame] | 221 | int ret = 0; |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 222 | |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 223 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); |
| 224 | if (!pdata) |
| 225 | return -ENOMEM; |
| 226 | |
Julia Lawall | 7c1d69e | 2013-09-11 14:24:27 -0700 | [diff] [blame] | 227 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 228 | pdata->ioaddr = devm_ioremap_resource(&pdev->dev, res); |
| 229 | if (IS_ERR(pdata->ioaddr)) |
| 230 | return PTR_ERR(pdata->ioaddr); |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 231 | |
Andrew Lunn | 89c58c1 | 2013-02-03 12:32:06 +0100 | [diff] [blame] | 232 | pdata->clk = devm_clk_get(&pdev->dev, NULL); |
| 233 | /* Not all SoCs require a clock.*/ |
| 234 | if (!IS_ERR(pdata->clk)) |
| 235 | clk_prepare_enable(pdata->clk); |
| 236 | |
Alexandre Belloni | 4042a14 | 2015-06-08 16:16:15 +0200 | [diff] [blame] | 237 | /* make sure the 24 hour mode is enabled */ |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 238 | rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); |
| 239 | if (rtc_time & RTC_HOURS_12H_MODE) { |
Alexandre Belloni | 4042a14 | 2015-06-08 16:16:15 +0200 | [diff] [blame] | 240 | dev_err(&pdev->dev, "12 Hour mode is enabled but not supported.\n"); |
Andrew Lunn | 89c58c1 | 2013-02-03 12:32:06 +0100 | [diff] [blame] | 241 | ret = -EINVAL; |
| 242 | goto out; |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 243 | } |
| 244 | |
Nicolas Pitre | 9d1d4f9 | 2009-03-23 20:42:29 -0400 | [diff] [blame] | 245 | /* make sure it is actually functional */ |
| 246 | if (rtc_time == 0x01000000) { |
| 247 | ssleep(1); |
| 248 | rtc_time = readl(pdata->ioaddr + RTC_TIME_REG_OFFS); |
| 249 | if (rtc_time == 0x01000000) { |
| 250 | dev_err(&pdev->dev, "internal RTC not ticking\n"); |
Andrew Lunn | 89c58c1 | 2013-02-03 12:32:06 +0100 | [diff] [blame] | 251 | ret = -ENODEV; |
| 252 | goto out; |
Nicolas Pitre | 9d1d4f9 | 2009-03-23 20:42:29 -0400 | [diff] [blame] | 253 | } |
| 254 | } |
| 255 | |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 256 | pdata->irq = platform_get_irq(pdev, 0); |
| 257 | |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 258 | platform_set_drvdata(pdev, pdata); |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 259 | |
| 260 | if (pdata->irq >= 0) { |
| 261 | device_init_wakeup(&pdev->dev, 1); |
Jingoo Han | 4241e2b | 2013-04-29 16:19:08 -0700 | [diff] [blame] | 262 | pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 263 | &mv_rtc_alarm_ops, |
| 264 | THIS_MODULE); |
Jingoo Han | 4241e2b | 2013-04-29 16:19:08 -0700 | [diff] [blame] | 265 | } else { |
| 266 | pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name, |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 267 | &mv_rtc_ops, THIS_MODULE); |
Jingoo Han | 4241e2b | 2013-04-29 16:19:08 -0700 | [diff] [blame] | 268 | } |
Andrew Lunn | 89c58c1 | 2013-02-03 12:32:06 +0100 | [diff] [blame] | 269 | if (IS_ERR(pdata->rtc)) { |
| 270 | ret = PTR_ERR(pdata->rtc); |
| 271 | goto out; |
| 272 | } |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 273 | |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 274 | if (pdata->irq >= 0) { |
| 275 | writel(0, pdata->ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS); |
| 276 | if (devm_request_irq(&pdev->dev, pdata->irq, mv_rtc_interrupt, |
Yong Zhang | 2f6e5f9 | 2012-03-23 15:02:34 -0700 | [diff] [blame] | 277 | IRQF_SHARED, |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 278 | pdev->name, pdata) < 0) { |
| 279 | dev_warn(&pdev->dev, "interrupt not available.\n"); |
| 280 | pdata->irq = -1; |
| 281 | } |
| 282 | } |
| 283 | |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 284 | return 0; |
Andrew Lunn | 89c58c1 | 2013-02-03 12:32:06 +0100 | [diff] [blame] | 285 | out: |
| 286 | if (!IS_ERR(pdata->clk)) |
| 287 | clk_disable_unprepare(pdata->clk); |
| 288 | |
| 289 | return ret; |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 290 | } |
| 291 | |
| 292 | static int __exit mv_rtc_remove(struct platform_device *pdev) |
| 293 | { |
| 294 | struct rtc_plat_data *pdata = platform_get_drvdata(pdev); |
| 295 | |
Saeed Bishara | aeedaca | 2009-12-15 16:46:08 -0800 | [diff] [blame] | 296 | if (pdata->irq >= 0) |
| 297 | device_init_wakeup(&pdev->dev, 0); |
| 298 | |
Andrew Lunn | 89c58c1 | 2013-02-03 12:32:06 +0100 | [diff] [blame] | 299 | if (!IS_ERR(pdata->clk)) |
| 300 | clk_disable_unprepare(pdata->clk); |
| 301 | |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 302 | return 0; |
| 303 | } |
| 304 | |
Jason Cooper | ea983ede | 2012-03-06 23:53:57 +0000 | [diff] [blame] | 305 | #ifdef CONFIG_OF |
Jingoo Han | 4621bc5 | 2014-06-06 14:35:57 -0700 | [diff] [blame] | 306 | static const struct of_device_id rtc_mv_of_match_table[] = { |
Andrew Lunn | 7784350 | 2012-07-18 19:22:54 +0200 | [diff] [blame] | 307 | { .compatible = "marvell,orion-rtc", }, |
Jason Cooper | ea983ede | 2012-03-06 23:53:57 +0000 | [diff] [blame] | 308 | {} |
| 309 | }; |
Javier Martinez Canillas | 73798d5 | 2015-08-27 13:52:02 +0200 | [diff] [blame] | 310 | MODULE_DEVICE_TABLE(of, rtc_mv_of_match_table); |
Jason Cooper | ea983ede | 2012-03-06 23:53:57 +0000 | [diff] [blame] | 311 | #endif |
| 312 | |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 313 | static struct platform_driver mv_rtc_driver = { |
| 314 | .remove = __exit_p(mv_rtc_remove), |
| 315 | .driver = { |
| 316 | .name = "rtc-mv", |
Jason Cooper | ea983ede | 2012-03-06 23:53:57 +0000 | [diff] [blame] | 317 | .of_match_table = of_match_ptr(rtc_mv_of_match_table), |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 318 | }, |
| 319 | }; |
| 320 | |
Jingoo Han | 1963f7c | 2013-04-29 16:18:44 -0700 | [diff] [blame] | 321 | module_platform_driver_probe(mv_rtc_driver, mv_rtc_probe); |
Saeed Bishara | defb451 | 2009-01-06 14:42:24 -0800 | [diff] [blame] | 322 | |
| 323 | MODULE_AUTHOR("Saeed Bishara <saeed@marvell.com>"); |
| 324 | MODULE_DESCRIPTION("Marvell RTC driver"); |
| 325 | MODULE_LICENSE("GPL"); |
| 326 | MODULE_ALIAS("platform:rtc-mv"); |