Skip to content

Commit 796bb2d

Browse files
petegriffinkrzk
authored andcommitted
watchdog: s3c2410_wdt: Add support for Google gs101 SoC
This patch adds the compatibles and drvdata for the Google gs101 SoC found in Pixel 6, Pixel 6a & Pixel 6 pro phones. Similar to Exynos850 it has two watchdog instances, one for each cluster and has some control bits in PMU registers. gs101 also has the dbgack_mask bit in wtcon register, so we also enable QUIRK_HAS_DBGACK_BIT. Tested-by: Will McVicker <willmcvicker@google.com> Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> Signed-off-by: Peter Griffin <peter.griffin@linaro.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20231211162331.435900-13-peter.griffin@linaro.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
1 parent d429928 commit 796bb2d

1 file changed

Lines changed: 43 additions & 4 deletions

File tree

drivers/watchdog/s3c2410_wdt.c

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@
6969
#define EXYNOSAUTOV9_CLUSTER0_WDTRESET_BIT 25
7070
#define EXYNOSAUTOV9_CLUSTER1_WDTRESET_BIT 24
7171

72+
#define GS_CLUSTER0_NONCPU_OUT 0x1220
73+
#define GS_CLUSTER1_NONCPU_OUT 0x1420
74+
#define GS_CLUSTER0_NONCPU_INT_EN 0x1244
75+
#define GS_CLUSTER1_NONCPU_INT_EN 0x1444
76+
#define GS_CLUSTER2_NONCPU_INT_EN 0x1644
77+
#define GS_RST_STAT_REG_OFFSET 0x3B44
78+
7279
/**
7380
* DOC: Quirk flags for different Samsung watchdog IP-cores
7481
*
@@ -270,7 +277,35 @@ static const struct s3c2410_wdt_variant drv_data_exynosautov9_cl1 = {
270277
QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN,
271278
};
272279

280+
static const struct s3c2410_wdt_variant drv_data_gs101_cl0 = {
281+
.mask_reset_reg = GS_CLUSTER0_NONCPU_INT_EN,
282+
.mask_bit = 2,
283+
.mask_reset_inv = true,
284+
.rst_stat_reg = GS_RST_STAT_REG_OFFSET,
285+
.rst_stat_bit = 0,
286+
.cnt_en_reg = GS_CLUSTER0_NONCPU_OUT,
287+
.cnt_en_bit = 8,
288+
.quirks = QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_MASK_RESET |
289+
QUIRK_HAS_PMU_CNT_EN | QUIRK_HAS_WTCLRINT_REG |
290+
QUIRK_HAS_DBGACK_BIT,
291+
};
292+
293+
static const struct s3c2410_wdt_variant drv_data_gs101_cl1 = {
294+
.mask_reset_reg = GS_CLUSTER1_NONCPU_INT_EN,
295+
.mask_bit = 2,
296+
.mask_reset_inv = true,
297+
.rst_stat_reg = GS_RST_STAT_REG_OFFSET,
298+
.rst_stat_bit = 1,
299+
.cnt_en_reg = GS_CLUSTER1_NONCPU_OUT,
300+
.cnt_en_bit = 7,
301+
.quirks = QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_MASK_RESET |
302+
QUIRK_HAS_PMU_CNT_EN | QUIRK_HAS_WTCLRINT_REG |
303+
QUIRK_HAS_DBGACK_BIT,
304+
};
305+
273306
static const struct of_device_id s3c2410_wdt_match[] = {
307+
{ .compatible = "google,gs101-wdt",
308+
.data = &drv_data_gs101_cl0 },
274309
{ .compatible = "samsung,s3c2410-wdt",
275310
.data = &drv_data_s3c2410 },
276311
{ .compatible = "samsung,s3c6410-wdt",
@@ -607,7 +642,8 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev, struct s3c2410_wdt *wdt)
607642
#ifdef CONFIG_OF
608643
/* Choose Exynos850/ExynosAutov9 driver data w.r.t. cluster index */
609644
if (variant == &drv_data_exynos850_cl0 ||
610-
variant == &drv_data_exynosautov9_cl0) {
645+
variant == &drv_data_exynosautov9_cl0 ||
646+
variant == &drv_data_gs101_cl0) {
611647
u32 index;
612648
int err;
613649

@@ -620,9 +656,12 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev, struct s3c2410_wdt *wdt)
620656
case 0:
621657
break;
622658
case 1:
623-
variant = (variant == &drv_data_exynos850_cl0) ?
624-
&drv_data_exynos850_cl1 :
625-
&drv_data_exynosautov9_cl1;
659+
if (variant == &drv_data_exynos850_cl0)
660+
variant = &drv_data_exynos850_cl1;
661+
else if (variant == &drv_data_exynosautov9_cl0)
662+
variant = &drv_data_exynosautov9_cl1;
663+
else if (variant == &drv_data_gs101_cl0)
664+
variant = &drv_data_gs101_cl1;
626665
break;
627666
default:
628667
return dev_err_probe(dev, -EINVAL, "wrong cluster index: %u\n", index);

0 commit comments

Comments
 (0)