[PATCH 13/17] MIPS: loongson32: Convert watchdog platform device to DT

From: Keguang Zhang
Date: Sat Jul 29 2023 - 09:45:31 EST


Add watchdog device node for Loongson-1 boards,
and drop the legacy platform device and data accordingly.

Signed-off-by: Keguang Zhang <keguang.zhang@xxxxxxxxx>
---
arch/mips/boot/dts/loongson/loongson1b.dtsi | 9 +++++++++
arch/mips/boot/dts/loongson/loongson1c.dtsi | 9 +++++++++
arch/mips/boot/dts/loongson/lsgz_1b_dev.dts | 4 ++++
arch/mips/boot/dts/loongson/smartloong_1c.dts | 4 ++++
arch/mips/loongson32/common/platform.c | 16 ----------------
arch/mips/loongson32/ls1b/board.c | 1 -
arch/mips/loongson32/ls1c/board.c | 1 -
7 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/arch/mips/boot/dts/loongson/loongson1b.dtsi b/arch/mips/boot/dts/loongson/loongson1b.dtsi
index 935e559016d6..d7f5cebae0a9 100644
--- a/arch/mips/boot/dts/loongson/loongson1b.dtsi
+++ b/arch/mips/boot/dts/loongson/loongson1b.dtsi
@@ -133,6 +133,15 @@ phy1: ethernet-phy@0 {
};

&apb {
+ watchdog: watchdog@1fe5c060 {
+ compatible = "loongson,ls1b-wdt";
+ reg = <0x1fe5c060 0xc>;
+
+ clocks = <&clkc LS1X_CLKID_APB>;
+
+ status = "disabled";
+ };
+
rtc: rtc@1fe64000 {
compatible = "loongson,ls1b-rtc";
reg = <0x1fe64000 0x78>;
diff --git a/arch/mips/boot/dts/loongson/loongson1c.dtsi b/arch/mips/boot/dts/loongson/loongson1c.dtsi
index f68bef1f65d3..ac1b311b0622 100644
--- a/arch/mips/boot/dts/loongson/loongson1c.dtsi
+++ b/arch/mips/boot/dts/loongson/loongson1c.dtsi
@@ -89,6 +89,15 @@ ohci0: usb@1fe28000 {
};

&apb {
+ watchdog: watchdog@1fe5c060 {
+ compatible = "loongson,ls1c-wdt";
+ reg = <0x1fe5c060 0xc>;
+
+ clocks = <&clkc LS1X_CLKID_APB>;
+
+ status = "disabled";
+ };
+
rtc: rtc@1fe64000 {
compatible = "loongson,ls1c-rtc";
reg = <0x1fe64000 0x78>;
diff --git a/arch/mips/boot/dts/loongson/lsgz_1b_dev.dts b/arch/mips/boot/dts/loongson/lsgz_1b_dev.dts
index d3988d789c0f..01152807a13f 100644
--- a/arch/mips/boot/dts/loongson/lsgz_1b_dev.dts
+++ b/arch/mips/boot/dts/loongson/lsgz_1b_dev.dts
@@ -82,3 +82,7 @@ &uart2 {
&uart3 {
status = "okay";
};
+
+&watchdog {
+ status = "okay";
+};
diff --git a/arch/mips/boot/dts/loongson/smartloong_1c.dts b/arch/mips/boot/dts/loongson/smartloong_1c.dts
index 1b7741dcb87f..2360be8942d6 100644
--- a/arch/mips/boot/dts/loongson/smartloong_1c.dts
+++ b/arch/mips/boot/dts/loongson/smartloong_1c.dts
@@ -78,3 +78,7 @@ &uart2 {
&uart3 {
status = "okay";
};
+
+&watchdog {
+ status = "okay";
+};
diff --git a/arch/mips/loongson32/common/platform.c b/arch/mips/loongson32/common/platform.c
index 7d0120fe9a5b..9783c34f39b4 100644
--- a/arch/mips/loongson32/common/platform.c
+++ b/arch/mips/loongson32/common/platform.c
@@ -15,19 +15,3 @@
#include <dma.h>
#include <nand.h>
#include <irq.h>
-
-/* 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 59c70c7ffe1a..ff28f44fa687 100644
--- a/arch/mips/loongson32/ls1b/board.c
+++ b/arch/mips/loongson32/ls1b/board.c
@@ -13,7 +13,6 @@
#include <platform.h>

static struct platform_device *ls1b_platform_devices[] __initdata = {
- &ls1x_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 4c2d44f9f6f2..e0b0eb94077e 100644
--- a/arch/mips/loongson32/ls1c/board.c
+++ b/arch/mips/loongson32/ls1c/board.c
@@ -6,7 +6,6 @@
#include <platform.h>

static struct platform_device *ls1c_platform_devices[] __initdata = {
- &ls1x_wdt_pdev,
};

static int __init ls1c_platform_init(void)
--
2.39.2