Lines Matching +full:ixp4xx +full:- +full:timer

1 // SPDX-License-Identifier: GPL-2.0-only
5 * Watchdog driver for Intel IXP4xx network processors
21 #include <linux/soc/ixp4xx/cpu.h>
32 /* Registers after the timer registers */
33 #define IXP4XX_OSWT_OFFSET 0x14 /* Watchdog Timer */
36 #define IXP4XX_OSST_OFFSET 0x20 /* Timer Status */
55 __raw_writel(IXP4XX_WDT_KEY, iwdt->base + IXP4XX_OSWK_OFFSET); in ixp4xx_wdt_start()
56 __raw_writel(0, iwdt->base + IXP4XX_OSWE_OFFSET); in ixp4xx_wdt_start()
57 __raw_writel(wdd->timeout * iwdt->rate, in ixp4xx_wdt_start()
58 iwdt->base + IXP4XX_OSWT_OFFSET); in ixp4xx_wdt_start()
60 iwdt->base + IXP4XX_OSWE_OFFSET); in ixp4xx_wdt_start()
61 __raw_writel(0, iwdt->base + IXP4XX_OSWK_OFFSET); in ixp4xx_wdt_start()
70 __raw_writel(IXP4XX_WDT_KEY, iwdt->base + IXP4XX_OSWK_OFFSET); in ixp4xx_wdt_stop()
71 __raw_writel(0, iwdt->base + IXP4XX_OSWE_OFFSET); in ixp4xx_wdt_stop()
72 __raw_writel(0, iwdt->base + IXP4XX_OSWK_OFFSET); in ixp4xx_wdt_stop()
80 wdd->timeout = timeout; in ixp4xx_wdt_set_timeout()
92 __raw_writel(IXP4XX_WDT_KEY, iwdt->base + IXP4XX_OSWK_OFFSET); in ixp4xx_wdt_restart()
93 __raw_writel(0, iwdt->base + IXP4XX_OSWT_OFFSET); in ixp4xx_wdt_restart()
95 iwdt->base + IXP4XX_OSWE_OFFSET); in ixp4xx_wdt_restart()
115 /* Devres-handled clock disablement */
123 struct device *dev = &pdev->dev; in ixp4xx_wdt_probe()
129 dev_err(dev, "Rev. A0 IXP42x CPU detected - watchdog disabled\n"); in ixp4xx_wdt_probe()
130 return -ENODEV; in ixp4xx_wdt_probe()
135 return -ENOMEM; in ixp4xx_wdt_probe()
136 iwdt->base = (void __iomem *)dev->platform_data; in ixp4xx_wdt_probe()
142 clk = devm_clk_get(dev->parent, NULL); in ixp4xx_wdt_probe()
150 iwdt->rate = clk_get_rate(clk); in ixp4xx_wdt_probe()
152 if (!iwdt->rate) in ixp4xx_wdt_probe()
153 iwdt->rate = IXP4XX_TIMER_FREQ; in ixp4xx_wdt_probe()
155 iwdt->wdd.info = &ixp4xx_wdt_info; in ixp4xx_wdt_probe()
156 iwdt->wdd.ops = &ixp4xx_wdt_ops; in ixp4xx_wdt_probe()
157 iwdt->wdd.min_timeout = 1; in ixp4xx_wdt_probe()
158 iwdt->wdd.max_timeout = U32_MAX / iwdt->rate; in ixp4xx_wdt_probe()
159 iwdt->wdd.parent = dev; in ixp4xx_wdt_probe()
161 iwdt->wdd.timeout = 60U; in ixp4xx_wdt_probe()
162 watchdog_init_timeout(&iwdt->wdd, 0, dev); in ixp4xx_wdt_probe()
164 if (__raw_readl(iwdt->base + IXP4XX_OSST_OFFSET) & in ixp4xx_wdt_probe()
166 iwdt->wdd.bootstatus = WDIOF_CARDRESET; in ixp4xx_wdt_probe()
168 ret = devm_watchdog_register_device(dev, &iwdt->wdd); in ixp4xx_wdt_probe()
172 dev_info(dev, "IXP4xx watchdog available\n"); in ixp4xx_wdt_probe()
180 .name = "ixp4xx-watchdog",
186 MODULE_DESCRIPTION("IXP4xx Network Processor Watchdog");