Lines Matching refs:gwdt

127 static u64 sbsa_gwdt_reg_read(struct sbsa_gwdt *gwdt)  in sbsa_gwdt_reg_read()  argument
129 if (gwdt->version == 0) in sbsa_gwdt_reg_read()
130 return readl(gwdt->control_base + SBSA_GWDT_WOR); in sbsa_gwdt_reg_read()
132 return lo_hi_readq(gwdt->control_base + SBSA_GWDT_WOR); in sbsa_gwdt_reg_read()
135 static void sbsa_gwdt_reg_write(u64 val, struct sbsa_gwdt *gwdt) in sbsa_gwdt_reg_write() argument
137 if (gwdt->version == 0) in sbsa_gwdt_reg_write()
138 writel((u32)val, gwdt->control_base + SBSA_GWDT_WOR); in sbsa_gwdt_reg_write()
140 lo_hi_writeq(val, gwdt->control_base + SBSA_GWDT_WOR); in sbsa_gwdt_reg_write()
149 struct sbsa_gwdt *gwdt = watchdog_get_drvdata(wdd); in sbsa_gwdt_set_timeout() local
155 sbsa_gwdt_reg_write((u64)gwdt->clk * timeout, gwdt); in sbsa_gwdt_set_timeout()
162 sbsa_gwdt_reg_write(((u64)gwdt->clk / 2) * timeout, gwdt); in sbsa_gwdt_set_timeout()
169 struct sbsa_gwdt *gwdt = watchdog_get_drvdata(wdd); in sbsa_gwdt_get_timeleft() local
178 !(readl(gwdt->control_base + SBSA_GWDT_WCS) & SBSA_GWDT_WCS_WS0)) in sbsa_gwdt_get_timeleft()
179 timeleft += sbsa_gwdt_reg_read(gwdt); in sbsa_gwdt_get_timeleft()
181 timeleft += lo_hi_readq(gwdt->control_base + SBSA_GWDT_WCV) - in sbsa_gwdt_get_timeleft()
184 do_div(timeleft, gwdt->clk); in sbsa_gwdt_get_timeleft()
191 struct sbsa_gwdt *gwdt = watchdog_get_drvdata(wdd); in sbsa_gwdt_keepalive() local
197 writel(0, gwdt->refresh_base + SBSA_GWDT_WRR); in sbsa_gwdt_keepalive()
204 struct sbsa_gwdt *gwdt = watchdog_get_drvdata(wdd); in sbsa_gwdt_get_version() local
207 ver = readl(gwdt->control_base + SBSA_GWDT_W_IIDR); in sbsa_gwdt_get_version()
210 gwdt->version = ver; in sbsa_gwdt_get_version()
215 struct sbsa_gwdt *gwdt = watchdog_get_drvdata(wdd); in sbsa_gwdt_start() local
218 writel(SBSA_GWDT_WCS_EN, gwdt->control_base + SBSA_GWDT_WCS); in sbsa_gwdt_start()
225 struct sbsa_gwdt *gwdt = watchdog_get_drvdata(wdd); in sbsa_gwdt_stop() local
228 writel(0, gwdt->control_base + SBSA_GWDT_WCS); in sbsa_gwdt_stop()
262 struct sbsa_gwdt *gwdt; in sbsa_gwdt_probe() local
266 gwdt = devm_kzalloc(dev, sizeof(*gwdt), GFP_KERNEL); in sbsa_gwdt_probe()
267 if (!gwdt) in sbsa_gwdt_probe()
269 platform_set_drvdata(pdev, gwdt); in sbsa_gwdt_probe()
284 gwdt->clk = arch_timer_get_cntfrq(); in sbsa_gwdt_probe()
285 gwdt->refresh_base = rf_base; in sbsa_gwdt_probe()
286 gwdt->control_base = cf_base; in sbsa_gwdt_probe()
288 wdd = &gwdt->wdd; in sbsa_gwdt_probe()
294 watchdog_set_drvdata(wdd, gwdt); in sbsa_gwdt_probe()
297 if (gwdt->version == 0) in sbsa_gwdt_probe()
298 wdd->max_hw_heartbeat_ms = U32_MAX / gwdt->clk * 1000; in sbsa_gwdt_probe()
300 wdd->max_hw_heartbeat_ms = GENMASK_ULL(47, 0) / gwdt->clk * 1000; in sbsa_gwdt_probe()
322 pdev->name, gwdt)) { in sbsa_gwdt_probe()
352 wdd->timeout, gwdt->clk, action, in sbsa_gwdt_probe()
361 struct sbsa_gwdt *gwdt = dev_get_drvdata(dev); in sbsa_gwdt_suspend() local
363 if (watchdog_hw_running(&gwdt->wdd)) in sbsa_gwdt_suspend()
364 sbsa_gwdt_stop(&gwdt->wdd); in sbsa_gwdt_suspend()
372 struct sbsa_gwdt *gwdt = dev_get_drvdata(dev); in sbsa_gwdt_resume() local
374 if (watchdog_hw_running(&gwdt->wdd)) in sbsa_gwdt_resume()
375 sbsa_gwdt_start(&gwdt->wdd); in sbsa_gwdt_resume()