Lines Matching refs:xrtcdev

61 	struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev);  in xlnx_rtc_set_time()  local
71 writel(new_time, xrtcdev->reg_base + RTC_SET_TM_WR); in xlnx_rtc_set_time()
81 writel(RTC_INT_SEC, xrtcdev->reg_base + RTC_INT_STS); in xlnx_rtc_set_time()
90 struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev); in xlnx_rtc_read_time() local
92 status = readl(xrtcdev->reg_base + RTC_INT_STS); in xlnx_rtc_read_time()
99 read_time = readl(xrtcdev->reg_base + RTC_CUR_TM); in xlnx_rtc_read_time()
108 read_time = readl(xrtcdev->reg_base + RTC_SET_TM_RD) - 1; in xlnx_rtc_read_time()
117 struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev); in xlnx_rtc_read_alarm() local
119 rtc_time64_to_tm(readl(xrtcdev->reg_base + RTC_ALRM), &alrm->time); in xlnx_rtc_read_alarm()
120 alrm->enabled = readl(xrtcdev->reg_base + RTC_INT_MASK) & RTC_INT_ALRM; in xlnx_rtc_read_alarm()
127 struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev); in xlnx_rtc_alarm_irq_enable() local
135 status = readl(xrtcdev->reg_base + RTC_INT_STS); in xlnx_rtc_alarm_irq_enable()
143 writel(RTC_INT_ALRM, xrtcdev->reg_base + RTC_INT_STS); in xlnx_rtc_alarm_irq_enable()
146 writel(RTC_INT_ALRM, xrtcdev->reg_base + RTC_INT_EN); in xlnx_rtc_alarm_irq_enable()
148 writel(RTC_INT_ALRM, xrtcdev->reg_base + RTC_INT_DIS); in xlnx_rtc_alarm_irq_enable()
156 struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev); in xlnx_rtc_set_alarm() local
161 writel((u32)alarm_time, (xrtcdev->reg_base + RTC_ALRM)); in xlnx_rtc_set_alarm()
168 static void xlnx_init_rtc(struct xlnx_rtc_dev *xrtcdev) in xlnx_init_rtc() argument
173 rtc_ctrl = readl(xrtcdev->reg_base + RTC_CTRL); in xlnx_init_rtc()
175 writel(rtc_ctrl, xrtcdev->reg_base + RTC_CTRL); in xlnx_init_rtc()
180 struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev); in xlnx_rtc_read_offset() local
182 unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq); in xlnx_rtc_read_offset()
186 calibval = readl(xrtcdev->reg_base + RTC_CALIB_RD); in xlnx_rtc_read_offset()
203 struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev); in xlnx_rtc_set_offset() local
205 unsigned int tick_mult = do_div(rtc_ppb, xrtcdev->freq); in xlnx_rtc_set_offset()
243 writel(calibval, (xrtcdev->reg_base + RTC_CALIB_WR)); in xlnx_rtc_set_offset()
260 struct xlnx_rtc_dev *xrtcdev = (struct xlnx_rtc_dev *)id; in xlnx_rtc_interrupt() local
263 status = readl(xrtcdev->reg_base + RTC_INT_STS); in xlnx_rtc_interrupt()
269 writel(RTC_INT_ALRM, xrtcdev->reg_base + RTC_INT_DIS); in xlnx_rtc_interrupt()
272 rtc_update_irq(xrtcdev->rtc, 1, RTC_IRQF | RTC_AF); in xlnx_rtc_interrupt()
279 struct xlnx_rtc_dev *xrtcdev; in xlnx_rtc_probe() local
282 xrtcdev = devm_kzalloc(&pdev->dev, sizeof(*xrtcdev), GFP_KERNEL); in xlnx_rtc_probe()
283 if (!xrtcdev) in xlnx_rtc_probe()
286 platform_set_drvdata(pdev, xrtcdev); in xlnx_rtc_probe()
288 xrtcdev->rtc = devm_rtc_allocate_device(&pdev->dev); in xlnx_rtc_probe()
289 if (IS_ERR(xrtcdev->rtc)) in xlnx_rtc_probe()
290 return PTR_ERR(xrtcdev->rtc); in xlnx_rtc_probe()
292 xrtcdev->rtc->ops = &xlnx_rtc_ops; in xlnx_rtc_probe()
293 xrtcdev->rtc->range_max = U32_MAX; in xlnx_rtc_probe()
295 xrtcdev->reg_base = devm_platform_ioremap_resource(pdev, 0); in xlnx_rtc_probe()
296 if (IS_ERR(xrtcdev->reg_base)) in xlnx_rtc_probe()
297 return PTR_ERR(xrtcdev->reg_base); in xlnx_rtc_probe()
299 xrtcdev->alarm_irq = platform_get_irq_byname(pdev, "alarm"); in xlnx_rtc_probe()
300 if (xrtcdev->alarm_irq < 0) in xlnx_rtc_probe()
301 return xrtcdev->alarm_irq; in xlnx_rtc_probe()
302 ret = devm_request_irq(&pdev->dev, xrtcdev->alarm_irq, in xlnx_rtc_probe()
304 dev_name(&pdev->dev), xrtcdev); in xlnx_rtc_probe()
310 xrtcdev->sec_irq = platform_get_irq_byname(pdev, "sec"); in xlnx_rtc_probe()
311 if (xrtcdev->sec_irq < 0) in xlnx_rtc_probe()
312 return xrtcdev->sec_irq; in xlnx_rtc_probe()
313 ret = devm_request_irq(&pdev->dev, xrtcdev->sec_irq, in xlnx_rtc_probe()
315 dev_name(&pdev->dev), xrtcdev); in xlnx_rtc_probe()
322 xrtcdev->rtc_clk = devm_clk_get_optional(&pdev->dev, "rtc_clk"); in xlnx_rtc_probe()
323 if (IS_ERR(xrtcdev->rtc_clk)) { in xlnx_rtc_probe()
324 if (PTR_ERR(xrtcdev->rtc_clk) != -EPROBE_DEFER) in xlnx_rtc_probe()
327 xrtcdev->freq = clk_get_rate(xrtcdev->rtc_clk); in xlnx_rtc_probe()
328 if (!xrtcdev->freq) { in xlnx_rtc_probe()
330 &xrtcdev->freq); in xlnx_rtc_probe()
332 xrtcdev->freq = RTC_CALIB_DEF; in xlnx_rtc_probe()
334 ret = readl(xrtcdev->reg_base + RTC_CALIB_RD); in xlnx_rtc_probe()
336 writel(xrtcdev->freq, (xrtcdev->reg_base + RTC_CALIB_WR)); in xlnx_rtc_probe()
338 xlnx_init_rtc(xrtcdev); in xlnx_rtc_probe()
342 return devm_rtc_register_device(xrtcdev->rtc); in xlnx_rtc_probe()
353 struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev); in xlnx_rtc_suspend() local
356 enable_irq_wake(xrtcdev->alarm_irq); in xlnx_rtc_suspend()
365 struct xlnx_rtc_dev *xrtcdev = dev_get_drvdata(dev); in xlnx_rtc_resume() local
368 disable_irq_wake(xrtcdev->alarm_irq); in xlnx_rtc_resume()