rk29_wdt: fix for fiq debugger
author黄涛 <huangtao@rock-chips.com>
Wed, 30 Jan 2013 02:27:59 +0000 (10:27 +0800)
committer黄涛 <huangtao@rock-chips.com>
Wed, 30 Jan 2013 02:34:15 +0000 (10:34 +0800)
drivers/watchdog/rk29_wdt.c

index ce367ee16d68bff26c6bd63b7cba02f74193ff78..dd3e7972a779bd750e7075698b4fe13484a920f8 100644 (file)
@@ -122,20 +122,22 @@ static char                expect_close;
                printk(KERN_INFO msg); \\r
        } while (0)\r
 \r
+#define wdt_writel(v, offset) do { writel_relaxed(v, wdt_base + offset); dsb(); } while (0)\r
 \r
 /* functions */\r
 void rk29_wdt_keepalive(void)\r
 {\r
-       writel(0x76, wdt_base + RK29_WDT_CRR);\r
+       if (wdt_base)\r
+               wdt_writel(0x76, RK29_WDT_CRR);\r
 }\r
 \r
 static void __rk29_wdt_stop(void)\r
 {\r
        rk29_wdt_keepalive();    //feed dog\r
-       writel(0x0a, wdt_base + RK29_WDT_CR);\r
+       wdt_writel(0x0a, RK29_WDT_CR);\r
 }\r
 \r
-void rk29_wdt_stop(void)\r
+static void rk29_wdt_stop(void)\r
 {\r
        __rk29_wdt_stop();\r
        clk_disable(wdt_clock);\r
@@ -164,17 +166,17 @@ static int rk29_wdt_set_heartbeat(int timeout)
                torr = 15;\r
        }\r
        DBG("%s:%d\n", __func__, torr);\r
-       writel(torr, wdt_base + RK29_WDT_TORR);\r
+       wdt_writel(torr, RK29_WDT_TORR);\r
        return 0;\r
 }\r
 \r
-void rk29_wdt_start(void)\r
+static void rk29_wdt_start(void)\r
 {\r
-       unsigned long wtcon = 0;\r
+       unsigned long wtcon;\r
        clk_enable(wdt_clock);\r
        rk29_wdt_set_heartbeat(tmr_margin);\r
-       wtcon |= (RK29_WDT_EN << 0) | (RK29_RESPONSE_MODE << 1) | (RK29_RESET_PULSE << 2);\r
-       writel(wtcon, wdt_base + RK29_WDT_CR);\r
+       wtcon = (RK29_WDT_EN << 0) | (RK29_RESPONSE_MODE << 1) | (RK29_RESET_PULSE << 2);\r
+       wdt_writel(wtcon, RK29_WDT_CR);\r
 }\r
 \r
 /*\r
@@ -384,7 +386,6 @@ static int __devinit rk29_wdt_probe(struct platform_device *pdev)
                        WATCHDOG_MINOR, ret);\r
                goto err_clk;\r
        }\r
-       printk("watchdog misc directory:%s\n", rk29_wdt_miscdev.nodename);\r
        if (tmr_atboot && started == 0) {\r
                dev_info(dev, "starting watchdog timer\n");\r
                rk29_wdt_start();\r