Lines Matching refs:dw_ced
84 void dw_apb_clockevent_pause(struct dw_apb_clock_event_device *dw_ced) in dw_apb_clockevent_pause() argument
86 disable_irq(dw_ced->timer.irq); in dw_apb_clockevent_pause()
87 apbt_disable_int(&dw_ced->timer); in dw_apb_clockevent_pause()
98 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in dw_apb_clockevent_irq() local
105 if (dw_ced->eoi) in dw_apb_clockevent_irq()
106 dw_ced->eoi(&dw_ced->timer); in dw_apb_clockevent_irq()
123 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_shutdown() local
129 ctrl = apbt_readl(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_shutdown()
131 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_shutdown()
137 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_set_oneshot() local
143 ctrl = apbt_readl(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_set_oneshot()
152 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_oneshot()
154 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_oneshot()
160 apbt_writel(&dw_ced->timer, ~0, APBTMR_N_LOAD_COUNT); in apbt_set_oneshot()
163 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_oneshot()
169 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_set_periodic() local
170 unsigned long period = DIV_ROUND_UP(dw_ced->timer.freq, HZ); in apbt_set_periodic()
176 ctrl = apbt_readl(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_set_periodic()
178 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_periodic()
184 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_periodic()
187 apbt_writel(&dw_ced->timer, period, APBTMR_N_LOAD_COUNT); in apbt_set_periodic()
189 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_periodic()
195 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_resume() local
200 apbt_enable_int(&dw_ced->timer); in apbt_resume()
208 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_next_event() local
211 ctrl = apbt_readl_relaxed(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_next_event()
213 apbt_writel_relaxed(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_next_event()
215 apbt_writel_relaxed(&dw_ced->timer, delta, APBTMR_N_LOAD_COUNT); in apbt_next_event()
217 apbt_writel_relaxed(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_next_event()
244 struct dw_apb_clock_event_device *dw_ced = in dw_apb_clockevent_init() local
245 kzalloc(sizeof(*dw_ced), GFP_KERNEL); in dw_apb_clockevent_init()
248 if (!dw_ced) in dw_apb_clockevent_init()
251 dw_ced->timer.base = base; in dw_apb_clockevent_init()
252 dw_ced->timer.irq = irq; in dw_apb_clockevent_init()
253 dw_ced->timer.freq = freq; in dw_apb_clockevent_init()
255 clockevents_calc_mult_shift(&dw_ced->ced, freq, APBT_MIN_PERIOD); in dw_apb_clockevent_init()
256 dw_ced->ced.max_delta_ns = clockevent_delta2ns(0x7fffffff, in dw_apb_clockevent_init()
257 &dw_ced->ced); in dw_apb_clockevent_init()
258 dw_ced->ced.max_delta_ticks = 0x7fffffff; in dw_apb_clockevent_init()
259 dw_ced->ced.min_delta_ns = clockevent_delta2ns(5000, &dw_ced->ced); in dw_apb_clockevent_init()
260 dw_ced->ced.min_delta_ticks = 5000; in dw_apb_clockevent_init()
261 dw_ced->ced.cpumask = cpu < 0 ? cpu_possible_mask : cpumask_of(cpu); in dw_apb_clockevent_init()
262 dw_ced->ced.features = CLOCK_EVT_FEAT_PERIODIC | in dw_apb_clockevent_init()
264 dw_ced->ced.set_state_shutdown = apbt_shutdown; in dw_apb_clockevent_init()
265 dw_ced->ced.set_state_periodic = apbt_set_periodic; in dw_apb_clockevent_init()
266 dw_ced->ced.set_state_oneshot = apbt_set_oneshot; in dw_apb_clockevent_init()
267 dw_ced->ced.set_state_oneshot_stopped = apbt_shutdown; in dw_apb_clockevent_init()
268 dw_ced->ced.tick_resume = apbt_resume; in dw_apb_clockevent_init()
269 dw_ced->ced.set_next_event = apbt_next_event; in dw_apb_clockevent_init()
270 dw_ced->ced.irq = dw_ced->timer.irq; in dw_apb_clockevent_init()
271 dw_ced->ced.rating = rating; in dw_apb_clockevent_init()
272 dw_ced->ced.name = name; in dw_apb_clockevent_init()
274 dw_ced->eoi = apbt_eoi; in dw_apb_clockevent_init()
277 dw_ced->ced.name, &dw_ced->ced); in dw_apb_clockevent_init()
280 kfree(dw_ced); in dw_apb_clockevent_init()
281 dw_ced = NULL; in dw_apb_clockevent_init()
284 return dw_ced; in dw_apb_clockevent_init()
292 void dw_apb_clockevent_resume(struct dw_apb_clock_event_device *dw_ced) in dw_apb_clockevent_resume() argument
294 enable_irq(dw_ced->timer.irq); in dw_apb_clockevent_resume()
302 void dw_apb_clockevent_stop(struct dw_apb_clock_event_device *dw_ced) in dw_apb_clockevent_stop() argument
304 free_irq(dw_ced->timer.irq, &dw_ced->ced); in dw_apb_clockevent_stop()
312 void dw_apb_clockevent_register(struct dw_apb_clock_event_device *dw_ced) in dw_apb_clockevent_register() argument
314 apbt_writel(&dw_ced->timer, 0, APBTMR_N_CONTROL); in dw_apb_clockevent_register()
315 clockevents_register_device(&dw_ced->ced); in dw_apb_clockevent_register()
316 apbt_enable_int(&dw_ced->timer); in dw_apb_clockevent_register()