Lines Matching refs:to
69 #define SYST_CON_REG(to) (timer_of_base(to) + SYST_CON) argument
70 #define SYST_VAL_REG(to) (timer_of_base(to) + SYST_VAL) argument
88 static u32 mtk_cpux_readl(u32 reg_idx, struct timer_of *to) in mtk_cpux_readl() argument
90 writel(reg_idx, timer_of_base(to) + CPUX_IDX_REG); in mtk_cpux_readl()
91 return readl(timer_of_base(to) + CPUX_CON_REG); in mtk_cpux_readl()
94 static void mtk_cpux_writel(u32 val, u32 reg_idx, struct timer_of *to) in mtk_cpux_writel() argument
96 writel(reg_idx, timer_of_base(to) + CPUX_IDX_REG); in mtk_cpux_writel()
97 writel(val, timer_of_base(to) + CPUX_CON_REG); in mtk_cpux_writel()
100 static void mtk_cpux_set_irq(struct timer_of *to, bool enable) in mtk_cpux_set_irq() argument
105 val = mtk_cpux_readl(CPUX_IDX_GLOBAL_IRQ, to); in mtk_cpux_set_irq()
112 mtk_cpux_writel(val, CPUX_IDX_GLOBAL_IRQ, to); in mtk_cpux_set_irq()
134 static void mtk_syst_ack_irq(struct timer_of *to) in mtk_syst_ack_irq() argument
137 writel(SYST_CON_EN, SYST_CON_REG(to)); in mtk_syst_ack_irq()
138 writel(SYST_CON_IRQ_CLR | SYST_CON_EN, SYST_CON_REG(to)); in mtk_syst_ack_irq()
144 struct timer_of *to = to_timer_of(clkevt); in mtk_syst_handler() local
146 mtk_syst_ack_irq(to); in mtk_syst_handler()
155 struct timer_of *to = to_timer_of(clkevt); in mtk_syst_clkevt_next_event() local
158 writel(SYST_CON_EN, SYST_CON_REG(to)); in mtk_syst_clkevt_next_event()
164 writel(ticks, SYST_VAL_REG(to)); in mtk_syst_clkevt_next_event()
167 writel(SYST_CON_EN | SYST_CON_IRQ_EN, SYST_CON_REG(to)); in mtk_syst_clkevt_next_event()
198 static void mtk_gpt_clkevt_time_stop(struct timer_of *to, u8 timer) in mtk_gpt_clkevt_time_stop() argument
202 val = readl(timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_stop()
203 writel(val & ~GPT_CTRL_ENABLE, timer_of_base(to) + in mtk_gpt_clkevt_time_stop()
207 static void mtk_gpt_clkevt_time_setup(struct timer_of *to, in mtk_gpt_clkevt_time_setup() argument
210 writel(delay, timer_of_base(to) + GPT_CMP_REG(timer)); in mtk_gpt_clkevt_time_setup()
213 static void mtk_gpt_clkevt_time_start(struct timer_of *to, in mtk_gpt_clkevt_time_start() argument
219 writel(GPT_IRQ_ACK(timer), timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_clkevt_time_start()
221 val = readl(timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_start()
232 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_start()
244 struct timer_of *to = to_timer_of(clk); in mtk_gpt_clkevt_set_periodic() local
246 mtk_gpt_clkevt_time_stop(to, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
247 mtk_gpt_clkevt_time_setup(to, to->of_clk.period, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
248 mtk_gpt_clkevt_time_start(to, true, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
256 struct timer_of *to = to_timer_of(clk); in mtk_gpt_clkevt_next_event() local
258 mtk_gpt_clkevt_time_stop(to, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
259 mtk_gpt_clkevt_time_setup(to, event, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
260 mtk_gpt_clkevt_time_start(to, false, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
268 struct timer_of *to = to_timer_of(clkevt); in mtk_gpt_interrupt() local
271 writel(GPT_IRQ_ACK(TIMER_CLK_EVT), timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_interrupt()
278 __init mtk_gpt_setup(struct timer_of *to, u8 timer, u8 option) in mtk_gpt_setup() argument
281 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_setup()
284 timer_of_base(to) + GPT_CLK_REG(timer)); in mtk_gpt_setup()
286 writel(0x0, timer_of_base(to) + GPT_CMP_REG(timer)); in mtk_gpt_setup()
289 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_setup()
292 static void mtk_gpt_enable_irq(struct timer_of *to, u8 timer) in mtk_gpt_enable_irq() argument
297 writel(0x0, timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
300 writel(0x3f, timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_enable_irq()
302 val = readl(timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
304 timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
309 struct timer_of *to = to_timer_of(clk); in mtk_gpt_resume() local
311 mtk_gpt_enable_irq(to, TIMER_CLK_EVT); in mtk_gpt_resume()
316 struct timer_of *to = to_timer_of(clk); in mtk_gpt_suspend() local
319 writel(0x0, timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_suspend()
326 writel(0x3f, timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_suspend()
329 static struct timer_of to = { variable
401 to.clkevt.features = CLOCK_EVT_FEAT_DYNIRQ | CLOCK_EVT_FEAT_ONESHOT; in mtk_syst_init()
402 to.clkevt.set_state_shutdown = mtk_syst_clkevt_shutdown; in mtk_syst_init()
403 to.clkevt.set_state_oneshot = mtk_syst_clkevt_oneshot; in mtk_syst_init()
404 to.clkevt.tick_resume = mtk_syst_clkevt_resume; in mtk_syst_init()
405 to.clkevt.set_next_event = mtk_syst_clkevt_next_event; in mtk_syst_init()
406 to.of_irq.handler = mtk_syst_handler; in mtk_syst_init()
408 ret = timer_of_init(node, &to); in mtk_syst_init()
412 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to), in mtk_syst_init()
422 to.clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; in mtk_gpt_init()
423 to.clkevt.set_state_shutdown = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
424 to.clkevt.set_state_periodic = mtk_gpt_clkevt_set_periodic; in mtk_gpt_init()
425 to.clkevt.set_state_oneshot = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
426 to.clkevt.tick_resume = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
427 to.clkevt.set_next_event = mtk_gpt_clkevt_next_event; in mtk_gpt_init()
428 to.clkevt.suspend = mtk_gpt_suspend; in mtk_gpt_init()
429 to.clkevt.resume = mtk_gpt_resume; in mtk_gpt_init()
430 to.of_irq.handler = mtk_gpt_interrupt; in mtk_gpt_init()
432 ret = timer_of_init(node, &to); in mtk_gpt_init()
437 mtk_gpt_setup(&to, TIMER_CLK_SRC, GPT_CTRL_OP_FREERUN); in mtk_gpt_init()
438 clocksource_mmio_init(timer_of_base(&to) + GPT_CNT_REG(TIMER_CLK_SRC), in mtk_gpt_init()
439 node->name, timer_of_rate(&to), 300, 32, in mtk_gpt_init()
441 gpt_sched_reg = timer_of_base(&to) + GPT_CNT_REG(TIMER_CLK_SRC); in mtk_gpt_init()
442 sched_clock_register(mtk_gpt_read_sched_clock, 32, timer_of_rate(&to)); in mtk_gpt_init()
445 mtk_gpt_setup(&to, TIMER_CLK_EVT, GPT_CTRL_OP_REPEAT); in mtk_gpt_init()
446 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to), in mtk_gpt_init()
449 mtk_gpt_enable_irq(&to, TIMER_CLK_EVT); in mtk_gpt_init()