Lines Matching +full:mt6577 +full:- +full:timer
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Mediatek SoCs General-Purpose Timer handling.
18 #include "timer-of.h"
27 #define GPT_IRQ_ENABLE(val) BIT((val) - 1)
29 #define GPT_IRQ_ACK(val) BIT((val) - 1)
50 /* system timer */
61 * - Start timer countdown.
62 * - Allow timeout ticks being updated.
63 * - Allow changing interrupt status,like clear irq pending.
88 clkevt->event_handler(clkevt); in mtk_syst_handler()
102 * Write new timeout ticks. Timer shall start countdown in mtk_syst_clkevt_next_event()
118 /* Disable timer */ in mtk_syst_clkevt_shutdown()
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()
145 GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_stop()
149 unsigned long delay, u8 timer) in mtk_gpt_clkevt_time_setup() argument
151 writel(delay, timer_of_base(to) + GPT_CMP_REG(timer)); in mtk_gpt_clkevt_time_setup()
155 bool periodic, u8 timer) 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()
164 /* Clear 2 bit timer operation mode field */ in mtk_gpt_clkevt_time_start()
173 timer_of_base(to) + GPT_CTRL_REG(timer)); in mtk_gpt_clkevt_time_start()
188 mtk_gpt_clkevt_time_setup(to, to->of_clk.period, TIMER_CLK_EVT); in mtk_gpt_clkevt_set_periodic()
213 clkevt->event_handler(clkevt); 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
244 writel(val | GPT_IRQ_ENABLE(timer), in mtk_gpt_enable_irq()
274 .name = "mtk-clkevt",
326 node->name, timer_of_rate(&to), 300, 32, in mtk_gpt_init()
340 TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_gpt_init);
341 TIMER_OF_DECLARE(mtk_mt6765, "mediatek,mt6765-timer", mtk_syst_init);