Lines Matching +full:bcm6345 +full:- +full:timer
1 // SPDX-License-Identifier: GPL-2.0+
41 * peripheral registers for CPU-native byte order. in bcm7038_wdt_write()
62 timeout = wdt->rate * wdog->timeout; in bcm7038_wdt_set_timeout_reg()
64 bcm7038_wdt_write(timeout, wdt->base + WDT_TIMEOUT_REG); in bcm7038_wdt_set_timeout_reg()
71 bcm7038_wdt_write(WDT_START_1, wdt->base + WDT_CMD_REG); in bcm7038_wdt_ping()
72 bcm7038_wdt_write(WDT_START_2, wdt->base + WDT_CMD_REG); in bcm7038_wdt_ping()
89 bcm7038_wdt_write(WDT_STOP_1, wdt->base + WDT_CMD_REG); in bcm7038_wdt_stop()
90 bcm7038_wdt_write(WDT_STOP_2, wdt->base + WDT_CMD_REG); in bcm7038_wdt_stop()
98 /* Can't modify timeout value if watchdog timer is running */ in bcm7038_wdt_set_timeout()
100 wdog->timeout = t; in bcm7038_wdt_set_timeout()
111 time_left = bcm7038_wdt_read(wdt->base + WDT_CMD_REG); in bcm7038_wdt_get_timeleft()
113 return time_left / wdt->rate; in bcm7038_wdt_get_timeleft()
117 .identity = "Broadcom BCM7038 Watchdog Timer",
132 struct bcm7038_wdt_platform_data *pdata = pdev->dev.platform_data; in bcm7038_wdt_probe()
133 struct device *dev = &pdev->dev; in bcm7038_wdt_probe()
140 return -ENOMEM; in bcm7038_wdt_probe()
144 wdt->base = devm_platform_ioremap_resource(pdev, 0); in bcm7038_wdt_probe()
145 if (IS_ERR(wdt->base)) in bcm7038_wdt_probe()
146 return PTR_ERR(wdt->base); in bcm7038_wdt_probe()
148 if (pdata && pdata->clk_name) in bcm7038_wdt_probe()
149 clk_name = pdata->clk_name; in bcm7038_wdt_probe()
151 wdt->clk = devm_clk_get_enabled(dev, clk_name); in bcm7038_wdt_probe()
153 if (!IS_ERR(wdt->clk)) { in bcm7038_wdt_probe()
154 wdt->rate = clk_get_rate(wdt->clk); in bcm7038_wdt_probe()
155 /* Prevent divide-by-zero exception */ in bcm7038_wdt_probe()
156 if (!wdt->rate) in bcm7038_wdt_probe()
157 wdt->rate = WDT_DEFAULT_RATE; in bcm7038_wdt_probe()
159 wdt->rate = WDT_DEFAULT_RATE; in bcm7038_wdt_probe()
160 wdt->clk = NULL; in bcm7038_wdt_probe()
163 wdt->wdd.info = &bcm7038_wdt_info; in bcm7038_wdt_probe()
164 wdt->wdd.ops = &bcm7038_wdt_ops; in bcm7038_wdt_probe()
165 wdt->wdd.min_timeout = WDT_MIN_TIMEOUT; in bcm7038_wdt_probe()
166 wdt->wdd.timeout = WDT_DEFAULT_TIMEOUT; in bcm7038_wdt_probe()
167 wdt->wdd.max_timeout = 0xffffffff / wdt->rate; in bcm7038_wdt_probe()
168 wdt->wdd.parent = dev; in bcm7038_wdt_probe()
169 watchdog_set_drvdata(&wdt->wdd, wdt); in bcm7038_wdt_probe()
171 watchdog_stop_on_reboot(&wdt->wdd); in bcm7038_wdt_probe()
172 watchdog_stop_on_unregister(&wdt->wdd); in bcm7038_wdt_probe()
173 err = devm_watchdog_register_device(dev, &wdt->wdd); in bcm7038_wdt_probe()
186 if (watchdog_active(&wdt->wdd)) in bcm7038_wdt_suspend()
187 return bcm7038_wdt_stop(&wdt->wdd); in bcm7038_wdt_suspend()
196 if (watchdog_active(&wdt->wdd)) in bcm7038_wdt_resume()
197 return bcm7038_wdt_start(&wdt->wdd); in bcm7038_wdt_resume()
206 { .compatible = "brcm,bcm6345-wdt" },
207 { .compatible = "brcm,bcm7038-wdt" },
213 { .name = "bcm63xx-wdt" },
222 .name = "bcm7038-wdt",