[PATCH v2.1 2/2] MIPS: loongson1: Add watchdog support for Loongson1 board

2016-10-20 Thread Yang Ling
The patch adds watchdog support for Loongson1 board.

Signed-off-by: Yang Ling 

---
V2.1:
  No change.
V2.0:
  Add watchdog support for loongson1b_defconfig.
V1.1:
  Add watchdog support for Loongson1B.
---
 arch/mips/configs/loongson1b_defconfig   |  4 
 arch/mips/configs/loongson1c_defconfig   |  4 
 arch/mips/include/asm/mach-loongson32/platform.h |  3 ++-
 arch/mips/loongson32/common/platform.c   | 16 
 arch/mips/loongson32/ls1b/board.c|  1 +
 arch/mips/loongson32/ls1c/board.c|  1 +
 6 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/mips/configs/loongson1b_defconfig 
b/arch/mips/configs/loongson1b_defconfig
index c442f27..914c867 100644
--- a/arch/mips/configs/loongson1b_defconfig
+++ b/arch/mips/configs/loongson1b_defconfig
@@ -74,6 +74,10 @@ CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_LOONGSON1=y
 # CONFIG_HWMON is not set
+CONFIG_WATCHDOG=y
+CONFIG_WATCHDOG_NOWAYOUT=y
+CONFIG_WATCHDOG_SYSFS=y
+CONFIG_LOONGSON1_WDT=y
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_HID_GENERIC=m
 CONFIG_USB_HID=m
diff --git a/arch/mips/configs/loongson1c_defconfig 
b/arch/mips/configs/loongson1c_defconfig
index 2304d41..68e42ef 100644
--- a/arch/mips/configs/loongson1c_defconfig
+++ b/arch/mips/configs/loongson1c_defconfig
@@ -75,6 +75,10 @@ CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_LOONGSON1=y
 # CONFIG_HWMON is not set
+CONFIG_WATCHDOG=y
+CONFIG_WATCHDOG_NOWAYOUT=y
+CONFIG_WATCHDOG_SYSFS=y
+CONFIG_LOONGSON1_WDT=y
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_HID_GENERIC=m
 CONFIG_USB_HID=m
diff --git a/arch/mips/include/asm/mach-loongson32/platform.h 
b/arch/mips/include/asm/mach-loongson32/platform.h
index 7adc313..85335fd 100644
--- a/arch/mips/include/asm/mach-loongson32/platform.h
+++ b/arch/mips/include/asm/mach-loongson32/platform.h
@@ -25,11 +25,12 @@
 extern struct platform_device ls1x_gpio1_pdev;
 extern struct platform_device ls1x_nand_pdev;
 extern struct platform_device ls1x_rtc_pdev;
+extern struct platform_device ls1x_wdt_pdev;
 
 void __init ls1x_clk_init(void);
 void __init ls1x_dma_set_platdata(struct plat_ls1x_dma *pdata);
 void __init ls1x_nand_set_platdata(struct plat_ls1x_nand *pdata);
-void __init ls1x_serial_set_uartclk(struct platform_device *pdev);
 void __init ls1x_rtc_set_extclk(struct platform_device *pdev);
+void __init ls1x_serial_set_uartclk(struct platform_device *pdev);
 
 #endif /* __ASM_MACH_LOONGSON32_PLATFORM_H */
diff --git a/arch/mips/loongson32/common/platform.c 
b/arch/mips/loongson32/common/platform.c
index 4e28e0f..1bfcdcb 100644
--- a/arch/mips/loongson32/common/platform.c
+++ b/arch/mips/loongson32/common/platform.c
@@ -357,3 +357,19 @@ struct platform_device ls1x_rtc_pdev = {
.name   = "ls1x-rtc",
.id = -1,
 };
+
+/* Watchdog */
+static struct resource ls1x_wdt_resources[] = {
+   {
+   .start  = LS1X_WDT_BASE,
+   .end= LS1X_WDT_BASE + SZ_16 - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+};
+
+struct platform_device ls1x_wdt_pdev = {
+   .name   = "ls1x-wdt",
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(ls1x_wdt_resources),
+   .resource   = ls1x_wdt_resources,
+};
diff --git a/arch/mips/loongson32/ls1b/board.c 
b/arch/mips/loongson32/ls1b/board.c
index 38a1d40..d0812a3 100644
--- a/arch/mips/loongson32/ls1b/board.c
+++ b/arch/mips/loongson32/ls1b/board.c
@@ -72,6 +72,7 @@ struct plat_ls1x_nand ls1x_nand_pdata = {
_gpio1_pdev,
_nand_pdev,
_rtc_pdev,
+   _wdt_pdev,
 };
 
 static int __init ls1b_platform_init(void)
diff --git a/arch/mips/loongson32/ls1c/board.c 
b/arch/mips/loongson32/ls1c/board.c
index a96bed5..0e02362 100644
--- a/arch/mips/loongson32/ls1c/board.c
+++ b/arch/mips/loongson32/ls1c/board.c
@@ -13,6 +13,7 @@
_uart_pdev,
_eth0_pdev,
_rtc_pdev,
+   _wdt_pdev,
 };
 
 static int __init ls1c_platform_init(void)
-- 
1.9.1



[PATCH v2.1 2/2] MIPS: loongson1: Add watchdog support for Loongson1 board

