static void mtk_wdt_set_timeout(struct udevice *dev, unsigned int timeout) { struct mtk_wdt_priv *priv = dev_get_priv(dev); /* * One bit is the value of 512 ticks * The clock has 32 KHz */ timeout = WDT_LENGTH_TIMEOUT(timeout << 6) | WDT_LENGTH_KEY; writel(timeout, priv->base + MTK_WDT_LENGTH); mtk_wdt_reset(dev); }
static int mtk_wdt_set_timeout(struct watchdog_device *wdt_dev, unsigned int timeout) { struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev); void __iomem *wdt_base = mtk_wdt->wdt_base; u32 reg; wdt_dev->timeout = timeout; /* * One bit is the value of 512 ticks * The clock has 32 KHz */ reg = WDT_LENGTH_TIMEOUT(timeout << 6) | WDT_LENGTH_KEY; iowrite32(reg, wdt_base + WDT_LENGTH); mtk_wdt_ping(wdt_dev); return 0; }