summaryrefslogtreecommitdiff
path: root/drivers/timer
diff options
context:
space:
mode:
authorDario Binacchi <dariobin@libero.it>2020-12-30 02:16:22 +0300
committerLokesh Vutla <lokeshvutla@ti.com>2021-01-12 08:28:05 +0300
commit11326f379329d979bc39d26896190b799103a407 (patch)
tree98bcc45b3b3f879f026f67ce397fb400351d6ffb /drivers/timer
parentd64b9cdcd475eb7f07b49741ded87e24dae4a5fc (diff)
downloadu-boot-11326f379329d979bc39d26896190b799103a407.tar.xz
omap: timer: fix the rate setting
The prescaler (PTV) setting must be taken into account even when the timer input clock frequency has been set. Signed-off-by: Dario Binacchi <dariobin@libero.it>
Diffstat (limited to 'drivers/timer')
-rw-r--r--drivers/timer/omap-timer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c
index 7ac20d78dd..721e385fd1 100644
--- a/drivers/timer/omap-timer.c
+++ b/drivers/timer/omap-timer.c
@@ -19,8 +19,6 @@
#define TCLR_PRE_EN BIT(5) /* Pre-scaler enable */
#define TCLR_PTV_SHIFT (2) /* Pre-scaler shift value */
-#define TIMER_CLOCK (V_SCLK / (2 << CONFIG_SYS_PTV))
-
struct omap_gptimer_regs {
unsigned int tidr; /* offset 0x00 */
unsigned char res1[12];
@@ -61,7 +59,9 @@ static int omap_timer_probe(struct udevice *dev)
struct omap_timer_priv *priv = dev_get_priv(dev);
if (!uc_priv->clock_rate)
- uc_priv->clock_rate = TIMER_CLOCK;
+ uc_priv->clock_rate = V_SCLK;
+
+ uc_priv->clock_rate /= (2 << CONFIG_SYS_PTV);
/* start the counter ticking up, reload value on overflow */
writel(0, &priv->regs->tldr);