Lines Matching full:to
65 #define SYST_CON_REG(to) (timer_of_base(to) + SYST_CON) argument
66 #define SYST_VAL_REG(to) (timer_of_base(to) + SYST_VAL) argument
69 * SYST_CON_EN: Clock enable. Shall be set to
74 * SYST_CON_IRQ_EN: Set to allow interrupt.
76 * SYST_CON_IRQ_CLR: Set to clear interrupt.
84 static void mtk_syst_ack_irq(struct timer_of *to) in mtk_syst_ack_irq() argument
87 writel(SYST_CON_IRQ_CLR | SYST_CON_EN, SYST_CON_REG(to)); in mtk_syst_ack_irq()
93 struct timer_of *to = to_timer_of(clkevt); in mtk_syst_handler() local
95 mtk_syst_ack_irq(to); in mtk_syst_handler()
104 struct timer_of *to = to_timer_of(clkevt); in mtk_syst_clkevt_next_event() local
106 /* Enable clock to allow timeout tick update later */ in mtk_syst_clkevt_next_event()
107 writel(SYST_CON_EN, SYST_CON_REG(to)); in mtk_syst_clkevt_next_event()
113 writel(ticks, SYST_VAL_REG(to)); in mtk_syst_clkevt_next_event()
116 writel(SYST_CON_EN | SYST_CON_IRQ_EN, SYST_CON_REG(to)); in mtk_syst_clkevt_next_event()
144 static void mtk_gpt_clkevt_time_stop(struct timer_of *to, u8 timer) in mtk_gpt_clkevt_time_stop() argument
148 val = readl(timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_stop()
149 writel(val & ~GPT_CTRL_ENABLE, timer_of_base(to) + in mtk_gpt_clkevt_time_stop()
153 static void mtk_gpt_clkevt_time_setup(struct timer_of *to, in mtk_gpt_clkevt_time_setup() argument
156 writel(delay, timer_of_base(to) + GPT_CMP_REG(timer)); in mtk_gpt_clkevt_time_setup()
159 static void mtk_gpt_clkevt_time_start(struct timer_of *to, in mtk_gpt_clkevt_time_start() argument
165 writel(GPT_IRQ_ACK(timer), timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_clkevt_time_start()
167 val = readl(timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_start()
178 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_start()
190 struct timer_of *to = to_timer_of(clk); in mtk_gpt_clkevt_set_periodic() local
192 mtk_gpt_clkevt_time_stop(to, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
193 mtk_gpt_clkevt_time_setup(to, to->of_clk.period, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
194 mtk_gpt_clkevt_time_start(to, true, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
202 struct timer_of *to = to_timer_of(clk); in mtk_gpt_clkevt_next_event() local
204 mtk_gpt_clkevt_time_stop(to, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
205 mtk_gpt_clkevt_time_setup(to, event, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
206 mtk_gpt_clkevt_time_start(to, false, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
214 struct timer_of *to = to_timer_of(clkevt); in mtk_gpt_interrupt() local
217 writel(GPT_IRQ_ACK(TIMER_CLK_EVT), timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_interrupt()
224 __init mtk_gpt_setup(struct timer_of *to, u8 timer, u8 option) in mtk_gpt_setup() argument
227 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_setup()
230 timer_of_base(to) + GPT_CLK_REG(timer)); in mtk_gpt_setup()
232 writel(0x0, timer_of_base(to) + GPT_CMP_REG(timer)); in mtk_gpt_setup()
235 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_setup()
238 static void mtk_gpt_enable_irq(struct timer_of *to, u8 timer) in mtk_gpt_enable_irq() argument
243 writel(0x0, timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
246 writel(0x3f, timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_enable_irq()
248 val = readl(timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
250 timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
253 static struct timer_of to = { variable
271 to.clkevt.features = CLOCK_EVT_FEAT_DYNIRQ | CLOCK_EVT_FEAT_ONESHOT; in mtk_syst_init()
272 to.clkevt.set_state_shutdown = mtk_syst_clkevt_shutdown; in mtk_syst_init()
273 to.clkevt.set_state_oneshot = mtk_syst_clkevt_oneshot; in mtk_syst_init()
274 to.clkevt.tick_resume = mtk_syst_clkevt_resume; in mtk_syst_init()
275 to.clkevt.set_next_event = mtk_syst_clkevt_next_event; in mtk_syst_init()
276 to.of_irq.handler = mtk_syst_handler; in mtk_syst_init()
278 ret = timer_of_init(node, &to); in mtk_syst_init()
282 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to), in mtk_syst_init()
292 to.clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; in mtk_gpt_init()
293 to.clkevt.set_state_shutdown = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
294 to.clkevt.set_state_periodic = mtk_gpt_clkevt_set_periodic; in mtk_gpt_init()
295 to.clkevt.set_state_oneshot = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
296 to.clkevt.tick_resume = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
297 to.clkevt.set_next_event = mtk_gpt_clkevt_next_event; in mtk_gpt_init()
298 to.of_irq.handler = mtk_gpt_interrupt; in mtk_gpt_init()
300 ret = timer_of_init(node, &to); in mtk_gpt_init()
305 mtk_gpt_setup(&to, TIMER_CLK_SRC, GPT_CTRL_OP_FREERUN); in mtk_gpt_init()
306 clocksource_mmio_init(timer_of_base(&to) + GPT_CNT_REG(TIMER_CLK_SRC), in mtk_gpt_init()
307 node->name, timer_of_rate(&to), 300, 32, in mtk_gpt_init()
309 gpt_sched_reg = timer_of_base(&to) + GPT_CNT_REG(TIMER_CLK_SRC); in mtk_gpt_init()
310 sched_clock_register(mtk_gpt_read_sched_clock, 32, timer_of_rate(&to)); in mtk_gpt_init()
313 mtk_gpt_setup(&to, TIMER_CLK_EVT, GPT_CTRL_OP_REPEAT); in mtk_gpt_init()
314 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to), in mtk_gpt_init()
317 mtk_gpt_enable_irq(&to, TIMER_CLK_EVT); in mtk_gpt_init()