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