Lines Matching full:rtc
12 #include <linux/rtc.h>
22 u8 set_time; /* RTC + 0x00 */
23 u8 hour_set; /* RTC + 0x01 */
24 u8 minute_set; /* RTC + 0x02 */
25 u8 second_set; /* RTC + 0x03 */
27 u8 set_date; /* RTC + 0x04 */
28 u8 month_set; /* RTC + 0x05 */
29 u8 weekday_set; /* RTC + 0x06 */
30 u8 date_set; /* RTC + 0x07 */
32 u8 write_sw; /* RTC + 0x08 */
33 u8 sw_set; /* RTC + 0x09 */
34 u16 year_set; /* RTC + 0x0a */
36 u8 alm_enable; /* RTC + 0x0c */
37 u8 alm_hour_set; /* RTC + 0x0d */
38 u8 alm_min_set; /* RTC + 0x0e */
39 u8 int_enable; /* RTC + 0x0f */
42 u8 hour; /* RTC + 0x11 */
43 u8 minute; /* RTC + 0x12 */
44 u8 second; /* RTC + 0x13 */
46 u8 month; /* RTC + 0x14 */
47 u8 wday_mday; /* RTC + 0x15 */
48 u16 year; /* RTC + 0x16 */
50 u8 int_alm; /* RTC + 0x18 */
51 u8 int_sw; /* RTC + 0x19 */
52 u8 alm_status; /* RTC + 0x1a */
53 u8 sw_minute; /* RTC + 0x1b */
55 u8 bus_error_1; /* RTC + 0x1c */
56 u8 int_day; /* RTC + 0x1d */
57 u8 int_min; /* RTC + 0x1e */
58 u8 int_sec; /* RTC + 0x1f */
67 u32 target_time; /* RTC + 0x20 */
72 u32 actual_time; /* RTC + 0x24 */
73 u32 keep_alive; /* RTC + 0x28 */
80 struct rtc_device *rtc; member
105 struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev); in mpc5121_rtc_read_time() local
106 struct mpc5121_rtc_regs __iomem *regs = rtc->regs; in mpc5121_rtc_read_time()
127 struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev); in mpc5121_rtc_set_time() local
128 struct mpc5121_rtc_regs __iomem *regs = rtc->regs; in mpc5121_rtc_set_time()
149 struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev); in mpc5200_rtc_read_time() local
150 struct mpc5121_rtc_regs __iomem *regs = rtc->regs; in mpc5200_rtc_read_time()
176 struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev); in mpc5200_rtc_set_time() local
177 struct mpc5121_rtc_regs __iomem *regs = rtc->regs; in mpc5200_rtc_set_time()
198 struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev); in mpc5121_rtc_read_alarm() local
199 struct mpc5121_rtc_regs __iomem *regs = rtc->regs; in mpc5121_rtc_read_alarm()
201 *alarm = rtc->wkalarm; in mpc5121_rtc_read_alarm()
210 struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev); in mpc5121_rtc_set_alarm() local
211 struct mpc5121_rtc_regs __iomem *regs = rtc->regs; in mpc5121_rtc_set_alarm()
222 rtc->wkalarm = *alarm; in mpc5121_rtc_set_alarm()
228 struct mpc5121_rtc_data *rtc = dev_get_drvdata((struct device *)dev); in mpc5121_rtc_handler() local
229 struct mpc5121_rtc_regs __iomem *regs = rtc->regs; in mpc5121_rtc_handler()
236 rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF); in mpc5121_rtc_handler()
245 struct mpc5121_rtc_data *rtc = dev_get_drvdata((struct device *)dev); in mpc5121_rtc_handler_upd() local
246 struct mpc5121_rtc_regs __iomem *regs = rtc->regs; in mpc5121_rtc_handler_upd()
252 rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_UF); in mpc5121_rtc_handler_upd()
262 struct mpc5121_rtc_data *rtc = dev_get_drvdata(dev); in mpc5121_rtc_alarm_irq_enable() local
263 struct mpc5121_rtc_regs __iomem *regs = rtc->regs; in mpc5121_rtc_alarm_irq_enable()
272 rtc->wkalarm.enabled = val; in mpc5121_rtc_alarm_irq_enable()
295 struct mpc5121_rtc_data *rtc; in mpc5121_rtc_probe() local
298 rtc = devm_kzalloc(&op->dev, sizeof(*rtc), GFP_KERNEL); in mpc5121_rtc_probe()
299 if (!rtc) in mpc5121_rtc_probe()
302 rtc->regs = devm_platform_ioremap_resource(op, 0); in mpc5121_rtc_probe()
303 if (IS_ERR(rtc->regs)) { in mpc5121_rtc_probe()
305 return PTR_ERR(rtc->regs); in mpc5121_rtc_probe()
310 platform_set_drvdata(op, rtc); in mpc5121_rtc_probe()
312 rtc->irq = irq_of_parse_and_map(op->dev.of_node, 1); in mpc5121_rtc_probe()
313 err = devm_request_irq(&op->dev, rtc->irq, mpc5121_rtc_handler, 0, in mpc5121_rtc_probe()
314 "mpc5121-rtc", &op->dev); in mpc5121_rtc_probe()
317 __func__, rtc->irq); in mpc5121_rtc_probe()
321 rtc->irq_periodic = irq_of_parse_and_map(op->dev.of_node, 0); in mpc5121_rtc_probe()
322 err = devm_request_irq(&op->dev, rtc->irq_periodic, in mpc5121_rtc_probe()
327 __func__, rtc->irq_periodic); in mpc5121_rtc_probe()
331 rtc->rtc = devm_rtc_allocate_device(&op->dev); in mpc5121_rtc_probe()
332 if (IS_ERR(rtc->rtc)) { in mpc5121_rtc_probe()
333 err = PTR_ERR(rtc->rtc); in mpc5121_rtc_probe()
337 rtc->rtc->ops = &mpc5200_rtc_ops; in mpc5121_rtc_probe()
338 set_bit(RTC_FEATURE_ALARM_RES_MINUTE, rtc->rtc->features); in mpc5121_rtc_probe()
339 clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->rtc->features); in mpc5121_rtc_probe()
340 rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_0000; in mpc5121_rtc_probe()
341 rtc->rtc->range_max = 65733206399ULL; /* 4052-12-31 23:59:59 */ in mpc5121_rtc_probe()
343 if (of_device_is_compatible(op->dev.of_node, "fsl,mpc5121-rtc")) { in mpc5121_rtc_probe()
345 ka = in_be32(&rtc->regs->keep_alive); in mpc5121_rtc_probe()
348 "mpc5121-rtc: Battery or oscillator failure!\n"); in mpc5121_rtc_probe()
349 out_be32(&rtc->regs->keep_alive, ka); in mpc5121_rtc_probe()
351 rtc->rtc->ops = &mpc5121_rtc_ops; in mpc5121_rtc_probe()
357 rtc->rtc->range_min = 0; in mpc5121_rtc_probe()
358 rtc->rtc->range_max = U32_MAX; in mpc5121_rtc_probe()
361 err = devm_rtc_register_device(rtc->rtc); in mpc5121_rtc_probe()
368 irq_dispose_mapping(rtc->irq_periodic); in mpc5121_rtc_probe()
370 irq_dispose_mapping(rtc->irq); in mpc5121_rtc_probe()
377 struct mpc5121_rtc_data *rtc = platform_get_drvdata(op); in mpc5121_rtc_remove() local
378 struct mpc5121_rtc_regs __iomem *regs = rtc->regs; in mpc5121_rtc_remove()
384 irq_dispose_mapping(rtc->irq); in mpc5121_rtc_remove()
385 irq_dispose_mapping(rtc->irq_periodic); in mpc5121_rtc_remove()
392 { .compatible = "fsl,mpc5121-rtc", },
393 { .compatible = "fsl,mpc5200-rtc", },
401 .name = "mpc5121-rtc",