[PATCH v2 3/7] wdt: dw: Fix clock rate being off by 1000

Sean Anderson seanga2 at gmail.com
Fri Aug 7 17:03:50 CEST 2020


The clock subsystem returns clock rates in Hz. We need to divide by 1000 so
the rate is in kHz.

Fixes: cf89ef8d10f240554541c20b2e1bdcdd58d1d7e6
Signed-off-by: Sean Anderson <seanga2 at gmail.com>
---

(no changes since v1)

 drivers/watchdog/designware_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c
index 49cf861d46..41866fa01b 100644
--- a/drivers/watchdog/designware_wdt.c
+++ b/drivers/watchdog/designware_wdt.c
@@ -129,7 +129,7 @@ static int designware_wdt_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
-	priv->clk_khz = clk_get_rate(&clk);
+	priv->clk_khz = clk_get_rate(&clk) / 1000;
 	if (!priv->clk_khz)
 		return -EINVAL;
 #else
-- 
2.28.0



More information about the U-Boot mailing list