Lines Matching full: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
60 * SYST_CON_EN: Clock enable. Shall be set to
65 * SYST_CON_IRQ_EN: Set to allow interrupt.
67 * SYST_CON_IRQ_CLR: Set to clear interrupt.
75 static void mtk_syst_ack_irq(struct timer_of *to) in mtk_syst_ack_irq() argument
78 writel(SYST_CON_IRQ_CLR | SYST_CON_EN, SYST_CON_REG(to)); in mtk_syst_ack_irq()
84 struct timer_of *to = to_timer_of(clkevt); in mtk_syst_handler() local
86 mtk_syst_ack_irq(to); in mtk_syst_handler()
95 struct timer_of *to = to_timer_of(clkevt); in mtk_syst_clkevt_next_event() local
97 /* Enable clock to allow timeout tick update later */ in mtk_syst_clkevt_next_event()
98 writel(SYST_CON_EN, SYST_CON_REG(to)); in mtk_syst_clkevt_next_event()
104 writel(ticks, SYST_VAL_REG(to)); in mtk_syst_clkevt_next_event()
107 writel(SYST_CON_EN | SYST_CON_IRQ_EN, SYST_CON_REG(to)); in mtk_syst_clkevt_next_event()
135 static void mtk_gpt_clkevt_time_stop(struct timer_of *to, u8 timer) in mtk_gpt_clkevt_time_stop() argument
139 val = readl(timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_stop()
140 writel(val & ~GPT_CTRL_ENABLE, timer_of_base(to) + in mtk_gpt_clkevt_time_stop()
144 static void mtk_gpt_clkevt_time_setup(struct timer_of *to, in mtk_gpt_clkevt_time_setup() argument
147 writel(delay, timer_of_base(to) + GPT_CMP_REG(timer)); in mtk_gpt_clkevt_time_setup()
150 static void mtk_gpt_clkevt_time_start(struct timer_of *to, in mtk_gpt_clkevt_time_start() argument
156 writel(GPT_IRQ_ACK(timer), timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_clkevt_time_start()
158 val = readl(timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_start()
169 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_start()
181 struct timer_of *to = to_timer_of(clk); in mtk_gpt_clkevt_set_periodic() local
183 mtk_gpt_clkevt_time_stop(to, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
184 mtk_gpt_clkevt_time_setup(to, to->of_clk.period, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
185 mtk_gpt_clkevt_time_start(to, true, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
193 struct timer_of *to = to_timer_of(clk); in mtk_gpt_clkevt_next_event() local
195 mtk_gpt_clkevt_time_stop(to, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
196 mtk_gpt_clkevt_time_setup(to, event, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
197 mtk_gpt_clkevt_time_start(to, false, TIMER_CLK_EVT); in mtk_gpt_clkevt_next_event()
205 struct timer_of *to = to_timer_of(clkevt); in mtk_gpt_interrupt() local
208 writel(GPT_IRQ_ACK(TIMER_CLK_EVT), timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_interrupt()
215 __init mtk_gpt_setup(struct timer_of *to, u8 timer, u8 option) in mtk_gpt_setup() argument
218 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_setup()
221 timer_of_base(to) + GPT_CLK_REG(timer)); in mtk_gpt_setup()
223 writel(0x0, timer_of_base(to) + GPT_CMP_REG(timer)); in mtk_gpt_setup()
226 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_setup()
229 static void mtk_gpt_enable_irq(struct timer_of *to, u8 timer) in mtk_gpt_enable_irq() argument
234 writel(0x0, timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
237 writel(0x3f, timer_of_base(to) + GPT_IRQ_ACK_REG); in mtk_gpt_enable_irq()
239 val = readl(timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
241 timer_of_base(to) + GPT_IRQ_EN_REG); in mtk_gpt_enable_irq()
244 static struct timer_of to = { variable
262 to.clkevt.features = CLOCK_EVT_FEAT_DYNIRQ | CLOCK_EVT_FEAT_ONESHOT; in mtk_syst_init()
263 to.clkevt.set_state_shutdown = mtk_syst_clkevt_shutdown; in mtk_syst_init()
264 to.clkevt.set_state_oneshot = mtk_syst_clkevt_oneshot; in mtk_syst_init()
265 to.clkevt.tick_resume = mtk_syst_clkevt_resume; in mtk_syst_init()
266 to.clkevt.set_next_event = mtk_syst_clkevt_next_event; in mtk_syst_init()
267 to.of_irq.handler = mtk_syst_handler; in mtk_syst_init()
269 ret = timer_of_init(node, &to); in mtk_syst_init()
273 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to), in mtk_syst_init()
283 to.clkevt.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; in mtk_gpt_init()
284 to.clkevt.set_state_shutdown = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
285 to.clkevt.set_state_periodic = mtk_gpt_clkevt_set_periodic; in mtk_gpt_init()
286 to.clkevt.set_state_oneshot = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
287 to.clkevt.tick_resume = mtk_gpt_clkevt_shutdown; in mtk_gpt_init()
288 to.clkevt.set_next_event = mtk_gpt_clkevt_next_event; in mtk_gpt_init()
289 to.of_irq.handler = mtk_gpt_interrupt; in mtk_gpt_init()
291 ret = timer_of_init(node, &to); in mtk_gpt_init()
296 mtk_gpt_setup(&to, TIMER_CLK_SRC, GPT_CTRL_OP_FREERUN); in mtk_gpt_init()
297 clocksource_mmio_init(timer_of_base(&to) + GPT_CNT_REG(TIMER_CLK_SRC), in mtk_gpt_init()
298 node->name, timer_of_rate(&to), 300, 32, in mtk_gpt_init()
300 gpt_sched_reg = timer_of_base(&to) + GPT_CNT_REG(TIMER_CLK_SRC); in mtk_gpt_init()
301 sched_clock_register(mtk_gpt_read_sched_clock, 32, timer_of_rate(&to)); in mtk_gpt_init()
304 mtk_gpt_setup(&to, TIMER_CLK_EVT, GPT_CTRL_OP_REPEAT); in mtk_gpt_init()
305 clockevents_config_and_register(&to.clkevt, timer_of_rate(&to), in mtk_gpt_init()
308 mtk_gpt_enable_irq(&to, TIMER_CLK_EVT); in mtk_gpt_init()