Lines Matching refs:rtap

56 	struct coh901331_port *rtap = data;  in coh901331_interrupt()  local
58 clk_enable(rtap->clk); in coh901331_interrupt()
60 writel(1, rtap->virtbase + COH901331_IRQ_EVENT); in coh901331_interrupt()
68 writel(0, rtap->virtbase + COH901331_IRQ_MASK); in coh901331_interrupt()
69 clk_disable(rtap->clk); in coh901331_interrupt()
72 rtc_update_irq(rtap->rtc, 1, RTC_AF); in coh901331_interrupt()
79 struct coh901331_port *rtap = dev_get_drvdata(dev); in coh901331_read_time() local
81 clk_enable(rtap->clk); in coh901331_read_time()
83 if (!readl(rtap->virtbase + COH901331_VALID)) { in coh901331_read_time()
84 clk_disable(rtap->clk); in coh901331_read_time()
88 rtc_time64_to_tm(readl(rtap->virtbase + COH901331_CUR_TIME), tm); in coh901331_read_time()
89 clk_disable(rtap->clk); in coh901331_read_time()
95 struct coh901331_port *rtap = dev_get_drvdata(dev); in coh901331_set_time() local
97 clk_enable(rtap->clk); in coh901331_set_time()
98 writel(rtc_tm_to_time64(tm), rtap->virtbase + COH901331_SET_TIME); in coh901331_set_time()
99 clk_disable(rtap->clk); in coh901331_set_time()
106 struct coh901331_port *rtap = dev_get_drvdata(dev); in coh901331_read_alarm() local
108 clk_enable(rtap->clk); in coh901331_read_alarm()
109 rtc_time64_to_tm(readl(rtap->virtbase + COH901331_ALARM), &alarm->time); in coh901331_read_alarm()
110 alarm->pending = readl(rtap->virtbase + COH901331_IRQ_EVENT) & 1U; in coh901331_read_alarm()
111 alarm->enabled = readl(rtap->virtbase + COH901331_IRQ_MASK) & 1U; in coh901331_read_alarm()
112 clk_disable(rtap->clk); in coh901331_read_alarm()
119 struct coh901331_port *rtap = dev_get_drvdata(dev); in coh901331_set_alarm() local
122 clk_enable(rtap->clk); in coh901331_set_alarm()
123 writel(time, rtap->virtbase + COH901331_ALARM); in coh901331_set_alarm()
124 writel(alarm->enabled, rtap->virtbase + COH901331_IRQ_MASK); in coh901331_set_alarm()
125 clk_disable(rtap->clk); in coh901331_set_alarm()
132 struct coh901331_port *rtap = dev_get_drvdata(dev); in coh901331_alarm_irq_enable() local
134 clk_enable(rtap->clk); in coh901331_alarm_irq_enable()
136 writel(1, rtap->virtbase + COH901331_IRQ_MASK); in coh901331_alarm_irq_enable()
138 writel(0, rtap->virtbase + COH901331_IRQ_MASK); in coh901331_alarm_irq_enable()
139 clk_disable(rtap->clk); in coh901331_alarm_irq_enable()
154 struct coh901331_port *rtap = platform_get_drvdata(pdev); in coh901331_remove() local
156 if (rtap) in coh901331_remove()
157 clk_unprepare(rtap->clk); in coh901331_remove()
166 struct coh901331_port *rtap; in coh901331_probe() local
168 rtap = devm_kzalloc(&pdev->dev, in coh901331_probe()
170 if (!rtap) in coh901331_probe()
173 rtap->virtbase = devm_platform_ioremap_resource(pdev, 0); in coh901331_probe()
174 if (IS_ERR(rtap->virtbase)) in coh901331_probe()
175 return PTR_ERR(rtap->virtbase); in coh901331_probe()
177 rtap->irq = platform_get_irq(pdev, 0); in coh901331_probe()
178 if (devm_request_irq(&pdev->dev, rtap->irq, coh901331_interrupt, 0, in coh901331_probe()
179 "RTC COH 901 331 Alarm", rtap)) in coh901331_probe()
182 rtap->clk = devm_clk_get(&pdev->dev, NULL); in coh901331_probe()
183 if (IS_ERR(rtap->clk)) { in coh901331_probe()
184 ret = PTR_ERR(rtap->clk); in coh901331_probe()
189 rtap->rtc = devm_rtc_allocate_device(&pdev->dev); in coh901331_probe()
190 if (IS_ERR(rtap->rtc)) in coh901331_probe()
191 return PTR_ERR(rtap->rtc); in coh901331_probe()
193 rtap->rtc->ops = &coh901331_ops; in coh901331_probe()
194 rtap->rtc->range_max = U32_MAX; in coh901331_probe()
197 ret = clk_prepare_enable(rtap->clk); in coh901331_probe()
202 clk_disable(rtap->clk); in coh901331_probe()
204 platform_set_drvdata(pdev, rtap); in coh901331_probe()
206 ret = rtc_register_device(rtap->rtc); in coh901331_probe()
213 clk_unprepare(rtap->clk); in coh901331_probe()
220 struct coh901331_port *rtap = dev_get_drvdata(dev); in coh901331_suspend() local
228 enable_irq_wake(rtap->irq); in coh901331_suspend()
230 clk_enable(rtap->clk); in coh901331_suspend()
231 rtap->irqmaskstore = readl(rtap->virtbase + COH901331_IRQ_MASK); in coh901331_suspend()
232 writel(0, rtap->virtbase + COH901331_IRQ_MASK); in coh901331_suspend()
233 clk_disable(rtap->clk); in coh901331_suspend()
235 clk_unprepare(rtap->clk); in coh901331_suspend()
242 struct coh901331_port *rtap = dev_get_drvdata(dev); in coh901331_resume() local
244 ret = clk_prepare(rtap->clk); in coh901331_resume()
249 disable_irq_wake(rtap->irq); in coh901331_resume()
251 clk_enable(rtap->clk); in coh901331_resume()
252 writel(rtap->irqmaskstore, rtap->virtbase + COH901331_IRQ_MASK); in coh901331_resume()
253 clk_disable(rtap->clk); in coh901331_resume()
263 struct coh901331_port *rtap = platform_get_drvdata(pdev); in coh901331_shutdown() local
265 clk_enable(rtap->clk); in coh901331_shutdown()
266 writel(0, rtap->virtbase + COH901331_IRQ_MASK); in coh901331_shutdown()
267 clk_disable_unprepare(rtap->clk); in coh901331_shutdown()