Lines Matching refs:wdt

85 static struct wdt_at32ap700x *wdt;  variable
95 spin_lock(&wdt->io_lock); in at32_wdt_stop()
96 psel = wdt_readl(wdt, CTRL) & WDT_BF(CTRL_PSEL, 0x0f); in at32_wdt_stop()
97 wdt_writel(wdt, CTRL, psel | WDT_BF(CTRL_KEY, 0x55)); in at32_wdt_stop()
98 wdt_writel(wdt, CTRL, psel | WDT_BF(CTRL_KEY, 0xaa)); in at32_wdt_stop()
99 spin_unlock(&wdt->io_lock); in at32_wdt_stop()
108 unsigned long psel = (wdt->timeout > 1) ? 0xf : 0xe; in at32_wdt_start()
110 spin_lock(&wdt->io_lock); in at32_wdt_start()
111 wdt_writel(wdt, CTRL, WDT_BIT(CTRL_EN) in at32_wdt_start()
114 wdt_writel(wdt, CTRL, WDT_BIT(CTRL_EN) in at32_wdt_start()
117 spin_unlock(&wdt->io_lock); in at32_wdt_start()
125 spin_lock(&wdt->io_lock); in at32_wdt_pat()
126 wdt_writel(wdt, CLR, 0x42); in at32_wdt_pat()
127 spin_unlock(&wdt->io_lock); in at32_wdt_pat()
135 if (test_and_set_bit(1, &wdt->users)) in at32_wdt_open()
150 dev_dbg(wdt->miscdev.parent, in at32_wdt_close()
154 clear_bit(1, &wdt->users); in at32_wdt_close()
175 wdt->timeout = time; in at32_wdt_settimeout()
187 rcause = wdt_readl(wdt, RCAUSE); in at32_wdt_get_status()
233 ret = put_user(wdt->boot_status, p); in at32_wdt_ioctl()
260 ret = put_user(wdt->timeout, p); in at32_wdt_ioctl()
313 if (wdt) { in at32_wdt_probe()
324 wdt = devm_kzalloc(&pdev->dev, sizeof(struct wdt_at32ap700x), in at32_wdt_probe()
326 if (!wdt) in at32_wdt_probe()
329 wdt->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs)); in at32_wdt_probe()
330 if (!wdt->regs) { in at32_wdt_probe()
336 spin_lock_init(&wdt->io_lock); in at32_wdt_probe()
337 wdt->boot_status = at32_wdt_get_status(); in at32_wdt_probe()
340 if (wdt->boot_status & WDIOF_CARDRESET) { in at32_wdt_probe()
346 wdt->users = 0; in at32_wdt_probe()
349 wdt->miscdev.minor = WATCHDOG_MINOR; in at32_wdt_probe()
350 wdt->miscdev.name = "watchdog"; in at32_wdt_probe()
351 wdt->miscdev.fops = &at32_wdt_fops; in at32_wdt_probe()
352 wdt->miscdev.parent = &pdev->dev; in at32_wdt_probe()
354 platform_set_drvdata(pdev, wdt); in at32_wdt_probe()
363 ret = misc_register(&wdt->miscdev); in at32_wdt_probe()
371 wdt->regs, wdt->timeout, nowayout); in at32_wdt_probe()
376 wdt = NULL; in at32_wdt_probe()
382 if (wdt && platform_get_drvdata(pdev) == wdt) { in at32_wdt_remove()
387 misc_deregister(&wdt->miscdev); in at32_wdt_remove()
388 wdt = NULL; in at32_wdt_remove()
407 if (wdt->users) in at32_wdt_resume()