disable the watchdog if the bootloader left it enabled
[openwrt/openwrt.git] / target / linux / gemini / patches / 004-gemini-disable-watchdog-in-probe.patch
1 --- a/drivers/watchdog/gemini_wdt.c
2 +++ b/drivers/watchdog/gemini_wdt.c
3 @@ -224,6 +224,7 @@ static int __init gemini_wdt_probe(struc
4 struct resource *res;
5 void __iomem *base;
6 struct gemini_wdt_struct *gemini_wdt;
7 + unsigned int reg;
8
9 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
10 if (!res) {
11 @@ -267,6 +268,13 @@ static int __init gemini_wdt_probe(struc
12
13 gemini_wdt_miscdev.parent = &pdev->dev;
14
15 + reg = __raw_readw(gemini_wdt->base + GEMINI_WDCR);
16 + if (reg & WDCR_ENABLE) {
17 + /* Watchdog was enabled by the bootloader, disable it. */
18 + reg &= ~(WDCR_ENABLE);
19 + __raw_writel(reg, gemini_wdt->base + GEMINI_WDCR);
20 + }
21 +
22 ret = misc_register(&gemini_wdt_miscdev);
23 if (ret)
24 goto fail2;