Lines Matching refs:rtc
64 struct rtc_device *rtc; member
71 struct lpc24xx_rtc *rtc = dev_get_drvdata(dev); in lpc24xx_rtc_set_time() local
74 rtc_writel(rtc, LPC24XX_CCR, LPC178X_CCALEN); in lpc24xx_rtc_set_time()
76 rtc_writel(rtc, LPC24XX_SEC, tm->tm_sec); in lpc24xx_rtc_set_time()
77 rtc_writel(rtc, LPC24XX_MIN, tm->tm_min); in lpc24xx_rtc_set_time()
78 rtc_writel(rtc, LPC24XX_HOUR, tm->tm_hour); in lpc24xx_rtc_set_time()
79 rtc_writel(rtc, LPC24XX_DOW, tm->tm_wday); in lpc24xx_rtc_set_time()
80 rtc_writel(rtc, LPC24XX_DOM, tm->tm_mday); in lpc24xx_rtc_set_time()
81 rtc_writel(rtc, LPC24XX_DOY, tm->tm_yday); in lpc24xx_rtc_set_time()
82 rtc_writel(rtc, LPC24XX_MONTH, tm->tm_mon); in lpc24xx_rtc_set_time()
83 rtc_writel(rtc, LPC24XX_YEAR, tm->tm_year); in lpc24xx_rtc_set_time()
85 rtc_writel(rtc, LPC24XX_CCR, LPC24XX_CLKEN | LPC178X_CCALEN); in lpc24xx_rtc_set_time()
92 struct lpc24xx_rtc *rtc = dev_get_drvdata(dev); in lpc24xx_rtc_read_time() local
95 ct0 = rtc_readl(rtc, LPC24XX_CTIME0); in lpc24xx_rtc_read_time()
96 ct1 = rtc_readl(rtc, LPC24XX_CTIME1); in lpc24xx_rtc_read_time()
97 ct2 = rtc_readl(rtc, LPC24XX_CTIME2); in lpc24xx_rtc_read_time()
113 struct lpc24xx_rtc *rtc = dev_get_drvdata(dev); in lpc24xx_rtc_read_alarm() local
116 tm->tm_sec = rtc_readl(rtc, LPC24XX_ALSEC); in lpc24xx_rtc_read_alarm()
117 tm->tm_min = rtc_readl(rtc, LPC24XX_ALMIN); in lpc24xx_rtc_read_alarm()
118 tm->tm_hour = rtc_readl(rtc, LPC24XX_ALHOUR); in lpc24xx_rtc_read_alarm()
119 tm->tm_mday = rtc_readl(rtc, LPC24XX_ALDOM); in lpc24xx_rtc_read_alarm()
120 tm->tm_wday = rtc_readl(rtc, LPC24XX_ALDOW); in lpc24xx_rtc_read_alarm()
121 tm->tm_yday = rtc_readl(rtc, LPC24XX_ALDOY); in lpc24xx_rtc_read_alarm()
122 tm->tm_mon = rtc_readl(rtc, LPC24XX_ALMON); in lpc24xx_rtc_read_alarm()
123 tm->tm_year = rtc_readl(rtc, LPC24XX_ALYEAR); in lpc24xx_rtc_read_alarm()
125 wkalrm->enabled = rtc_readl(rtc, LPC24XX_AMR) == 0; in lpc24xx_rtc_read_alarm()
126 wkalrm->pending = !!(rtc_readl(rtc, LPC24XX_ILR) & LPC24XX_RTCCIF); in lpc24xx_rtc_read_alarm()
133 struct lpc24xx_rtc *rtc = dev_get_drvdata(dev); in lpc24xx_rtc_set_alarm() local
137 rtc_writel(rtc, LPC24XX_AMR, LPC24XX_ALARM_DISABLE); in lpc24xx_rtc_set_alarm()
139 rtc_writel(rtc, LPC24XX_ALSEC, tm->tm_sec); in lpc24xx_rtc_set_alarm()
140 rtc_writel(rtc, LPC24XX_ALMIN, tm->tm_min); in lpc24xx_rtc_set_alarm()
141 rtc_writel(rtc, LPC24XX_ALHOUR, tm->tm_hour); in lpc24xx_rtc_set_alarm()
142 rtc_writel(rtc, LPC24XX_ALDOM, tm->tm_mday); in lpc24xx_rtc_set_alarm()
143 rtc_writel(rtc, LPC24XX_ALDOW, tm->tm_wday); in lpc24xx_rtc_set_alarm()
144 rtc_writel(rtc, LPC24XX_ALDOY, tm->tm_yday); in lpc24xx_rtc_set_alarm()
145 rtc_writel(rtc, LPC24XX_ALMON, tm->tm_mon); in lpc24xx_rtc_set_alarm()
146 rtc_writel(rtc, LPC24XX_ALYEAR, tm->tm_year); in lpc24xx_rtc_set_alarm()
149 rtc_writel(rtc, LPC24XX_AMR, 0); in lpc24xx_rtc_set_alarm()
156 struct lpc24xx_rtc *rtc = dev_get_drvdata(dev); in lpc24xx_rtc_alarm_irq_enable() local
159 rtc_writel(rtc, LPC24XX_AMR, 0); in lpc24xx_rtc_alarm_irq_enable()
161 rtc_writel(rtc, LPC24XX_AMR, LPC24XX_ALARM_DISABLE); in lpc24xx_rtc_alarm_irq_enable()
169 struct lpc24xx_rtc *rtc = data; in lpc24xx_rtc_interrupt() local
173 rtc_iir = rtc_readl(rtc, LPC24XX_ILR); in lpc24xx_rtc_interrupt()
176 rtc_writel(rtc, LPC24XX_AMR, LPC24XX_ALARM_DISABLE); in lpc24xx_rtc_interrupt()
180 rtc_writel(rtc, LPC24XX_ILR, rtc_iir); in lpc24xx_rtc_interrupt()
181 rtc_update_irq(rtc->rtc, 1, events); in lpc24xx_rtc_interrupt()
196 struct lpc24xx_rtc *rtc; in lpc24xx_rtc_probe() local
199 rtc = devm_kzalloc(&pdev->dev, sizeof(*rtc), GFP_KERNEL); in lpc24xx_rtc_probe()
200 if (!rtc) in lpc24xx_rtc_probe()
203 rtc->rtc_base = devm_platform_ioremap_resource(pdev, 0); in lpc24xx_rtc_probe()
204 if (IS_ERR(rtc->rtc_base)) in lpc24xx_rtc_probe()
205 return PTR_ERR(rtc->rtc_base); in lpc24xx_rtc_probe()
211 rtc->clk_rtc = devm_clk_get(&pdev->dev, "rtc"); in lpc24xx_rtc_probe()
212 if (IS_ERR(rtc->clk_rtc)) { in lpc24xx_rtc_probe()
214 return PTR_ERR(rtc->clk_rtc); in lpc24xx_rtc_probe()
217 rtc->clk_reg = devm_clk_get(&pdev->dev, "reg"); in lpc24xx_rtc_probe()
218 if (IS_ERR(rtc->clk_reg)) { in lpc24xx_rtc_probe()
220 return PTR_ERR(rtc->clk_reg); in lpc24xx_rtc_probe()
223 ret = clk_prepare_enable(rtc->clk_rtc); in lpc24xx_rtc_probe()
229 ret = clk_prepare_enable(rtc->clk_reg); in lpc24xx_rtc_probe()
235 platform_set_drvdata(pdev, rtc); in lpc24xx_rtc_probe()
238 rtc_writel(rtc, LPC24XX_ILR, LPC24XX_RTCCIF | LPC24XX_RTCALF); in lpc24xx_rtc_probe()
241 rtc_writel(rtc, LPC24XX_CCR, LPC24XX_CLKEN | LPC178X_CCALEN); in lpc24xx_rtc_probe()
244 pdev->name, rtc); in lpc24xx_rtc_probe()
250 rtc->rtc = devm_rtc_device_register(&pdev->dev, "lpc24xx-rtc", in lpc24xx_rtc_probe()
252 if (IS_ERR(rtc->rtc)) { in lpc24xx_rtc_probe()
254 ret = PTR_ERR(rtc->rtc); in lpc24xx_rtc_probe()
261 clk_disable_unprepare(rtc->clk_reg); in lpc24xx_rtc_probe()
263 clk_disable_unprepare(rtc->clk_rtc); in lpc24xx_rtc_probe()
269 struct lpc24xx_rtc *rtc = platform_get_drvdata(pdev); in lpc24xx_rtc_remove() local
272 rtc_writel(rtc, LPC24XX_AMR, LPC24XX_ALARM_DISABLE); in lpc24xx_rtc_remove()
273 rtc_writel(rtc, LPC24XX_CIIR, 0); in lpc24xx_rtc_remove()
275 rtc_writel(rtc, LPC24XX_CCR, LPC178X_CCALEN); in lpc24xx_rtc_remove()
277 clk_disable_unprepare(rtc->clk_rtc); in lpc24xx_rtc_remove()
278 clk_disable_unprepare(rtc->clk_reg); in lpc24xx_rtc_remove()