Lines Matching refs:xdev
52 struct xwdt_device *xdev = watchdog_get_drvdata(wdd); in xilinx_wdt_start() local
54 ret = clk_enable(xdev->clk); in xilinx_wdt_start()
60 spin_lock(&xdev->spinlock); in xilinx_wdt_start()
63 control_status_reg = ioread32(xdev->base + XWT_TWCSR0_OFFSET); in xilinx_wdt_start()
67 xdev->base + XWT_TWCSR0_OFFSET); in xilinx_wdt_start()
69 iowrite32(XWT_CSRX_EWDT2_MASK, xdev->base + XWT_TWCSR1_OFFSET); in xilinx_wdt_start()
71 spin_unlock(&xdev->spinlock); in xilinx_wdt_start()
79 struct xwdt_device *xdev = watchdog_get_drvdata(wdd); in xilinx_wdt_stop() local
81 spin_lock(&xdev->spinlock); in xilinx_wdt_stop()
83 control_status_reg = ioread32(xdev->base + XWT_TWCSR0_OFFSET); in xilinx_wdt_stop()
86 xdev->base + XWT_TWCSR0_OFFSET); in xilinx_wdt_stop()
88 iowrite32(0, xdev->base + XWT_TWCSR1_OFFSET); in xilinx_wdt_stop()
90 spin_unlock(&xdev->spinlock); in xilinx_wdt_stop()
92 clk_disable(xdev->clk); in xilinx_wdt_stop()
102 struct xwdt_device *xdev = watchdog_get_drvdata(wdd); in xilinx_wdt_keepalive() local
104 spin_lock(&xdev->spinlock); in xilinx_wdt_keepalive()
106 control_status_reg = ioread32(xdev->base + XWT_TWCSR0_OFFSET); in xilinx_wdt_keepalive()
108 iowrite32(control_status_reg, xdev->base + XWT_TWCSR0_OFFSET); in xilinx_wdt_keepalive()
110 spin_unlock(&xdev->spinlock); in xilinx_wdt_keepalive()
129 static u32 xwdt_selftest(struct xwdt_device *xdev) in xwdt_selftest() argument
135 spin_lock(&xdev->spinlock); in xwdt_selftest()
137 timer_value1 = ioread32(xdev->base + XWT_TBR_OFFSET); in xwdt_selftest()
138 timer_value2 = ioread32(xdev->base + XWT_TBR_OFFSET); in xwdt_selftest()
143 timer_value2 = ioread32(xdev->base + XWT_TBR_OFFSET); in xwdt_selftest()
146 spin_unlock(&xdev->spinlock); in xwdt_selftest()
164 struct xwdt_device *xdev; in xwdt_probe() local
167 xdev = devm_kzalloc(dev, sizeof(*xdev), GFP_KERNEL); in xwdt_probe()
168 if (!xdev) in xwdt_probe()
171 xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; in xwdt_probe()
176 xdev->base = devm_platform_ioremap_resource(pdev, 0); in xwdt_probe()
177 if (IS_ERR(xdev->base)) in xwdt_probe()
178 return PTR_ERR(xdev->base); in xwdt_probe()
181 &xdev->wdt_interval); in xwdt_probe()
193 xdev->clk = devm_clk_get(dev, NULL); in xwdt_probe()
194 if (IS_ERR(xdev->clk)) { in xwdt_probe()
195 if (PTR_ERR(xdev->clk) != -ENOENT) in xwdt_probe()
196 return PTR_ERR(xdev->clk); in xwdt_probe()
202 xdev->clk = NULL; in xwdt_probe()
210 pfreq = clk_get_rate(xdev->clk); in xwdt_probe()
217 if (pfreq && xdev->wdt_interval) in xwdt_probe()
218 xilinx_wdt_wdd->timeout = 2 * ((1 << xdev->wdt_interval) / in xwdt_probe()
221 spin_lock_init(&xdev->spinlock); in xwdt_probe()
222 watchdog_set_drvdata(xilinx_wdt_wdd, xdev); in xwdt_probe()
224 rc = clk_prepare_enable(xdev->clk); in xwdt_probe()
230 xdev->clk); in xwdt_probe()
234 rc = xwdt_selftest(xdev); in xwdt_probe()
244 clk_disable(xdev->clk); in xwdt_probe()
247 xdev->base, xilinx_wdt_wdd->timeout); in xwdt_probe()
249 platform_set_drvdata(pdev, xdev); in xwdt_probe()
262 struct xwdt_device *xdev = dev_get_drvdata(dev); in xwdt_suspend() local
264 if (watchdog_active(&xdev->xilinx_wdt_wdd)) in xwdt_suspend()
265 xilinx_wdt_stop(&xdev->xilinx_wdt_wdd); in xwdt_suspend()
278 struct xwdt_device *xdev = dev_get_drvdata(dev); in xwdt_resume() local
281 if (watchdog_active(&xdev->xilinx_wdt_wdd)) in xwdt_resume()
282 ret = xilinx_wdt_start(&xdev->xilinx_wdt_wdd); in xwdt_resume()