2016-10-20 Thread Yang Ling
The patch adds watchdog support for Loongson1 board.

Signed-off-by: Yang Ling 

---
V2.1:
  No change.
V2.0:
  Add watchdog support for loongson1b_defconfig.
V1.1:
  Add watchdog support for Loongson1B.
---
 arch/mips/configs/loongson1b_defconfig   |  4 
 arch/mips/configs/loongson1c_defconfig   |  4 
 arch/mips/include/asm/mach-loongson32/platform.h |  3 ++-
 arch/mips/loongson32/common/platform.c   | 16 
 arch/mips/loongson32/ls1b/board.c|  1 +
 arch/mips/loongson32/ls1c/board.c|  1 +
 6 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/arch/mips/configs/loongson1b_defconfig 
b/arch/mips/configs/loongson1b_defconfig
index c442f27..914c867 100644
--- a/arch/mips/configs/loongson1b_defconfig
+++ b/arch/mips/configs/loongson1b_defconfig
@@ -74,6 +74,10 @@ CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_LOONGSON1=y
 # CONFIG_HWMON is not set
+CONFIG_WATCHDOG=y
+CONFIG_WATCHDOG_NOWAYOUT=y
+CONFIG_WATCHDOG_SYSFS=y
+CONFIG_LOONGSON1_WDT=y
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_HID_GENERIC=m
 CONFIG_USB_HID=m
diff --git a/arch/mips/configs/loongson1c_defconfig 
b/arch/mips/configs/loongson1c_defconfig
index 2304d41..68e42ef 100644
--- a/arch/mips/configs/loongson1c_defconfig
+++ b/arch/mips/configs/loongson1c_defconfig
@@ -75,6 +75,10 @@ CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_GPIOLIB=y
 CONFIG_GPIO_LOONGSON1=y
 # CONFIG_HWMON is not set
+CONFIG_WATCHDOG=y
+CONFIG_WATCHDOG_NOWAYOUT=y
+CONFIG_WATCHDOG_SYSFS=y
+CONFIG_LOONGSON1_WDT=y
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_HID_GENERIC=m
 CONFIG_USB_HID=m
diff --git a/arch/mips/include/asm/mach-loongson32/platform.h 
b/arch/mips/include/asm/mach-loongson32/platform.h
index 7adc313..85335fd 100644
--- a/arch/mips/include/asm/mach-loongson32/platform.h
+++ b/arch/mips/include/asm/mach-loongson32/platform.h
@@ -25,11 +25,12 @@
 extern struct platform_device ls1x_gpio1_pdev;
 extern struct platform_device ls1x_nand_pdev;
 extern struct platform_device ls1x_rtc_pdev;
+extern struct platform_device ls1x_wdt_pdev;
 
 void __init ls1x_clk_init(void);
 void __init ls1x_dma_set_platdata(struct plat_ls1x_dma *pdata);
 void __init ls1x_nand_set_platdata(struct plat_ls1x_nand *pdata);
-void __init ls1x_serial_set_uartclk(struct platform_device *pdev);
 void __init ls1x_rtc_set_extclk(struct platform_device *pdev);
+void __init ls1x_serial_set_uartclk(struct platform_device *pdev);
 
 #endif /* __ASM_MACH_LOONGSON32_PLATFORM_H */
diff --git a/arch/mips/loongson32/common/platform.c 
b/arch/mips/loongson32/common/platform.c
index 4e28e0f..1bfcdcb 100644
--- a/arch/mips/loongson32/common/platform.c
+++ b/arch/mips/loongson32/common/platform.c
@@ -357,3 +357,19 @@ struct platform_device ls1x_rtc_pdev = {
.name   = "ls1x-rtc",
.id = -1,
 };
+
+/* Watchdog */
+static struct resource ls1x_wdt_resources[] = {
+   {
+   .start  = LS1X_WDT_BASE,
+   .end= LS1X_WDT_BASE + SZ_16 - 1,
+   .flags  = IORESOURCE_MEM,
+   },
+};
+
+struct platform_device ls1x_wdt_pdev = {
+   .name   = "ls1x-wdt",
+   .id = -1,
+   .num_resources  = ARRAY_SIZE(ls1x_wdt_resources),
+   .resource   = ls1x_wdt_resources,
+};
diff --git a/arch/mips/loongson32/ls1b/board.c 
b/arch/mips/loongson32/ls1b/board.c
index 38a1d40..d0812a3 100644
--- a/arch/mips/loongson32/ls1b/board.c
+++ b/arch/mips/loongson32/ls1b/board.c
@@ -72,6 +72,7 @@ struct plat_ls1x_nand ls1x_nand_pdata = {
_gpio1_pdev,
_nand_pdev,
_rtc_pdev,
+   _wdt_pdev,
 };
 
 static int __init ls1b_platform_init(void)
diff --git a/arch/mips/loongson32/ls1c/board.c 
b/arch/mips/loongson32/ls1c/board.c
index a96bed5..0e02362 100644
--- a/arch/mips/loongson32/ls1c/board.c
+++ b/arch/mips/loongson32/ls1c/board.c
@@ -13,6 +13,7 @@
_uart_pdev,
_eth0_pdev,
_rtc_pdev,
+   _wdt_pdev,
 };
 
 static int __init ls1c_platform_init(void)
-- 
1.9.1