Lines Matching +full:irq +full:- +full:syscfg
1 // SPDX-License-Identifier: GPL-2.0
10 #include <linux/clk-provider.h>
18 #include <linux/pinctrl/pinconf-generic.h>
189 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_wpr_unlock()
191 writel_relaxed(RTC_WPR_1ST_KEY, rtc->base + regs->wpr); in stm32_rtc_wpr_unlock()
192 writel_relaxed(RTC_WPR_2ND_KEY, rtc->base + regs->wpr); in stm32_rtc_wpr_unlock()
197 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_wpr_lock()
199 writel_relaxed(RTC_WPR_WRONG_KEY, rtc->base + regs->wpr); in stm32_rtc_wpr_lock()
254 struct stm32_rtc_registers regs = rtc->data->regs; in stm32_rtc_pinmux_action_alarm()
255 unsigned int cr = readl_relaxed(rtc->base + regs.cr); in stm32_rtc_pinmux_action_alarm()
256 unsigned int cfgr = readl_relaxed(rtc->base + regs.cfgr); in stm32_rtc_pinmux_action_alarm()
258 if (!rtc->data->has_alarm_out) in stm32_rtc_pinmux_action_alarm()
259 return -EPERM; in stm32_rtc_pinmux_action_alarm()
281 return -EINVAL; in stm32_rtc_pinmux_action_alarm()
285 writel_relaxed(cr, rtc->base + regs.cr); in stm32_rtc_pinmux_action_alarm()
286 writel_relaxed(cfgr, rtc->base + regs.cfgr); in stm32_rtc_pinmux_action_alarm()
295 struct stm32_rtc_registers regs = rtc->data->regs; in stm32_rtc_pinmux_lsco_available()
296 unsigned int cr = readl_relaxed(rtc->base + regs.cr); in stm32_rtc_pinmux_lsco_available()
297 unsigned int cfgr = readl_relaxed(rtc->base + regs.cfgr); in stm32_rtc_pinmux_lsco_available()
306 return -EBUSY; in stm32_rtc_pinmux_lsco_available()
312 return -EBUSY; in stm32_rtc_pinmux_lsco_available()
315 return -EINVAL; in stm32_rtc_pinmux_lsco_available()
318 if (clk_get_rate(rtc->rtc_ck) != 32768) in stm32_rtc_pinmux_lsco_available()
319 return -ERANGE; in stm32_rtc_pinmux_lsco_available()
327 struct stm32_rtc_registers regs = rtc->data->regs; in stm32_rtc_pinmux_action_lsco()
328 struct device *dev = rtc->rtc_dev->dev.parent; in stm32_rtc_pinmux_action_lsco()
332 if (!rtc->data->has_lsco) in stm32_rtc_pinmux_action_lsco()
333 return -EPERM; in stm32_rtc_pinmux_action_lsco()
341 rtc->clk_lsco = clk_register_gate(dev, "rtc_lsco", __clk_get_name(rtc->rtc_ck), in stm32_rtc_pinmux_action_lsco()
343 rtc->base + regs.cfgr, lscoen, 0, NULL); in stm32_rtc_pinmux_action_lsco()
344 if (IS_ERR(rtc->clk_lsco)) in stm32_rtc_pinmux_action_lsco()
345 return PTR_ERR(rtc->clk_lsco); in stm32_rtc_pinmux_action_lsco()
347 of_clk_add_provider(dev->of_node, of_clk_src_simple_get, rtc->clk_lsco); in stm32_rtc_pinmux_action_lsco()
354 STM32_RTC_PINMUX("alarm-a", &stm32_rtc_pinmux_action_alarm, "out1", "out2", "out2_rmp"),
385 return -EINVAL; in stm32_rtc_pinmux_set_mux()
407 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_enter_init_mode()
408 unsigned int isr = readl_relaxed(rtc->base + regs->isr); in stm32_rtc_enter_init_mode()
412 writel_relaxed(isr, rtc->base + regs->isr); in stm32_rtc_enter_init_mode()
420 return readl_relaxed_poll_timeout_atomic(rtc->base + regs->isr, isr, in stm32_rtc_enter_init_mode()
430 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_exit_init_mode()
431 unsigned int isr = readl_relaxed(rtc->base + regs->isr); in stm32_rtc_exit_init_mode()
434 writel_relaxed(isr, rtc->base + regs->isr); in stm32_rtc_exit_init_mode()
439 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_wait_sync()
440 unsigned int isr = readl_relaxed(rtc->base + regs->isr); in stm32_rtc_wait_sync()
443 writel_relaxed(isr, rtc->base + regs->isr); in stm32_rtc_wait_sync()
449 return readl_relaxed_poll_timeout_atomic(rtc->base + regs->isr, in stm32_rtc_wait_sync()
458 rtc->data->clear_events(rtc, flags); in stm32_rtc_clear_event_flags()
461 static irqreturn_t stm32_rtc_alarm_irq(int irq, void *dev_id) in stm32_rtc_alarm_irq() argument
464 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_alarm_irq()
465 const struct stm32_rtc_events *evts = &rtc->data->events; in stm32_rtc_alarm_irq()
468 rtc_lock(rtc->rtc_dev); in stm32_rtc_alarm_irq()
470 status = readl_relaxed(rtc->base + regs->sr); in stm32_rtc_alarm_irq()
471 cr = readl_relaxed(rtc->base + regs->cr); in stm32_rtc_alarm_irq()
473 if ((status & evts->alra) && in stm32_rtc_alarm_irq()
475 /* Alarm A flag - Alarm interrupt */ in stm32_rtc_alarm_irq()
476 dev_dbg(&rtc->rtc_dev->dev, "Alarm occurred\n"); in stm32_rtc_alarm_irq()
479 rtc_update_irq(rtc->rtc_dev, 1, RTC_IRQF | RTC_AF); in stm32_rtc_alarm_irq()
482 stm32_rtc_clear_event_flags(rtc, evts->alra); in stm32_rtc_alarm_irq()
485 rtc_unlock(rtc->rtc_dev); in stm32_rtc_alarm_irq()
493 tm->tm_sec = bin2bcd(tm->tm_sec); in tm2bcd()
494 tm->tm_min = bin2bcd(tm->tm_min); in tm2bcd()
495 tm->tm_hour = bin2bcd(tm->tm_hour); in tm2bcd()
497 tm->tm_mday = bin2bcd(tm->tm_mday); in tm2bcd()
498 tm->tm_mon = bin2bcd(tm->tm_mon + 1); in tm2bcd()
499 tm->tm_year = bin2bcd(tm->tm_year - 100); in tm2bcd()
502 * - on kernel side, 0=Sunday...6=Saturday in tm2bcd()
503 * - on rtc side, 0=invalid,1=Monday...7=Sunday in tm2bcd()
505 tm->tm_wday = (!tm->tm_wday) ? 7 : tm->tm_wday; in tm2bcd()
511 tm->tm_sec = bcd2bin(tm->tm_sec); in bcd2tm()
512 tm->tm_min = bcd2bin(tm->tm_min); in bcd2tm()
513 tm->tm_hour = bcd2bin(tm->tm_hour); in bcd2tm()
515 tm->tm_mday = bcd2bin(tm->tm_mday); in bcd2tm()
516 tm->tm_mon = bcd2bin(tm->tm_mon) - 1; in bcd2tm()
517 tm->tm_year = bcd2bin(tm->tm_year) + 100; in bcd2tm()
520 * - on kernel side, 0=Sunday...6=Saturday in bcd2tm()
521 * - on rtc side, 0=invalid,1=Monday...7=Sunday in bcd2tm()
523 tm->tm_wday %= 7; in bcd2tm()
529 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_read_time()
533 tr = readl_relaxed(rtc->base + regs->tr); in stm32_rtc_read_time()
534 dr = readl_relaxed(rtc->base + regs->dr); in stm32_rtc_read_time()
536 tm->tm_sec = (tr & STM32_RTC_TR_SEC) >> STM32_RTC_TR_SEC_SHIFT; in stm32_rtc_read_time()
537 tm->tm_min = (tr & STM32_RTC_TR_MIN) >> STM32_RTC_TR_MIN_SHIFT; in stm32_rtc_read_time()
538 tm->tm_hour = (tr & STM32_RTC_TR_HOUR) >> STM32_RTC_TR_HOUR_SHIFT; in stm32_rtc_read_time()
540 tm->tm_mday = (dr & STM32_RTC_DR_DATE) >> STM32_RTC_DR_DATE_SHIFT; in stm32_rtc_read_time()
541 tm->tm_mon = (dr & STM32_RTC_DR_MONTH) >> STM32_RTC_DR_MONTH_SHIFT; in stm32_rtc_read_time()
542 tm->tm_year = (dr & STM32_RTC_DR_YEAR) >> STM32_RTC_DR_YEAR_SHIFT; in stm32_rtc_read_time()
543 tm->tm_wday = (dr & STM32_RTC_DR_WDAY) >> STM32_RTC_DR_WDAY_SHIFT; in stm32_rtc_read_time()
555 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_set_time()
562 tr = ((tm->tm_sec << STM32_RTC_TR_SEC_SHIFT) & STM32_RTC_TR_SEC) | in stm32_rtc_set_time()
563 ((tm->tm_min << STM32_RTC_TR_MIN_SHIFT) & STM32_RTC_TR_MIN) | in stm32_rtc_set_time()
564 ((tm->tm_hour << STM32_RTC_TR_HOUR_SHIFT) & STM32_RTC_TR_HOUR); in stm32_rtc_set_time()
567 dr = ((tm->tm_mday << STM32_RTC_DR_DATE_SHIFT) & STM32_RTC_DR_DATE) | in stm32_rtc_set_time()
568 ((tm->tm_mon << STM32_RTC_DR_MONTH_SHIFT) & STM32_RTC_DR_MONTH) | in stm32_rtc_set_time()
569 ((tm->tm_year << STM32_RTC_DR_YEAR_SHIFT) & STM32_RTC_DR_YEAR) | in stm32_rtc_set_time()
570 ((tm->tm_wday << STM32_RTC_DR_WDAY_SHIFT) & STM32_RTC_DR_WDAY); in stm32_rtc_set_time()
580 writel_relaxed(tr, rtc->base + regs->tr); in stm32_rtc_set_time()
581 writel_relaxed(dr, rtc->base + regs->dr); in stm32_rtc_set_time()
595 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_read_alarm()
596 const struct stm32_rtc_events *evts = &rtc->data->events; in stm32_rtc_read_alarm()
597 struct rtc_time *tm = &alrm->time; in stm32_rtc_read_alarm()
600 alrmar = readl_relaxed(rtc->base + regs->alrmar); in stm32_rtc_read_alarm()
601 cr = readl_relaxed(rtc->base + regs->cr); in stm32_rtc_read_alarm()
602 status = readl_relaxed(rtc->base + regs->sr); in stm32_rtc_read_alarm()
609 tm->tm_mday = -1; in stm32_rtc_read_alarm()
610 tm->tm_wday = -1; in stm32_rtc_read_alarm()
614 tm->tm_mday = -1; in stm32_rtc_read_alarm()
615 tm->tm_wday = (alrmar & STM32_RTC_ALRMXR_WDAY) >> in stm32_rtc_read_alarm()
617 tm->tm_wday %= 7; in stm32_rtc_read_alarm()
620 tm->tm_wday = -1; in stm32_rtc_read_alarm()
621 tm->tm_mday = (alrmar & STM32_RTC_ALRMXR_DATE) >> in stm32_rtc_read_alarm()
628 tm->tm_hour = -1; in stm32_rtc_read_alarm()
630 tm->tm_hour = (alrmar & STM32_RTC_ALRMXR_HOUR) >> in stm32_rtc_read_alarm()
633 tm->tm_hour += 12; in stm32_rtc_read_alarm()
638 tm->tm_min = -1; in stm32_rtc_read_alarm()
640 tm->tm_min = (alrmar & STM32_RTC_ALRMXR_MIN) >> in stm32_rtc_read_alarm()
646 tm->tm_sec = -1; in stm32_rtc_read_alarm()
648 tm->tm_sec = (alrmar & STM32_RTC_ALRMXR_SEC) >> in stm32_rtc_read_alarm()
654 alrm->enabled = (cr & STM32_RTC_CR_ALRAE) ? 1 : 0; in stm32_rtc_read_alarm()
655 alrm->pending = (status & evts->alra) ? 1 : 0; in stm32_rtc_read_alarm()
663 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_alarm_irq_enable()
664 const struct stm32_rtc_events *evts = &rtc->data->events; in stm32_rtc_alarm_irq_enable()
667 cr = readl_relaxed(rtc->base + regs->cr); in stm32_rtc_alarm_irq_enable()
676 writel_relaxed(cr, rtc->base + regs->cr); in stm32_rtc_alarm_irq_enable()
679 stm32_rtc_clear_event_flags(rtc, evts->alra); in stm32_rtc_alarm_irq_enable()
695 * Assuming current date is M-D-Y H:M:S. in stm32_rtc_valid_alrm()
698 * M-D-Y H:M:S < alarm <= (M+1)-D-Y H:M:S in stm32_rtc_valid_alrm()
716 - now.tm_mday in stm32_rtc_valid_alrm()
721 return rtc_tm_to_time64(tm) <= max_alarm_time64 ? 0 : -EINVAL; in stm32_rtc_valid_alrm()
727 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_set_alarm()
728 struct rtc_time *tm = &alrm->time; in stm32_rtc_set_alarm()
738 return -EINVAL; in stm32_rtc_set_alarm()
745 alrmar |= (tm->tm_mday << STM32_RTC_ALRMXR_DATE_SHIFT) & in stm32_rtc_set_alarm()
747 /* 24-hour format */ in stm32_rtc_set_alarm()
749 alrmar |= (tm->tm_hour << STM32_RTC_ALRMXR_HOUR_SHIFT) & in stm32_rtc_set_alarm()
751 alrmar |= (tm->tm_min << STM32_RTC_ALRMXR_MIN_SHIFT) & in stm32_rtc_set_alarm()
753 alrmar |= (tm->tm_sec << STM32_RTC_ALRMXR_SEC_SHIFT) & in stm32_rtc_set_alarm()
759 cr = readl_relaxed(rtc->base + regs->cr); in stm32_rtc_set_alarm()
761 writel_relaxed(cr, rtc->base + regs->cr); in stm32_rtc_set_alarm()
767 ret = readl_relaxed_poll_timeout_atomic(rtc->base + regs->isr, in stm32_rtc_set_alarm()
778 writel_relaxed(alrmar, rtc->base + regs->alrmar); in stm32_rtc_set_alarm()
780 stm32_rtc_alarm_irq_enable(dev, alrm->enabled); in stm32_rtc_set_alarm()
798 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_clear_events()
801 writel_relaxed(readl_relaxed(rtc->base + regs->isr) & ~flags, in stm32_rtc_clear_events()
802 rtc->base + regs->isr); in stm32_rtc_clear_events()
860 struct stm32_rtc_registers regs = rtc->data->regs; in stm32mp1_rtc_clear_events()
863 writel_relaxed(flags, rtc->base + regs.scr); in stm32mp1_rtc_clear_events()
919 { .compatible = "st,stm32-rtc", .data = &stm32_rtc_data },
920 { .compatible = "st,stm32h7-rtc", .data = &stm32h7_rtc_data },
921 { .compatible = "st,stm32mp1-rtc", .data = &stm32mp1_data },
922 { .compatible = "st,stm32mp25-rtc", .data = &stm32mp25_data },
929 struct stm32_rtc_registers regs = rtc->data->regs; in stm32_rtc_clean_outs()
930 unsigned int cr = readl_relaxed(rtc->base + regs.cr); in stm32_rtc_clean_outs()
939 writel_relaxed(cr, rtc->base + regs.cr); in stm32_rtc_clean_outs()
943 unsigned int cfgr = readl_relaxed(rtc->base + regs.cfgr); in stm32_rtc_clean_outs()
947 writel_relaxed(cfgr, rtc->base + regs.cfgr); in stm32_rtc_clean_outs()
954 u32 rxcidcfgr = readl_relaxed(stm32_rtc->base + STM32_RTC_RXCIDCFGR(res.num)); in stm32_rtc_check_rif()
960 return -EACCES; in stm32_rtc_check_rif()
963 seccfgr = readl_relaxed(stm32_rtc->base + STM32_RTC_SECCFGR); in stm32_rtc_check_rif()
965 return -EACCES; in stm32_rtc_check_rif()
973 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_init()
978 rate = clk_get_rate(rtc->rtc_ck); in stm32_rtc_init()
985 dev_err(&pdev->dev, "rtc_ck rate is too high: %dHz\n", rate); in stm32_rtc_init()
986 return -EINVAL; in stm32_rtc_init()
989 if (rtc->data->need_accuracy) { in stm32_rtc_init()
991 pred_s = (rate / (pred_a + 1)) - 1; in stm32_rtc_init()
997 for (pred_a = pred_a_max; pred_a + 1 > 0; pred_a--) { in stm32_rtc_init()
998 pred_s = (rate / (pred_a + 1)) - 1; in stm32_rtc_init()
1011 pred_s = (rate / (pred_a + 1)) - 1; in stm32_rtc_init()
1013 dev_warn(&pdev->dev, "rtc_ck is %s\n", in stm32_rtc_init()
1018 cr = readl_relaxed(rtc->base + regs->cr); in stm32_rtc_init()
1020 prer = readl_relaxed(rtc->base + regs->prer); in stm32_rtc_init()
1036 dev_err(&pdev->dev, in stm32_rtc_init()
1041 writel_relaxed(pred_s, rtc->base + regs->prer); in stm32_rtc_init()
1042 writel_relaxed(pred_a | pred_s, rtc->base + regs->prer); in stm32_rtc_init()
1046 writel_relaxed(cr, rtc->base + regs->cr); in stm32_rtc_init()
1064 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); in stm32_rtc_probe()
1066 return -ENOMEM; in stm32_rtc_probe()
1068 rtc->base = devm_platform_ioremap_resource(pdev, 0); in stm32_rtc_probe()
1069 if (IS_ERR(rtc->base)) in stm32_rtc_probe()
1070 return PTR_ERR(rtc->base); in stm32_rtc_probe()
1072 rtc->data = (struct stm32_rtc_data *) in stm32_rtc_probe()
1073 of_device_get_match_data(&pdev->dev); in stm32_rtc_probe()
1074 regs = &rtc->data->regs; in stm32_rtc_probe()
1076 if (rtc->data->need_dbp) { in stm32_rtc_probe()
1077 rtc->dbp = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, in stm32_rtc_probe()
1078 "st,syscfg"); in stm32_rtc_probe()
1079 if (IS_ERR(rtc->dbp)) { in stm32_rtc_probe()
1080 dev_err(&pdev->dev, "no st,syscfg\n"); in stm32_rtc_probe()
1081 return PTR_ERR(rtc->dbp); in stm32_rtc_probe()
1084 ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg", in stm32_rtc_probe()
1085 1, &rtc->dbp_reg); in stm32_rtc_probe()
1087 dev_err(&pdev->dev, "can't read DBP register offset\n"); in stm32_rtc_probe()
1091 ret = of_property_read_u32_index(pdev->dev.of_node, "st,syscfg", in stm32_rtc_probe()
1092 2, &rtc->dbp_mask); in stm32_rtc_probe()
1094 dev_err(&pdev->dev, "can't read DBP register mask\n"); in stm32_rtc_probe()
1099 if (!rtc->data->has_pclk) { in stm32_rtc_probe()
1100 rtc->pclk = NULL; in stm32_rtc_probe()
1101 rtc->rtc_ck = devm_clk_get(&pdev->dev, NULL); in stm32_rtc_probe()
1103 rtc->pclk = devm_clk_get(&pdev->dev, "pclk"); in stm32_rtc_probe()
1104 if (IS_ERR(rtc->pclk)) in stm32_rtc_probe()
1105 return dev_err_probe(&pdev->dev, PTR_ERR(rtc->pclk), "no pclk clock"); in stm32_rtc_probe()
1107 rtc->rtc_ck = devm_clk_get(&pdev->dev, "rtc_ck"); in stm32_rtc_probe()
1109 if (IS_ERR(rtc->rtc_ck)) in stm32_rtc_probe()
1110 return dev_err_probe(&pdev->dev, PTR_ERR(rtc->rtc_ck), "no rtc_ck clock"); in stm32_rtc_probe()
1112 if (rtc->data->has_pclk) { in stm32_rtc_probe()
1113 ret = clk_prepare_enable(rtc->pclk); in stm32_rtc_probe()
1118 ret = clk_prepare_enable(rtc->rtc_ck); in stm32_rtc_probe()
1122 if (rtc->data->need_dbp) in stm32_rtc_probe()
1123 regmap_update_bits(rtc->dbp, rtc->dbp_reg, in stm32_rtc_probe()
1124 rtc->dbp_mask, rtc->dbp_mask); in stm32_rtc_probe()
1126 if (rtc->data->rif_protected) { in stm32_rtc_probe()
1131 dev_err(&pdev->dev, "Failed to probe RTC due to RIF configuration\n"); in stm32_rtc_probe()
1139 * power-on reset (no vbat, no power-supply). It is not reset if in stm32_rtc_probe()
1148 rtc->irq_alarm = platform_get_irq(pdev, 0); in stm32_rtc_probe()
1149 if (rtc->irq_alarm <= 0) { in stm32_rtc_probe()
1150 ret = rtc->irq_alarm; in stm32_rtc_probe()
1154 ret = device_init_wakeup(&pdev->dev, true); in stm32_rtc_probe()
1158 ret = dev_pm_set_wake_irq(&pdev->dev, rtc->irq_alarm); in stm32_rtc_probe()
1164 rtc->rtc_dev = devm_rtc_device_register(&pdev->dev, pdev->name, in stm32_rtc_probe()
1166 if (IS_ERR(rtc->rtc_dev)) { in stm32_rtc_probe()
1167 ret = PTR_ERR(rtc->rtc_dev); in stm32_rtc_probe()
1168 dev_err(&pdev->dev, "rtc device registration failed, err=%d\n", in stm32_rtc_probe()
1174 ret = devm_request_threaded_irq(&pdev->dev, rtc->irq_alarm, NULL, in stm32_rtc_probe()
1176 pdev->name, rtc); in stm32_rtc_probe()
1178 dev_err(&pdev->dev, "IRQ%d (alarm interrupt) already claimed\n", in stm32_rtc_probe()
1179 rtc->irq_alarm); in stm32_rtc_probe()
1185 ret = devm_pinctrl_register_and_init(&pdev->dev, &stm32_rtc_pdesc, rtc, &pctl); in stm32_rtc_probe()
1187 return dev_err_probe(&pdev->dev, ret, "pinctrl register failed"); in stm32_rtc_probe()
1191 return dev_err_probe(&pdev->dev, ret, "pinctrl enable failed"); in stm32_rtc_probe()
1197 if (!(readl_relaxed(rtc->base + regs->isr) & STM32_RTC_ISR_INITS)) in stm32_rtc_probe()
1198 dev_warn(&pdev->dev, "Date/Time must be initialized\n"); in stm32_rtc_probe()
1200 if (regs->verr != UNDEF_REG) { in stm32_rtc_probe()
1201 u32 ver = readl_relaxed(rtc->base + regs->verr); in stm32_rtc_probe()
1203 dev_info(&pdev->dev, "registered rev:%d.%d\n", in stm32_rtc_probe()
1211 clk_disable_unprepare(rtc->rtc_ck); in stm32_rtc_probe()
1213 if (rtc->data->has_pclk) in stm32_rtc_probe()
1214 clk_disable_unprepare(rtc->pclk); in stm32_rtc_probe()
1216 if (rtc->data->need_dbp) in stm32_rtc_probe()
1217 regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0); in stm32_rtc_probe()
1219 dev_pm_clear_wake_irq(&pdev->dev); in stm32_rtc_probe()
1220 device_init_wakeup(&pdev->dev, false); in stm32_rtc_probe()
1228 const struct stm32_rtc_registers *regs = &rtc->data->regs; in stm32_rtc_remove()
1231 if (!IS_ERR_OR_NULL(rtc->clk_lsco)) in stm32_rtc_remove()
1232 clk_unregister_gate(rtc->clk_lsco); in stm32_rtc_remove()
1236 cr = readl_relaxed(rtc->base + regs->cr); in stm32_rtc_remove()
1238 writel_relaxed(cr, rtc->base + regs->cr); in stm32_rtc_remove()
1241 clk_disable_unprepare(rtc->rtc_ck); in stm32_rtc_remove()
1242 if (rtc->data->has_pclk) in stm32_rtc_remove()
1243 clk_disable_unprepare(rtc->pclk); in stm32_rtc_remove()
1246 if (rtc->data->need_dbp) in stm32_rtc_remove()
1247 regmap_update_bits(rtc->dbp, rtc->dbp_reg, rtc->dbp_mask, 0); in stm32_rtc_remove()
1249 dev_pm_clear_wake_irq(&pdev->dev); in stm32_rtc_remove()
1250 device_init_wakeup(&pdev->dev, false); in stm32_rtc_remove()
1257 if (rtc->data->has_pclk) in stm32_rtc_suspend()
1258 clk_disable_unprepare(rtc->pclk); in stm32_rtc_suspend()
1268 if (rtc->data->has_pclk) { in stm32_rtc_resume()
1269 ret = clk_prepare_enable(rtc->pclk); in stm32_rtc_resume()
1276 if (rtc->data->has_pclk) in stm32_rtc_resume()
1277 clk_disable_unprepare(rtc->pclk); in stm32_rtc_resume()