Skip to contentSkip to conversation

wdt: designware: fix timeout calculation due to expecting KHz

PATCH New Jack Mitchell 3 participants 3 messages Sep 17, 2020 – Oct 9, 2020 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wdt: designware: fix timeout calculation due to expecting KHz

The timeout calculation is based on the clk being in KHz but the clk api returns the clk value in Hz. Convert this to KHz to calculate the correct timeout value.

---
 drivers/watchdog/designware_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/designware_wdt.c +1 -1
index 12f09a7a39..7caa6c550c 100644
@@ -130,7 +130,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
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/1 wdt: designware: fix timeout calculation due to expecting KHz

Quoted 15 lines · Jack Mitchell

The timeout calculation is based on the clk being in KHz but the clk api returns the clk value in Hz. Convert this to KHz to calculate the correct timeout value.

---
 drivers/watchdog/designware_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/watchdog/designware_wdt.c +0 -0
index 12f09a7a39..7caa6c550c 100644

drivers/watchdog/designware_wdt.c static int designware_wdt_probe(struct udevice *dev) · line 136

Quoted 8 lines
drivers/watchdog/designware_wdt.c +1 -1
@@ -130,7 +130,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

Hi,

Thanks for submitting this. I believe it is a duplicate of [1].

--Sean

[1] https://patchwork.ozlabs.org/project/uboot/patch/20200909210420.243190-4-seanga2 at gmail.com/

#2 lore raw

PATCH 1/1 wdt: designware: fix timeout calculation due to expecting KHz

In reply to Jack Mitchell
Quoted 5 lines · Jack Mitchell

The timeout calculation is based on the clk being in KHz but the clk api returns the clk value in Hz. Convert this to KHz to calculate the correct timeout value.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201009/56762ef6/attachment.sig>