rtc-armada38x.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. // SPDX-License-Identifier: GPL-2.0-or-later
  2. /*
  3. * RTC driver for the Armada 38x Marvell SoCs
  4. *
  5. * Copyright (C) 2015 Marvell
  6. *
  7. * Gregory Clement <gregory.clement@free-electrons.com>
  8. */
  9. #include <linux/delay.h>
  10. #include <linux/io.h>
  11. #include <linux/module.h>
  12. #include <linux/of.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/rtc.h>
  15. #define RTC_STATUS 0x0
  16. #define RTC_STATUS_ALARM1 BIT(0)
  17. #define RTC_STATUS_ALARM2 BIT(1)
  18. #define RTC_IRQ1_CONF 0x4
  19. #define RTC_IRQ2_CONF 0x8
  20. #define RTC_IRQ_AL_EN BIT(0)
  21. #define RTC_IRQ_FREQ_EN BIT(1)
  22. #define RTC_IRQ_FREQ_1HZ BIT(2)
  23. #define RTC_CCR 0x18
  24. #define RTC_CCR_MODE BIT(15)
  25. #define RTC_CONF_TEST 0x1C
  26. #define RTC_NOMINAL_TIMING BIT(13)
  27. #define RTC_TIME 0xC
  28. #define RTC_ALARM1 0x10
  29. #define RTC_ALARM2 0x14
  30. /* Armada38x SoC registers */
  31. #define RTC_38X_BRIDGE_TIMING_CTL 0x0
  32. #define RTC_38X_PERIOD_OFFS 0
  33. #define RTC_38X_PERIOD_MASK (0x3FF << RTC_38X_PERIOD_OFFS)
  34. #define RTC_38X_READ_DELAY_OFFS 26
  35. #define RTC_38X_READ_DELAY_MASK (0x1F << RTC_38X_READ_DELAY_OFFS)
  36. /* Armada 7K/8K registers */
  37. #define RTC_8K_BRIDGE_TIMING_CTL0 0x0
  38. #define RTC_8K_WRCLK_PERIOD_OFFS 0
  39. #define RTC_8K_WRCLK_PERIOD_MASK (0xFFFF << RTC_8K_WRCLK_PERIOD_OFFS)
  40. #define RTC_8K_WRCLK_SETUP_OFFS 16
  41. #define RTC_8K_WRCLK_SETUP_MASK (0xFFFF << RTC_8K_WRCLK_SETUP_OFFS)
  42. #define RTC_8K_BRIDGE_TIMING_CTL1 0x4
  43. #define RTC_8K_READ_DELAY_OFFS 0
  44. #define RTC_8K_READ_DELAY_MASK (0xFFFF << RTC_8K_READ_DELAY_OFFS)
  45. #define RTC_8K_ISR 0x10
  46. #define RTC_8K_IMR 0x14
  47. #define RTC_8K_ALARM2 BIT(0)
  48. #define SOC_RTC_INTERRUPT 0x8
  49. #define SOC_RTC_ALARM1 BIT(0)
  50. #define SOC_RTC_ALARM2 BIT(1)
  51. #define SOC_RTC_ALARM1_MASK BIT(2)
  52. #define SOC_RTC_ALARM2_MASK BIT(3)
  53. #define SAMPLE_NR 100
  54. struct value_to_freq {
  55. u32 value;
  56. u8 freq;
  57. };
  58. struct armada38x_rtc {
  59. struct rtc_device *rtc_dev;
  60. void __iomem *regs;
  61. void __iomem *regs_soc;
  62. spinlock_t lock;
  63. int irq;
  64. bool initialized;
  65. struct value_to_freq *val_to_freq;
  66. const struct armada38x_rtc_data *data;
  67. };
  68. #define ALARM1 0
  69. #define ALARM2 1
  70. #define ALARM_REG(base, alarm) ((base) + (alarm) * sizeof(u32))
  71. struct armada38x_rtc_data {
  72. /* Initialize the RTC-MBUS bridge timing */
  73. void (*update_mbus_timing)(struct armada38x_rtc *rtc);
  74. u32 (*read_rtc_reg)(struct armada38x_rtc *rtc, u8 rtc_reg);
  75. void (*clear_isr)(struct armada38x_rtc *rtc);
  76. void (*unmask_interrupt)(struct armada38x_rtc *rtc);
  77. u32 alarm;
  78. };
  79. /*
  80. * According to the datasheet, the OS should wait 5us after every
  81. * register write to the RTC hard macro so that the required update
  82. * can occur without holding off the system bus
  83. * According to errata RES-3124064, Write to any RTC register
  84. * may fail. As a workaround, before writing to RTC
  85. * register, issue a dummy write of 0x0 twice to RTC Status
  86. * register.
  87. */
  88. static void rtc_delayed_write(u32 val, struct armada38x_rtc *rtc, int offset)
  89. {
  90. writel(0, rtc->regs + RTC_STATUS);
  91. writel(0, rtc->regs + RTC_STATUS);
  92. writel(val, rtc->regs + offset);
  93. udelay(5);
  94. }
  95. /* Update RTC-MBUS bridge timing parameters */
  96. static void rtc_update_38x_mbus_timing_params(struct armada38x_rtc *rtc)
  97. {
  98. u32 reg;
  99. reg = readl(rtc->regs_soc + RTC_38X_BRIDGE_TIMING_CTL);
  100. reg &= ~RTC_38X_PERIOD_MASK;
  101. reg |= 0x3FF << RTC_38X_PERIOD_OFFS; /* Maximum value */
  102. reg &= ~RTC_38X_READ_DELAY_MASK;
  103. reg |= 0x1F << RTC_38X_READ_DELAY_OFFS; /* Maximum value */
  104. writel(reg, rtc->regs_soc + RTC_38X_BRIDGE_TIMING_CTL);
  105. }
  106. static void rtc_update_8k_mbus_timing_params(struct armada38x_rtc *rtc)
  107. {
  108. u32 reg;
  109. reg = readl(rtc->regs_soc + RTC_8K_BRIDGE_TIMING_CTL0);
  110. reg &= ~RTC_8K_WRCLK_PERIOD_MASK;
  111. reg |= 0x3FF << RTC_8K_WRCLK_PERIOD_OFFS;
  112. reg &= ~RTC_8K_WRCLK_SETUP_MASK;
  113. reg |= 0x29 << RTC_8K_WRCLK_SETUP_OFFS;
  114. writel(reg, rtc->regs_soc + RTC_8K_BRIDGE_TIMING_CTL0);
  115. reg = readl(rtc->regs_soc + RTC_8K_BRIDGE_TIMING_CTL1);
  116. reg &= ~RTC_8K_READ_DELAY_MASK;
  117. reg |= 0x3F << RTC_8K_READ_DELAY_OFFS;
  118. writel(reg, rtc->regs_soc + RTC_8K_BRIDGE_TIMING_CTL1);
  119. }
  120. static u32 read_rtc_register(struct armada38x_rtc *rtc, u8 rtc_reg)
  121. {
  122. return readl(rtc->regs + rtc_reg);
  123. }
  124. static u32 read_rtc_register_38x_wa(struct armada38x_rtc *rtc, u8 rtc_reg)
  125. {
  126. int i, index_max = 0, max = 0;
  127. for (i = 0; i < SAMPLE_NR; i++) {
  128. rtc->val_to_freq[i].value = readl(rtc->regs + rtc_reg);
  129. rtc->val_to_freq[i].freq = 0;
  130. }
  131. for (i = 0; i < SAMPLE_NR; i++) {
  132. int j = 0;
  133. u32 value = rtc->val_to_freq[i].value;
  134. while (rtc->val_to_freq[j].freq) {
  135. if (rtc->val_to_freq[j].value == value) {
  136. rtc->val_to_freq[j].freq++;
  137. break;
  138. }
  139. j++;
  140. }
  141. if (!rtc->val_to_freq[j].freq) {
  142. rtc->val_to_freq[j].value = value;
  143. rtc->val_to_freq[j].freq = 1;
  144. }
  145. if (rtc->val_to_freq[j].freq > max) {
  146. index_max = j;
  147. max = rtc->val_to_freq[j].freq;
  148. }
  149. /*
  150. * If a value already has half of the sample this is the most
  151. * frequent one and we can stop the research right now
  152. */
  153. if (max > SAMPLE_NR / 2)
  154. break;
  155. }
  156. return rtc->val_to_freq[index_max].value;
  157. }
  158. static void armada38x_clear_isr(struct armada38x_rtc *rtc)
  159. {
  160. u32 val = readl(rtc->regs_soc + SOC_RTC_INTERRUPT);
  161. writel(val & ~SOC_RTC_ALARM1, rtc->regs_soc + SOC_RTC_INTERRUPT);
  162. }
  163. static void armada38x_unmask_interrupt(struct armada38x_rtc *rtc)
  164. {
  165. u32 val = readl(rtc->regs_soc + SOC_RTC_INTERRUPT);
  166. writel(val | SOC_RTC_ALARM1_MASK, rtc->regs_soc + SOC_RTC_INTERRUPT);
  167. }
  168. static void armada8k_clear_isr(struct armada38x_rtc *rtc)
  169. {
  170. writel(RTC_8K_ALARM2, rtc->regs_soc + RTC_8K_ISR);
  171. }
  172. static void armada8k_unmask_interrupt(struct armada38x_rtc *rtc)
  173. {
  174. writel(RTC_8K_ALARM2, rtc->regs_soc + RTC_8K_IMR);
  175. }
  176. static int armada38x_rtc_read_time(struct device *dev, struct rtc_time *tm)
  177. {
  178. struct armada38x_rtc *rtc = dev_get_drvdata(dev);
  179. unsigned long time, flags;
  180. spin_lock_irqsave(&rtc->lock, flags);
  181. time = rtc->data->read_rtc_reg(rtc, RTC_TIME);
  182. spin_unlock_irqrestore(&rtc->lock, flags);
  183. rtc_time64_to_tm(time, tm);
  184. return 0;
  185. }
  186. static void armada38x_rtc_reset(struct armada38x_rtc *rtc)
  187. {
  188. u32 reg;
  189. reg = rtc->data->read_rtc_reg(rtc, RTC_CONF_TEST);
  190. /* If bits [7:0] are non-zero, assume RTC was uninitialized */
  191. if (reg & 0xff) {
  192. rtc_delayed_write(0, rtc, RTC_CONF_TEST);
  193. msleep(500); /* Oscillator startup time */
  194. rtc_delayed_write(0, rtc, RTC_TIME);
  195. rtc_delayed_write(SOC_RTC_ALARM1 | SOC_RTC_ALARM2, rtc,
  196. RTC_STATUS);
  197. rtc_delayed_write(RTC_NOMINAL_TIMING, rtc, RTC_CCR);
  198. }
  199. rtc->initialized = true;
  200. }
  201. static int armada38x_rtc_set_time(struct device *dev, struct rtc_time *tm)
  202. {
  203. struct armada38x_rtc *rtc = dev_get_drvdata(dev);
  204. unsigned long time, flags;
  205. time = rtc_tm_to_time64(tm);
  206. if (!rtc->initialized)
  207. armada38x_rtc_reset(rtc);
  208. spin_lock_irqsave(&rtc->lock, flags);
  209. rtc_delayed_write(time, rtc, RTC_TIME);
  210. spin_unlock_irqrestore(&rtc->lock, flags);
  211. return 0;
  212. }
  213. static int armada38x_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
  214. {
  215. struct armada38x_rtc *rtc = dev_get_drvdata(dev);
  216. unsigned long time, flags;
  217. u32 reg = ALARM_REG(RTC_ALARM1, rtc->data->alarm);
  218. u32 reg_irq = ALARM_REG(RTC_IRQ1_CONF, rtc->data->alarm);
  219. u32 val;
  220. spin_lock_irqsave(&rtc->lock, flags);
  221. time = rtc->data->read_rtc_reg(rtc, reg);
  222. val = rtc->data->read_rtc_reg(rtc, reg_irq) & RTC_IRQ_AL_EN;
  223. spin_unlock_irqrestore(&rtc->lock, flags);
  224. alrm->enabled = val ? 1 : 0;
  225. rtc_time64_to_tm(time, &alrm->time);
  226. return 0;
  227. }
  228. static int armada38x_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
  229. {
  230. struct armada38x_rtc *rtc = dev_get_drvdata(dev);
  231. u32 reg = ALARM_REG(RTC_ALARM1, rtc->data->alarm);
  232. u32 reg_irq = ALARM_REG(RTC_IRQ1_CONF, rtc->data->alarm);
  233. unsigned long time, flags;
  234. time = rtc_tm_to_time64(&alrm->time);
  235. spin_lock_irqsave(&rtc->lock, flags);
  236. rtc_delayed_write(time, rtc, reg);
  237. if (alrm->enabled) {
  238. rtc_delayed_write(RTC_IRQ_AL_EN, rtc, reg_irq);
  239. rtc->data->unmask_interrupt(rtc);
  240. }
  241. spin_unlock_irqrestore(&rtc->lock, flags);
  242. return 0;
  243. }
  244. static int armada38x_rtc_alarm_irq_enable(struct device *dev,
  245. unsigned int enabled)
  246. {
  247. struct armada38x_rtc *rtc = dev_get_drvdata(dev);
  248. u32 reg_irq = ALARM_REG(RTC_IRQ1_CONF, rtc->data->alarm);
  249. unsigned long flags;
  250. spin_lock_irqsave(&rtc->lock, flags);
  251. if (enabled)
  252. rtc_delayed_write(RTC_IRQ_AL_EN, rtc, reg_irq);
  253. else
  254. rtc_delayed_write(0, rtc, reg_irq);
  255. spin_unlock_irqrestore(&rtc->lock, flags);
  256. return 0;
  257. }
  258. static irqreturn_t armada38x_rtc_alarm_irq(int irq, void *data)
  259. {
  260. struct armada38x_rtc *rtc = data;
  261. u32 val;
  262. int event = RTC_IRQF | RTC_AF;
  263. u32 reg_irq = ALARM_REG(RTC_IRQ1_CONF, rtc->data->alarm);
  264. dev_dbg(&rtc->rtc_dev->dev, "%s:irq(%d)\n", __func__, irq);
  265. spin_lock(&rtc->lock);
  266. rtc->data->clear_isr(rtc);
  267. val = rtc->data->read_rtc_reg(rtc, reg_irq);
  268. /* disable all the interrupts for alarm*/
  269. rtc_delayed_write(0, rtc, reg_irq);
  270. /* Ack the event */
  271. rtc_delayed_write(1 << rtc->data->alarm, rtc, RTC_STATUS);
  272. spin_unlock(&rtc->lock);
  273. if (val & RTC_IRQ_FREQ_EN) {
  274. if (val & RTC_IRQ_FREQ_1HZ)
  275. event |= RTC_UF;
  276. else
  277. event |= RTC_PF;
  278. }
  279. rtc_update_irq(rtc->rtc_dev, 1, event);
  280. return IRQ_HANDLED;
  281. }
  282. /*
  283. * The information given in the Armada 388 functional spec is complex.
  284. * They give two different formulas for calculating the offset value,
  285. * but when considering "Offset" as an 8-bit signed integer, they both
  286. * reduce down to (we shall rename "Offset" as "val" here):
  287. *
  288. * val = (f_ideal / f_measured - 1) / resolution where f_ideal = 32768
  289. *
  290. * Converting to time, f = 1/t:
  291. * val = (t_measured / t_ideal - 1) / resolution where t_ideal = 1/32768
  292. *
  293. * => t_measured / t_ideal = val * resolution + 1
  294. *
  295. * "offset" in the RTC interface is defined as:
  296. * t = t0 * (1 + offset * 1e-9)
  297. * where t is the desired period, t0 is the measured period with a zero
  298. * offset, which is t_measured above. With t0 = t_measured and t = t_ideal,
  299. * offset = (t_ideal / t_measured - 1) / 1e-9
  300. *
  301. * => t_ideal / t_measured = offset * 1e-9 + 1
  302. *
  303. * so:
  304. *
  305. * offset * 1e-9 + 1 = 1 / (val * resolution + 1)
  306. *
  307. * We want "resolution" to be an integer, so resolution = R * 1e-9, giving
  308. * offset = 1e18 / (val * R + 1e9) - 1e9
  309. * val = (1e18 / (offset + 1e9) - 1e9) / R
  310. * with a common transformation:
  311. * f(x) = 1e18 / (x + 1e9) - 1e9
  312. * offset = f(val * R)
  313. * val = f(offset) / R
  314. *
  315. * Armada 38x supports two modes, fine mode (954ppb) and coarse mode (3815ppb).
  316. */
  317. static long armada38x_ppb_convert(long ppb)
  318. {
  319. long div = ppb + 1000000000L;
  320. return div_s64(1000000000000000000LL + div / 2, div) - 1000000000L;
  321. }
  322. static int armada38x_rtc_read_offset(struct device *dev, long *offset)
  323. {
  324. struct armada38x_rtc *rtc = dev_get_drvdata(dev);
  325. unsigned long ccr, flags;
  326. long ppb_cor;
  327. spin_lock_irqsave(&rtc->lock, flags);
  328. ccr = rtc->data->read_rtc_reg(rtc, RTC_CCR);
  329. spin_unlock_irqrestore(&rtc->lock, flags);
  330. ppb_cor = (ccr & RTC_CCR_MODE ? 3815 : 954) * (s8)ccr;
  331. /* ppb_cor + 1000000000L can never be zero */
  332. *offset = armada38x_ppb_convert(ppb_cor);
  333. return 0;
  334. }
  335. static int armada38x_rtc_set_offset(struct device *dev, long offset)
  336. {
  337. struct armada38x_rtc *rtc = dev_get_drvdata(dev);
  338. unsigned long ccr = 0;
  339. long ppb_cor, off;
  340. /*
  341. * The maximum ppb_cor is -128 * 3815 .. 127 * 3815, but we
  342. * need to clamp the input. This equates to -484270 .. 488558.
  343. * Not only is this to stop out of range "off" but also to
  344. * avoid the division by zero in armada38x_ppb_convert().
  345. */
  346. offset = clamp(offset, -484270L, 488558L);
  347. ppb_cor = armada38x_ppb_convert(offset);
  348. /*
  349. * Use low update mode where possible, which gives a better
  350. * resolution of correction.
  351. */
  352. off = DIV_ROUND_CLOSEST(ppb_cor, 954);
  353. if (off > 127 || off < -128) {
  354. ccr = RTC_CCR_MODE;
  355. off = DIV_ROUND_CLOSEST(ppb_cor, 3815);
  356. }
  357. /*
  358. * Armada 388 requires a bit pattern in bits 14..8 depending on
  359. * the sign bit: { 0, ~S, S, S, S, S, S }
  360. */
  361. ccr |= (off & 0x3fff) ^ 0x2000;
  362. rtc_delayed_write(ccr, rtc, RTC_CCR);
  363. return 0;
  364. }
  365. static const struct rtc_class_ops armada38x_rtc_ops = {
  366. .read_time = armada38x_rtc_read_time,
  367. .set_time = armada38x_rtc_set_time,
  368. .read_alarm = armada38x_rtc_read_alarm,
  369. .set_alarm = armada38x_rtc_set_alarm,
  370. .alarm_irq_enable = armada38x_rtc_alarm_irq_enable,
  371. .read_offset = armada38x_rtc_read_offset,
  372. .set_offset = armada38x_rtc_set_offset,
  373. };
  374. static const struct armada38x_rtc_data armada38x_data = {
  375. .update_mbus_timing = rtc_update_38x_mbus_timing_params,
  376. .read_rtc_reg = read_rtc_register_38x_wa,
  377. .clear_isr = armada38x_clear_isr,
  378. .unmask_interrupt = armada38x_unmask_interrupt,
  379. .alarm = ALARM1,
  380. };
  381. static const struct armada38x_rtc_data armada8k_data = {
  382. .update_mbus_timing = rtc_update_8k_mbus_timing_params,
  383. .read_rtc_reg = read_rtc_register,
  384. .clear_isr = armada8k_clear_isr,
  385. .unmask_interrupt = armada8k_unmask_interrupt,
  386. .alarm = ALARM2,
  387. };
  388. static const struct of_device_id armada38x_rtc_of_match_table[] = {
  389. {
  390. .compatible = "marvell,armada-380-rtc",
  391. .data = &armada38x_data,
  392. },
  393. {
  394. .compatible = "marvell,armada-8k-rtc",
  395. .data = &armada8k_data,
  396. },
  397. {}
  398. };
  399. MODULE_DEVICE_TABLE(of, armada38x_rtc_of_match_table);
  400. static __init int armada38x_rtc_probe(struct platform_device *pdev)
  401. {
  402. struct armada38x_rtc *rtc;
  403. rtc = devm_kzalloc(&pdev->dev, sizeof(struct armada38x_rtc),
  404. GFP_KERNEL);
  405. if (!rtc)
  406. return -ENOMEM;
  407. rtc->data = of_device_get_match_data(&pdev->dev);
  408. rtc->val_to_freq = devm_kcalloc(&pdev->dev, SAMPLE_NR,
  409. sizeof(struct value_to_freq), GFP_KERNEL);
  410. if (!rtc->val_to_freq)
  411. return -ENOMEM;
  412. spin_lock_init(&rtc->lock);
  413. rtc->regs = devm_platform_ioremap_resource_byname(pdev, "rtc");
  414. if (IS_ERR(rtc->regs))
  415. return PTR_ERR(rtc->regs);
  416. rtc->regs_soc = devm_platform_ioremap_resource_byname(pdev, "rtc-soc");
  417. if (IS_ERR(rtc->regs_soc))
  418. return PTR_ERR(rtc->regs_soc);
  419. rtc->irq = platform_get_irq(pdev, 0);
  420. if (rtc->irq < 0)
  421. return rtc->irq;
  422. rtc->rtc_dev = devm_rtc_allocate_device(&pdev->dev);
  423. if (IS_ERR(rtc->rtc_dev))
  424. return PTR_ERR(rtc->rtc_dev);
  425. if (devm_request_irq(&pdev->dev, rtc->irq, armada38x_rtc_alarm_irq,
  426. 0, pdev->name, rtc) < 0) {
  427. dev_warn(&pdev->dev, "Interrupt not available.\n");
  428. rtc->irq = -1;
  429. }
  430. platform_set_drvdata(pdev, rtc);
  431. if (rtc->irq != -1)
  432. device_init_wakeup(&pdev->dev, true);
  433. else
  434. clear_bit(RTC_FEATURE_ALARM, rtc->rtc_dev->features);
  435. /* Update RTC-MBUS bridge timing parameters */
  436. rtc->data->update_mbus_timing(rtc);
  437. rtc->rtc_dev->ops = &armada38x_rtc_ops;
  438. rtc->rtc_dev->range_max = U32_MAX;
  439. return devm_rtc_register_device(rtc->rtc_dev);
  440. }
  441. #ifdef CONFIG_PM_SLEEP
  442. static int armada38x_rtc_suspend(struct device *dev)
  443. {
  444. if (device_may_wakeup(dev)) {
  445. struct armada38x_rtc *rtc = dev_get_drvdata(dev);
  446. return enable_irq_wake(rtc->irq);
  447. }
  448. return 0;
  449. }
  450. static int armada38x_rtc_resume(struct device *dev)
  451. {
  452. if (device_may_wakeup(dev)) {
  453. struct armada38x_rtc *rtc = dev_get_drvdata(dev);
  454. /* Update RTC-MBUS bridge timing parameters */
  455. rtc->data->update_mbus_timing(rtc);
  456. return disable_irq_wake(rtc->irq);
  457. }
  458. return 0;
  459. }
  460. #endif
  461. static SIMPLE_DEV_PM_OPS(armada38x_rtc_pm_ops,
  462. armada38x_rtc_suspend, armada38x_rtc_resume);
  463. static struct platform_driver armada38x_rtc_driver = {
  464. .driver = {
  465. .name = "armada38x-rtc",
  466. .pm = &armada38x_rtc_pm_ops,
  467. .of_match_table = armada38x_rtc_of_match_table,
  468. },
  469. };
  470. module_platform_driver_probe(armada38x_rtc_driver, armada38x_rtc_probe);
  471. MODULE_DESCRIPTION("Marvell Armada 38x RTC driver");
  472. MODULE_AUTHOR("Gregory CLEMENT <gregory.clement@free-electrons.com>");
  473. MODULE_LICENSE("GPL");