Skip to content

Commit c045712

Browse files
shenkiWim Van Sebroeck
authored andcommitted
watchdog: aspeed: Fix clock behaviour for ast2600
The ast2600 no longer uses bit 4 in the control register to indicate a 1MHz clock (It now controls whether this watchdog is reset by a SOC reset). This means we do not want to set it. It also does not need to be set for the ast2500, as it is read-only on that SoC. The comment next to the clock rate selection wandered away from where it was set, so put it back next to the register setting it's describing. Fixes: b3528b4 ("watchdog: aspeed: Add support for AST2600") Signed-off-by: Joel Stanley <[email protected]> Reviewed-by: Cédric Le Goater <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent 6083ab7 commit c045712

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

drivers/watchdog/aspeed_wdt.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,6 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
258258
if (IS_ERR(wdt->base))
259259
return PTR_ERR(wdt->base);
260260

261-
/*
262-
* The ast2400 wdt can run at PCLK, or 1MHz. The ast2500 only
263-
* runs at 1MHz. We chose to always run at 1MHz, as there's no
264-
* good reason to have a faster watchdog counter.
265-
*/
266261
wdt->wdd.info = &aspeed_wdt_info;
267262
wdt->wdd.ops = &aspeed_wdt_ops;
268263
wdt->wdd.max_hw_heartbeat_ms = WDT_MAX_TIMEOUT_MS;
@@ -278,7 +273,16 @@ static int aspeed_wdt_probe(struct platform_device *pdev)
278273
return -EINVAL;
279274
config = ofdid->data;
280275

281-
wdt->ctrl = WDT_CTRL_1MHZ_CLK;
276+
/*
277+
* On clock rates:
278+
* - ast2400 wdt can run at PCLK, or 1MHz
279+
* - ast2500 only runs at 1MHz, hard coding bit 4 to 1
280+
* - ast2600 always runs at 1MHz
281+
*
282+
* Set the ast2400 to run at 1MHz as it simplifies the driver.
283+
*/
284+
if (of_device_is_compatible(np, "aspeed,ast2400-wdt"))
285+
wdt->ctrl = WDT_CTRL_1MHZ_CLK;
282286

283287
/*
284288
* Control reset on a per-device basis to ensure the

0 commit comments

Comments
 (0)