Lines Matching refs:airoha_wdt

56 	struct airoha_wdt_desc *airoha_wdt = watchdog_get_drvdata(wdog_dev);  in airoha_wdt_start()  local
59 val = readl(airoha_wdt->base + TIMER_CTRL); in airoha_wdt_start()
61 writel(val, airoha_wdt->base + TIMER_CTRL); in airoha_wdt_start()
62 val = wdog_dev->timeout * airoha_wdt->wdt_freq; in airoha_wdt_start()
63 writel(val, airoha_wdt->base + WDT_TIMER_LOAD_VALUE); in airoha_wdt_start()
70 struct airoha_wdt_desc *airoha_wdt = watchdog_get_drvdata(wdog_dev); in airoha_wdt_stop() local
73 val = readl(airoha_wdt->base + TIMER_CTRL); in airoha_wdt_stop()
75 writel(val, airoha_wdt->base + TIMER_CTRL); in airoha_wdt_stop()
82 struct airoha_wdt_desc *airoha_wdt = watchdog_get_drvdata(wdog_dev); in airoha_wdt_ping() local
85 val = readl(airoha_wdt->base + WDT_RELOAD); in airoha_wdt_ping()
87 writel(val, airoha_wdt->base + WDT_RELOAD); in airoha_wdt_ping()
106 struct airoha_wdt_desc *airoha_wdt = watchdog_get_drvdata(wdog_dev); in airoha_wdt_get_timeleft() local
109 val = readl(airoha_wdt->base + WDT_TIMER_CUR_VALUE); in airoha_wdt_get_timeleft()
110 return DIV_ROUND_UP(val, airoha_wdt->wdt_freq); in airoha_wdt_get_timeleft()
129 struct airoha_wdt_desc *airoha_wdt; in airoha_wdt_probe() local
135 airoha_wdt = devm_kzalloc(dev, sizeof(*airoha_wdt), GFP_KERNEL); in airoha_wdt_probe()
136 if (!airoha_wdt) in airoha_wdt_probe()
139 airoha_wdt->base = devm_platform_ioremap_resource(pdev, 0); in airoha_wdt_probe()
140 if (IS_ERR(airoha_wdt->base)) in airoha_wdt_probe()
141 return PTR_ERR(airoha_wdt->base); in airoha_wdt_probe()
149 airoha_wdt->wdt_freq = clk_get_rate(bus_clk) / 2; in airoha_wdt_probe()
152 wdog_dev = &airoha_wdt->wdog_dev; in airoha_wdt_probe()
157 wdog_dev->max_timeout = FIELD_MAX(WDT_TIMER_VAL) / airoha_wdt->wdt_freq; in airoha_wdt_probe()
160 watchdog_set_drvdata(wdog_dev, airoha_wdt); in airoha_wdt_probe()
168 platform_set_drvdata(pdev, airoha_wdt); in airoha_wdt_probe()
174 struct airoha_wdt_desc *airoha_wdt = dev_get_drvdata(dev); in airoha_wdt_suspend() local
176 if (watchdog_active(&airoha_wdt->wdog_dev)) in airoha_wdt_suspend()
177 airoha_wdt_stop(&airoha_wdt->wdog_dev); in airoha_wdt_suspend()
184 struct airoha_wdt_desc *airoha_wdt = dev_get_drvdata(dev); in airoha_wdt_resume() local
186 if (watchdog_active(&airoha_wdt->wdog_dev)) { in airoha_wdt_resume()
187 airoha_wdt_start(&airoha_wdt->wdog_dev); in airoha_wdt_resume()
188 airoha_wdt_ping(&airoha_wdt->wdog_dev); in airoha_wdt_resume()