Lines Matching refs:vt8500_rtc

72 struct vt8500_rtc {  struct
81 struct vt8500_rtc *vt8500_rtc = dev_id; in vt8500_rtc_irq() argument
85 spin_lock(&vt8500_rtc->lock); in vt8500_rtc_irq()
88 isr = readl(vt8500_rtc->regbase + VT8500_RTC_IS); in vt8500_rtc_irq()
89 writel(isr, vt8500_rtc->regbase + VT8500_RTC_IS); in vt8500_rtc_irq()
91 spin_unlock(&vt8500_rtc->lock); in vt8500_rtc_irq()
96 rtc_update_irq(vt8500_rtc->rtc, 1, events); in vt8500_rtc_irq()
103 struct vt8500_rtc *vt8500_rtc = dev_get_drvdata(dev); in vt8500_rtc_read_time() local
106 date = readl(vt8500_rtc->regbase + VT8500_RTC_DR); in vt8500_rtc_read_time()
107 time = readl(vt8500_rtc->regbase + VT8500_RTC_TR); in vt8500_rtc_read_time()
123 struct vt8500_rtc *vt8500_rtc = dev_get_drvdata(dev); in vt8500_rtc_set_time() local
129 vt8500_rtc->regbase + VT8500_RTC_DS); in vt8500_rtc_set_time()
134 vt8500_rtc->regbase + VT8500_RTC_TS); in vt8500_rtc_set_time()
141 struct vt8500_rtc *vt8500_rtc = dev_get_drvdata(dev); in vt8500_rtc_read_alarm() local
144 alarm = readl(vt8500_rtc->regbase + VT8500_RTC_AS); in vt8500_rtc_read_alarm()
145 isr = readl(vt8500_rtc->regbase + VT8500_RTC_IS); in vt8500_rtc_read_alarm()
160 struct vt8500_rtc *vt8500_rtc = dev_get_drvdata(dev); in vt8500_rtc_set_alarm() local
167 vt8500_rtc->regbase + VT8500_RTC_AS); in vt8500_rtc_set_alarm()
174 struct vt8500_rtc *vt8500_rtc = dev_get_drvdata(dev); in vt8500_alarm_irq_enable() local
175 unsigned long tmp = readl(vt8500_rtc->regbase + VT8500_RTC_AS); in vt8500_alarm_irq_enable()
182 writel(tmp, vt8500_rtc->regbase + VT8500_RTC_AS); in vt8500_alarm_irq_enable()
196 struct vt8500_rtc *vt8500_rtc; in vt8500_rtc_probe() local
199 vt8500_rtc = devm_kzalloc(&pdev->dev, in vt8500_rtc_probe()
200 sizeof(struct vt8500_rtc), GFP_KERNEL); in vt8500_rtc_probe()
201 if (!vt8500_rtc) in vt8500_rtc_probe()
204 spin_lock_init(&vt8500_rtc->lock); in vt8500_rtc_probe()
205 platform_set_drvdata(pdev, vt8500_rtc); in vt8500_rtc_probe()
207 vt8500_rtc->irq_alarm = platform_get_irq(pdev, 0); in vt8500_rtc_probe()
208 if (vt8500_rtc->irq_alarm < 0) in vt8500_rtc_probe()
209 return vt8500_rtc->irq_alarm; in vt8500_rtc_probe()
211 vt8500_rtc->regbase = devm_platform_ioremap_resource(pdev, 0); in vt8500_rtc_probe()
212 if (IS_ERR(vt8500_rtc->regbase)) in vt8500_rtc_probe()
213 return PTR_ERR(vt8500_rtc->regbase); in vt8500_rtc_probe()
217 vt8500_rtc->regbase + VT8500_RTC_CR); in vt8500_rtc_probe()
219 vt8500_rtc->rtc = devm_rtc_allocate_device(&pdev->dev); in vt8500_rtc_probe()
220 if (IS_ERR(vt8500_rtc->rtc)) in vt8500_rtc_probe()
221 return PTR_ERR(vt8500_rtc->rtc); in vt8500_rtc_probe()
223 vt8500_rtc->rtc->ops = &vt8500_rtc_ops; in vt8500_rtc_probe()
224 vt8500_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; in vt8500_rtc_probe()
225 vt8500_rtc->rtc->range_max = RTC_TIMESTAMP_END_2199; in vt8500_rtc_probe()
227 ret = devm_request_irq(&pdev->dev, vt8500_rtc->irq_alarm, in vt8500_rtc_probe()
228 vt8500_rtc_irq, 0, "rtc alarm", vt8500_rtc); in vt8500_rtc_probe()
231 vt8500_rtc->irq_alarm, ret); in vt8500_rtc_probe()
235 return devm_rtc_register_device(vt8500_rtc->rtc); in vt8500_rtc_probe()
240 struct vt8500_rtc *vt8500_rtc = platform_get_drvdata(pdev); in vt8500_rtc_remove() local
243 writel(0, vt8500_rtc->regbase + VT8500_RTC_IS); in vt8500_rtc_remove()