Lines Matching refs:dw_ced

76 void dw_apb_clockevent_pause(struct dw_apb_clock_event_device *dw_ced)  in dw_apb_clockevent_pause()  argument
78 disable_irq(dw_ced->timer.irq); in dw_apb_clockevent_pause()
79 apbt_disable_int(&dw_ced->timer); in dw_apb_clockevent_pause()
90 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in dw_apb_clockevent_irq() local
97 if (dw_ced->eoi) in dw_apb_clockevent_irq()
98 dw_ced->eoi(&dw_ced->timer); in dw_apb_clockevent_irq()
115 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_shutdown() local
121 ctrl = apbt_readl(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_shutdown()
123 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_shutdown()
129 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_set_oneshot() local
135 ctrl = apbt_readl(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_set_oneshot()
144 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_oneshot()
146 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_oneshot()
152 apbt_writel(&dw_ced->timer, ~0, APBTMR_N_LOAD_COUNT); in apbt_set_oneshot()
155 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_oneshot()
161 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_set_periodic() local
162 unsigned long period = DIV_ROUND_UP(dw_ced->timer.freq, HZ); in apbt_set_periodic()
168 ctrl = apbt_readl(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_set_periodic()
170 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_periodic()
176 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_periodic()
179 apbt_writel(&dw_ced->timer, period, APBTMR_N_LOAD_COUNT); in apbt_set_periodic()
181 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_periodic()
187 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_resume() local
192 apbt_enable_int(&dw_ced->timer); in apbt_resume()
200 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_next_event() local
203 ctrl = apbt_readl(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_next_event()
205 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_next_event()
207 apbt_writel(&dw_ced->timer, delta, APBTMR_N_LOAD_COUNT); in apbt_next_event()
209 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_next_event()
235 struct dw_apb_clock_event_device *dw_ced = in dw_apb_clockevent_init() local
236 kzalloc(sizeof(*dw_ced), GFP_KERNEL); in dw_apb_clockevent_init()
239 if (!dw_ced) in dw_apb_clockevent_init()
242 dw_ced->timer.base = base; in dw_apb_clockevent_init()
243 dw_ced->timer.irq = irq; in dw_apb_clockevent_init()
244 dw_ced->timer.freq = freq; in dw_apb_clockevent_init()
246 clockevents_calc_mult_shift(&dw_ced->ced, freq, APBT_MIN_PERIOD); in dw_apb_clockevent_init()
247 dw_ced->ced.max_delta_ns = clockevent_delta2ns(0x7fffffff, in dw_apb_clockevent_init()
248 &dw_ced->ced); in dw_apb_clockevent_init()
249 dw_ced->ced.min_delta_ns = clockevent_delta2ns(5000, &dw_ced->ced); in dw_apb_clockevent_init()
250 dw_ced->ced.cpumask = cpumask_of(cpu); in dw_apb_clockevent_init()
251 dw_ced->ced.features = CLOCK_EVT_FEAT_PERIODIC | in dw_apb_clockevent_init()
253 dw_ced->ced.set_state_shutdown = apbt_shutdown; in dw_apb_clockevent_init()
254 dw_ced->ced.set_state_periodic = apbt_set_periodic; in dw_apb_clockevent_init()
255 dw_ced->ced.set_state_oneshot = apbt_set_oneshot; in dw_apb_clockevent_init()
256 dw_ced->ced.tick_resume = apbt_resume; in dw_apb_clockevent_init()
257 dw_ced->ced.set_next_event = apbt_next_event; in dw_apb_clockevent_init()
258 dw_ced->ced.irq = dw_ced->timer.irq; in dw_apb_clockevent_init()
259 dw_ced->ced.rating = rating; in dw_apb_clockevent_init()
260 dw_ced->ced.name = name; in dw_apb_clockevent_init()
262 dw_ced->irqaction.name = dw_ced->ced.name; in dw_apb_clockevent_init()
263 dw_ced->irqaction.handler = dw_apb_clockevent_irq; in dw_apb_clockevent_init()
264 dw_ced->irqaction.dev_id = &dw_ced->ced; in dw_apb_clockevent_init()
265 dw_ced->irqaction.irq = irq; in dw_apb_clockevent_init()
266 dw_ced->irqaction.flags = IRQF_TIMER | IRQF_IRQPOLL | in dw_apb_clockevent_init()
269 dw_ced->eoi = apbt_eoi; in dw_apb_clockevent_init()
270 err = setup_irq(irq, &dw_ced->irqaction); in dw_apb_clockevent_init()
273 kfree(dw_ced); in dw_apb_clockevent_init()
274 dw_ced = NULL; in dw_apb_clockevent_init()
277 return dw_ced; in dw_apb_clockevent_init()
285 void dw_apb_clockevent_resume(struct dw_apb_clock_event_device *dw_ced) in dw_apb_clockevent_resume() argument
287 enable_irq(dw_ced->timer.irq); in dw_apb_clockevent_resume()
295 void dw_apb_clockevent_stop(struct dw_apb_clock_event_device *dw_ced) in dw_apb_clockevent_stop() argument
297 free_irq(dw_ced->timer.irq, &dw_ced->ced); in dw_apb_clockevent_stop()
305 void dw_apb_clockevent_register(struct dw_apb_clock_event_device *dw_ced) in dw_apb_clockevent_register() argument
307 apbt_writel(&dw_ced->timer, 0, APBTMR_N_CONTROL); in dw_apb_clockevent_register()
308 clockevents_register_device(&dw_ced->ced); in dw_apb_clockevent_register()
309 apbt_enable_int(&dw_ced->timer); in dw_apb_clockevent_register()