summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStanley Chu <[email protected]>2025-12-16 10:47:24 +0800
committerTom Rini <[email protected]>2025-12-31 10:17:00 -0600
commitf74beb8dcf325707dcf6b4f6e260c940236f8067 (patch)
tree73f801c8361a1d1e7423164f007b93d1d453f183 /drivers
parent41eddd89235303309ea4e8f2d1f5a076605ee8ce (diff)
watchdog: npcm: Support more timeout value
Calculate a timeout value that is close to the requested value. Signed-off-by: Stanley Chu <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/watchdog/npcm_wdt.c23
1 files changed, 4 insertions, 19 deletions
diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
index 57b61215a2a..7becc646fda 100644
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -27,26 +27,11 @@ struct npcm_wdt_priv {
static int npcm_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
{
struct npcm_wdt_priv *priv = dev_get_priv(dev);
- u32 time_out, val;
+ u32 val;
- time_out = (u32)(timeout_ms) / 1000;
- if (time_out < 2)
- val = 0x800;
- else if (time_out < 3)
- val = 0x420;
- else if (time_out < 6)
- val = 0x810;
- else if (time_out < 11)
- val = 0x430;
- else if (time_out < 22)
- val = 0x820;
- else if (time_out < 44)
- val = 0xc00;
- else if (time_out < 87)
- val = 0x830;
- else if (time_out < 173)
- val = 0xc10;
- else if (time_out < 688)
+ if (timeout_ms < 343552)
+ val = ((timeout_ms / 1342) << 16) + 0x800;
+ else if (timeout_ms < 688000)
val = 0xc20;
else
val = 0xc30;