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