Lines Matching refs:nuc900_wdt

62 struct nuc900_wdt {  struct
73 static struct nuc900_wdt *nuc900_wdt; argument
79 spin_lock(&nuc900_wdt->wdt_lock); in nuc900_wdt_keepalive()
81 val = __raw_readl(nuc900_wdt->wdt_base + REG_WTCR); in nuc900_wdt_keepalive()
83 __raw_writel(val, nuc900_wdt->wdt_base + REG_WTCR); in nuc900_wdt_keepalive()
85 spin_unlock(&nuc900_wdt->wdt_lock); in nuc900_wdt_keepalive()
92 spin_lock(&nuc900_wdt->wdt_lock); in nuc900_wdt_start()
94 val = __raw_readl(nuc900_wdt->wdt_base + REG_WTCR); in nuc900_wdt_start()
98 __raw_writel(val, nuc900_wdt->wdt_base + REG_WTCR); in nuc900_wdt_start()
100 spin_unlock(&nuc900_wdt->wdt_lock); in nuc900_wdt_start()
102 nuc900_wdt->next_heartbeat = jiffies + heartbeat * HZ; in nuc900_wdt_start()
103 mod_timer(&nuc900_wdt->timer, jiffies + WDT_TIMEOUT); in nuc900_wdt_start()
110 del_timer(&nuc900_wdt->timer); in nuc900_wdt_stop()
112 spin_lock(&nuc900_wdt->wdt_lock); in nuc900_wdt_stop()
114 val = __raw_readl(nuc900_wdt->wdt_base + REG_WTCR); in nuc900_wdt_stop()
116 __raw_writel(val, nuc900_wdt->wdt_base + REG_WTCR); in nuc900_wdt_stop()
118 spin_unlock(&nuc900_wdt->wdt_lock); in nuc900_wdt_stop()
123 nuc900_wdt->next_heartbeat = jiffies + heartbeat * HZ; in nuc900_wdt_ping()
139 if (nuc900_wdt->expect_close == 42) in nuc900_wdt_close()
142 dev_crit(&nuc900_wdt->pdev->dev, in nuc900_wdt_close()
147 nuc900_wdt->expect_close = 0; in nuc900_wdt_close()
202 nuc900_wdt->expect_close = 0; in nuc900_wdt_write()
209 nuc900_wdt->expect_close = 42; in nuc900_wdt_write()
221 if (time_before(jiffies, nuc900_wdt->next_heartbeat)) { in nuc900_wdt_timer_ping()
223 mod_timer(&nuc900_wdt->timer, jiffies + WDT_TIMEOUT); in nuc900_wdt_timer_ping()
225 dev_warn(&nuc900_wdt->pdev->dev, "Will reset the machine !\n"); in nuc900_wdt_timer_ping()
248 nuc900_wdt = devm_kzalloc(&pdev->dev, sizeof(*nuc900_wdt), in nuc900wdt_probe()
250 if (!nuc900_wdt) in nuc900wdt_probe()
253 nuc900_wdt->pdev = pdev; in nuc900wdt_probe()
255 spin_lock_init(&nuc900_wdt->wdt_lock); in nuc900wdt_probe()
258 nuc900_wdt->wdt_base = devm_ioremap_resource(&pdev->dev, res); in nuc900wdt_probe()
259 if (IS_ERR(nuc900_wdt->wdt_base)) in nuc900wdt_probe()
260 return PTR_ERR(nuc900_wdt->wdt_base); in nuc900wdt_probe()
262 nuc900_wdt->wdt_clock = devm_clk_get(&pdev->dev, NULL); in nuc900wdt_probe()
263 if (IS_ERR(nuc900_wdt->wdt_clock)) { in nuc900wdt_probe()
265 return PTR_ERR(nuc900_wdt->wdt_clock); in nuc900wdt_probe()
268 clk_enable(nuc900_wdt->wdt_clock); in nuc900wdt_probe()
270 setup_timer(&nuc900_wdt->timer, nuc900_wdt_timer_ping, 0); in nuc900wdt_probe()
282 clk_disable(nuc900_wdt->wdt_clock); in nuc900wdt_probe()
290 clk_disable(nuc900_wdt->wdt_clock); in nuc900wdt_remove()