diff options
author | Fabrizio Castro <fabrizio.castro@bp.renesas.com> | 2018-02-13 08:02:44 -0500 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2018-02-15 11:19:58 -0500 |
commit | 69e0d1b8db8f8cc319f966ec3eb2fffce28c4f28 (patch) | |
tree | 4b14969dcbb191abe5802ae7c4a5f0663a12ce52 | |
parent | 7d7b619e16d420b723d6618c60a0aaf0ba4e3666 (diff) |
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
This patch allows for platform specific quirks as some of the SoC need
further customization for the watchdog to work properly, like for R-Car
Gen2 and for RZ/G.
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
-rw-r--r-- | drivers/soc/renesas/rcar-rst.c | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/drivers/soc/renesas/rcar-rst.c b/drivers/soc/renesas/rcar-rst.c index e2340eb9ea9c..34136664ece4 100644 --- a/drivers/soc/renesas/rcar-rst.c +++ b/drivers/soc/renesas/rcar-rst.c | |||
@@ -13,8 +13,18 @@ | |||
13 | #include <linux/of_address.h> | 13 | #include <linux/of_address.h> |
14 | #include <linux/soc/renesas/rcar-rst.h> | 14 | #include <linux/soc/renesas/rcar-rst.h> |
15 | 15 | ||
16 | #define WDTRSTCR_RESET 0xA55A0002 | ||
17 | #define WDTRSTCR 0x0054 | ||
18 | |||
19 | static int rcar_rst_enable_wdt_reset(void __iomem *base) | ||
20 | { | ||
21 | iowrite32(WDTRSTCR_RESET, base + WDTRSTCR); | ||
22 | return 0; | ||
23 | } | ||
24 | |||
16 | struct rst_config { | 25 | struct rst_config { |
17 | unsigned int modemr; /* Mode Monitoring Register Offset */ | 26 | unsigned int modemr; /* Mode Monitoring Register Offset */ |
27 | int (*configure)(void *base); /* Platform specific configuration */ | ||
18 | }; | 28 | }; |
19 | 29 | ||
20 | static const struct rst_config rcar_rst_gen1 __initconst = { | 30 | static const struct rst_config rcar_rst_gen1 __initconst = { |
@@ -23,6 +33,11 @@ static const struct rst_config rcar_rst_gen1 __initconst = { | |||
23 | 33 | ||
24 | static const struct rst_config rcar_rst_gen2 __initconst = { | 34 | static const struct rst_config rcar_rst_gen2 __initconst = { |
25 | .modemr = 0x60, | 35 | .modemr = 0x60, |
36 | .configure = rcar_rst_enable_wdt_reset, | ||
37 | }; | ||
38 | |||
39 | static const struct rst_config rcar_rst_gen3 __initconst = { | ||
40 | .modemr = 0x60, | ||
26 | }; | 41 | }; |
27 | 42 | ||
28 | static const struct of_device_id rcar_rst_matches[] __initconst = { | 43 | static const struct of_device_id rcar_rst_matches[] __initconst = { |
@@ -38,12 +53,12 @@ static const struct of_device_id rcar_rst_matches[] __initconst = { | |||
38 | { .compatible = "renesas,r8a7792-rst", .data = &rcar_rst_gen2 }, | 53 | { .compatible = "renesas,r8a7792-rst", .data = &rcar_rst_gen2 }, |
39 | { .compatible = "renesas,r8a7793-rst", .data = &rcar_rst_gen2 }, | 54 | { .compatible = "renesas,r8a7793-rst", .data = &rcar_rst_gen2 }, |
40 | { .compatible = "renesas,r8a7794-rst", .data = &rcar_rst_gen2 }, | 55 | { .compatible = "renesas,r8a7794-rst", .data = &rcar_rst_gen2 }, |
41 | /* R-Car Gen3 is handled like R-Car Gen2 */ | 56 | /* R-Car Gen3 */ |
42 | { .compatible = "renesas,r8a7795-rst", .data = &rcar_rst_gen2 }, | 57 | { .compatible = "renesas,r8a7795-rst", .data = &rcar_rst_gen3 }, |
43 | { .compatible = "renesas,r8a7796-rst", .data = &rcar_rst_gen2 }, | 58 | { .compatible = "renesas,r8a7796-rst", .data = &rcar_rst_gen3 }, |
44 | { .compatible = "renesas,r8a77970-rst", .data = &rcar_rst_gen2 }, | 59 | { .compatible = "renesas,r8a77970-rst", .data = &rcar_rst_gen3 }, |
45 | { .compatible = "renesas,r8a77980-rst", .data = &rcar_rst_gen2 }, | 60 | { .compatible = "renesas,r8a77980-rst", .data = &rcar_rst_gen3 }, |
46 | { .compatible = "renesas,r8a77995-rst", .data = &rcar_rst_gen2 }, | 61 | { .compatible = "renesas,r8a77995-rst", .data = &rcar_rst_gen3 }, |
47 | { /* sentinel */ } | 62 | { /* sentinel */ } |
48 | }; | 63 | }; |
49 | 64 | ||
@@ -72,6 +87,14 @@ static int __init rcar_rst_init(void) | |||
72 | rcar_rst_base = base; | 87 | rcar_rst_base = base; |
73 | cfg = match->data; | 88 | cfg = match->data; |
74 | saved_mode = ioread32(base + cfg->modemr); | 89 | saved_mode = ioread32(base + cfg->modemr); |
90 | if (cfg->configure) { | ||
91 | error = cfg->configure(base); | ||
92 | if (error) { | ||
93 | pr_warn("%pOF: Cannot run SoC specific configuration\n", | ||
94 | np); | ||
95 | goto out_put; | ||
96 | } | ||
97 | } | ||
75 | 98 | ||
76 | pr_debug("%pOF: MODE = 0x%08x\n", np, saved_mode); | 99 | pr_debug("%pOF: MODE = 0x%08x\n", np, saved_mode); |
77 | 100 | ||