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()
118 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_set_mode() local
126 period = DIV_ROUND_UP(dw_ced->timer.freq, HZ); in apbt_set_mode()
127 ctrl = apbt_readl(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_set_mode()
129 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_mode()
135 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_mode()
138 apbt_writel(&dw_ced->timer, period, APBTMR_N_LOAD_COUNT); in apbt_set_mode()
140 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_mode()
144 ctrl = apbt_readl(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_set_mode()
153 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_mode()
155 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_mode()
161 apbt_writel(&dw_ced->timer, ~0, APBTMR_N_LOAD_COUNT); in apbt_set_mode()
164 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_mode()
169 ctrl = apbt_readl(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_set_mode()
171 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_set_mode()
175 apbt_enable_int(&dw_ced->timer); in apbt_set_mode()
184 struct dw_apb_clock_event_device *dw_ced = ced_to_dw_apb_ced(evt); in apbt_next_event() local
187 ctrl = apbt_readl(&dw_ced->timer, APBTMR_N_CONTROL); in apbt_next_event()
189 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_next_event()
191 apbt_writel(&dw_ced->timer, delta, APBTMR_N_LOAD_COUNT); in apbt_next_event()
193 apbt_writel(&dw_ced->timer, ctrl, APBTMR_N_CONTROL); in apbt_next_event()
219 struct dw_apb_clock_event_device *dw_ced = in dw_apb_clockevent_init() local
220 kzalloc(sizeof(*dw_ced), GFP_KERNEL); in dw_apb_clockevent_init()
223 if (!dw_ced) in dw_apb_clockevent_init()
226 dw_ced->timer.base = base; in dw_apb_clockevent_init()
227 dw_ced->timer.irq = irq; in dw_apb_clockevent_init()
228 dw_ced->timer.freq = freq; in dw_apb_clockevent_init()
230 clockevents_calc_mult_shift(&dw_ced->ced, freq, APBT_MIN_PERIOD); in dw_apb_clockevent_init()
231 dw_ced->ced.max_delta_ns = clockevent_delta2ns(0x7fffffff, in dw_apb_clockevent_init()
232 &dw_ced->ced); in dw_apb_clockevent_init()
233 dw_ced->ced.min_delta_ns = clockevent_delta2ns(5000, &dw_ced->ced); in dw_apb_clockevent_init()
234 dw_ced->ced.cpumask = cpumask_of(cpu); in dw_apb_clockevent_init()
235 dw_ced->ced.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; in dw_apb_clockevent_init()
236 dw_ced->ced.set_mode = apbt_set_mode; in dw_apb_clockevent_init()
237 dw_ced->ced.set_next_event = apbt_next_event; in dw_apb_clockevent_init()
238 dw_ced->ced.irq = dw_ced->timer.irq; in dw_apb_clockevent_init()
239 dw_ced->ced.rating = rating; in dw_apb_clockevent_init()
240 dw_ced->ced.name = name; in dw_apb_clockevent_init()
242 dw_ced->irqaction.name = dw_ced->ced.name; in dw_apb_clockevent_init()
243 dw_ced->irqaction.handler = dw_apb_clockevent_irq; in dw_apb_clockevent_init()
244 dw_ced->irqaction.dev_id = &dw_ced->ced; in dw_apb_clockevent_init()
245 dw_ced->irqaction.irq = irq; in dw_apb_clockevent_init()
246 dw_ced->irqaction.flags = IRQF_TIMER | IRQF_IRQPOLL | in dw_apb_clockevent_init()
249 dw_ced->eoi = apbt_eoi; in dw_apb_clockevent_init()
250 err = setup_irq(irq, &dw_ced->irqaction); in dw_apb_clockevent_init()
253 kfree(dw_ced); in dw_apb_clockevent_init()
254 dw_ced = NULL; in dw_apb_clockevent_init()
257 return dw_ced; in dw_apb_clockevent_init()
265 void dw_apb_clockevent_resume(struct dw_apb_clock_event_device *dw_ced) in dw_apb_clockevent_resume() argument
267 enable_irq(dw_ced->timer.irq); in dw_apb_clockevent_resume()
275 void dw_apb_clockevent_stop(struct dw_apb_clock_event_device *dw_ced) in dw_apb_clockevent_stop() argument
277 free_irq(dw_ced->timer.irq, &dw_ced->ced); in dw_apb_clockevent_stop()
285 void dw_apb_clockevent_register(struct dw_apb_clock_event_device *dw_ced) in dw_apb_clockevent_register() argument
287 apbt_writel(&dw_ced->timer, 0, APBTMR_N_CONTROL); in dw_apb_clockevent_register()
288 clockevents_register_device(&dw_ced->ced); in dw_apb_clockevent_register()
289 apbt_enable_int(&dw_ced->timer); in dw_apb_clockevent_register()