Lines Matching refs:ce

58 static void sun5i_clkevt_sync(struct sun5i_timer *ce)  in sun5i_clkevt_sync()  argument
60 u32 old = readl(ce->base + TIMER_CNTVAL_LO_REG(1)); in sun5i_clkevt_sync()
62 while ((old - readl(ce->base + TIMER_CNTVAL_LO_REG(1))) < TIMER_SYNC_TICKS) in sun5i_clkevt_sync()
66 static void sun5i_clkevt_time_stop(struct sun5i_timer *ce, u8 timer) in sun5i_clkevt_time_stop() argument
68 u32 val = readl(ce->base + TIMER_CTL_REG(timer)); in sun5i_clkevt_time_stop()
69 writel(val & ~TIMER_CTL_ENABLE, ce->base + TIMER_CTL_REG(timer)); in sun5i_clkevt_time_stop()
71 sun5i_clkevt_sync(ce); in sun5i_clkevt_time_stop()
74 static void sun5i_clkevt_time_setup(struct sun5i_timer *ce, u8 timer, u32 delay) in sun5i_clkevt_time_setup() argument
76 writel(delay, ce->base + TIMER_INTVAL_LO_REG(timer)); in sun5i_clkevt_time_setup()
79 static void sun5i_clkevt_time_start(struct sun5i_timer *ce, u8 timer, bool periodic) in sun5i_clkevt_time_start() argument
81 u32 val = readl(ce->base + TIMER_CTL_REG(timer)); in sun5i_clkevt_time_start()
89 ce->base + TIMER_CTL_REG(timer)); in sun5i_clkevt_time_start()
94 struct sun5i_timer *ce = clkevt_to_sun5i_timer(clkevt); in sun5i_clkevt_shutdown() local
96 sun5i_clkevt_time_stop(ce, 0); in sun5i_clkevt_shutdown()
102 struct sun5i_timer *ce = clkevt_to_sun5i_timer(clkevt); in sun5i_clkevt_set_oneshot() local
104 sun5i_clkevt_time_stop(ce, 0); in sun5i_clkevt_set_oneshot()
105 sun5i_clkevt_time_start(ce, 0, false); in sun5i_clkevt_set_oneshot()
111 struct sun5i_timer *ce = clkevt_to_sun5i_timer(clkevt); in sun5i_clkevt_set_periodic() local
113 sun5i_clkevt_time_stop(ce, 0); in sun5i_clkevt_set_periodic()
114 sun5i_clkevt_time_setup(ce, 0, ce->ticks_per_jiffy); in sun5i_clkevt_set_periodic()
115 sun5i_clkevt_time_start(ce, 0, true); in sun5i_clkevt_set_periodic()
122 struct sun5i_timer *ce = clkevt_to_sun5i_timer(clkevt); in sun5i_clkevt_next_event() local
124 sun5i_clkevt_time_stop(ce, 0); in sun5i_clkevt_next_event()
125 sun5i_clkevt_time_setup(ce, 0, evt - TIMER_SYNC_TICKS); in sun5i_clkevt_next_event()
126 sun5i_clkevt_time_start(ce, 0, false); in sun5i_clkevt_next_event()
133 struct sun5i_timer *ce = dev_id; in sun5i_timer_interrupt() local
135 writel(0x1, ce->base + TIMER_IRQ_ST_REG); in sun5i_timer_interrupt()
136 ce->clkevt.event_handler(&ce->clkevt); in sun5i_timer_interrupt()
202 struct sun5i_timer *ce = platform_get_drvdata(pdev); in sun5i_setup_clockevent() local
203 void __iomem *base = ce->base; in sun5i_setup_clockevent()
207 ce->clkevt.name = dev->of_node->name; in sun5i_setup_clockevent()
208 ce->clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; in sun5i_setup_clockevent()
209 ce->clkevt.set_next_event = sun5i_clkevt_next_event; in sun5i_setup_clockevent()
210 ce->clkevt.set_state_shutdown = sun5i_clkevt_shutdown; in sun5i_setup_clockevent()
211 ce->clkevt.set_state_periodic = sun5i_clkevt_set_periodic; in sun5i_setup_clockevent()
212 ce->clkevt.set_state_oneshot = sun5i_clkevt_set_oneshot; in sun5i_setup_clockevent()
213 ce->clkevt.tick_resume = sun5i_clkevt_shutdown; in sun5i_setup_clockevent()
214 ce->clkevt.rating = 340; in sun5i_setup_clockevent()
215 ce->clkevt.irq = irq; in sun5i_setup_clockevent()
216 ce->clkevt.cpumask = cpu_possible_mask; in sun5i_setup_clockevent()
222 clockevents_config_and_register(&ce->clkevt, rate, in sun5i_setup_clockevent()
227 "sun5i_timer0", ce); in sun5i_setup_clockevent()