• Home
  • Raw
  • Download

Lines Matching refs:rtc

66 	struct ftrtc010_rtc *rtc = dev_get_drvdata(dev);  in ftrtc010_rtc_read_time()  local
71 sec = readl(rtc->rtc_base + FTRTC010_RTC_SECOND); in ftrtc010_rtc_read_time()
72 min = readl(rtc->rtc_base + FTRTC010_RTC_MINUTE); in ftrtc010_rtc_read_time()
73 hour = readl(rtc->rtc_base + FTRTC010_RTC_HOUR); in ftrtc010_rtc_read_time()
74 days = readl(rtc->rtc_base + FTRTC010_RTC_DAYS); in ftrtc010_rtc_read_time()
75 offset = readl(rtc->rtc_base + FTRTC010_RTC_RECORD); in ftrtc010_rtc_read_time()
86 struct ftrtc010_rtc *rtc = dev_get_drvdata(dev); in ftrtc010_rtc_set_time() local
92 sec = readl(rtc->rtc_base + FTRTC010_RTC_SECOND); in ftrtc010_rtc_set_time()
93 min = readl(rtc->rtc_base + FTRTC010_RTC_MINUTE); in ftrtc010_rtc_set_time()
94 hour = readl(rtc->rtc_base + FTRTC010_RTC_HOUR); in ftrtc010_rtc_set_time()
95 day = readl(rtc->rtc_base + FTRTC010_RTC_DAYS); in ftrtc010_rtc_set_time()
99 writel(offset, rtc->rtc_base + FTRTC010_RTC_RECORD); in ftrtc010_rtc_set_time()
100 writel(0x01, rtc->rtc_base + FTRTC010_RTC_CR); in ftrtc010_rtc_set_time()
113 struct ftrtc010_rtc *rtc; in ftrtc010_rtc_probe() local
118 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); in ftrtc010_rtc_probe()
119 if (unlikely(!rtc)) in ftrtc010_rtc_probe()
121 platform_set_drvdata(pdev, rtc); in ftrtc010_rtc_probe()
123 rtc->pclk = devm_clk_get(dev, "PCLK"); in ftrtc010_rtc_probe()
124 if (IS_ERR(rtc->pclk)) { in ftrtc010_rtc_probe()
127 ret = clk_prepare_enable(rtc->pclk); in ftrtc010_rtc_probe()
133 rtc->extclk = devm_clk_get(dev, "EXTCLK"); in ftrtc010_rtc_probe()
134 if (IS_ERR(rtc->extclk)) { in ftrtc010_rtc_probe()
137 ret = clk_prepare_enable(rtc->extclk); in ftrtc010_rtc_probe()
144 rtc->rtc_irq = platform_get_irq(pdev, 0); in ftrtc010_rtc_probe()
145 if (rtc->rtc_irq < 0) { in ftrtc010_rtc_probe()
146 ret = rtc->rtc_irq; in ftrtc010_rtc_probe()
156 rtc->rtc_base = devm_ioremap(dev, res->start, in ftrtc010_rtc_probe()
158 if (!rtc->rtc_base) { in ftrtc010_rtc_probe()
163 rtc->rtc_dev = devm_rtc_allocate_device(dev); in ftrtc010_rtc_probe()
164 if (IS_ERR(rtc->rtc_dev)) { in ftrtc010_rtc_probe()
165 ret = PTR_ERR(rtc->rtc_dev); in ftrtc010_rtc_probe()
169 rtc->rtc_dev->ops = &ftrtc010_rtc_ops; in ftrtc010_rtc_probe()
171 sec = readl(rtc->rtc_base + FTRTC010_RTC_SECOND); in ftrtc010_rtc_probe()
172 min = readl(rtc->rtc_base + FTRTC010_RTC_MINUTE); in ftrtc010_rtc_probe()
173 hour = readl(rtc->rtc_base + FTRTC010_RTC_HOUR); in ftrtc010_rtc_probe()
174 days = readl(rtc->rtc_base + FTRTC010_RTC_DAYS); in ftrtc010_rtc_probe()
176 rtc->rtc_dev->range_min = (u64)days * 86400 + hour * 3600 + in ftrtc010_rtc_probe()
178 rtc->rtc_dev->range_max = U32_MAX + rtc->rtc_dev->range_min; in ftrtc010_rtc_probe()
180 ret = devm_request_irq(dev, rtc->rtc_irq, ftrtc010_rtc_interrupt, in ftrtc010_rtc_probe()
185 return devm_rtc_register_device(rtc->rtc_dev); in ftrtc010_rtc_probe()
188 clk_disable_unprepare(rtc->extclk); in ftrtc010_rtc_probe()
190 clk_disable_unprepare(rtc->pclk); in ftrtc010_rtc_probe()
196 struct ftrtc010_rtc *rtc = platform_get_drvdata(pdev); in ftrtc010_rtc_remove() local
198 if (!IS_ERR(rtc->extclk)) in ftrtc010_rtc_remove()
199 clk_disable_unprepare(rtc->extclk); in ftrtc010_rtc_remove()
200 if (!IS_ERR(rtc->pclk)) in ftrtc010_rtc_remove()
201 clk_disable_unprepare(rtc->pclk); in ftrtc010_rtc_remove()