Skip to content

Commit 0c91aa1

Browse files
cometzeroWim Van Sebroeck
authored andcommitted
watchdog: s3c2410_wdt: support exynosautov9 watchdog
Like exynos850, exynosautov9 SoC also has two cpu watchdogs. Unfortunately, some configurations are slightly different so we need to add samsung,exynosautov9-wdt and separate drv data for those watchdogs. Signed-off-by: Chanho Park <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent eadf8c4 commit 0c91aa1

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

drivers/watchdog/s3c2410_wdt.c

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,13 @@
6060
#define EXYNOS850_CLUSTER0_NONCPU_INT_EN 0x1244
6161
#define EXYNOS850_CLUSTER1_NONCPU_OUT 0x1620
6262
#define EXYNOS850_CLUSTER1_NONCPU_INT_EN 0x1644
63+
#define EXYNOSAUTOV9_CLUSTER1_NONCPU_OUT 0x1520
64+
#define EXYNOSAUTOV9_CLUSTER1_NONCPU_INT_EN 0x1544
6365

6466
#define EXYNOS850_CLUSTER0_WDTRESET_BIT 24
6567
#define EXYNOS850_CLUSTER1_WDTRESET_BIT 23
68+
#define EXYNOSAUTOV9_CLUSTER0_WDTRESET_BIT 25
69+
#define EXYNOSAUTOV9_CLUSTER1_WDTRESET_BIT 24
6670

6771
/**
6872
* DOC: Quirk flags for different Samsung watchdog IP-cores
@@ -236,6 +240,30 @@ static const struct s3c2410_wdt_variant drv_data_exynos850_cl1 = {
236240
QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN,
237241
};
238242

243+
static const struct s3c2410_wdt_variant drv_data_exynosautov9_cl0 = {
244+
.mask_reset_reg = EXYNOS850_CLUSTER0_NONCPU_INT_EN,
245+
.mask_bit = 2,
246+
.mask_reset_inv = true,
247+
.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
248+
.rst_stat_bit = EXYNOSAUTOV9_CLUSTER0_WDTRESET_BIT,
249+
.cnt_en_reg = EXYNOS850_CLUSTER0_NONCPU_OUT,
250+
.cnt_en_bit = 7,
251+
.quirks = QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_PMU_MASK_RESET |
252+
QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN,
253+
};
254+
255+
static const struct s3c2410_wdt_variant drv_data_exynosautov9_cl1 = {
256+
.mask_reset_reg = EXYNOSAUTOV9_CLUSTER1_NONCPU_INT_EN,
257+
.mask_bit = 2,
258+
.mask_reset_inv = true,
259+
.rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET,
260+
.rst_stat_bit = EXYNOSAUTOV9_CLUSTER1_WDTRESET_BIT,
261+
.cnt_en_reg = EXYNOSAUTOV9_CLUSTER1_NONCPU_OUT,
262+
.cnt_en_bit = 7,
263+
.quirks = QUIRK_HAS_WTCLRINT_REG | QUIRK_HAS_PMU_MASK_RESET |
264+
QUIRK_HAS_PMU_RST_STAT | QUIRK_HAS_PMU_CNT_EN,
265+
};
266+
239267
static const struct of_device_id s3c2410_wdt_match[] = {
240268
{ .compatible = "samsung,s3c2410-wdt",
241269
.data = &drv_data_s3c2410 },
@@ -249,6 +277,8 @@ static const struct of_device_id s3c2410_wdt_match[] = {
249277
.data = &drv_data_exynos7 },
250278
{ .compatible = "samsung,exynos850-wdt",
251279
.data = &drv_data_exynos850_cl0 },
280+
{ .compatible = "samsung,exynosautov9-wdt",
281+
.data = &drv_data_exynosautov9_cl0 },
252282
{},
253283
};
254284
MODULE_DEVICE_TABLE(of, s3c2410_wdt_match);
@@ -630,8 +660,9 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev)
630660
}
631661

632662
#ifdef CONFIG_OF
633-
/* Choose Exynos850 driver data w.r.t. cluster index */
634-
if (variant == &drv_data_exynos850_cl0) {
663+
/* Choose Exynos850/ExynosAutov9 driver data w.r.t. cluster index */
664+
if (variant == &drv_data_exynos850_cl0 ||
665+
variant == &drv_data_exynosautov9_cl0) {
635666
u32 index;
636667
int err;
637668

@@ -644,9 +675,11 @@ s3c2410_get_wdt_drv_data(struct platform_device *pdev)
644675

645676
switch (index) {
646677
case 0:
647-
return &drv_data_exynos850_cl0;
678+
return variant;
648679
case 1:
649-
return &drv_data_exynos850_cl1;
680+
return (variant == &drv_data_exynos850_cl0) ?
681+
&drv_data_exynos850_cl1 :
682+
&drv_data_exynosautov9_cl1;
650683
default:
651684
dev_err(dev, "wrong cluster index: %u\n", index);
652685
return NULL;

0 commit comments

Comments
 (0)