Lines Matching refs:to
56 #define SYST_CON_REG(to) (timer_of_base(to) + SYST_CON) argument
57 #define SYST_VAL_REG(to) (timer_of_base(to) + SYST_VAL) argument
75 static void mtk_syst_ack_irq(struct timer_of *to) in mtk_syst_ack_irq() argument
78 writel(SYST_CON_EN, SYST_CON_REG(to)); in mtk_syst_ack_irq()
79 writel(SYST_CON_IRQ_CLR | SYST_CON_EN, SYST_CON_REG(to)); in mtk_syst_ack_irq()
85 struct timer_of *to = to_timer_of(clkevt); in mtk_syst_handler() local
87 mtk_syst_ack_irq(to); in mtk_syst_handler()
96 struct timer_of *to = to_timer_of(clkevt); in mtk_syst_clkevt_next_event() local
99 writel(SYST_CON_EN, SYST_CON_REG(to)); in mtk_syst_clkevt_next_event()
105 writel(ticks, SYST_VAL_REG(to)); in mtk_syst_clkevt_next_event()
108 writel(SYST_CON_EN | SYST_CON_IRQ_EN, SYST_CON_REG(to)); in mtk_syst_clkevt_next_event()
139 static void mtk_gpt_clkevt_time_stop(struct timer_of *to, u8 timer) in mtk_gpt_clkevt_time_stop() argument
143 val = readl(timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_stop()
144 writel(val & ~GPT_CTRL_ENABLE, timer_of_base(to) + in mtk_gpt_clkevt_time_stop()
148 static void mtk_gpt_clkevt_time_setup(struct timer_of *to, in mtk_gpt_clkevt_time_setup() argument
151 writel(delay, timer_of_base(to) + GPT_CMP_REG(timer)); in mtk_gpt_clkevt_time_setup()
154 static void mtk_gpt_clkevt_time_start(struct timer_of *to, in mtk_gpt_clkevt_time_start() argument
160 writel(GPT_IRQ_ACK(timer), timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_clkevt_time_start()
162 val = readl(timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_start()
173 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_start()
185 struct timer_of *to = to_timer_of(clk); in mtk_gpt_clkevt_set_periodic() local
187 mtk_gpt_clkevt_time_stop(to, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
188 mtk_gpt_clkevt_time_setup(to, to->of_clk.period, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
189 mtk_gpt_clkevt_time_start(to, true, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
197 struct timer_of *to = to_timer_of(clk); in mtk_gpt_clkevt_next_event() local
199 mtk_gpt_clkevt_time_stop(to, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
200 mtk_gpt_clkevt_time_setup(to, event, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
201 mtk_gpt_clkevt_time_start(to, false, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
209 struct timer_of *to = to_timer_of(clkevt); in mtk_gpt_interrupt() local
212 writel(GPT_IRQ_ACK(TIMER_CLK_EVT), timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_interrupt()
219 __init mtk_gpt_setup(struct timer_of *to, u8 timer, u8 option) in mtk_gpt_setup() argument
222 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_setup()
225 timer_of_base(to) + GPT_CLK_REG(timer)); in mtk_gpt_setup()
227 writel(0x0, timer_of_base(to) + GPT_CMP_REG(timer)); in mtk_gpt_setup()
230 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_setup()
233 static void mtk_gpt_enable_irq(struct timer_of *to, u8 timer) in mtk_gpt_enable_irq() argument
238 writel(0x0, timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
241 writel(0x3f, timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_enable_irq()
243 val = readl(timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
245 timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
250 struct timer_of *to = to_timer_of(clk); in mtk_gpt_resume() local
252 mtk_gpt_enable_irq(to, TIMER_CLK_EVT); in mtk_gpt_resume()
257 struct timer_of *to = to_timer_of(clk); in mtk_gpt_suspend() local
260 writel(0x0, timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_suspend()
267 writel(0x3f, timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_suspend()
270 static struct timer_of to = { variable
288 to.clkevt.features = CLOCK_EVT_FEAT_DYNIRQ | CLOCK_EVT_FEAT_ONESHOT; in mtk_syst_init()
289 to.clkevt.set_state_shutdown = mtk_syst_clkevt_shutdown; in mtk_syst_init()
290 to.clkevt.set_state_oneshot = mtk_syst_clkevt_oneshot; in mtk_syst_init()
291 to.clkevt.tick_resume = mtk_syst_clkevt_resume; in mtk_syst_init()
292 to.clkevt.set_next_event = mtk_syst_clkevt_next_event; in mtk_syst_init()
293 to.of_irq.handler = mtk_syst_handler; in mtk_syst_init()
295 ret = timer_of_init(node, &to); in mtk_syst_init()
299 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to), in mtk_syst_init()
309 to.clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; in mtk_gpt_init()
310 to.clkevt.set_state_shutdown = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
311 to.clkevt.set_state_periodic = mtk_gpt_clkevt_set_periodic; in mtk_gpt_init()
312 to.clkevt.set_state_oneshot = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
313 to.clkevt.tick_resume = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
314 to.clkevt.set_next_event = mtk_gpt_clkevt_next_event; in mtk_gpt_init()
315 to.clkevt.suspend = mtk_gpt_suspend; in mtk_gpt_init()
316 to.clkevt.resume = mtk_gpt_resume; in mtk_gpt_init()
317 to.of_irq.handler = mtk_gpt_interrupt; in mtk_gpt_init()
319 ret = timer_of_init(node, &to); in mtk_gpt_init()
324 mtk_gpt_setup(&to, TIMER_CLK_SRC, GPT_CTRL_OP_FREERUN); in mtk_gpt_init()
325 clocksource_mmio_init(timer_of_base(&to) + GPT_CNT_REG(TIMER_CLK_SRC), in mtk_gpt_init()
326 node->name, timer_of_rate(&to), 300, 32, in mtk_gpt_init()
328 gpt_sched_reg = timer_of_base(&to) + GPT_CNT_REG(TIMER_CLK_SRC); in mtk_gpt_init()
329 sched_clock_register(mtk_gpt_read_sched_clock, 32, timer_of_rate(&to)); in mtk_gpt_init()
332 mtk_gpt_setup(&to, TIMER_CLK_EVT, GPT_CTRL_OP_REPEAT); in mtk_gpt_init()
333 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to), in mtk_gpt_init()
336 mtk_gpt_enable_irq(&to, TIMER_CLK_EVT); in mtk_gpt_init()