diff options
author | Tom Rini <trini@konsulko.com> | 2021-01-19 07:56:59 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-01-19 07:56:59 -0500 |
commit | db0dd72e27ce62c5b28f07595b91ed00d0565819 (patch) | |
tree | 912603265aac7ae1fb843c02986dbbb0835b7060 /drivers/timer/mtk_timer.c | |
parent | ae3d8b6c403218e68b56bce962ba7737161cc6f4 (diff) | |
parent | ac7a51c0e48f2aa81ae20caf8d6b9fad976675cd (diff) |
Merge branch '2021-01-18-assorted-platform-updates'
- Assorted MediaTek, AST2x00 updates
- Assorted driver fixes for various platforms
- Keymile platform updates
- Add pwm command, mp5416 pmic driver
Diffstat (limited to 'drivers/timer/mtk_timer.c')
-rw-r--r-- | drivers/timer/mtk_timer.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/timer/mtk_timer.c b/drivers/timer/mtk_timer.c index 448a76a7e1f..f6b97f868c7 100644 --- a/drivers/timer/mtk_timer.c +++ b/drivers/timer/mtk_timer.c @@ -61,6 +61,16 @@ static int mtk_timer_probe(struct udevice *dev) if (!uc_priv->clock_rate) return -EINVAL; + /* + * Initialize the timer: + * 1. set clock source to system clock with clock divider setting to 1 + * 2. set timer mode to free running + * 3. reset timer counter to 0 then enable the timer + */ + writel(GPT4_CLK_SYS | GPT4_CLK_DIV1, priv->base + MTK_GPT4_CLK); + writel(GPT4_FREERUN | GPT4_CLEAR | GPT4_ENABLE, + priv->base + MTK_GPT4_CTRL); + return 0; } |