[PATCH] watchdog: meson_gxbb: Add support for s4/t7 SoCs

Sean Anderson <[email protected]>
Newsgroups gmane.comp.boot-loaders.u-boot
Message-ID <20260817163048.1892107-1-sanderson__45714.6537884668$1786990663$gmane$org@brivo.com>
These SoCs have an almost identical watchdog to other meson SoCs, except
the reset bit has moved. Add a new compatible and driver data.

This commit is based off of Linux commits 55908e388b5da ("watchdog: Add
a new struct for Amlogic-GXBB driver") and 8c776a0401f1d ("watchdog: Add
support for Amlogic-T7 SoCs")

Signed-off-by: Sean Anderson <[email protected]>
---

 drivers/watchdog/meson_gxbb_wdt.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/meson_gxbb_wdt.c b/drivers/watchdog/meson_gxbb_wdt.c
index fced8f3686b..30694936c93 100644
--- a/drivers/watchdog/meson_gxbb_wdt.c
+++ b/drivers/watchdog/meson_gxbb_wdt.c
@@ -18,7 +18,6 @@
 #define GXBB_WDT_CTRL_SYS_RESET_NOW		BIT(26)
 #define GXBB_WDT_CTRL_CLKDIV_EN			BIT(25)
 #define GXBB_WDT_CTRL_CLK_EN			BIT(24)
-#define GXBB_WDT_CTRL_EE_RESET			BIT(21)
 #define GXBB_WDT_CTRL_EN			BIT(18)
 
 #define GXBB_WDT_CTRL_DIV_MASK			GENMASK(17, 0)
@@ -28,6 +27,10 @@ struct amlogic_wdt_priv {
 	void __iomem *reg_base;
 };
 
+struct wdt_params {
+	u32 rst;
+};
+
 static int amlogic_wdt_set_timeout(struct udevice *dev, u64 timeout_ms)
 {
 	struct amlogic_wdt_priv *data = dev_get_priv(dev);
@@ -84,14 +87,14 @@ static int amlogic_wdt_expire_now(struct udevice *dev, ulong flags)
 static int amlogic_wdt_probe(struct udevice *dev)
 {
 	struct amlogic_wdt_priv *data = dev_get_priv(dev);
+	struct wdt_params *params = (void *)dev_get_driver_data(dev);
+	struct clk clk;
 	int ret;
 
 	data->reg_base = dev_remap_addr(dev);
 	if (!data->reg_base)
 		return -EINVAL;
 
-	struct clk clk;
-
 	ret = clk_get_by_index(dev, 0, &clk);
 	if (ret)
 		return ret;
@@ -102,7 +105,7 @@ static int amlogic_wdt_probe(struct udevice *dev)
 
 	/* Setup with 1ms timebase */
 	writel(((clk_get_rate(&clk) / 1000) & GXBB_WDT_CTRL_DIV_MASK) |
-	       GXBB_WDT_CTRL_EE_RESET |
+	       params->rst |
 	       GXBB_WDT_CTRL_CLK_EN |
 	       GXBB_WDT_CTRL_CLKDIV_EN,
 	       data->reg_base + GXBB_WDT_CTRL_REG);
@@ -117,8 +120,17 @@ static const struct wdt_ops amlogic_wdt_ops = {
 	.expire_now = amlogic_wdt_expire_now,
 };
 
+static const struct wdt_params gxbb_params = {
+	.rst = BIT(21),
+};
+
+static const struct wdt_params t7_params = {
+	.rst = BIT(22),
+};
+
 static const struct udevice_id amlogic_wdt_ids[] = {
-	{ .compatible = "amlogic,meson-gxbb-wdt" },
+	{ .compatible = "amlogic,meson-gxbb-wdt", .data = (ulong)&gxbb_params, },
+	{ .compatible = "amlogic,t7-wdt", .data = (ulong)&t7_params, },
 	{}
 };
 
---
base-commit: d3e8597e46b635ec556a057bc42f0b0859654bdf
branch: s4_wdt

-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.