From: Peter Griffin <peter.griffin@linaro.org>
To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
mturquette@baylibre.com, conor+dt@kernel.org, sboyd@kernel.org,
tomasz.figa@gmail.com, s.nawrocki@samsung.com,
linus.walleij@linaro.org, wim@linux-watchdog.org,
linux@roeck-us.net, catalin.marinas@arm.com, will@kernel.org,
arnd@arndb.de, olof@lixom.net, cw00.choi@samsung.com
Cc: peter.griffin@linaro.org, tudor.ambarus@linaro.org,
andre.draszik@linaro.org, semen.protsenko@linaro.org,
saravanak@google.com, willmcvicker@google.com, soc@kernel.org,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-watchdog@vger.kernel.org,
kernel-team@android.com, linux-serial@vger.kernel.org
Subject: [PATCH v2 15/20] watchdog: s3c2410_wdt: Add support for Google tensor SoCs
Date: Tue, 10 Oct 2023 23:49:23 +0100 [thread overview]
Message-ID: <20231010224928.2296997-16-peter.griffin@linaro.org> (raw)
In-Reply-To: <20231010224928.2296997-1-peter.griffin@linaro.org>
This patch adds the compatibles and drvdata for the Google
gs101 & gs201 SoCs found in Pixel 6 and Pixel 7 phones. Similar
to Exynos850 it has two watchdog instances, one for each cluster
and has some control bits in PMU registers.
The watchdog IP found in gs101 SoCs also supports a few
additional bits/features in the WTCON register which we add
support for and an additional register detailed below.
dbgack-mask - Enables masking WDT interrupt and reset request
according to asserted DBGACK input
windowed-mode - Enabled Windowed watchdog mode
Windowed watchdog mode also has an additional register WTMINCNT.
If windowed watchdog is enabled and you reload WTCNT when the
value is greater than WTMINCNT, it prompts interrupt or reset
request as if the watchdog time has expired.
Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
---
drivers/watchdog/s3c2410_wdt.c | 104 ++++++++++++++++++++++++++++++---
1 file changed, 95 insertions(+), 9 deletions(-)
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 0b4bd883ff28..08a775c01c57 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -31,12 +31,14 @@
#define S3C2410_WTDAT 0x04
#define S3C2410_WTCNT 0x08
#define S3C2410_WTCLRINT 0x0c
-
+#define S3C2410_WTMINCNT 0x10
#define S3C2410_WTCNT_MAXCNT 0xffff
-#define S3C2410_WTCON_RSTEN (1 << 0)
-#define S3C2410_WTCON_INTEN (1 << 2)
-#define S3C2410_WTCON_ENABLE (1 << 5)
+#define S3C2410_WTCON_RSTEN (1 << 0)
+#define S3C2410_WTCON_INTEN (1 << 2)
+#define S3C2410_WTCON_ENABLE (1 << 5)
+#define S3C2410_WTCON_DBGACK_MASK (1 << 16)
+#define S3C2410_WTCON_WINDOWED_WD (1 << 20)
#define S3C2410_WTCON_DIV16 (0 << 3)
#define S3C2410_WTCON_DIV32 (1 << 3)
@@ -67,6 +69,12 @@
#define EXYNOSAUTOV9_CLUSTER0_WDTRESET_BIT 25
#define EXYNOSAUTOV9_CLUSTER1_WDTRESET_BIT 24
+#define GS_CLUSTER0_NONCPU_OUT 0x1220
+#define GS_CLUSTER1_NONCPU_OUT 0x1420
+#define GS_CLUSTER0_NONCPU_INT_EN 0x1244
+#define GS_CLUSTER1_NONCPU_INT_EN 0x1444
+#define GS_CLUSTER2_NONCPU_INT_EN 0x1644
+#define GS_RST_STAT_REG_OFFSET 0x3B44
/**
* DOC: Quirk flags for different Samsung watchdog IP-cores
*
@@ -106,6 +114,8 @@
#define QUIRK_HAS_PMU_RST_STAT (1 << 2)
#define QUIRK_HAS_PMU_AUTO_DISABLE (1 << 3)
#define QUIRK_HAS_PMU_CNT_EN (1 << 4)
+#define QUIRK_HAS_DBGACK_BIT (1 << 5)
+#define QUIRK_HAS_WTMINCNT_REG (1 << 6)
/* These quirks require that we have a PMU register map */
#define QUIRKS_HAVE_PMUREG \
@@ -263,6 +273,54 @@ static const struct s3c2410_wdt_variant drv_data_exynosautov9_cl1 = {
QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN,
};
+static const struct s3c2410_wdt_variant drv_data_gs101_cl0 = {
+ .mask_reset_reg = GS_CLUSTER0_NONCPU_INT_EN,
+ .mask_bit = 2,
+ .mask_reset_inv = true,
+ .rst_stat_reg = GS_RST_STAT_REG_OFFSET,
+ .rst_stat_bit = 0,
+ .cnt_en_reg = GS_CLUSTER0_NONCPU_OUT,
+ .cnt_en_bit = 8,
+ .quirks = QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_MASK_RESET | QUIRK_HAS_PMU_CNT_EN |
+ QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_DBGACK_BIT | QUIRK_HAS_WTMINCNT_REG,
+};
+
+static const struct s3c2410_wdt_variant drv_data_gs101_cl1 = {
+ .mask_reset_reg = GS_CLUSTER1_NONCPU_INT_EN,
+ .mask_bit = 2,
+ .mask_reset_inv = true,
+ .rst_stat_reg = GS_RST_STAT_REG_OFFSET,
+ .rst_stat_bit = 1,
+ .cnt_en_reg = GS_CLUSTER1_NONCPU_OUT,
+ .cnt_en_bit = 7,
+ .quirks = QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_MASK_RESET | QUIRK_HAS_PMU_CNT_EN |
+ QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_DBGACK_BIT | QUIRK_HAS_WTMINCNT_REG,
+};
+
+static const struct s3c2410_wdt_variant drv_data_gs201_cl0 = {
+ .mask_reset_reg = GS_CLUSTER0_NONCPU_INT_EN,
+ .mask_bit = 2,
+ .mask_reset_inv = true,
+ .rst_stat_reg = GS_RST_STAT_REG_OFFSET,
+ .rst_stat_bit = 0,
+ .cnt_en_reg = GS_CLUSTER0_NONCPU_OUT,
+ .cnt_en_bit = 8,
+ .quirks = QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_MASK_RESET | QUIRK_HAS_PMU_CNT_EN |
+ QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_DBGACK_BIT | QUIRK_HAS_WTMINCNT_REG,
+};
+
+static const struct s3c2410_wdt_variant drv_data_gs201_cl1 = {
+ .mask_reset_reg = GS_CLUSTER1_NONCPU_INT_EN,
+ .mask_bit = 2,
+ .mask_reset_inv = true,
+ .rst_stat_reg = GS_RST_STAT_REG_OFFSET,
+ .rst_stat_bit = 1,
+ .cnt_en_reg = GS_CLUSTER1_NONCPU_OUT,
+ .cnt_en_bit = 7,
+ .quirks = QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_MASK_RESET | QUIRK_HAS_PMU_CNT_EN |
+ QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_DBGACK_BIT | QUIRK_HAS_WTMINCNT_REG,
+};
+
static const struct of_device_id s3c2410_wdt_match[] = {
{ .compatible = "samsung,s3c2410-wdt",
.data = &drv_data_s3c2410 },
@@ -278,6 +336,10 @@ static const struct of_device_id s3c2410_wdt_match[] = {
.data = &drv_data_exynos850_cl0 },
{ .compatible = "samsung,exynosautov9-wdt",
.data = &drv_data_exynosautov9_cl0 },
+ { .compatible = "google,gs101-wdt",
+ .data = &drv_data_gs101_cl0 },
+ { .compatible = "google,gs201-wdt",
+ .data = &drv_data_gs201_cl0 },
{},
};
MODULE_DEVICE_TABLE(of, s3c2410_wdt_match);
@@ -375,6 +437,21 @@ static int s3c2410wdt_enable(struct s3c2410_wdt *wdt, bool en)
return 0;
}
+static void s3c2410wdt_mask_dbgack(struct s3c2410_wdt *wdt, bool mask)
+{
+ unsigned long wtcon;
+
+ if (!(wdt->drv_data->quirks & QUIRK_HAS_DBGACK_BIT))
+ return;
+
+ wtcon = readl(wdt->reg_base + S3C2410_WTCON);
+ if (mask)
+ wtcon |= S3C2410_WTCON_DBGACK_MASK;
+ else
+ wtcon &= ~S3C2410_WTCON_DBGACK_MASK;
+ writel(wtcon, wdt->reg_base + S3C2410_WTCON);
+}
+
static int s3c2410wdt_keepalive(struct watchdog_device *wdd)
{
struct s3c2410_wdt *wdt = watchdog_get_drvdata(wdd);
@@ -585,9 +662,11 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev, struct s3c2410_wdt *wdt)
}
#ifdef CONFIG_OF
- /* Choose Exynos850/ExynosAutov9 driver data w.r.t. cluster index */
+ /* Choose Exynos850/ExynosAutov9/gsx01 driver data w.r.t. cluster index */
if (variant == &drv_data_exynos850_cl0 ||
- variant == &drv_data_exynosautov9_cl0) {
+ variant == &drv_data_exynosautov9_cl0 ||
+ variant == &drv_data_gs101_cl0 ||
+ variant == &drv_data_gs201_cl0) {
u32 index;
int err;
@@ -600,9 +679,14 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev, struct s3c2410_wdt *wdt)
case 0:
break;
case 1:
- variant = (variant == &drv_data_exynos850_cl0) ?
- &drv_data_exynos850_cl1 :
- &drv_data_exynosautov9_cl1;
+ if (variant == &drv_data_exynos850_cl0)
+ variant = &drv_data_exynos850_cl1;
+ else if (variant == &drv_data_exynosautov9_cl0)
+ variant = &drv_data_exynosautov9_cl1;
+ else if (variant == &drv_data_gs101_cl0)
+ variant = &drv_data_gs101_cl1;
+ else if (variant == &drv_data_gs201_cl0)
+ variant = &drv_data_gs201_cl1;
break;
default:
return dev_err_probe(dev, -EINVAL, "wrong cluster index: %u\n", index);
@@ -700,6 +784,8 @@ static int s3c2410wdt_probe(struct platform_device *pdev)
wdt->wdt_device.bootstatus = s3c2410wdt_get_bootstatus(wdt);
wdt->wdt_device.parent = dev;
+ s3c2410wdt_mask_dbgack(wdt, true);
+
/*
* If "tmr_atboot" param is non-zero, start the watchdog right now. Also
* set WDOG_HW_RUNNING bit, so that watchdog core can kick the watchdog.
--
2.42.0.609.gbb76f46606-goog
next prev parent reply other threads:[~2023-10-10 22:50 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-10 22:49 [PATCH v2 00/20] Add minimal Tensor/GS101 SoC support and Oriole/Pixel6 board Peter Griffin
2023-10-10 22:49 ` [PATCH v2 01/20] dt-bindings: soc: samsung: exynos-pmu: Add gs101 compatible Peter Griffin
2023-10-10 22:49 ` [PATCH v2 02/20] dt-bindings: clock: Add Google gs101 clock management unit bindings Peter Griffin
2023-10-10 22:49 ` [PATCH v2 03/20] dt-bindings: soc: google: exynos-sysreg: add dedicated SYSREG compatibles to GS101 Peter Griffin
2023-10-10 22:49 ` [PATCH v2 04/20] dt-bindings: watchdog: Document Google gs101 & gs201 watchdog bindings Peter Griffin
2023-10-10 22:49 ` [PATCH v2 05/20] dt-bindings: arm: google: Add bindings for Google ARM platforms Peter Griffin
2023-10-10 22:49 ` [PATCH v2 06/20] dt-bindings: pinctrl: samsung: add google,gs101-pinctrl compatible Peter Griffin
2023-10-10 22:49 ` [PATCH v2 07/20] dt-bindings: pinctrl: samsung: add gs101-wakeup-eint compatible Peter Griffin
2023-10-11 23:12 ` Sam Protsenko
2023-10-12 11:24 ` Peter Griffin
2023-10-10 22:49 ` [PATCH v2 08/20] dt-bindings: serial: samsung: Add google-gs101-uart compatible Peter Griffin
[not found] ` <2023101111-banknote-satin-1f77@gregkh>
2023-10-11 8:49 ` Tudor Ambarus
[not found] ` <2023101137-fester-rerun-5c39@gregkh>
2023-10-11 9:30 ` Arnd Bergmann
[not found] ` <2023101126-stash-manor-7162@gregkh>
2023-10-11 10:19 ` Arnd Bergmann
2023-10-11 11:55 ` Peter Griffin
2023-10-11 12:07 ` Krzysztof Kozlowski
2023-10-11 9:22 ` Peter Griffin
2023-10-11 11:58 ` Linus Walleij
2023-10-11 12:09 ` Krzysztof Kozlowski
2023-10-11 13:27 ` Peter Griffin
2023-10-11 13:32 ` Krzysztof Kozlowski
2023-10-10 22:49 ` [PATCH v2 09/20] clk: samsung: clk-pll: Add support for pll_{0516,0517,518} Peter Griffin
2023-10-10 22:49 ` [PATCH v2 10/20] clk: samsung: clk-gs101: Add cmu_top registers, plls, mux and gates Peter Griffin
2023-10-10 22:49 ` [PATCH v2 11/20] clk: samsung: clk-gs101: add CMU_APM support Peter Griffin
2023-10-10 22:49 ` [PATCH v2 12/20] clk: samsung: clk-gs101: Add support for CMU_MISC clock unit Peter Griffin
2023-10-10 22:49 ` [PATCH v2 13/20] pinctrl: samsung: Add filter selection support for alive banks Peter Griffin
2023-10-10 22:49 ` [PATCH v2 14/20] pinctrl: samsung: Add gs101 SoC pinctrl configuration Peter Griffin
2023-10-10 22:49 ` Peter Griffin [this message]
2023-10-10 23:56 ` [PATCH v2 15/20] watchdog: s3c2410_wdt: Add support for Google tensor SoCs Guenter Roeck
2023-10-11 14:43 ` Peter Griffin
2023-10-10 22:49 ` [PATCH v2 16/20] tty: serial: samsung: Add gs101 compatible and SoC data Peter Griffin
[not found] ` <2023101109-crispy-escapable-0801@gregkh>
2023-10-11 18:03 ` Peter Griffin
2023-10-10 22:49 ` [PATCH v2 17/20] arm64: dts: google: Add initial Google gs101 SoC support Peter Griffin
2023-10-10 22:49 ` [PATCH v2 18/20] arm64: dts: google: Add initial Oriole/pixel 6 board support Peter Griffin
2023-10-10 22:49 ` [PATCH v2 19/20] arm64: defconfig: Enable Google Tensor SoC Peter Griffin
2023-10-10 22:49 ` [PATCH v2 20/20] MAINTAINERS: add entry for " Peter Griffin
2023-10-11 6:10 ` [PATCH v2 00/20] Add minimal Tensor/GS101 SoC support and Oriole/Pixel6 board Tudor Ambarus
2023-10-11 8:16 ` Peter Griffin
2023-10-11 8:42 ` Tudor Ambarus
2023-10-11 14:16 ` Peter Griffin
2023-10-11 7:44 ` Greg KH
2023-10-11 9:06 ` Peter Griffin
2023-10-11 9:11 ` Greg KH
2023-10-11 12:11 ` Krzysztof Kozlowski
2023-10-11 12:10 ` Krzysztof Kozlowski
2023-11-02 22:32 ` Maksym Holovach
2023-11-03 13:11 ` Peter Griffin
2023-11-03 13:56 ` Maksym Holovach
2023-11-03 14:49 ` Krzysztof Kozlowski
2023-11-03 17:36 ` William McVicker
2023-11-03 20:05 ` William McVicker
2023-11-03 23:05 ` Maksym Holovach
2023-11-03 23:23 ` Maksym Holovach
2023-11-06 20:12 ` William McVicker
2023-11-05 12:52 ` Krzysztof Kozlowski
[not found] ` <2023110535-rare-underdone-b508@gregkh>
2023-11-05 13:14 ` Krzysztof Kozlowski
2023-11-04 17:55 ` Alim Akhtar
2023-11-06 13:36 ` Peter Griffin
2023-11-06 15:10 ` Henrik Grimler
2023-11-06 12:46 ` Peter Griffin
2023-11-06 13:46 ` Krzysztof Kozlowski
2023-11-06 19:42 ` William McVicker
2023-11-07 3:52 ` Alim Akhtar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231010224928.2296997-16-peter.griffin@linaro.org \
--to=peter.griffin@linaro.org \
--cc=andre.draszik@linaro.org \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=kernel-team@android.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=mturquette@baylibre.com \
--cc=olof@lixom.net \
--cc=robh+dt@kernel.org \
--cc=s.nawrocki@samsung.com \
--cc=saravanak@google.com \
--cc=sboyd@kernel.org \
--cc=semen.protsenko@linaro.org \
--cc=soc@kernel.org \
--cc=tomasz.figa@gmail.com \
--cc=tudor.ambarus@linaro.org \
--cc=will@kernel.org \
--cc=willmcvicker@google.com \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox