Fix watchdog on Renesas R-Car Gen2 and RZ/G1
Subsystems (7)
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
Dear All,
this series has been around for some time as RFC, and it has collected useful comments from the community along the way.
The solution proposed by this patch set works for most R-Car Gen2 and RZ/G1 devices, but not all of them. We now know that for some R-Car Gen2 early revisions there is no proper software fix. Anyway, no product has been built around early revisions, but development boards mounting early revisions (basically prototypes) are still out there. As a result, this series isn't enabling the internal watchdog on R-Car Gen2 boards, developers may enable it in board specific device trees if needed.
This series has been tested by me on the iwg20d, iwg22d, Lager, Alt, and Koelsch boards.
The problem
===========
To deal with SMP on R-Car Gen2 and RZ/G1, we install a reset vector to ICRAM1 and we program the [S]BAR registers so that when we turn ON the non-boot CPUs they are redirected to the reset vector installed by Linux in ICRAM1, and eventually they continue the execution to RAM, where the SMP bring-up code will take care of the rest.
The content of the [S]BAR registers survives a watchdog triggered reset, and as such after the watchdog fires the boot core will try and execute the SMP bring-up code instead of jumping to the bootrom code.
The fix
=======
The main strategy for the solution is to let the reset vector decide if it needs to jump to shmobile_boot_fn or to the bootrom code. In a watchdog triggered reset scenario, since the [S]BAR registers keep their values, the boot CPU will jump into the newly designed reset vector, the assembly routine will eventually test WOVF (a bit in register RWTCSRA that indicates if the watchdog counter has overflown, the value of this bit gets retained in this scenario), and jump to the bootrom code which will in turn load up the bootloader, etc.
When bringing up SMP or using CPU hotplug, the reset vector will jump to shmobile_boot_fn instead.
Thank you All for your help.
Best regards,
Fabrizio Castro (26):
ARM: shmobile: Add watchdog support
ARM: dts: r8a7743: Adjust SMP routine size
ARM: dts: r8a7745: Adjust SMP routine size
ARM: dts: r8a7790: Adjust SMP routine size
ARM: dts: r8a7791: Adjust SMP routine size
ARM: dts: r8a7792: Adjust SMP routine size
ARM: dts: r8a7793: Adjust SMP routine size
ARM: dts: r8a7794: Adjust SMP routine size
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
ARM: shmobile: rcar-gen2: Add watchdog support
dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
watchdog: renesas_wdt: Add R-Car Gen2 support
watchdog: renesas_wdt: Add restart handler
ARM: shmobile: defconfig: Enable RENESAS_WDT_GEN
clk: renesas: r8a7743: Add rwdt clock
clk: renesas: r8a7745: Add rwdt clock
clk: renesas: r8a7790: Add rwdt clock
clk: renesas: r8a7791/r8a7793: Add rwdt clock
clk: renesas: r8a7794: Add rwdt clock
ARM: dts: r8a7743: Add watchdog support to SoC dtsi
ARM: dts: r8a7745: Add watchdog support to SoC dtsi
ARM: dts: r8a7790: Add watchdog support to SoC dtsi
ARM: dts: r8a7791: Add watchdog support to SoC dtsi
ARM: dts: r8a7794: Add watchdog support to SoC dtsi
ARM: dts: iwg20m: Add watchdog support to SoM dtsi
ARM: dts: iwg22m: Add watchdog support to SoM dtsi
.../devicetree/bindings/watchdog/renesas-wdt.txt | 19 ++++++-- arch/arm/boot/dts/r8a7743-iwg20m.dtsi | 5 ++ arch/arm/boot/dts/r8a7743.dtsi | 12 ++++- arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 ++ arch/arm/boot/dts/r8a7745.dtsi | 12 ++++- arch/arm/boot/dts/r8a7790.dtsi | 12 ++++- arch/arm/boot/dts/r8a7791.dtsi | 12 ++++- arch/arm/boot/dts/r8a7792.dtsi | 2 +- arch/arm/boot/dts/r8a7793.dtsi | 2 +- arch/arm/boot/dts/r8a7794.dtsi | 12 ++++- arch/arm/configs/shmobile_defconfig | 1 + arch/arm/mach-shmobile/common.h | 6 +++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++ arch/arm/mach-shmobile/platsmp-apmu.c | 1 + arch/arm/mach-shmobile/pm-rcar-gen2.c | 15 ++++-- drivers/clk/renesas/r8a7743-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7745-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7790-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7791-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7794-cpg-mssr.c | 2 + drivers/soc/renesas/rcar-rst.c | 35 +++++++++++--- drivers/watchdog/renesas_wdt.c | 39 +++++++++++++-- 22 files changed, 229 insertions(+), 26 deletions(-)
Signature · 1 line
2.7.4
PATCH v5 1/26 ARM: shmobile: Add watchdog support
On R-Car Gen2 and RZ/G1 platforms, we use the SBAR registers to make non boot CPUs run a routine designed to bring up SMP and deal with hot plug. The value contained in the SBAR registers is not initialized by a WDT triggered reset, which means that after a WDT triggered reset we jump to the SMP bring up routine, preventing the system from executing the bootrom code.
The purpose of this patch is to jump to the bootrom code in case of a WDT triggered reset, and keep the SMP functionality untouched. In order to tell if the code had been called due to the WDT overflowing we are testing WOVF from register RWTCSRA.
The new function shmobile_boot_vector_gen2 isn't replacing shmobile_boot_vector for backward compatibility reasons. The kernel will install the best option (either shmobile_boot_vector or shmobile_boot_vector_gen2) to ICRAM1 after parsing the device tree, according to the amount of memory available.
Since shmobile_boot_vector has become bigger, "reg" property of nodes compatible with "renesas,smp-sram" now need to be set to a value greater or equal to "<0 0x60>".
---v4->v5:
* no change
arch/arm/mach-shmobile/common.h | 6 +++++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+)
arch/arm/mach-shmobile/common.h +6 -0
@@ -7,6 +7,12 @@ extern void shmobile_init_delay(void);extern void shmobile_boot_vector (void );extern unsigned long shmobile_boot_fn;extern unsigned long shmobile_boot_size; +#ifdef CONFIG_ARCH_RCAR_GEN2 +extern void shmobile_boot_vector_gen2 (void ); +extern unsigned long shmobile_boot_fn_gen2; +extern unsigned long shmobile_boot_cpu_gen2; +extern unsigned long shmobile_boot_size_gen2; +#endif /* CONFIG_ARCH_RCAR_GEN2 */ extern void shmobile_smp_boot (void );extern void shmobile_smp_sleep (void ); extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
arch/arm/mach-shmobile/headsmp.S +55 -0
67 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v5 1/26 ARM: shmobile: Add watchdog support
Hi Fabrizio,
Quoted 28 lines · Fabrizio Castro
On R-Car Gen2 and RZ/G1 platforms, we use the SBAR registers to make non boot CPUs run a routine designed to bring up SMP and deal with hot plug. The value contained in the SBAR registers is not initialized by a WDT triggered reset, which means that after a WDT triggered reset we jump to the SMP bring up routine, preventing the system from executing the bootrom code.
The purpose of this patch is to jump to the bootrom code in case of a WDT triggered reset, and keep the SMP functionality untouched. In order to tell if the code had been called due to the WDT overflowing we are testing WOVF from register RWTCSRA.
The new function
shmobile_boot_vector_gen2isn't replacingshmobile_boot_vectorfor backward compatibility reasons. The kernel will install the best option (eithershmobile_boot_vectororshmobile_boot_vector_gen2) to ICRAM1 after parsing the device tree, according to the amount of memory available.Since
shmobile_boot_vectorhas become bigger, "reg" property of nodes compatible with "renesas,smp-sram" now need to be set to a value greater or equal to "<00x60>".Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>
arch/arm/mach-shmobile/common.h extern void shmobile_init_delay(void); · line 10
Quoted 4 lines
arch/arm/mach-shmobile/common.h +1
-0@@ -7,6 +7,12 @@ extern void shmobile_init_delay(void);extern void shmobile_boot_vector (void );extern unsigned long shmobile_boot_fn;extern unsigned long shmobile_boot_size; +#ifdef CONFIG_ARCH_RCAR_GEN2
I think this #ifdef can be removed.
arch/arm/mach-shmobile/common.h extern void shmobile_init_delay(void); · line 18
Quoted 8 lines
arch/arm/mach-shmobile/common.h +5
-0+extern void shmobile_boot_vector_gen2 (void ); +extern unsigned long shmobile_boot_fn_gen2; +extern unsigned long shmobile_boot_cpu_gen2; +extern unsigned long shmobile_boot_size_gen2; +#endif /* CONFIG_ARCH_RCAR_GEN2 */ extern void shmobile_smp_boot (void );extern void shmobile_smp_sleep (void ); extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
Apart from that:
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH v5 1/26 ARM: shmobile: Add watchdog support
Hi Geert,
thank you for your feedback!
Quoted 31 lines
Subject: Re: [PATCH v5 01/26] ARM: shmobile: Add watchdog support
Hi Fabrizio,
Quoted 24 lines · Fabrizio Castro
On R-Car Gen2 and RZ/G1 platforms, we use the SBAR registers to make non boot CPUs run a routine designed to bring up SMP and deal with hot plug. The value contained in the SBAR registers is not initialized by a WDT triggered reset, which means that after a WDT triggered reset we jump to the SMP bring up routine, preventing the system from executing the bootrom code.
The purpose of this patch is to jump to the bootrom code in case of a WDT triggered reset, and keep the SMP functionality untouched. In order to tell if the code had been called due to the WDT overflowing we are testing WOVF from register RWTCSRA.
The new function
shmobile_boot_vector_gen2isn't replacingshmobile_boot_vectorfor backward compatibility reasons. The kernel will install the best option (eithershmobile_boot_vectororshmobile_boot_vector_gen2) to ICRAM1 after parsing the device tree, according to the amount of memory available.Since
shmobile_boot_vectorhas become bigger, "reg" property of nodes compatible with "renesas,smp-sram" now need to be set to a value greater or equal to "<00x60>".Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>
Quoted 9 lines
arch/arm/mach-shmobile/common.h extern void shmobile_init_delay(void); · line 10
Quoted 7 lines
arch/arm/mach-shmobile/common.h +1
-0@@ -7,6 +7,12 @@ extern void shmobile_init_delay(void);extern void shmobile_boot_vector (void );extern unsigned long shmobile_boot_fn;extern unsigned long shmobile_boot_size; +#ifdef CONFIG_ARCH_RCAR_GEN2 I think this #ifdef can be removed.
I'll send a new version of this patch without ifdefs.
Thanks,
Fab
Quoted 15 lines
arch/arm/mach-shmobile/common.h extern void shmobile_init_delay(void); · line 18
Quoted 9 lines
arch/arm/mach-shmobile/common.h +5
-0+extern void shmobile_boot_vector_gen2 (void ); +extern unsigned long shmobile_boot_fn_gen2; +extern unsigned long shmobile_boot_cpu_gen2; +extern unsigned long shmobile_boot_size_gen2; +#endif /* CONFIG_ARCH_RCAR_GEN2 */ extern void shmobile_smp_boot (void );extern void shmobile_smp_sleep (void ); extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,Apart from that:
Reviewed-by Geert Uytterhoeven <[email protected]>Gr{oetje,eeting}s,
Quoted 8 lines
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.orgIn personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
PATCH v6 1/26 ARM: shmobile: Add watchdog support
In reply to Geert UytterhoevenOn R-Car Gen2 and RZ/G1 platforms, we use the SBAR registers to make non boot CPUs run a routine designed to bring up SMP and deal with hot plug. The value contained in the SBAR registers is not initialized by a WDT triggered reset, which means that after a WDT triggered reset we jump to the SMP bring up routine, preventing the system from executing the bootrom code.
The purpose of this patch is to jump to the bootrom code in case of a WDT triggered reset, and keep the SMP functionality untouched. In order to tell if the code had been called due to the WDT overflowing we are testing WOVF from register RWTCSRA.
The new function shmobile_boot_vector_gen2 isn't replacing shmobile_boot_vector for backward compatibility reasons. The kernel will install the best option (either shmobile_boot_vector or shmobile_boot_vector_gen2) to ICRAM1 after parsing the device tree, according to the amount of memory available.
Since shmobile_boot_vector has become bigger, "reg" property of nodes compatible with "renesas,smp-sram" now need to be set to a value greater or equal to "<0 0x60>".
---v5->v6:
* taken ifdefs out as per Geert's suggestion.
arch/arm/mach-shmobile/common.h | 4 +++ arch/arm/mach-shmobile/headsmp.S | 53 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+)
arch/arm/mach-shmobile/common.h +4 -0
@@ -7,6 +7,10 @@ extern void shmobile_init_delay(void);extern void shmobile_boot_vector (void );extern unsigned long shmobile_boot_fn;extern unsigned long shmobile_boot_size; +extern void shmobile_boot_vector_gen2 (void ); +extern unsigned long shmobile_boot_fn_gen2; +extern unsigned long shmobile_boot_cpu_gen2; +extern unsigned long shmobile_boot_size_gen2;extern void shmobile_smp_boot (void );extern void shmobile_smp_sleep (void ); extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
arch/arm/mach-shmobile/headsmp.S +53 -0
65 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v6 1/26 ARM: shmobile: Add watchdog support
Quoted 18 lines · Fabrizio Castro
On R-Car Gen2 and RZ/G1 platforms, we use the SBAR registers to make non boot CPUs run a routine designed to bring up SMP and deal with hot plug. The value contained in the SBAR registers is not initialized by a WDT triggered reset, which means that after a WDT triggered reset we jump to the SMP bring up routine, preventing the system from executing the bootrom code.
The purpose of this patch is to jump to the bootrom code in case of a WDT triggered reset, and keep the SMP functionality untouched. In order to tell if the code had been called due to the WDT overflowing we are testing WOVF from register RWTCSRA.
The new function
shmobile_boot_vector_gen2isn't replacingshmobile_boot_vectorfor backward compatibility reasons. The kernel will install the best option (eithershmobile_boot_vectororshmobile_boot_vector_gen2) to ICRAM1 after parsing the device tree, according to the amount of memory available.
Quoted 6 lines
Since
shmobile_boot_vectorhas become bigger, "reg" property of nodes compatible with "renesas,smp-sram" now need to be set to a value greater or equal to "<00x60>".Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>
Thanks, I have marked this as deferred as I would like dependencies to be merged first.
PATCH v6 1/26 ARM: shmobile: Add watchdog support
In reply to Fabrizio CastroHi Fabrizio,
Quoted 22 lines · Fabrizio Castro
On R-Car Gen2 and RZ/G1 platforms, we use the SBAR registers to make non boot CPUs run a routine designed to bring up SMP and deal with hot plug. The value contained in the SBAR registers is not initialized by a WDT triggered reset, which means that after a WDT triggered reset we jump to the SMP bring up routine, preventing the system from executing the bootrom code.
The purpose of this patch is to jump to the bootrom code in case of a WDT triggered reset, and keep the SMP functionality untouched. In order to tell if the code had been called due to the WDT overflowing we are testing WOVF from register RWTCSRA.
The new function
shmobile_boot_vector_gen2isn't replacingshmobile_boot_vectorfor backward compatibility reasons. The kernel will install the best option (eithershmobile_boot_vectororshmobile_boot_vector_gen2) to ICRAM1 after parsing the device tree, according to the amount of memory available.Since
shmobile_boot_vectorhas become bigger, "reg" property of nodes compatible with "renesas,smp-sram" now need to be set to a value greater or equal to "<00x60>".
Quoted 6 lines
Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>Reviewed-by Geert Uytterhoeven <[email protected]>---
v5->v6:
* taken ifdefs out as per Geert's suggestion.
My intention was to remove the #ifdefs from the header file only, not from arch/arm/mach-shmobile/headsmp.S, as the latter is used for other SoC families, too.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH v6 1/26 ARM: shmobile: Add watchdog support
Hi Geert,
Quoted 35 lines
Subject: Re: [PATCH v6 01/26] ARM: shmobile: Add watchdog support
Hi Fabrizio,
Quoted 22 lines · Fabrizio Castro
On R-Car Gen2 and RZ/G1 platforms, we use the SBAR registers to make non boot CPUs run a routine designed to bring up SMP and deal with hot plug. The value contained in the SBAR registers is not initialized by a WDT triggered reset, which means that after a WDT triggered reset we jump to the SMP bring up routine, preventing the system from executing the bootrom code.
The purpose of this patch is to jump to the bootrom code in case of a WDT triggered reset, and keep the SMP functionality untouched. In order to tell if the code had been called due to the WDT overflowing we are testing WOVF from register RWTCSRA.
The new function
shmobile_boot_vector_gen2isn't replacingshmobile_boot_vectorfor backward compatibility reasons. The kernel will install the best option (eithershmobile_boot_vectororshmobile_boot_vector_gen2) to ICRAM1 after parsing the device tree, according to the amount of memory available.Since
shmobile_boot_vectorhas become bigger, "reg" property of nodes compatible with "renesas,smp-sram" now need to be set to a value greater or equal to "<00x60>".Quoted 6 lines
Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>Reviewed-by Geert Uytterhoeven <[email protected]>---
v5->v6:
* taken ifdefs out as per Geert's suggestion.
Quoted 3 lines
My intention was to remove the #ifdefs from the header file only, not from
arch/arm/mach-shmobile/headsmp.S, as the latter is used for other SoC families, too.
Ah ok, I'll send another version to restore the ifdef within headsmp.S then.
Thanks,
Fab
Quoted 11 lines
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.orgIn personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
PATCH v7 1/1 ARM: shmobile: Add watchdog support
In reply to Geert UytterhoevenOn R-Car Gen2 and RZ/G1 platforms, we use the SBAR registers to make non boot CPUs run a routine designed to bring up SMP and deal with hot plug. The value contained in the SBAR registers is not initialized by a WDT triggered reset, which means that after a WDT triggered reset we jump to the SMP bring up routine, preventing the system from executing the bootrom code.
The purpose of this patch is to jump to the bootrom code in case of a WDT triggered reset, and keep the SMP functionality untouched. In order to tell if the code had been called due to the WDT overflowing we are testing WOVF from register RWTCSRA.
The new function shmobile_boot_vector_gen2 isn't replacing shmobile_boot_vector for backward compatibility reasons. The kernel will install the best option (either shmobile_boot_vector or shmobile_boot_vector_gen2) to ICRAM1 after parsing the device tree, according to the amount of memory available.
Since shmobile_boot_vector has become bigger, "reg" property of nodes compatible with "renesas,smp-sram" now need to be set to a value greater or equal to "<0 0x60>".
---v6->v7:
* restored ifdef within arch/arm/mach-shmobile/headsmp.S
arch/arm/mach-shmobile/common.h | 4 +++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+)
arch/arm/mach-shmobile/common.h +4 -0
@@ -7,6 +7,10 @@ extern void shmobile_init_delay(void);extern void shmobile_boot_vector (void );extern unsigned long shmobile_boot_fn;extern unsigned long shmobile_boot_size; +extern void shmobile_boot_vector_gen2 (void ); +extern unsigned long shmobile_boot_fn_gen2; +extern unsigned long shmobile_boot_cpu_gen2; +extern unsigned long shmobile_boot_size_gen2;extern void shmobile_smp_boot (void );extern void shmobile_smp_sleep (void ); extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn,
arch/arm/mach-shmobile/headsmp.S +55 -0
67 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v7 1/1 ARM: shmobile: Add watchdog support
Quoted 22 lines · Fabrizio Castro
On R-Car Gen2 and RZ/G1 platforms, we use the SBAR registers to make non boot CPUs run a routine designed to bring up SMP and deal with hot plug. The value contained in the SBAR registers is not initialized by a WDT triggered reset, which means that after a WDT triggered reset we jump to the SMP bring up routine, preventing the system from executing the bootrom code.
The purpose of this patch is to jump to the bootrom code in case of a WDT triggered reset, and keep the SMP functionality untouched. In order to tell if the code had been called due to the WDT overflowing we are testing WOVF from register RWTCSRA.
The new function
shmobile_boot_vector_gen2isn't replacingshmobile_boot_vectorfor backward compatibility reasons. The kernel will install the best option (eithershmobile_boot_vectororshmobile_boot_vector_gen2) to ICRAM1 after parsing the device tree, according to the amount of memory available.Since
shmobile_boot_vectorhas become bigger, "reg" property of nodes compatible with "renesas,smp-sram" now need to be set to a value greater or equal to "<00x60>".
Quoted 6 lines
Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>Reviewed-by Geert Uytterhoeven <[email protected]>---
v6->v7:
* restored ifdef withinarch/arm/mach-shmobile/headsmp.S
Thanks. I believe that this is the same as the hand modified version of v5 that I applied yesterday.
PATCH v7 1/1 ARM: shmobile: Add watchdog support
Hello Simon,
Quoted 32 lines
Subject: Re: [PATCH v7] ARM: shmobile: Add watchdog support
Quoted 22 lines · Fabrizio Castro
On R-Car Gen2 and RZ/G1 platforms, we use the SBAR registers to make non boot CPUs run a routine designed to bring up SMP and deal with hot plug. The value contained in the SBAR registers is not initialized by a WDT triggered reset, which means that after a WDT triggered reset we jump to the SMP bring up routine, preventing the system from executing the bootrom code.
The purpose of this patch is to jump to the bootrom code in case of a WDT triggered reset, and keep the SMP functionality untouched. In order to tell if the code had been called due to the WDT overflowing we are testing WOVF from register RWTCSRA.
The new function
shmobile_boot_vector_gen2isn't replacingshmobile_boot_vectorfor backward compatibility reasons. The kernel will install the best option (eithershmobile_boot_vectororshmobile_boot_vector_gen2) to ICRAM1 after parsing the device tree, according to the amount of memory available.Since
shmobile_boot_vectorhas become bigger, "reg" property of nodes compatible with "renesas,smp-sram" now need to be set to a value greater or equal to "<00x60>".Quoted 6 lines
Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>Reviewed-by Geert Uytterhoeven <[email protected]>---
v6->v7:
* restored ifdef withinarch/arm/mach-shmobile/headsmp.S
Quoted 2 lines
Thanks. I believe that this is the same as the hand modified version of v5 that I applied yesterday.
yes, I believe v5 modified and applied by you is the same as v7. Thank you for taking the patch.
Fab
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
PATCH v7 1/1 ARM: shmobile: Add watchdog support
Quoted 34 lines · Fabrizio Castro
Hello Simon,
Quoted 32 lines
Subject: Re: [PATCH v7] ARM: shmobile: Add watchdog support
Quoted 28 lines · Fabrizio Castro
On R-Car Gen2 and RZ/G1 platforms, we use the SBAR registers to make non boot CPUs run a routine designed to bring up SMP and deal with hot plug. The value contained in the SBAR registers is not initialized by a WDT triggered reset, which means that after a WDT triggered reset we jump to the SMP bring up routine, preventing the system from executing the bootrom code.
The purpose of this patch is to jump to the bootrom code in case of a WDT triggered reset, and keep the SMP functionality untouched. In order to tell if the code had been called due to the WDT overflowing we are testing WOVF from register RWTCSRA.
The new function
shmobile_boot_vector_gen2isn't replacingshmobile_boot_vectorfor backward compatibility reasons. The kernel will install the best option (eithershmobile_boot_vectororshmobile_boot_vector_gen2) to ICRAM1 after parsing the device tree, according to the amount of memory available.Since
shmobile_boot_vectorhas become bigger, "reg" property of nodes compatible with "renesas,smp-sram" now need to be set to a value greater or equal to "<00x60>".Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>Reviewed-by Geert Uytterhoeven <[email protected]>---
v6->v7:
* restored ifdef withinarch/arm/mach-shmobile/headsmp.S
Quoted 5 lines
Quoted 2 lines
Thanks. I believe that this is the same as the hand modified version of v5 that I applied yesterday.
yes, I believe v5 modified and applied by you is the same as v7. Thank you for taking the patch.
Likewise, thanks for the patches and for confirming this one is correct.
PATCH v5 2/26 ARM: dts: r8a7743: Adjust SMP routine size
In reply to Fabrizio CastroThis patch adjusts the definition of the SMP routine size according to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"
---v4->v5:
* no change
arch/arm/boot/dts/r8a7743.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7743.dtsi +1 -1
@@ -973,7 +973,7 @@ smp-sram at 0 { compatible = "renesas,smp-sram"; - reg = <0 0x10>; + reg = <0 0x100>; }; };
Signature · 1 line
2.7.4
PATCH v5 3/26 ARM: dts: r8a7745: Adjust SMP routine size
In reply to Fabrizio CastroThis patch adjusts the definition of the SMP routine size according to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"
---v4->v5:
* no change
arch/arm/boot/dts/r8a7745.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7745.dtsi +1 -1
@@ -755,7 +755,7 @@ smp-sram at 0 { compatible = "renesas,smp-sram"; - reg = <0 0x10>; + reg = <0 0x100>; }; };
Signature · 1 line
2.7.4
PATCH v5 4/26 ARM: dts: r8a7790: Adjust SMP routine size
In reply to Fabrizio CastroThis patch adjusts the definition of the SMP routine size according to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"
---v4->v5:
* no change
arch/arm/boot/dts/r8a7790.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7790.dtsi +1 -1
@@ -443,7 +443,7 @@ smp-sram at 0 { compatible = "renesas,smp-sram"; - reg = <0 0x10>; + reg = <0 0x100>; }; };
Signature · 1 line
2.7.4
PATCH v5 5/26 ARM: dts: r8a7791: Adjust SMP routine size
In reply to Fabrizio CastroThis patch adjusts the definition of the SMP routine size according to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"
---v4->v5:
* no change
arch/arm/boot/dts/r8a7791.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7791.dtsi +1 -1
@@ -407,7 +407,7 @@ smp-sram at 0 { compatible = "renesas,smp-sram"; - reg = <0 0x10>; + reg = <0 0x100>; }; };
Signature · 1 line
2.7.4
PATCH v5 6/26 ARM: dts: r8a7792: Adjust SMP routine size
In reply to Fabrizio CastroThis patch adjusts the definition of the SMP routine size according to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"
---v4->v5:
* no change
arch/arm/boot/dts/r8a7792.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7792.dtsi +1 -1
@@ -341,7 +341,7 @@ smp-sram at 0 { compatible = "renesas,smp-sram"; - reg = <0 0x10>; + reg = <0 0x100>; }; };
Signature · 1 line
2.7.4
PATCH v5 7/26 ARM: dts: r8a7793: Adjust SMP routine size
In reply to Fabrizio CastroThis patch adjusts the definition of the SMP routine size according to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"
---v4->v5:
* no change
arch/arm/boot/dts/r8a7793.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7793.dtsi +1 -1
@@ -392,7 +392,7 @@ smp-sram at 0 { compatible = "renesas,smp-sram"; - reg = <0 0x10>; + reg = <0 0x100>; }; };
Signature · 1 line
2.7.4
PATCH v5 8/26 ARM: dts: r8a7794: Adjust SMP routine size
In reply to Fabrizio CastroThis patch adjusts the definition of the SMP routine size according to the latest changes made by commit:
"ARM: shmobile: Add watchdog support"
---v4->v5:
* no change
arch/arm/boot/dts/r8a7794.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/r8a7794.dtsi +1 -1
@@ -348,7 +348,7 @@ smp-sram at 0 { compatible = "renesas,smp-sram"; - reg = <0 0x10>; + reg = <0 0x100>; }; };
Signature · 1 line
2.7.4
PATCH v5 9/26 soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
In reply to Fabrizio CastroThis 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.
---v4->v5:
* no change
drivers/soc/renesas/rcar-rst.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-)
drivers/soc/renesas/rcar-rst.c +29 -6
@@ -13,8 +13,18 @@#include <linux/of_address.h> #include <linux/soc/renesas/rcar-rst.h> +#define WDTRSTCR_RESET 0xA55A0002 +#define WDTRSTCR 0x0054 + +static int rcar_rst_enable_wdt_reset (void __iomem *base) +{ +iowrite32 (WDTRSTCR_RESET , base +WDTRSTCR ); +return 0 ; +} +struct rst_config { -unsigned int modemr;/* Mode Monitoring Register Offset */ +unsigned int modemr;/* Mode Monitoring Register Offset */ +int (*configure)(void *base);/* Platform specific configuration */ };static const struct rst_config rcar_rst_gen1__initconst = {
@@ -23,6 +33,11 @@ static const struct rst_config rcar_rst_gen1 __initconst = {static const struct rst_config rcar_rst_gen2__initconst = { .modemr =0x60 , + .configure = rcar_rst_enable_wdt_reset, +}; + +static const struct rst_config rcar_rst_gen3__initconst = { + .modemr =0x60 , };static const struct of_device_id rcar_rst_matches[]__initconst = {
@@ -38,11 +53,11 @@ static const struct of_device_id rcar_rst_matches[] __initconst = { { .compatible = "renesas,r8a7792-rst", .data = &rcar_rst_gen2 }, { .compatible = "renesas,r8a7793-rst", .data = &rcar_rst_gen2 }, { .compatible = "renesas,r8a7794-rst", .data = &rcar_rst_gen2 }, - /* R-Car Gen3 is handled like R-Car Gen2 */ - { .compatible = "renesas,r8a7795-rst", .data = &rcar_rst_gen2 }, - { .compatible = "renesas,r8a7796-rst", .data = &rcar_rst_gen2 }, - { .compatible = "renesas,r8a77970-rst", .data = &rcar_rst_gen2 }, - { .compatible = "renesas,r8a77995-rst", .data = &rcar_rst_gen2 }, + /* R-Car Gen3 */ + { .compatible = "renesas,r8a7795-rst", .data = &rcar_rst_gen3 }, + { .compatible = "renesas,r8a7796-rst", .data = &rcar_rst_gen3 }, + { .compatible = "renesas,r8a77970-rst", .data = &rcar_rst_gen3 }, + { .compatible = "renesas,r8a77995-rst", .data = &rcar_rst_gen3 }, {/* sentinel */ } };
@@ -71,6 +86,14 @@ static int __init rcar_rst_init(void) rcar_rst_base = base; cfg = match->data; saved_mode =ioread32 (base + cfg->modemr); +if (cfg->configure) { + error = cfg->configure (base); +if (error) { +pr_warn ("%pOF: Cannot run SoC specific configuration\n" , + np); + goto out_put; + } + }pr_debug ("%pOF: MODE = 0x%08x\n" , np, saved_mode);
Signature · 1 line
2.7.4
PATCH v5 9/26 soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
Quoted 6 lines · Fabrizio Castro
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 <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>
I am fine with this patch but please rebase it on top of renesas-devel-20180212-v4.16-rc1 (or later).
PATCH v5 9/26 soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
Hello Simon,
Quoted 7 lines
Subject: Re: [PATCH v5 09/26] soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
Quoted 4 lines · Fabrizio Castro
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.
Quoted 5 lines
Quoted 2 lines
Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>I am fine with this patch but please rebase it on top of renesas-devel-20180212-v4.16-rc1 (or later).
sure, I will.
Thanks,
Fab
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
PATCH v6 9/26 soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
In reply to Simon HormanThis 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.
---v5->v6:
* rebased on top of renesas-devel-20180213-v4.16-rc1
drivers/soc/renesas/rcar-rst.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-)
drivers/soc/renesas/rcar-rst.c +30 -7
@@ -13,8 +13,18 @@#include <linux/of_address.h> #include <linux/soc/renesas/rcar-rst.h> +#define WDTRSTCR_RESET 0xA55A0002 +#define WDTRSTCR 0x0054 + +static int rcar_rst_enable_wdt_reset (void __iomem *base) +{ +iowrite32 (WDTRSTCR_RESET , base +WDTRSTCR ); +return 0 ; +} +struct rst_config { -unsigned int modemr;/* Mode Monitoring Register Offset */ +unsigned int modemr;/* Mode Monitoring Register Offset */ +int (*configure)(void *base);/* Platform specific configuration */ };static const struct rst_config rcar_rst_gen1__initconst = {
@@ -23,6 +33,11 @@ static const struct rst_config rcar_rst_gen1 __initconst = {static const struct rst_config rcar_rst_gen2__initconst = { .modemr =0x60 , + .configure = rcar_rst_enable_wdt_reset, +}; + +static const struct rst_config rcar_rst_gen3__initconst = { + .modemr =0x60 , };static const struct of_device_id rcar_rst_matches[]__initconst = {
@@ -38,12 +53,12 @@ static const struct of_device_id rcar_rst_matches[] __initconst = { { .compatible = "renesas,r8a7792-rst", .data = &rcar_rst_gen2 }, { .compatible = "renesas,r8a7793-rst", .data = &rcar_rst_gen2 }, { .compatible = "renesas,r8a7794-rst", .data = &rcar_rst_gen2 }, - /* R-Car Gen3 is handled like R-Car Gen2 */ - { .compatible = "renesas,r8a7795-rst", .data = &rcar_rst_gen2 }, - { .compatible = "renesas,r8a7796-rst", .data = &rcar_rst_gen2 }, - { .compatible = "renesas,r8a77970-rst", .data = &rcar_rst_gen2 }, - { .compatible = "renesas,r8a77980-rst", .data = &rcar_rst_gen2 }, - { .compatible = "renesas,r8a77995-rst", .data = &rcar_rst_gen2 }, + /* R-Car Gen3 */ + { .compatible = "renesas,r8a7795-rst", .data = &rcar_rst_gen3 }, + { .compatible = "renesas,r8a7796-rst", .data = &rcar_rst_gen3 }, + { .compatible = "renesas,r8a77970-rst", .data = &rcar_rst_gen3 }, + { .compatible = "renesas,r8a77980-rst", .data = &rcar_rst_gen3 }, + { .compatible = "renesas,r8a77995-rst", .data = &rcar_rst_gen3 }, { /* sentinel */ } };
@@ -72,6 +87,14 @@ static int __init rcar_rst_init(void) rcar_rst_base = base; cfg = match->data; saved_mode =ioread32 (base + cfg->modemr); +if (cfg->configure) { + error = cfg->configure (base); +if (error) { +pr_warn ("%pOF: Cannot run SoC specific configuration\n" , + np); + goto out_put; + } + }pr_debug ("%pOF: MODE = 0x%08x\n" , np, saved_mode);
Signature · 1 line
2.7.4
Simon Horman
AppliedPATCH v6 9/26 soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
Quoted 9 lines · Fabrizio Castro
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 <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>---
v5->v6:
* rebased on top of renesas-devel-20180213-v4.16-rc1
Thanks, applied.
PATCH v5 10/26 ARM: shmobile: rcar-gen2: Add watchdog support
In reply to Fabrizio CastroThis patch adds watchdog support by installing shmobile_boot_vector_gen2 to ICRAM1 when enough memory is available, in which case we also keep a copy of MPIDR to complete the reset vector logic.
---v4->v5:
* reworked comment style
arch/arm/mach-shmobile/platsmp-apmu.c | 1 + arch/arm/mach-shmobile/pm-rcar-gen2.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-)
arch/arm/mach-shmobile/platsmp-apmu.c +1 -0
@@ -191,6 +191,7 @@ static void __init shmobile_smp_apmu_setup_boot(void) {/* install boot code shared by all CPUs */ shmobile_boot_fn =__pa_symbol (shmobile_smp_boot); + shmobile_boot_fn_gen2 = shmobile_boot_fn; } void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus,
arch/arm/mach-shmobile/pm-rcar-gen2.c +12 -3
@@ -17,6 +17,7 @@#include <linux/smp.h> #include <linux/soc/renesas/rcar-sysc.h> #include <asm/io.h> +#include <asm/cputype.h> #include "common.h" #include "rcar-gen2.h"
@@ -37,7 +38,6 @@#define CA7RESCNT_CODE 0x5a5a0000#define CA7RESCNT_CPUS 0xf/* CPU0-3 */ -/* On-chip RAM */ #define ICRAM1 0xe63c0000/* Inter Connect RAM1 (4 KiB) */
@@ -119,8 +119,17 @@ void __init rcar_gen2_pm_init(void) p =ioremap (res.start,resource_size (&res));if (!p)return ; - -memcpy_toio (p, shmobile_boot_vector, shmobile_boot_size); +/* +* install the reset vector, use the largest version if we have enough +* memory available +*/ +if (resource_size (&res) >= shmobile_boot_size_gen2) { + shmobile_boot_cpu_gen2 =read_cpuid_mpidr (); +memcpy_toio (p, shmobile_boot_vector_gen2, + shmobile_boot_size_gen2); + }else { +memcpy_toio (p, shmobile_boot_vector, shmobile_boot_size); + }iounmap (p);/* setup reset vectors */
Signature · 1 line
2.7.4
PATCH v5 10/26 ARM: shmobile: rcar-gen2: Add watchdog support
Quoted 6 lines · Fabrizio Castro
This patch adds watchdog support by installing
shmobile_boot_vector_gen2to ICRAM1 when enough memory is available, in which case we also keep a copy of MPIDR to complete the reset vector logic.Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>
I am marking this patch as deferred as it has dependencies on watchdog driver and in turn clock changes in this series.
PATCH v5 11/26 dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
In reply to Fabrizio CastroThis commit documents the compatibility with R-Car Gen2 and RZ/G devices by defining the generic compatible string "renesas,rcar-gen2-wdt". Also, this patch expands the list of SoC-specific compatible strings to include RZ/G and R-Car Gen2 devices.
---v4->v5:
* no change
.../devicetree/bindings/watchdog/renesas-wdt.txt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/watchdog/renesas-wdt.txt +14 -5
@@ -1,17 +1,26 @@ Renesas Watchdog Timer (WDT) Controller Required properties: -- compatible : Should be "renesas,<soctype>-wdt", and - "renesas,rcar-gen3-wdt" or "renesas,rza-wdt" as fallback. + - compatible : Must be "renesas,<soctype>-wdt", followed by a generic + fallback compatible string when compatible with the generic + version. Examples with soctypes are: + - "renesas,r8a7743-wdt" (RZ/G1M) + - "renesas,r8a7745-wdt" (RZ/G1E) + - "renesas,r8a7790-wdt" (R-Car H2) + - "renesas,r8a7791-wdt" (R-Car M2-W) + - "renesas,r8a7792-wdt" (R-Car V2H) + - "renesas,r8a7793-wdt" (R-Car M2-N) + - "renesas,r8a7794-wdt" (R-Car E2) - "renesas,r8a7795-wdt" (R-Car H3) - "renesas,r8a7796-wdt" (R-Car M3-W) - "renesas,r8a77995-wdt" (R-Car D3) - "renesas,r7s72100-wdt" (RZ/A1) + The generic compatible string must be: + - "renesas,rza-wdt" for RZ/A + - "renesas,rcar-gen2-wdt" for R-Car Gen2 and RZ/G + - "renesas,rcar-gen3-wdt" for R-Car Gen3 - When compatible with the generic version, nodes must list the SoC-specific - version corresponding to the platform first, followed by the generic - version. - reg : Should contain WDT registers location and length - clocks : the clock feeding the watchdog timer.
Signature · 1 line
2.7.4
PATCH v5 12/26 watchdog: renesas_wdt: Add R-Car Gen2 support
In reply to Fabrizio CastroDue to commits:
* "ARM: shmobile: Add watchdog support",
* "ARM: shmobile: rcar-gen2: Add watchdog support", and
* "soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2", we now have everything we needed for the watchdog to work on Gen2 and RZ/G1.
This commit adds "renesas,rcar-gen2-wdt" as compatible string for R-Car Gen2 and RZ/G1, and since on those platforms the rwdt clock needs to be always ON, when suspending to RAM we need to explicitly disable the counting by clearing TME from RWTCSRA.
---v4->v5:
* various improvements suggested by Wolfram
drivers/watchdog/renesas_wdt.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
drivers/watchdog/renesas_wdt.c +22 -5
@@ -203,13 +203,29 @@ static int rwdt_remove(struct platform_device *pdev)return 0 ; } -/* -* This driver does also fit for R-Car Gen2 (r8a779[0-4]) WDT. However, for SMP -* to work there, one also needs a RESET (RST) driver which does not exist yet -* due to HW issues. This needs to be solved before adding compatibles here. -*/ +static int __maybe_unused rwdt_suspend (struct device *dev) +{ +struct rwdt_priv *priv =dev_get_drvdata (dev); + +if (watchdog_active (&priv->wdev)) +rwdt_write (priv, priv->cks,RWTCSRA ); +return 0 ; +} + +static int __maybe_unused rwdt_resume (struct device *dev) +{ +struct rwdt_priv *priv =dev_get_drvdata (dev); + +if (watchdog_active (&priv->wdev)) +rwdt_write (priv, priv->cks |RWTCSRA_TME ,RWTCSRA ); +return 0 ; +} + +static SIMPLE_DEV_PM_OPS(rwdt_pm_ops, rwdt_suspend, rwdt_resume); +static const struct of_device_id rwdt_ids[] = { { .compatible ="renesas,rcar-gen3-wdt" , }, + { .compatible ="renesas,rcar-gen2-wdt" , }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, rwdt_ids);
@@ -218,6 +234,7 @@ static struct platform_driver rwdt_driver = { .driver = { .name = "renesas_wdt", .of_match_table = rwdt_ids, + .pm = &rwdt_pm_ops, }, .probe = rwdt_probe, .remove = rwdt_remove,
Signature · 1 line
2.7.4
Guenter Roeck
maintainerPATCH v5 12/26 watchdog: renesas_wdt: Add R-Car Gen2 support
Quoted 7 lines · Fabrizio Castro
Due to commits:
* "ARM: shmobile: Add watchdog support",
* "ARM: shmobile: rcar-gen2: Add watchdog support", and
* "soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2", we now have everything we needed for the watchdog to work on Gen2 and RZ/G1.
Quoted 7 lines
This commit adds "renesas,rcar-gen2-wdt" as compatible string for R-Car Gen2 and RZ/G1, and since on those platforms the rwdt clock needs to be always ON, when suspending to RAM we need to explicitly disable the counting by clearing TME from RWTCSRA.
Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>
Quoted 57 lines
---
v4->v5:
* various improvements suggested by Wolframdrivers/watchdog/renesas_wdt.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)drivers/watchdog/renesas_wdt.c +22
-5@@ -203,13 +203,29 @@ static int rwdt_remove(struct platform_device *pdev)return 0 ; } -/* -* This driver does also fit for R-Car Gen2 (r8a779[0-4]) WDT. However, for SMP -* to work there, one also needs a RESET (RST) driver which does not exist yet -* due to HW issues. This needs to be solved before adding compatibles here. -*/ +static int __maybe_unused rwdt_suspend (struct device *dev) +{ +struct rwdt_priv *priv =dev_get_drvdata (dev); + +if (watchdog_active (&priv->wdev)) +rwdt_write (priv, priv->cks,RWTCSRA ); +return 0 ; +} + +static int __maybe_unused rwdt_resume (struct device *dev) +{ +struct rwdt_priv *priv =dev_get_drvdata (dev); + +if (watchdog_active (&priv->wdev)) +rwdt_write (priv, priv->cks |RWTCSRA_TME ,RWTCSRA ); +return 0 ; +} + +static SIMPLE_DEV_PM_OPS(rwdt_pm_ops, rwdt_suspend, rwdt_resume); +static const struct of_device_id rwdt_ids[] = { { .compatible ="renesas,rcar-gen3-wdt" , }, + { .compatible ="renesas,rcar-gen2-wdt" , }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, rwdt_ids);@@ -218,6 +234,7 @@ static struct platform_driver rwdt_driver = { .driver = { .name = "renesas_wdt", .of_match_table = rwdt_ids, + .pm = &rwdt_pm_ops, }, .probe = rwdt_probe, .remove = rwdt_remove,Signature · 1 line
2.7.4
PATCH v5 12/26 watchdog: renesas_wdt: Add R-Car Gen2 support
In reply to Fabrizio CastroQuoted 12 lines · Fabrizio Castro
Due to commits:
* "ARM: shmobile: Add watchdog support",
* "ARM: shmobile: rcar-gen2: Add watchdog support", and
* "soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2", we now have everything we needed for the watchdog to work on Gen2 and RZ/G1.This commit adds "renesas,rcar-gen2-wdt" as compatible string for R-Car Gen2 and RZ/G1, and since on those platforms the rwdt clock needs to be always ON, when suspending to RAM we need to explicitly disable the counting by clearing TME from RWTCSRA.
Quoted 6 lines
Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>---
v4->v5:
* various improvements suggested by Wolfram
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180212/961780c2/attachment.sig>
Geert Uytterhoeven
maintainerPATCH 1/1 watchdog: renesas_wdt: Blacklist early R-Car Gen2 SoCs
In reply to Fabrizio CastroOn early revisions of some R-Car Gen2 SoCs, and depending on SMP configuration, the system may fail to restart on watchdog time-out, and lock up instead.
Specifically:
- On R-Car H2 ES1.0 and M2-W ES1.0, watchdog restart fails unless only the first CPU core is in use (using e.g. the "maxcpus=1" kernel commandline option).
- On R-Car V2H ES1.1, watchdog restart fails unless SMP is disabled completely (using CONFIG_SMP=n during build configuration, or using the "nosmp" or "maxcpus=0" kernel commandline options).
Prevent using the watchdog in impacted cases by blacklisting the affected SoCs, using the minimum known working revisions (ES2.0 on R-Car H2, and ES3.0 on M2-W), and taking the actual SMP software configuration into account.
---
To be folded into Fabrizio Castro's "watchdog: renesas_wdt: Add R-Car Gen2 support".
Note that I cannot use IS_ENABLED(CONFIG_SMP), as setup_max_cpus does not exist for CONFIG_SMP=n.
Any reports on R-Car M2-W ES2.0 and V2H ES2.0+ are welcomed!
As the failure is due to an integration issue, and the watchdog itself is working fine, an alternative solution would be to move the check to the code that installs the reset trigger ("soc: renesas: rcar-rst:
Enable watchdog as reset trigger for Gen2").
However, doing so would mean that:
1. The user could enable and seemingly use the watchdog, but watchdog timeout would not restart the system,
2. The same check should be done before installing the new reset vector ("ARM: shmobile: rcar-gen2: Add watchdog support"), too, else onlining CPU0 would fail once the watchdog has timed out.
--- drivers/watchdog/renesas_wdt.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/watchdog/renesas_wdt.c +43 -0
@@ -16,6 +16,8 @@#include <linux/of.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/smp.h> +#include <linux/sys_soc.h> #include <linux/watchdog.h> #define RWTCNT 0
@@ -131,6 +133,44 @@ static const struct watchdog_ops rwdt_ops = { .restart = rwdt_restart, }; +#if defined(CONFIG_ARCH_RCAR_GEN2 ) && defined(CONFIG_SMP ) +/* +* Watchdog-reset integration is broken on early revisions of R-Car Gen2 SoCs +*/ +static const struct soc_device_attribute rwdt_quirks_match[] = { + { + .soc_id ="r8a7790" , + .revision ="ES1.*" , + .data = (void *)1 ,/* needs single CPU */ + }, { + .soc_id ="r8a7791" , + .revision ="ES[12].*" , + .data = (void *)1 ,/* needs single CPU */ + }, { + .soc_id ="r8a7792" , + .revision ="*" , + .data = (void *)0 ,/* needs SMP disabled */ + }, + {/* sentinel */ } +}; + +static bool rwdt_blacklisted (struct device *dev) +{ +const struct soc_device_attribute *attr; + + attr =soc_device_match (rwdt_quirks_match); +if (attr && setup_max_cpus > (uintptr_t )attr->data) { +dev_info (dev,"Watchdog blacklisted on %s %s\n" , attr->soc_id, + attr->revision); +return true; + } + +return false; +} +#else /* !CONFIG_ARCH_RCAR_GEN2 || !CONFIG_SMP */ +static inline bool rwdt_blacklisted (struct device *dev) {return false; } +#endif /* !CONFIG_ARCH_RCAR_GEN2 || !CONFIG_SMP */ +static int rwdt_probe (struct platform_device *pdev) {struct rwdt_priv *priv;
@@ -139,6 +179,9 @@ static int rwdt_probe(struct platform_device *pdev)unsigned long clks_per_sec;int ret, i; +if (rwdt_blacklisted (&pdev->dev)) +return -ENODEV ; + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ;
Signature · 1 line
2.7.4
Re: [PATCH] watchdog: renesas_wdt: Blacklist early R-Car Gen2 SoCs
Quoted 17 lines · Geert Uytterhoeven
On early revisions of some R-Car Gen2 SoCs, and depending on SMP configuration, the system may fail to restart on watchdog time-out, and lock up instead.
Specifically:
- On R-Car H2 ES1.0 and M2-W ES1.0, watchdog restart fails unless only the first CPU core is in use (using e.g. the "maxcpus=1" kernel commandline option).
- On R-Car V2H ES1.1, watchdog restart fails unless SMP is disabled completely (usingCONFIG_SMP=nduring build configuration, or using the "nosmp" or "maxcpus=0" kernel commandline options).Prevent using the watchdog in impacted cases by blacklisting the affected SoCs, using the minimum known working revisions (ES2.0 on R-Car H2, and ES3.0 on M2-W), and taking the actual SMP software configuration into account.
Quoted 7 lines
Signed-off-by Geert Uytterhoeven <[email protected]>---
To be folded into Fabrizio Castro's "watchdog:renesas_wdt: Add R-Car Gen2 support".Note that I cannot use
IS_ENABLED(CONFIG_SMP), assetup_max_cpusdoes not exist forCONFIG_SMP=n.
Thanks, I was going to ask about that.
Quoted 87 lines
Any reports on R-Car M2-W ES2.0 and V2H ES2.0+ are welcomed!
As the failure is due to an integration issue, and the watchdog itself is working fine, an alternative solution would be to move the check to the code that installs the reset trigger ("soc: renesas: rcar-rst:
Enable watchdog as reset trigger for Gen2").
However, doing so would mean that:
1. The user could enable and seemingly use the watchdog, but watchdog timeout would not restart the system,
2. The same check should be done before installing the new reset vector ("ARM: shmobile: rcar-gen2: Add watchdog support"), too, else onlining CPU0 would fail once the watchdog has timed out.--- drivers/watchdog/renesas_wdt.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)drivers/watchdog/renesas_wdt.c +43
-0@@ -16,6 +16,8 @@#include <linux/of.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/smp.h> +#include <linux/sys_soc.h> #include <linux/watchdog.h> #define RWTCNT 0@@ -131,6 +133,44 @@ static const struct watchdog_ops rwdt_ops = { .restart = rwdt_restart, }; +#if defined(CONFIG_ARCH_RCAR_GEN2 ) && defined(CONFIG_SMP ) +/* +* Watchdog-reset integration is broken on early revisions of R-Car Gen2 SoCs +*/ +static const struct soc_device_attribute rwdt_quirks_match[] = { + { + .soc_id ="r8a7790" , + .revision ="ES1.*" , + .data = (void *)1 ,/* needs single CPU */ + }, { + .soc_id ="r8a7791" , + .revision ="ES[12].*" , + .data = (void *)1 ,/* needs single CPU */ + }, { + .soc_id ="r8a7792" , + .revision ="*" , + .data = (void *)0 ,/* needs SMP disabled */ + }, + {/* sentinel */ } +}; + +static bool rwdt_blacklisted (struct device *dev) +{ +const struct soc_device_attribute *attr; + + attr =soc_device_match (rwdt_quirks_match); +if (attr && setup_max_cpus > (uintptr_t )attr->data) { +dev_info (dev,"Watchdog blacklisted on %s %s\n" , attr->soc_id, + attr->revision); +return true; + } + +return false; +} +#else /* !CONFIG_ARCH_RCAR_GEN2 || !CONFIG_SMP */ +static inline bool rwdt_blacklisted (struct device *dev) {return false; } +#endif /* !CONFIG_ARCH_RCAR_GEN2 || !CONFIG_SMP */ +static int rwdt_probe (struct platform_device *pdev) {struct rwdt_priv *priv;@@ -139,6 +179,9 @@ static int rwdt_probe(struct platform_device *pdev)unsigned long clks_per_sec;int ret, i; +if (rwdt_blacklisted (&pdev->dev)) +return -ENODEV ; + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ;Signature · 1 line
2.7.4
RE: [PATCH] watchdog: renesas_wdt: Blacklist early R-Car Gen2 SoCs
In reply to Geert UytterhoevenQuoted 14 lines
Subject: [PATCH] watchdog:
renesas_wdt: Blacklist early R-Car Gen2 SoCsOn early revisions of some R-Car Gen2 SoCs, and depending on SMP configuration, the system may fail to restart on watchdog time-out, and lock up instead.
Specifically:
- On R-Car H2 ES1.0 and M2-W ES1.0, watchdog restart fails unless only the first CPU core is in use (using e.g. the "maxcpus=1" kernel commandline option).
- On R-Car V2H ES1.1, watchdog restart fails unless SMP is disabled completely (usingCONFIG_SMP=nduring build configuration, or using the "nosmp" or "maxcpus=0" kernel commandline options).
Quoted 6 lines
Prevent using the watchdog in impacted cases by blacklisting the affected SoCs, using the minimum known working revisions (ES2.0 on R-Car H2, and ES3.0 on M2-W), and taking the actual SMP software configuration into account.
Signed-off-by Geert Uytterhoeven <[email protected]>
Quoted 92 lines
---
To be folded into Fabrizio Castro's "watchdog:renesas_wdt: Add R-Car Gen2 support".Note that I cannot use
IS_ENABLED(CONFIG_SMP), assetup_max_cpusdoes not exist forCONFIG_SMP=n.Any reports on R-Car M2-W ES2.0 and V2H ES2.0+ are welcomed!
As the failure is due to an integration issue, and the watchdog itself is working fine, an alternative solution would be to move the check to the code that installs the reset trigger ("soc: renesas: rcar-rst:
Enable watchdog as reset trigger for Gen2").
However, doing so would mean that:
1. The user could enable and seemingly use the watchdog, but watchdog timeout would not restart the system,
2. The same check should be done before installing the new reset vector ("ARM: shmobile: rcar-gen2: Add watchdog support"), too, else onlining CPU0 would fail once the watchdog has timed out.--- drivers/watchdog/renesas_wdt.c | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)drivers/watchdog/renesas_wdt.c +43
-1@@ -16,6 +16,8 @@#include <linux/of.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> +#include <linux/smp.h> +#include <linux/sys_soc.h> #include <linux/watchdog.h> #define RWTCNT0 @@ -131,6 +133,44 @@ static const struct watchdog_ops rwdt_ops = { .restart = rwdt_restart, }; +#if defined(CONFIG_ARCH_RCAR_GEN2 ) && defined(CONFIG_SMP ) +/* +* Watchdog-reset integration is broken on early revisions of R-Car Gen2 SoCs +*/ +static const struct soc_device_attribute rwdt_quirks_match[] = { +{ +.soc_id ="r8a7790" , +.revision ="ES1.*" , +.data = (void *)1 ,/* needs single CPU */ +}, { +.soc_id ="r8a7791" , +.revision ="ES[12].*" , +.data = (void *)1 ,/* needs single CPU */ +}, { +.soc_id ="r8a7792" , +.revision ="*" , +.data = (void *)0 ,/* needs SMP disabled */ +}, +{/* sentinel */ } +}; + +static bool rwdt_blacklisted (struct device *dev) +{ +const struct soc_device_attribute *attr; + +attr =soc_device_match (rwdt_quirks_match); +if (attr && setup_max_cpus > (uintptr_t )attr->data) { +dev_info (dev,"Watchdog blacklisted on %s %s\n" , attr->soc_id, + attr->revision); +return true; +} + +return false; +} +#else /* !CONFIG_ARCH_RCAR_GEN2 || !CONFIG_SMP */ +static inline bool rwdt_blacklisted (struct device *dev) {return false; } +#endif /* !CONFIG_ARCH_RCAR_GEN2 || !CONFIG_SMP */ +static int rwdt_probe (struct platform_device *pdev) {struct rwdt_priv *priv;@@ -139,6 +179,9 @@ static int rwdt_probe(struct platform_device *pdev)unsigned long clks_per_sec;int ret, i; +if (rwdt_blacklisted (&pdev->dev)) +return -ENODEV ; + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ; --
Quoted 1 line
2.7.4
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
PATCH v5 12/26 watchdog: renesas_wdt: Add R-Car Gen2 support
In reply to Fabrizio CastroHi Fabrizio,
Quoted 7 lines · Fabrizio Castro
Due to commits:
* "ARM: shmobile: Add watchdog support",
* "ARM: shmobile: rcar-gen2: Add watchdog support", and
* "soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2", we now have everything we needed for the watchdog to work on Gen2 and RZ/G1.
Quoted 7 lines
This commit adds "renesas,rcar-gen2-wdt" as compatible string for R-Car Gen2 and RZ/G1, and since on those platforms the rwdt clock needs to be always ON, when suspending to RAM we need to explicitly disable the counting by clearing TME from RWTCSRA.
Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>
Thanks for your patch!
I verified this works on R-Car Gen2, so
Still, more comments below...
Quoted 16 lines
drivers/watchdog/renesas_wdt.c +5
-5@@ -203,13 +203,29 @@ static int rwdt_remove(struct platform_device *pdev)return 0 ; } -/* -* This driver does also fit for R-Car Gen2 (r8a779[0-4]) WDT. However, for SMP -* to work there, one also needs a RESET (RST) driver which does not exist yet -* due to HW issues. This needs to be solved before adding compatibles here. -*/ +static int __maybe_unused rwdt_suspend (struct device *dev) +{ +struct rwdt_priv *priv =dev_get_drvdata (dev); + +if (watchdog_active (&priv->wdev))
drivers/watchdog/renesas_wdt.c static int rwdt_remove(struct platform_device *pdev) · line 220
Quoted 10 lines
drivers/watchdog/renesas_wdt.c +10
-0+rwdt_write (priv, priv->cks,RWTCSRA ); +return 0 ; +} + +static int __maybe_unused rwdt_resume (struct device *dev) +{ +struct rwdt_priv *priv =dev_get_drvdata (dev); + +if (watchdog_active (&priv->wdev)) +rwdt_write (priv, priv->cks |RWTCSRA_TME ,RWTCSRA );
Writing to this register is not sufficient on R-Car Gen3, where PSCI suspend powers down the whole SoC. Hence all WDT register content is lost, causing the watchdog timeout never to trigger.
Note that this issue is pre-existing, and not caused by your patch.
This can be fixed by replacing the RWTCSRA register writes in the suspend/resume handlers by calls to rwdt_stop() resp. rwdt_start(), like is done in the BSP in commit e406980763f18f38 ("watchdog: renesas-wdt: Support the suspend/resume"). Note that this would cause a small change in behavior on R-Car Gen2, where the timeout would be reset on resume, instead of continuing where stopped before. I don't think that hurts, though.
Since I was always a bit uncomfortable with this patch doing two things at once (1. suspend/resume, 2. "renesas,rcar-gen2-wdt" matching), I think it would be better to take the patch from the BSP first, and add support for "renesas,rcar-gen2-wdt" in a subsequent patch.
Does the above make sense?
Do you agree?
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH v5 12/26 watchdog: renesas_wdt: Add R-Car Gen2 support
Hi Geert,
thank you for your feedback!
Quoted 60 lines
Subject: Re: [PATCH v5 12/26] watchdog:
renesas_wdt: Add R-Car Gen2 supportHi Fabrizio,
Quoted 7 lines · Fabrizio Castro
Due to commits:
* "ARM: shmobile: Add watchdog support",
* "ARM: shmobile: rcar-gen2: Add watchdog support", and
* "soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2", we now have everything we needed for the watchdog to work on Gen2 and RZ/G1.Quoted 7 lines
This commit adds "renesas,rcar-gen2-wdt" as compatible string for R-Car Gen2 and RZ/G1, and since on those platforms the rwdt clock needs to be always ON, when suspending to RAM we need to explicitly disable the counting by clearing TME from RWTCSRA.
Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>Thanks for your patch!
I verified this works on R-Car Gen2, so
Reviewed-and-Tested-by Geert Uytterhoeven <[email protected]>Still, more comments below...
Quoted 16 lines
drivers/watchdog/renesas_wdt.c +5
-5@@ -203,13 +203,29 @@ static int rwdt_remove(struct platform_device *pdev)return 0 ; } -/* -* This driver does also fit for R-Car Gen2 (r8a779[0-4]) WDT. However, for SMP -* to work there, one also needs a RESET (RST) driver which does not exist yet -* due to HW issues. This needs to be solved before adding compatibles here. -*/ +static int __maybe_unused rwdt_suspend (struct device *dev) +{ +struct rwdt_priv *priv =dev_get_drvdata (dev); + +if (watchdog_active (&priv->wdev))drivers/watchdog/renesas_wdt.c static int rwdt_remove(struct platform_device *pdev) · line 220
Quoted 10 lines
drivers/watchdog/renesas_wdt.c +10
-0+rwdt_write (priv, priv->cks,RWTCSRA ); +return 0 ; +} + +static int __maybe_unused rwdt_resume (struct device *dev) +{ +struct rwdt_priv *priv =dev_get_drvdata (dev); + +if (watchdog_active (&priv->wdev)) +rwdt_write (priv, priv->cks |RWTCSRA_TME ,RWTCSRA );Writing to this register is not sufficient on R-Car Gen3, where PSCI suspend powers down the whole SoC. Hence all WDT register content is lost, causing the watchdog timeout never to trigger.
Note that this issue is pre-existing, and not caused by your patch.
Quoted 6 lines
This can be fixed by replacing the RWTCSRA register writes in the suspend/resume handlers by calls to
rwdt_stop()resp.rwdt_start(), like is done in the BSP in commite406980763f18f38("watchdog: renesas-wdt: Support the suspend/resume"). Note that this would cause a small change in behavior on R-Car Gen2, where the timeout would be reset on resume, instead of continuing where stopped before. I don't think that hurts, though.
I see, well I believe we can make both of us happy by addressing Gen3 problems and preserving the original behaviour from Gen2.
I am going to send a new series to address this shortly.
Quoted 5 lines
Since I was always a bit uncomfortable with this patch doing two things at once (1. suspend/resume, 2. "renesas,rcar-gen2-wdt" matching), I think it would be better to take the patch from the BSP first, and add support for "renesas,rcar-gen2-wdt" in a subsequent patch.
I agree, I'll split the patch and submit suspend/resume first, Gen2 compatibility next.
Thanks,
Fab
Quoted 8 lines
Does the above make sense?
Do you agree?Thanks!
Gr{oetje,eeting}s,
Quoted 8 lines
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.orgIn personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
PATCH v5 13/26 watchdog: renesas_wdt: Add restart handler
In reply to Fabrizio CastroOn iWave's boards iwg20d and iwg22d the only way to reboot the system is by means of the watchdog.
This patch adds a restart handler to rwdt_ops, and also makes sure we keep its priority to a medium level, in order to not override other more effective handlers.
---v4->v5:
* changed rwdt_restart implementation as per Wolfram comments
drivers/watchdog/renesas_wdt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/watchdog/renesas_wdt.c +12 -0
@@ -107,6 +107,16 @@ static unsigned int rwdt_get_timeleft(struct watchdog_device *wdev)return DIV_BY_CLKS_PER_SEC (priv,65536 - val); } +static int rwdt_restart (struct watchdog_device *wdev,unsigned long action, +void *data) +{ +struct rwdt_priv *priv =watchdog_get_drvdata (wdev); + +rwdt_start (wdev); +rwdt_write (priv,0xffff ,RWTCNT ); +return 0 ; +} +static const struct watchdog_info rwdt_ident = { .options =WDIOF_MAGICCLOSE |WDIOF_KEEPALIVEPING |WDIOF_SETTIMEOUT , .identity ="Renesas WDT Watchdog" ,
@@ -118,6 +128,7 @@ static const struct watchdog_ops rwdt_ops = { .stop = rwdt_stop, .ping = rwdt_init_timeout, .get_timeleft = rwdt_get_timeleft, + .restart = rwdt_restart, };static int rwdt_probe (struct platform_device *pdev)
@@ -176,6 +187,7 @@ static int rwdt_probe(struct platform_device *pdev)platform_set_drvdata (pdev, priv);watchdog_set_drvdata (&priv->wdev, priv);watchdog_set_nowayout (&priv->wdev, nowayout); +watchdog_set_restart_priority (&priv->wdev,0 );/* This overrides the default timeout only if DT configuration was found */ ret =watchdog_init_timeout (&priv->wdev,0 , &pdev->dev);
Signature · 1 line
2.7.4
PATCH v5 13/26 watchdog: renesas_wdt: Add restart handler
Quoted 9 lines · Fabrizio Castro
On iWave's boards iwg20d and iwg22d the only way to reboot the system is by means of the watchdog.
This patch adds a restart handler torwdt_ops, and also makes sure we keep its priority to a medium level, in order to not override other more effective handlers.Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>Reviewed-by Guenter Roeck <[email protected]>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20180212/9ad7f346/attachment.sig>
PATCH v5 14/26 ARM: shmobile: defconfig: Enable RENESAS_WDT_GEN
In reply to Fabrizio CastroR-Car Gen2 and RZ/G1 platforms come with a watchdog IP, therefore enable its driver by default.
---v4->v5:
* no change
arch/arm/configs/shmobile_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/shmobile_defconfig +1 -0
@@ -132,6 +132,7 @@ CONFIG_CPU_THERMAL=y CONFIG_RCAR_THERMAL=y CONFIG_WATCHDOG=y CONFIG_DA9063_WATCHDOG=y +CONFIG_RENESAS_WDT=y CONFIG_MFD_AS3711=y CONFIG_MFD_DA9063=y CONFIG_REGULATOR_FIXED_VOLTAGE=y
Signature · 1 line
2.7.4
PATCH v5 14/26 ARM: shmobile: defconfig: Enable RENESAS_WDT_GEN
Hello Simon,
what do you think about enabling the watchdog in multi_v7_defconfig as a module?
Thanks,
Fab
Quoted 28 lines
Subject: [PATCH v5 14/26] ARM: shmobile: defconfig: Enable
RENESAS_WDT_GENR-Car Gen2 and RZ/G1 platforms come with a watchdog IP, therefore enable its driver by default.
Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>Reviewed-by Wolfram Sang <[email protected]>---
v4->v5:
* no changearch/arm/configs/shmobile_defconfig | 1 + 1 file changed, 1 insertion(+)arch/arm/configs/shmobile_defconfig +1
-1@@ -132,6 +132,7 @@ CONFIG_CPU_THERMAL=y CONFIG_RCAR_THERMAL=y CONFIG_WATCHDOG=y CONFIG_DA9063_WATCHDOG=y +CONFIG_RENESAS_WDT=y CONFIG_MFD_AS3711=y CONFIG_MFD_DA9063=y CONFIG_REGULATOR_FIXED_VOLTAGE=y --
Quoted 1 line
2.7.4
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
PATCH v5 14/26 ARM: shmobile: defconfig: Enable RENESAS_WDT_GEN
Quoted 3 lines · Fabrizio Castro
Hello Simon,
what do you think about enabling the watchdog in
multi_v7_defconfigas a module?
I think its a good idea.
Simon Horman
AppliedPATCH v5 14/26 ARM: shmobile: defconfig: Enable RENESAS_WDT_GEN
In reply to Fabrizio CastroQuoted 6 lines · Fabrizio Castro
R-Car Gen2 and RZ/G1 platforms come with a watchdog IP, therefore enable its driver by default.
Signed-off-by Fabrizio Castro <[email protected]>Signed-off-by Ramesh Shanmugasundaram <[email protected]>Reviewed-by Wolfram Sang <[email protected]>
Thanks, applied.
PATCH v5 15/26 clk: renesas: r8a7743: Add rwdt clock
In reply to Fabrizio CastroAdd "rwdt" clock to r8a7743_mod_clks. Also, since we may need to access the watchdog registers at any time, declare the clock as critical.
---v4->v5:
* no change
drivers/clk/renesas/r8a7743-cpg-mssr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/renesas/r8a7743-cpg-mssr.c +2 -0
@@ -117,6 +117,7 @@ static const struct mssr_mod_clk r8a7743_mod_clks[] __initconst = {DEF_MOD ("cmt1" ,329 ,R8A7743_CLK_R ),DEF_MOD ("usbhs-dmac0" ,330 ,R8A7743_CLK_HP ),DEF_MOD ("usbhs-dmac1" ,331 ,R8A7743_CLK_HP ), +DEF_MOD ("rwdt" ,402 ,R8A7743_CLK_R ),DEF_MOD ("irqc" ,407 ,R8A7743_CLK_CP ),DEF_MOD ("intc-sys" ,408 ,R8A7743_CLK_ZS ), DEF_MOD("audio-dmac1", 501, R8A7743_CLK_HP),
@@ -195,6 +196,7 @@ static const struct mssr_mod_clk r8a7743_mod_clks[] __initconst = { };static const unsigned int r8a7743_crit_mod_clks[]__initconst = { +MOD_CLK_ID (402 ),/* RWDT */ MOD_CLK_ID (408 ),/* INTC-SYS (GIC) */ };
Signature · 1 line
2.7.4
PATCH v5 16/26 clk: renesas: r8a7745: Add rwdt clock
In reply to Fabrizio CastroAdd "rwdt" clock to r8a7745_mod_clks. Also, since we may need to access the watchdog registers at any time, declare the clock as critical.
---v4->v5:
* no change
drivers/clk/renesas/r8a7745-cpg-mssr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/renesas/r8a7745-cpg-mssr.c +2 -0
@@ -114,6 +114,7 @@ static const struct mssr_mod_clk r8a7745_mod_clks[] __initconst = {DEF_MOD ("cmt1" ,329 ,R8A7745_CLK_R ),DEF_MOD ("usbhs-dmac0" ,330 ,R8A7745_CLK_HP ),DEF_MOD ("usbhs-dmac1" ,331 ,R8A7745_CLK_HP ), +DEF_MOD ("rwdt" ,402 ,R8A7745_CLK_R ),DEF_MOD ("irqc" ,407 ,R8A7745_CLK_CP ),DEF_MOD ("intc-sys" ,408 ,R8A7745_CLK_ZS ), DEF_MOD("audio-dmac0", 502, R8A7745_CLK_HP),
@@ -180,6 +181,7 @@ static const struct mssr_mod_clk r8a7745_mod_clks[] __initconst = { };static const unsigned int r8a7745_crit_mod_clks[]__initconst = { +MOD_CLK_ID (402 ),/* RWDT */ MOD_CLK_ID (408 ),/* INTC-SYS (GIC) */ };
Signature · 1 line
2.7.4
PATCH v5 17/26 clk: renesas: r8a7790: Add rwdt clock
In reply to Fabrizio CastroAdd "rwdt" clock to r8a7790_mod_clks. Also, since we may need to access the watchdog registers at any time, declare the clock as critical.
---v4->v5:
* no change
drivers/clk/renesas/r8a7790-cpg-mssr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/renesas/r8a7790-cpg-mssr.c +2 -0
@@ -140,6 +140,7 @@ static const struct mssr_mod_clk r8a7790_mod_clks[] __initconst = {DEF_MOD ("cmt1" ,329 ,R8A7790_CLK_R ),DEF_MOD ("usbhs-dmac0" ,330 ,R8A7790_CLK_HP ),DEF_MOD ("usbhs-dmac1" ,331 ,R8A7790_CLK_HP ), +DEF_MOD ("rwdt" ,402 ,R8A7790_CLK_R ),DEF_MOD ("irqc" ,407 ,R8A7790_CLK_CP ),DEF_MOD ("intc-sys" ,408 ,R8A7790_CLK_ZS ), DEF_MOD("audio-dmac1", 501, R8A7790_CLK_HP),
@@ -211,6 +212,7 @@ static const struct mssr_mod_clk r8a7790_mod_clks[] __initconst = { };static const unsigned int r8a7790_crit_mod_clks[]__initconst = { +MOD_CLK_ID (402 ),/* RWDT */ MOD_CLK_ID (408 ),/* INTC-SYS (GIC) */ };
Signature · 1 line
2.7.4
PATCH v5 18/26 clk: renesas: r8a7791/r8a7793: Add rwdt clock
In reply to Fabrizio CastroAdd "rwdt" clock to r8a7791_mod_clks. Also, since we may need to access the watchdog registers at any time, declare the clock as critical.
---v4->v5:
* no change
drivers/clk/renesas/r8a7791-cpg-mssr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/renesas/r8a7791-cpg-mssr.c +2 -0
@@ -128,6 +128,7 @@ static const struct mssr_mod_clk r8a7791_mod_clks[] __initconst = {DEF_MOD ("cmt1" ,329 ,R8A7791_CLK_R ),DEF_MOD ("usbhs-dmac0" ,330 ,R8A7791_CLK_HP ),DEF_MOD ("usbhs-dmac1" ,331 ,R8A7791_CLK_HP ), +DEF_MOD ("rwdt" ,402 ,R8A7791_CLK_R ),DEF_MOD ("irqc" ,407 ,R8A7791_CLK_CP ),DEF_MOD ("intc-sys" ,408 ,R8A7791_CLK_ZS ), DEF_MOD("audio-dmac1", 501, R8A7791_CLK_HP),
@@ -209,6 +210,7 @@ static const struct mssr_mod_clk r8a7791_mod_clks[] __initconst = { };static const unsigned int r8a7791_crit_mod_clks[]__initconst = { +MOD_CLK_ID (402 ),/* RWDT */ MOD_CLK_ID (408 ),/* INTC-SYS (GIC) */ };
Signature · 1 line
2.7.4
PATCH v5 19/26 clk: renesas: r8a7794: Add rwdt clock
In reply to Fabrizio CastroAdd "rwdt" clock to r8a7794_mod_clks. Also, since we may need to access the watchdog registers at any time, declare the clock as critical.
---v4->v5:
* no change
drivers/clk/renesas/r8a7794-cpg-mssr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/renesas/r8a7794-cpg-mssr.c +2 -0
@@ -121,6 +121,7 @@ static const struct mssr_mod_clk r8a7794_mod_clks[] __initconst = {DEF_MOD ("cmt1" ,329 ,R8A7794_CLK_R ),DEF_MOD ("usbhs-dmac0" ,330 ,R8A7794_CLK_HP ),DEF_MOD ("usbhs-dmac1" ,331 ,R8A7794_CLK_HP ), +DEF_MOD ("rwdt" ,402 ,R8A7794_CLK_R ),DEF_MOD ("irqc" ,407 ,R8A7794_CLK_CP ),DEF_MOD ("intc-sys" ,408 ,R8A7794_CLK_ZS ), DEF_MOD("audio-dmac0", 502, R8A7794_CLK_HP),
@@ -190,6 +191,7 @@ static const struct mssr_mod_clk r8a7794_mod_clks[] __initconst = { };static const unsigned int r8a7794_crit_mod_clks[]__initconst = { +MOD_CLK_ID (402 ),/* RWDT */ MOD_CLK_ID (408 ),/* INTC-SYS (GIC) */ };
Signature · 1 line
2.7.4
PATCH v5 20/26 ARM: dts: r8a7743: Add watchdog support to SoC dtsi
In reply to Fabrizio CastroThis patch adds watchdog support to the r8a7743 SoC dtsi.
---v4->v5:
* no change
arch/arm/boot/dts/r8a7743.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/r8a7743.dtsi +10 -0
@@ -368,6 +368,16 @@ reg = <0 0xe6160000 0 0x100>; }; + rwdt: watchdog at e6020000 { + compatible = "renesas,r8a7743-wdt", + "renesas,rcar-gen2-wdt"; + reg = <0 0xe6020000 0 0x0c>; + clocks = <&cpg CPG_MOD 402>; + power-domains = <&sysc R8A7743_PD_ALWAYS_ON>; + resets = <&cpg 402>; + status = "disabled"; + }; + sysc: system-controller at e6180000 { compatible = "renesas,r8a7743-sysc"; reg = <0 0xe6180000 0 0x200>;
Signature · 1 line
2.7.4
PATCH v5 21/26 ARM: dts: r8a7745: Add watchdog support to SoC dtsi
In reply to Fabrizio CastroThis patch adds watchdog support to the r8a7745 SoC dtsi.
---v4->v5:
* no change
arch/arm/boot/dts/r8a7745.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/r8a7745.dtsi +10 -0
@@ -321,6 +321,16 @@ reg = <0 0xe6160000 0 0x100>; }; + rwdt: watchdog at e6020000 { + compatible = "renesas,r8a7745-wdt", + "renesas,rcar-gen2-wdt"; + reg = <0 0xe6020000 0 0x0c>; + clocks = <&cpg CPG_MOD 402>; + power-domains = <&sysc R8A7745_PD_ALWAYS_ON>; + resets = <&cpg 402>; + status = "disabled"; + }; + sysc: system-controller at e6180000 { compatible = "renesas,r8a7745-sysc"; reg = <0 0xe6180000 0 0x200>;
Signature · 1 line
2.7.4
PATCH v5 22/26 ARM: dts: r8a7790: Add watchdog support to SoC dtsi
In reply to Fabrizio CastroThis commit adds watchdog support to the r8a7790 dtsi.
---v4->v5:
* no change
arch/arm/boot/dts/r8a7790.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/r8a7790.dtsi +10 -0
@@ -218,6 +218,16 @@ #size-cells = <2>; ranges; + rwdt: watchdog at e6020000 { + compatible = "renesas,r8a7790-wdt", + "renesas,rcar-gen2-wdt"; + reg = <0 0xe6020000 0 0x0c>; + clocks = <&cpg CPG_MOD 402>; + power-domains = <&sysc R8A7790_PD_ALWAYS_ON>; + resets = <&cpg 402>; + status = "disabled"; + }; + gpio0: gpio at e6050000 { compatible = "renesas,gpio-r8a7790", "renesas,rcar-gen2-gpio";
Signature · 1 line
2.7.4
PATCH v5 23/26 ARM: dts: r8a7791: Add watchdog support to SoC dtsi
In reply to Fabrizio CastroThis commit adds watchdog support to the r8a7791 dtsi.
---v4->v5:
* no change
arch/arm/boot/dts/r8a7791.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/r8a7791.dtsi +10 -0
@@ -142,6 +142,16 @@ #size-cells = <2>; ranges; + rwdt: watchdog at e6020000 { + compatible = "renesas,r8a7791-wdt", + "renesas,rcar-gen2-wdt"; + reg = <0 0xe6020000 0 0x0c>; + clocks = <&cpg CPG_MOD 402>; + power-domains = <&sysc R8A7791_PD_ALWAYS_ON>; + resets = <&cpg 402>; + status = "disabled"; + }; + gpio0: gpio at e6050000 { compatible = "renesas,gpio-r8a7791", "renesas,rcar-gen2-gpio";
Signature · 1 line
2.7.4
PATCH v5 24/26 ARM: dts: r8a7794: Add watchdog support to SoC dtsi
In reply to Fabrizio CastroThis commit adds watchdog support to the r8a7794 dtsi.
---v4->v5:
* no change
arch/arm/boot/dts/r8a7794.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/r8a7794.dtsi +10 -0
@@ -119,6 +119,16 @@ #size-cells = <2>; ranges; + rwdt: watchdog at e6020000 { + compatible = "renesas,r8a7794-wdt", + "renesas,rcar-gen2-wdt"; + reg = <0 0xe6020000 0 0x0c>; + clocks = <&cpg CPG_MOD 402>; + power-domains = <&sysc R8A7794_PD_ALWAYS_ON>; + resets = <&cpg 402>; + status = "disabled"; + }; + gpio0: gpio at e6050000 { compatible = "renesas,gpio-r8a7794", "renesas,rcar-gen2-gpio";
Signature · 1 line
2.7.4
PATCH v5 25/26 ARM: dts: iwg20m: Add watchdog support to SoM dtsi
In reply to Fabrizio CastroThis patch enables the watchdog from within the iwg20m SoM dtsi.
---v4->v5:
* no change
arch/arm/boot/dts/r8a7743-iwg20m.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/r8a7743-iwg20m.dtsi +5 -0
@@ -91,6 +91,11 @@ }; }; +&rwdt { + timeout-sec = <60>; + status = "okay"; +}; + &sdhi0 { pinctrl-0 = <&sdhi0_pins>; pinctrl-names = "default";
Signature · 1 line
2.7.4
PATCH v5 26/26 ARM: dts: iwg22m: Add watchdog support to SoM dtsi
In reply to Fabrizio CastroThis patch enables the watchdog from within the iwg20m SoM dtsi.
---v4->v5:
* no change
arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/r8a7745-iwg22m.dtsi +5 -0
@@ -91,6 +91,11 @@ }; }; +&rwdt { + timeout-sec = <60>; + status = "okay"; +}; + &sdhi1 { pinctrl-0 = <&sdhi1_pins>; pinctrl-names = "default";
Signature · 1 line
2.7.4
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
In reply to Fabrizio CastroQuoted 62 lines · Fabrizio Castro
Dear All,
this series has been around for some time as RFC, and it has collected useful comments from the community along the way.
The solution proposed by this patch set works for most R-Car Gen2 and RZ/G1 devices, but not all of them. We now know that for some R-Car Gen2 early revisions there is no proper software fix. Anyway, no product has been built around early revisions, but development boards mounting early revisions (basically prototypes) are still out there. As a result, this series isn't enabling the internal watchdog on R-Car Gen2 boards, developers may enable it in board specific device trees if needed.
This series has been tested by me on the iwg20d, iwg22d, Lager, Alt, and Koelsch boards.The problem
===========
To deal with SMP on R-Car Gen2 and RZ/G1, we install a reset vector to ICRAM1 and we program the [S]BAR registers so that when we turn ON the non-boot CPUs they are redirected to the reset vector installed by Linux in ICRAM1, and eventually they continue the execution to RAM, where the SMP bring-up code will take care of the rest.
The content of the [S]BAR registers survives a watchdog triggered reset, and as such after the watchdog fires the boot core will try and execute the SMP bring-up code instead of jumping to the bootrom code.The fix
=======
The main strategy for the solution is to let the reset vector decide if it needs to jump toshmobile_boot_fnor to the bootrom code. In a watchdog triggered reset scenario, since the [S]BAR registers keep their values, the boot CPU will jump into the newly designed reset vector, the assembly routine will eventually test WOVF (a bit in register RWTCSRA that indicates if the watchdog counter has overflown, the value of this bit gets retained in this scenario), and jump to the bootrom code which will in turn load up the bootloader, etc.
When bringing up SMP or using CPU hotplug, the reset vector will jump toshmobile_boot_fninstead.Thank you All for your help.
Best regards,
Fabrizio Castro (26):
ARM: shmobile: Add watchdog support
ARM: dts: r8a7743: Adjust SMP routine size
ARM: dts: r8a7745: Adjust SMP routine size
ARM: dts: r8a7790: Adjust SMP routine size
ARM: dts: r8a7791: Adjust SMP routine size
ARM: dts: r8a7792: Adjust SMP routine size
ARM: dts: r8a7793: Adjust SMP routine size
ARM: dts: r8a7794: Adjust SMP routine size
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
ARM: shmobile: rcar-gen2: Add watchdog support
dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add restart handler
ARM: shmobile: defconfig: EnableRENESAS_WDT_GEN
clk: renesas: r8a7743: Add rwdt clock
clk: renesas: r8a7745: Add rwdt clock
clk: renesas: r8a7790: Add rwdt clock
clk: renesas: r8a7791/r8a7793: Add rwdt clock
Quoted 8 lines
clk: renesas: r8a7794: Add rwdt clock
ARM: dts: r8a7743: Add watchdog support to SoC dtsi
ARM: dts: r8a7745: Add watchdog support to SoC dtsi
ARM: dts: r8a7790: Add watchdog support to SoC dtsi
ARM: dts: r8a7791: Add watchdog support to SoC dtsi
ARM: dts: r8a7794: Add watchdog support to SoC dtsi
ARM: dts: iwg20m: Add watchdog support to SoM dtsi
ARM: dts: iwg22m: Add watchdog support to SoM dtsi
Thanks, I have applied the above "dts" and "defconfig" patches for v4.17.
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
In reply to Fabrizio CastroQuoted 83 lines · Fabrizio Castro
this series has been around for some time as RFC, and it has collected useful comments from the community along the way.
The solution proposed by this patch set works for most R-Car Gen2 and RZ/G1 devices, but not all of them. We now know that for some R-Car Gen2 early revisions there is no proper software fix. Anyway, no product has been built around early revisions, but development boards mounting early revisions (basically prototypes) are still out there. As a result, this series isn't enabling the internal watchdog on R-Car Gen2 boards, developers may enable it in board specific device trees if needed.
This series has been tested by me on the iwg20d, iwg22d, Lager, Alt, and Koelsch boards.The problem
===========
To deal with SMP on R-Car Gen2 and RZ/G1, we install a reset vector to ICRAM1 and we program the [S]BAR registers so that when we turn ON the non-boot CPUs they are redirected to the reset vector installed by Linux in ICRAM1, and eventually they continue the execution to RAM, where the SMP bring-up code will take care of the rest.
The content of the [S]BAR registers survives a watchdog triggered reset, and as such after the watchdog fires the boot core will try and execute the SMP bring-up code instead of jumping to the bootrom code.The fix
=======
The main strategy for the solution is to let the reset vector decide if it needs to jump toshmobile_boot_fnor to the bootrom code. In a watchdog triggered reset scenario, since the [S]BAR registers keep their values, the boot CPU will jump into the newly designed reset vector, the assembly routine will eventually test WOVF (a bit in register RWTCSRA that indicates if the watchdog counter has overflown, the value of this bit gets retained in this scenario), and jump to the bootrom code which will in turn load up the bootloader, etc.
When bringing up SMP or using CPU hotplug, the reset vector will jump toshmobile_boot_fninstead.Thank you All for your help.
Best regards,
Fabrizio Castro (26):
ARM: shmobile: Add watchdog support
ARM: dts: r8a7743: Adjust SMP routine size
ARM: dts: r8a7745: Adjust SMP routine size
ARM: dts: r8a7790: Adjust SMP routine size
ARM: dts: r8a7791: Adjust SMP routine size
ARM: dts: r8a7792: Adjust SMP routine size
ARM: dts: r8a7793: Adjust SMP routine size
ARM: dts: r8a7794: Adjust SMP routine size
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
ARM: shmobile: rcar-gen2: Add watchdog support
dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add restart handler
ARM: shmobile: defconfig: EnableRENESAS_WDT_GEN
clk: renesas: r8a7743: Add rwdt clock
clk: renesas: r8a7745: Add rwdt clock
clk: renesas: r8a7790: Add rwdt clock
clk: renesas: r8a7791/r8a7793: Add rwdt clock
clk: renesas: r8a7794: Add rwdt clock
ARM: dts: r8a7743: Add watchdog support to SoC dtsi
ARM: dts: r8a7745: Add watchdog support to SoC dtsi
ARM: dts: r8a7790: Add watchdog support to SoC dtsi
ARM: dts: r8a7791: Add watchdog support to SoC dtsi
ARM: dts: r8a7794: Add watchdog support to SoC dtsi
ARM: dts: iwg20m: Add watchdog support to SoM dtsi
ARM: dts: iwg22m: Add watchdog support to SoM dtsi.../devicetree/bindings/watchdog/renesas-wdt.txt | 19 ++++++-- arch/arm/boot/dts/r8a7743-iwg20m.dtsi | 5 ++ arch/arm/boot/dts/r8a7743.dtsi | 12 ++++- arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 ++ arch/arm/boot/dts/r8a7745.dtsi | 12 ++++- arch/arm/boot/dts/r8a7790.dtsi | 12 ++++- arch/arm/boot/dts/r8a7791.dtsi | 12 ++++- arch/arm/boot/dts/r8a7792.dtsi | 2 +- arch/arm/boot/dts/r8a7793.dtsi | 2 +- arch/arm/boot/dts/r8a7794.dtsi | 12 ++++- arch/arm/configs/shmobile_defconfig | 1 + arch/arm/mach-shmobile/common.h | 6 +++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++ arch/arm/mach-shmobile/platsmp-apmu.c | 1 +
Quoted 8 lines
arch/arm/mach-shmobile/pm-rcar-gen2.c | 15 ++++-- drivers/clk/renesas/r8a7743-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7745-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7790-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7791-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7794-cpg-mssr.c | 2 + drivers/soc/renesas/rcar-rst.c | 35 +++++++++++--- drivers/watchdog/renesas_wdt.c | 39 +++++++++++++--
Thanks, I've queued the clock patches in clk-renesas-for-v4.17, as they are a hard dependency for:
(1) The new reset vector in arch/arm/mach-shmobile/
(2) The watchdog driver.
Note that the watchdog driver itself (2) has a hard dependency on the new reset vector (1).
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
Quoted 94 lines · Geert Uytterhoeven
Quoted 83 lines · Fabrizio Castro
this series has been around for some time as RFC, and it has collected useful comments from the community along the way.
The solution proposed by this patch set works for most R-Car Gen2 and RZ/G1 devices, but not all of them. We now know that for some R-Car Gen2 early revisions there is no proper software fix. Anyway, no product has been built around early revisions, but development boards mounting early revisions (basically prototypes) are still out there. As a result, this series isn't enabling the internal watchdog on R-Car Gen2 boards, developers may enable it in board specific device trees if needed.
This series has been tested by me on the iwg20d, iwg22d, Lager, Alt, and Koelsch boards.The problem
===========
To deal with SMP on R-Car Gen2 and RZ/G1, we install a reset vector to ICRAM1 and we program the [S]BAR registers so that when we turn ON the non-boot CPUs they are redirected to the reset vector installed by Linux in ICRAM1, and eventually they continue the execution to RAM, where the SMP bring-up code will take care of the rest.
The content of the [S]BAR registers survives a watchdog triggered reset, and as such after the watchdog fires the boot core will try and execute the SMP bring-up code instead of jumping to the bootrom code.The fix
=======
The main strategy for the solution is to let the reset vector decide if it needs to jump toshmobile_boot_fnor to the bootrom code. In a watchdog triggered reset scenario, since the [S]BAR registers keep their values, the boot CPU will jump into the newly designed reset vector, the assembly routine will eventually test WOVF (a bit in register RWTCSRA that indicates if the watchdog counter has overflown, the value of this bit gets retained in this scenario), and jump to the bootrom code which will in turn load up the bootloader, etc.
When bringing up SMP or using CPU hotplug, the reset vector will jump toshmobile_boot_fninstead.Thank you All for your help.
Best regards,
Fabrizio Castro (26):
ARM: shmobile: Add watchdog support
ARM: dts: r8a7743: Adjust SMP routine size
ARM: dts: r8a7745: Adjust SMP routine size
ARM: dts: r8a7790: Adjust SMP routine size
ARM: dts: r8a7791: Adjust SMP routine size
ARM: dts: r8a7792: Adjust SMP routine size
ARM: dts: r8a7793: Adjust SMP routine size
ARM: dts: r8a7794: Adjust SMP routine size
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
ARM: shmobile: rcar-gen2: Add watchdog support
dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add restart handler
ARM: shmobile: defconfig: EnableRENESAS_WDT_GEN
clk: renesas: r8a7743: Add rwdt clock
clk: renesas: r8a7745: Add rwdt clock
clk: renesas: r8a7790: Add rwdt clock
clk: renesas: r8a7791/r8a7793: Add rwdt clock
clk: renesas: r8a7794: Add rwdt clock
ARM: dts: r8a7743: Add watchdog support to SoC dtsi
ARM: dts: r8a7745: Add watchdog support to SoC dtsi
ARM: dts: r8a7790: Add watchdog support to SoC dtsi
ARM: dts: r8a7791: Add watchdog support to SoC dtsi
ARM: dts: r8a7794: Add watchdog support to SoC dtsi
ARM: dts: iwg20m: Add watchdog support to SoM dtsi
ARM: dts: iwg22m: Add watchdog support to SoM dtsi.../devicetree/bindings/watchdog/renesas-wdt.txt | 19 ++++++-- arch/arm/boot/dts/r8a7743-iwg20m.dtsi | 5 ++ arch/arm/boot/dts/r8a7743.dtsi | 12 ++++- arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 ++ arch/arm/boot/dts/r8a7745.dtsi | 12 ++++- arch/arm/boot/dts/r8a7790.dtsi | 12 ++++- arch/arm/boot/dts/r8a7791.dtsi | 12 ++++- arch/arm/boot/dts/r8a7792.dtsi | 2 +- arch/arm/boot/dts/r8a7793.dtsi | 2 +- arch/arm/boot/dts/r8a7794.dtsi | 12 ++++- arch/arm/configs/shmobile_defconfig | 1 + arch/arm/mach-shmobile/common.h | 6 +++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++ arch/arm/mach-shmobile/platsmp-apmu.c | 1 +Quoted 8 lines
arch/arm/mach-shmobile/pm-rcar-gen2.c | 15 ++++-- drivers/clk/renesas/r8a7743-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7745-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7790-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7791-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7794-cpg-mssr.c | 2 + drivers/soc/renesas/rcar-rst.c | 35 +++++++++++--- drivers/watchdog/renesas_wdt.c | 39 +++++++++++++--
Quoted 7 lines
Thanks, I've queued the clock patches in clk-renesas-for-v4.17, as they are a hard dependency for:
(1) The new reset vector inarch/arm/mach-shmobile/
(2) The watchdog driver.Note that the watchdog driver itself (2) has a hard dependency on the new reset vector (1).
Thanks, I have marked the watchdog driver patch as Deferred. Please resubmit or otherwise ping me once they dependencies are in an rc release.
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
Hi Simon,
Quoted 100 lines · Simon Horman
Quoted 99 lines · Geert Uytterhoeven
Quoted 83 lines · Fabrizio Castro
this series has been around for some time as RFC, and it has collected useful comments from the community along the way.
The solution proposed by this patch set works for most R-Car Gen2 and RZ/G1 devices, but not all of them. We now know that for some R-Car Gen2 early revisions there is no proper software fix. Anyway, no product has been built around early revisions, but development boards mounting early revisions (basically prototypes) are still out there. As a result, this series isn't enabling the internal watchdog on R-Car Gen2 boards, developers may enable it in board specific device trees if needed.
This series has been tested by me on the iwg20d, iwg22d, Lager, Alt, and Koelsch boards.The problem
===========
To deal with SMP on R-Car Gen2 and RZ/G1, we install a reset vector to ICRAM1 and we program the [S]BAR registers so that when we turn ON the non-boot CPUs they are redirected to the reset vector installed by Linux in ICRAM1, and eventually they continue the execution to RAM, where the SMP bring-up code will take care of the rest.
The content of the [S]BAR registers survives a watchdog triggered reset, and as such after the watchdog fires the boot core will try and execute the SMP bring-up code instead of jumping to the bootrom code.The fix
=======
The main strategy for the solution is to let the reset vector decide if it needs to jump toshmobile_boot_fnor to the bootrom code. In a watchdog triggered reset scenario, since the [S]BAR registers keep their values, the boot CPU will jump into the newly designed reset vector, the assembly routine will eventually test WOVF (a bit in register RWTCSRA that indicates if the watchdog counter has overflown, the value of this bit gets retained in this scenario), and jump to the bootrom code which will in turn load up the bootloader, etc.
When bringing up SMP or using CPU hotplug, the reset vector will jump toshmobile_boot_fninstead.Thank you All for your help.
Best regards,
Fabrizio Castro (26):
ARM: shmobile: Add watchdog support
ARM: dts: r8a7743: Adjust SMP routine size
ARM: dts: r8a7745: Adjust SMP routine size
ARM: dts: r8a7790: Adjust SMP routine size
ARM: dts: r8a7791: Adjust SMP routine size
ARM: dts: r8a7792: Adjust SMP routine size
ARM: dts: r8a7793: Adjust SMP routine size
ARM: dts: r8a7794: Adjust SMP routine size
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
ARM: shmobile: rcar-gen2: Add watchdog support
dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add restart handler
ARM: shmobile: defconfig: EnableRENESAS_WDT_GEN
clk: renesas: r8a7743: Add rwdt clock
clk: renesas: r8a7745: Add rwdt clock
clk: renesas: r8a7790: Add rwdt clock
clk: renesas: r8a7791/r8a7793: Add rwdt clock
clk: renesas: r8a7794: Add rwdt clock
ARM: dts: r8a7743: Add watchdog support to SoC dtsi
ARM: dts: r8a7745: Add watchdog support to SoC dtsi
ARM: dts: r8a7790: Add watchdog support to SoC dtsi
ARM: dts: r8a7791: Add watchdog support to SoC dtsi
ARM: dts: r8a7794: Add watchdog support to SoC dtsi
ARM: dts: iwg20m: Add watchdog support to SoM dtsi
ARM: dts: iwg22m: Add watchdog support to SoM dtsi.../devicetree/bindings/watchdog/renesas-wdt.txt | 19 ++++++-- arch/arm/boot/dts/r8a7743-iwg20m.dtsi | 5 ++ arch/arm/boot/dts/r8a7743.dtsi | 12 ++++- arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 ++ arch/arm/boot/dts/r8a7745.dtsi | 12 ++++- arch/arm/boot/dts/r8a7790.dtsi | 12 ++++- arch/arm/boot/dts/r8a7791.dtsi | 12 ++++- arch/arm/boot/dts/r8a7792.dtsi | 2 +- arch/arm/boot/dts/r8a7793.dtsi | 2 +- arch/arm/boot/dts/r8a7794.dtsi | 12 ++++- arch/arm/configs/shmobile_defconfig | 1 + arch/arm/mach-shmobile/common.h | 6 +++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++ arch/arm/mach-shmobile/platsmp-apmu.c | 1 +Quoted 8 lines
arch/arm/mach-shmobile/pm-rcar-gen2.c | 15 ++++-- drivers/clk/renesas/r8a7743-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7745-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7790-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7791-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7794-cpg-mssr.c | 2 + drivers/soc/renesas/rcar-rst.c | 35 +++++++++++--- drivers/watchdog/renesas_wdt.c | 39 +++++++++++++--Thanks, I've queued the clock patches in clk-renesas-for-v4.17, as they are a hard dependency for:
(1) The new reset vector inarch/arm/mach-shmobile/
(2) The watchdog driver.
Quoted 6 lines
Quoted 2 lines
Note that the watchdog driver itself (2) has a hard dependency on the new reset vector (1).
Thanks, I have marked the watchdog driver patch as Deferred. Please resubmit or otherwise ping me once they dependencies are in an rc release.
I gave the dependencies a bit more thought.
I think we can gain once release cycle if you would postpone the DTS patches (both SMP routine size adjustments and RWDT device node additions) to v4.18. Then all other parts can be upstreamed in parallel in v4.17, as nothing will be activated before the DTS parts are in.
Does this look sane?
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
Quoted 110 lines · Geert Uytterhoeven
Hi Simon,
Quoted 100 lines · Simon Horman
Quoted 99 lines · Geert Uytterhoeven
Quoted 83 lines · Fabrizio Castro
this series has been around for some time as RFC, and it has collected useful comments from the community along the way.
The solution proposed by this patch set works for most R-Car Gen2 and RZ/G1 devices, but not all of them. We now know that for some R-Car Gen2 early revisions there is no proper software fix. Anyway, no product has been built around early revisions, but development boards mounting early revisions (basically prototypes) are still out there. As a result, this series isn't enabling the internal watchdog on R-Car Gen2 boards, developers may enable it in board specific device trees if needed.
This series has been tested by me on the iwg20d, iwg22d, Lager, Alt, and Koelsch boards.The problem
===========
To deal with SMP on R-Car Gen2 and RZ/G1, we install a reset vector to ICRAM1 and we program the [S]BAR registers so that when we turn ON the non-boot CPUs they are redirected to the reset vector installed by Linux in ICRAM1, and eventually they continue the execution to RAM, where the SMP bring-up code will take care of the rest.
The content of the [S]BAR registers survives a watchdog triggered reset, and as such after the watchdog fires the boot core will try and execute the SMP bring-up code instead of jumping to the bootrom code.The fix
=======
The main strategy for the solution is to let the reset vector decide if it needs to jump toshmobile_boot_fnor to the bootrom code. In a watchdog triggered reset scenario, since the [S]BAR registers keep their values, the boot CPU will jump into the newly designed reset vector, the assembly routine will eventually test WOVF (a bit in register RWTCSRA that indicates if the watchdog counter has overflown, the value of this bit gets retained in this scenario), and jump to the bootrom code which will in turn load up the bootloader, etc.
When bringing up SMP or using CPU hotplug, the reset vector will jump toshmobile_boot_fninstead.Thank you All for your help.
Best regards,
Fabrizio Castro (26):
ARM: shmobile: Add watchdog support
ARM: dts: r8a7743: Adjust SMP routine size
ARM: dts: r8a7745: Adjust SMP routine size
ARM: dts: r8a7790: Adjust SMP routine size
ARM: dts: r8a7791: Adjust SMP routine size
ARM: dts: r8a7792: Adjust SMP routine size
ARM: dts: r8a7793: Adjust SMP routine size
ARM: dts: r8a7794: Adjust SMP routine size
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
ARM: shmobile: rcar-gen2: Add watchdog support
dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add restart handler
ARM: shmobile: defconfig: EnableRENESAS_WDT_GEN
clk: renesas: r8a7743: Add rwdt clock
clk: renesas: r8a7745: Add rwdt clock
clk: renesas: r8a7790: Add rwdt clock
clk: renesas: r8a7791/r8a7793: Add rwdt clock
clk: renesas: r8a7794: Add rwdt clock
ARM: dts: r8a7743: Add watchdog support to SoC dtsi
ARM: dts: r8a7745: Add watchdog support to SoC dtsi
ARM: dts: r8a7790: Add watchdog support to SoC dtsi
ARM: dts: r8a7791: Add watchdog support to SoC dtsi
ARM: dts: r8a7794: Add watchdog support to SoC dtsi
ARM: dts: iwg20m: Add watchdog support to SoM dtsi
ARM: dts: iwg22m: Add watchdog support to SoM dtsi.../devicetree/bindings/watchdog/renesas-wdt.txt | 19 ++++++-- arch/arm/boot/dts/r8a7743-iwg20m.dtsi | 5 ++ arch/arm/boot/dts/r8a7743.dtsi | 12 ++++- arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 ++ arch/arm/boot/dts/r8a7745.dtsi | 12 ++++- arch/arm/boot/dts/r8a7790.dtsi | 12 ++++- arch/arm/boot/dts/r8a7791.dtsi | 12 ++++- arch/arm/boot/dts/r8a7792.dtsi | 2 +- arch/arm/boot/dts/r8a7793.dtsi | 2 +- arch/arm/boot/dts/r8a7794.dtsi | 12 ++++- arch/arm/configs/shmobile_defconfig | 1 + arch/arm/mach-shmobile/common.h | 6 +++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++ arch/arm/mach-shmobile/platsmp-apmu.c | 1 +Quoted 8 lines
arch/arm/mach-shmobile/pm-rcar-gen2.c | 15 ++++-- drivers/clk/renesas/r8a7743-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7745-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7790-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7791-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7794-cpg-mssr.c | 2 + drivers/soc/renesas/rcar-rst.c | 35 +++++++++++--- drivers/watchdog/renesas_wdt.c | 39 +++++++++++++--Thanks, I've queued the clock patches in clk-renesas-for-v4.17, as they are a hard dependency for:
(1) The new reset vector inarch/arm/mach-shmobile/
(2) The watchdog driver.Quoted 6 lines
Quoted 2 lines
Note that the watchdog driver itself (2) has a hard dependency on the new reset vector (1).
Thanks, I have marked the watchdog driver patch as Deferred. Please resubmit or otherwise ping me once they dependencies are in an rc release.
Quoted 8 lines
I gave the dependencies a bit more thought.
I think we can gain once release cycle if you would postpone the DTS patches (both SMP routine size adjustments and RWDT device node additions) to v4.18. Then all other parts can be upstreamed in parallel in v4.17, as nothing will be activated before the DTS parts are in.
Does this look sane?
What about new DTS on old kernels of a specific vintage?
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
Hi Simon,
Quoted 111 lines · Simon Horman
Quoted 110 lines · Geert Uytterhoeven
Quoted 100 lines · Simon Horman
Quoted 99 lines · Geert Uytterhoeven
Quoted 83 lines · Fabrizio Castro
this series has been around for some time as RFC, and it has collected useful comments from the community along the way.
The solution proposed by this patch set works for most R-Car Gen2 and RZ/G1 devices, but not all of them. We now know that for some R-Car Gen2 early revisions there is no proper software fix. Anyway, no product has been built around early revisions, but development boards mounting early revisions (basically prototypes) are still out there. As a result, this series isn't enabling the internal watchdog on R-Car Gen2 boards, developers may enable it in board specific device trees if needed.
This series has been tested by me on the iwg20d, iwg22d, Lager, Alt, and Koelsch boards.The problem
===========
To deal with SMP on R-Car Gen2 and RZ/G1, we install a reset vector to ICRAM1 and we program the [S]BAR registers so that when we turn ON the non-boot CPUs they are redirected to the reset vector installed by Linux in ICRAM1, and eventually they continue the execution to RAM, where the SMP bring-up code will take care of the rest.
The content of the [S]BAR registers survives a watchdog triggered reset, and as such after the watchdog fires the boot core will try and execute the SMP bring-up code instead of jumping to the bootrom code.The fix
=======
The main strategy for the solution is to let the reset vector decide if it needs to jump toshmobile_boot_fnor to the bootrom code. In a watchdog triggered reset scenario, since the [S]BAR registers keep their values, the boot CPU will jump into the newly designed reset vector, the assembly routine will eventually test WOVF (a bit in register RWTCSRA that indicates if the watchdog counter has overflown, the value of this bit gets retained in this scenario), and jump to the bootrom code which will in turn load up the bootloader, etc.
When bringing up SMP or using CPU hotplug, the reset vector will jump toshmobile_boot_fninstead.Thank you All for your help.
Best regards,
Fabrizio Castro (26):
ARM: shmobile: Add watchdog support
ARM: dts: r8a7743: Adjust SMP routine size
ARM: dts: r8a7745: Adjust SMP routine size
ARM: dts: r8a7790: Adjust SMP routine size
ARM: dts: r8a7791: Adjust SMP routine size
ARM: dts: r8a7792: Adjust SMP routine size
ARM: dts: r8a7793: Adjust SMP routine size
ARM: dts: r8a7794: Adjust SMP routine size
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
ARM: shmobile: rcar-gen2: Add watchdog support
dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add restart handler
ARM: shmobile: defconfig: EnableRENESAS_WDT_GEN
clk: renesas: r8a7743: Add rwdt clock
clk: renesas: r8a7745: Add rwdt clock
clk: renesas: r8a7790: Add rwdt clock
clk: renesas: r8a7791/r8a7793: Add rwdt clock
clk: renesas: r8a7794: Add rwdt clock
ARM: dts: r8a7743: Add watchdog support to SoC dtsi
ARM: dts: r8a7745: Add watchdog support to SoC dtsi
ARM: dts: r8a7790: Add watchdog support to SoC dtsi
ARM: dts: r8a7791: Add watchdog support to SoC dtsi
ARM: dts: r8a7794: Add watchdog support to SoC dtsi
ARM: dts: iwg20m: Add watchdog support to SoM dtsi
ARM: dts: iwg22m: Add watchdog support to SoM dtsi.../devicetree/bindings/watchdog/renesas-wdt.txt | 19 ++++++-- arch/arm/boot/dts/r8a7743-iwg20m.dtsi | 5 ++ arch/arm/boot/dts/r8a7743.dtsi | 12 ++++- arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 ++ arch/arm/boot/dts/r8a7745.dtsi | 12 ++++- arch/arm/boot/dts/r8a7790.dtsi | 12 ++++- arch/arm/boot/dts/r8a7791.dtsi | 12 ++++- arch/arm/boot/dts/r8a7792.dtsi | 2 +- arch/arm/boot/dts/r8a7793.dtsi | 2 +- arch/arm/boot/dts/r8a7794.dtsi | 12 ++++- arch/arm/configs/shmobile_defconfig | 1 + arch/arm/mach-shmobile/common.h | 6 +++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++ arch/arm/mach-shmobile/platsmp-apmu.c | 1 +Quoted 8 lines
arch/arm/mach-shmobile/pm-rcar-gen2.c | 15 ++++-- drivers/clk/renesas/r8a7743-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7745-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7790-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7791-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7794-cpg-mssr.c | 2 + drivers/soc/renesas/rcar-rst.c | 35 +++++++++++--- drivers/watchdog/renesas_wdt.c | 39 +++++++++++++--Thanks, I've queued the clock patches in clk-renesas-for-v4.17, as they are a hard dependency for:
(1) The new reset vector inarch/arm/mach-shmobile/
(2) The watchdog driver.Quoted 6 lines
Quoted 2 lines
Note that the watchdog driver itself (2) has a hard dependency on the new reset vector (1).
Thanks, I have marked the watchdog driver patch as Deferred. Please resubmit or otherwise ping me once they dependencies are in an rc release.
I gave the dependencies a bit more thought.
Quoted 8 lines
Quoted 6 lines
I think we can gain once release cycle if you would postpone the DTS patches (both SMP routine size adjustments and RWDT device node additions) to v4.18. Then all other parts can be upstreamed in parallel in v4.17, as nothing will be activated before the DTS parts are in.
Does this look sane?
What about new DTS on old kernels of a specific vintage?
New DTS would work fine on v4.16 and older, which don't have any of the other patches from this series.
New DTS would work fine on v4.17, assumed all other patches from this series get into v4.17.
The only issue would be a new DTS on a kernel that has some but not all other patches from this series.
If we want to fast-track everything into v4.17, we need a stable branch, to be pulled by all 5 actors (clk-renesas, mach-shmobile, soc-renesas, watchdog, renesas-dts).
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
Quoted 123 lines · Geert Uytterhoeven
Hi Simon,
Quoted 111 lines · Simon Horman
Quoted 110 lines · Geert Uytterhoeven
Quoted 100 lines · Simon Horman
Quoted 99 lines · Geert Uytterhoeven
Quoted 83 lines · Fabrizio Castro
this series has been around for some time as RFC, and it has collected useful comments from the community along the way.
The solution proposed by this patch set works for most R-Car Gen2 and RZ/G1 devices, but not all of them. We now know that for some R-Car Gen2 early revisions there is no proper software fix. Anyway, no product has been built around early revisions, but development boards mounting early revisions (basically prototypes) are still out there. As a result, this series isn't enabling the internal watchdog on R-Car Gen2 boards, developers may enable it in board specific device trees if needed.
This series has been tested by me on the iwg20d, iwg22d, Lager, Alt, and Koelsch boards.The problem
===========
To deal with SMP on R-Car Gen2 and RZ/G1, we install a reset vector to ICRAM1 and we program the [S]BAR registers so that when we turn ON the non-boot CPUs they are redirected to the reset vector installed by Linux in ICRAM1, and eventually they continue the execution to RAM, where the SMP bring-up code will take care of the rest.
The content of the [S]BAR registers survives a watchdog triggered reset, and as such after the watchdog fires the boot core will try and execute the SMP bring-up code instead of jumping to the bootrom code.The fix
=======
The main strategy for the solution is to let the reset vector decide if it needs to jump toshmobile_boot_fnor to the bootrom code. In a watchdog triggered reset scenario, since the [S]BAR registers keep their values, the boot CPU will jump into the newly designed reset vector, the assembly routine will eventually test WOVF (a bit in register RWTCSRA that indicates if the watchdog counter has overflown, the value of this bit gets retained in this scenario), and jump to the bootrom code which will in turn load up the bootloader, etc.
When bringing up SMP or using CPU hotplug, the reset vector will jump toshmobile_boot_fninstead.Thank you All for your help.
Best regards,
Fabrizio Castro (26):
ARM: shmobile: Add watchdog support
ARM: dts: r8a7743: Adjust SMP routine size
ARM: dts: r8a7745: Adjust SMP routine size
ARM: dts: r8a7790: Adjust SMP routine size
ARM: dts: r8a7791: Adjust SMP routine size
ARM: dts: r8a7792: Adjust SMP routine size
ARM: dts: r8a7793: Adjust SMP routine size
ARM: dts: r8a7794: Adjust SMP routine size
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
ARM: shmobile: rcar-gen2: Add watchdog support
dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add restart handler
ARM: shmobile: defconfig: EnableRENESAS_WDT_GEN
clk: renesas: r8a7743: Add rwdt clock
clk: renesas: r8a7745: Add rwdt clock
clk: renesas: r8a7790: Add rwdt clock
clk: renesas: r8a7791/r8a7793: Add rwdt clock
clk: renesas: r8a7794: Add rwdt clock
ARM: dts: r8a7743: Add watchdog support to SoC dtsi
ARM: dts: r8a7745: Add watchdog support to SoC dtsi
ARM: dts: r8a7790: Add watchdog support to SoC dtsi
ARM: dts: r8a7791: Add watchdog support to SoC dtsi
ARM: dts: r8a7794: Add watchdog support to SoC dtsi
ARM: dts: iwg20m: Add watchdog support to SoM dtsi
ARM: dts: iwg22m: Add watchdog support to SoM dtsi.../devicetree/bindings/watchdog/renesas-wdt.txt | 19 ++++++-- arch/arm/boot/dts/r8a7743-iwg20m.dtsi | 5 ++ arch/arm/boot/dts/r8a7743.dtsi | 12 ++++- arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 ++ arch/arm/boot/dts/r8a7745.dtsi | 12 ++++- arch/arm/boot/dts/r8a7790.dtsi | 12 ++++- arch/arm/boot/dts/r8a7791.dtsi | 12 ++++- arch/arm/boot/dts/r8a7792.dtsi | 2 +- arch/arm/boot/dts/r8a7793.dtsi | 2 +- arch/arm/boot/dts/r8a7794.dtsi | 12 ++++- arch/arm/configs/shmobile_defconfig | 1 + arch/arm/mach-shmobile/common.h | 6 +++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++ arch/arm/mach-shmobile/platsmp-apmu.c | 1 +Quoted 8 lines
arch/arm/mach-shmobile/pm-rcar-gen2.c | 15 ++++-- drivers/clk/renesas/r8a7743-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7745-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7790-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7791-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7794-cpg-mssr.c | 2 + drivers/soc/renesas/rcar-rst.c | 35 +++++++++++--- drivers/watchdog/renesas_wdt.c | 39 +++++++++++++--Thanks, I've queued the clock patches in clk-renesas-for-v4.17, as they are a hard dependency for:
(1) The new reset vector inarch/arm/mach-shmobile/
(2) The watchdog driver.Quoted 6 lines
Quoted 2 lines
Note that the watchdog driver itself (2) has a hard dependency on the new reset vector (1).
Thanks, I have marked the watchdog driver patch as Deferred. Please resubmit or otherwise ping me once they dependencies are in an rc release.
I gave the dependencies a bit more thought.
Quoted 8 lines
Quoted 6 lines
I think we can gain once release cycle if you would postpone the DTS patches (both SMP routine size adjustments and RWDT device node additions) to v4.18. Then all other parts can be upstreamed in parallel in v4.17, as nothing will be activated before the DTS parts are in.
Does this look sane?
What about new DTS on old kernels of a specific vintage?
Quoted 7 lines
New DTS would work fine on v4.16 and older, which don't have any of the other patches from this series.
New DTS would work fine on v4.17, assumed all other patches from this series get into v4.17.The only issue would be a new DTS on a kernel that has some but not all other patches from this series.
Thanks for the analysis. I think this is the key point. What is the risk of that happening?
Quoted 3 lines
If we want to fast-track everything into v4.17, we need a stable branch, to be pulled by all 5 actors (clk-renesas, mach-shmobile, soc-renesas, watchdog, renesas-dts).
It seems that watchdog is the only item on that list that neither you nor I sign off on. So I conclude that if the watchdog patch goes in early enough in the cycle then we ought to be in good shape.
None the less, is it worth the risk?
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
Hi Simon,
Quoted 127 lines · Simon Horman
Quoted 126 lines · Geert Uytterhoeven
Quoted 111 lines · Simon Horman
Quoted 110 lines · Geert Uytterhoeven
Quoted 100 lines · Simon Horman
Quoted 99 lines · Geert Uytterhoeven
Quoted 83 lines · Fabrizio Castro
this series has been around for some time as RFC, and it has collected useful comments from the community along the way.
The solution proposed by this patch set works for most R-Car Gen2 and RZ/G1 devices, but not all of them. We now know that for some R-Car Gen2 early revisions there is no proper software fix. Anyway, no product has been built around early revisions, but development boards mounting early revisions (basically prototypes) are still out there. As a result, this series isn't enabling the internal watchdog on R-Car Gen2 boards, developers may enable it in board specific device trees if needed.
This series has been tested by me on the iwg20d, iwg22d, Lager, Alt, and Koelsch boards.The problem
===========
To deal with SMP on R-Car Gen2 and RZ/G1, we install a reset vector to ICRAM1 and we program the [S]BAR registers so that when we turn ON the non-boot CPUs they are redirected to the reset vector installed by Linux in ICRAM1, and eventually they continue the execution to RAM, where the SMP bring-up code will take care of the rest.
The content of the [S]BAR registers survives a watchdog triggered reset, and as such after the watchdog fires the boot core will try and execute the SMP bring-up code instead of jumping to the bootrom code.The fix
=======
The main strategy for the solution is to let the reset vector decide if it needs to jump toshmobile_boot_fnor to the bootrom code. In a watchdog triggered reset scenario, since the [S]BAR registers keep their values, the boot CPU will jump into the newly designed reset vector, the assembly routine will eventually test WOVF (a bit in register RWTCSRA that indicates if the watchdog counter has overflown, the value of this bit gets retained in this scenario), and jump to the bootrom code which will in turn load up the bootloader, etc.
When bringing up SMP or using CPU hotplug, the reset vector will jump toshmobile_boot_fninstead.Thank you All for your help.
Best regards,
Fabrizio Castro (26):
ARM: shmobile: Add watchdog support
ARM: dts: r8a7743: Adjust SMP routine size
ARM: dts: r8a7745: Adjust SMP routine size
ARM: dts: r8a7790: Adjust SMP routine size
ARM: dts: r8a7791: Adjust SMP routine size
ARM: dts: r8a7792: Adjust SMP routine size
ARM: dts: r8a7793: Adjust SMP routine size
ARM: dts: r8a7794: Adjust SMP routine size
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
ARM: shmobile: rcar-gen2: Add watchdog support
dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add restart handler
ARM: shmobile: defconfig: EnableRENESAS_WDT_GEN
clk: renesas: r8a7743: Add rwdt clock
clk: renesas: r8a7745: Add rwdt clock
clk: renesas: r8a7790: Add rwdt clock
clk: renesas: r8a7791/r8a7793: Add rwdt clock
clk: renesas: r8a7794: Add rwdt clock
ARM: dts: r8a7743: Add watchdog support to SoC dtsi
ARM: dts: r8a7745: Add watchdog support to SoC dtsi
ARM: dts: r8a7790: Add watchdog support to SoC dtsi
ARM: dts: r8a7791: Add watchdog support to SoC dtsi
ARM: dts: r8a7794: Add watchdog support to SoC dtsi
ARM: dts: iwg20m: Add watchdog support to SoM dtsi
ARM: dts: iwg22m: Add watchdog support to SoM dtsi.../devicetree/bindings/watchdog/renesas-wdt.txt | 19 ++++++-- arch/arm/boot/dts/r8a7743-iwg20m.dtsi | 5 ++ arch/arm/boot/dts/r8a7743.dtsi | 12 ++++- arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 ++ arch/arm/boot/dts/r8a7745.dtsi | 12 ++++- arch/arm/boot/dts/r8a7790.dtsi | 12 ++++- arch/arm/boot/dts/r8a7791.dtsi | 12 ++++- arch/arm/boot/dts/r8a7792.dtsi | 2 +- arch/arm/boot/dts/r8a7793.dtsi | 2 +- arch/arm/boot/dts/r8a7794.dtsi | 12 ++++- arch/arm/configs/shmobile_defconfig | 1 + arch/arm/mach-shmobile/common.h | 6 +++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++ arch/arm/mach-shmobile/platsmp-apmu.c | 1 +Quoted 8 lines
arch/arm/mach-shmobile/pm-rcar-gen2.c | 15 ++++-- drivers/clk/renesas/r8a7743-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7745-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7790-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7791-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7794-cpg-mssr.c | 2 + drivers/soc/renesas/rcar-rst.c | 35 +++++++++++--- drivers/watchdog/renesas_wdt.c | 39 +++++++++++++--Thanks, I've queued the clock patches in clk-renesas-for-v4.17, as they are a hard dependency for:
(1) The new reset vector inarch/arm/mach-shmobile/
(2) The watchdog driver.Quoted 6 lines
Quoted 2 lines
Note that the watchdog driver itself (2) has a hard dependency on the new reset vector (1).
Thanks, I have marked the watchdog driver patch as Deferred. Please resubmit or otherwise ping me once they dependencies are in an rc release.
I gave the dependencies a bit more thought.
Quoted 8 lines
Quoted 6 lines
I think we can gain once release cycle if you would postpone the DTS patches (both SMP routine size adjustments and RWDT device node additions) to v4.18. Then all other parts can be upstreamed in parallel in v4.17, as nothing will be activated before the DTS parts are in.
Does this look sane?
What about new DTS on old kernels of a specific vintage?
New DTS would work fine on v4.16 and older, which don't have any of the other patches from this series.
New DTS would work fine on v4.17, assumed all other patches from this series get into v4.17.
Quoted 5 lines
Quoted 2 lines
The only issue would be a new DTS on a kernel that has some but not all other patches from this series.
Thanks for the analysis. I think this is the key point. What is the risk of that happening?
I think the risk is fairly low.
You control when the DTS changes go in, and also when they are backported to LTSI.
Quoted 9 lines
Quoted 3 lines
If we want to fast-track everything into v4.17, we need a stable branch, to be pulled by all 5 actors (clk-renesas, mach-shmobile, soc-renesas, watchdog, renesas-dts).
It seems that watchdog is the only item on that list that neither you nor I sign off on. So I conclude that if the watchdog patch goes in early enough in the cycle then we ought to be in good shape.
None the less, is it worth the risk?
Do we want the functionality early, or can we wait until v4.19?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
Quoted 144 lines · Geert Uytterhoeven
Hi Simon,
Quoted 127 lines · Simon Horman
Quoted 126 lines · Geert Uytterhoeven
Quoted 111 lines · Simon Horman
Quoted 110 lines · Geert Uytterhoeven
Quoted 100 lines · Simon Horman
Quoted 99 lines · Geert Uytterhoeven
Quoted 83 lines · Fabrizio Castro
this series has been around for some time as RFC, and it has collected useful comments from the community along the way.
The solution proposed by this patch set works for most R-Car Gen2 and RZ/G1 devices, but not all of them. We now know that for some R-Car Gen2 early revisions there is no proper software fix. Anyway, no product has been built around early revisions, but development boards mounting early revisions (basically prototypes) are still out there. As a result, this series isn't enabling the internal watchdog on R-Car Gen2 boards, developers may enable it in board specific device trees if needed.
This series has been tested by me on the iwg20d, iwg22d, Lager, Alt, and Koelsch boards.The problem
===========
To deal with SMP on R-Car Gen2 and RZ/G1, we install a reset vector to ICRAM1 and we program the [S]BAR registers so that when we turn ON the non-boot CPUs they are redirected to the reset vector installed by Linux in ICRAM1, and eventually they continue the execution to RAM, where the SMP bring-up code will take care of the rest.
The content of the [S]BAR registers survives a watchdog triggered reset, and as such after the watchdog fires the boot core will try and execute the SMP bring-up code instead of jumping to the bootrom code.The fix
=======
The main strategy for the solution is to let the reset vector decide if it needs to jump toshmobile_boot_fnor to the bootrom code. In a watchdog triggered reset scenario, since the [S]BAR registers keep their values, the boot CPU will jump into the newly designed reset vector, the assembly routine will eventually test WOVF (a bit in register RWTCSRA that indicates if the watchdog counter has overflown, the value of this bit gets retained in this scenario), and jump to the bootrom code which will in turn load up the bootloader, etc.
When bringing up SMP or using CPU hotplug, the reset vector will jump toshmobile_boot_fninstead.Thank you All for your help.
Best regards,
Fabrizio Castro (26):
ARM: shmobile: Add watchdog support
ARM: dts: r8a7743: Adjust SMP routine size
ARM: dts: r8a7745: Adjust SMP routine size
ARM: dts: r8a7790: Adjust SMP routine size
ARM: dts: r8a7791: Adjust SMP routine size
ARM: dts: r8a7792: Adjust SMP routine size
ARM: dts: r8a7793: Adjust SMP routine size
ARM: dts: r8a7794: Adjust SMP routine size
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
ARM: shmobile: rcar-gen2: Add watchdog support
dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add restart handler
ARM: shmobile: defconfig: EnableRENESAS_WDT_GEN
clk: renesas: r8a7743: Add rwdt clock
clk: renesas: r8a7745: Add rwdt clock
clk: renesas: r8a7790: Add rwdt clock
clk: renesas: r8a7791/r8a7793: Add rwdt clock
clk: renesas: r8a7794: Add rwdt clock
ARM: dts: r8a7743: Add watchdog support to SoC dtsi
ARM: dts: r8a7745: Add watchdog support to SoC dtsi
ARM: dts: r8a7790: Add watchdog support to SoC dtsi
ARM: dts: r8a7791: Add watchdog support to SoC dtsi
ARM: dts: r8a7794: Add watchdog support to SoC dtsi
ARM: dts: iwg20m: Add watchdog support to SoM dtsi
ARM: dts: iwg22m: Add watchdog support to SoM dtsi.../devicetree/bindings/watchdog/renesas-wdt.txt | 19 ++++++-- arch/arm/boot/dts/r8a7743-iwg20m.dtsi | 5 ++ arch/arm/boot/dts/r8a7743.dtsi | 12 ++++- arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 ++ arch/arm/boot/dts/r8a7745.dtsi | 12 ++++- arch/arm/boot/dts/r8a7790.dtsi | 12 ++++- arch/arm/boot/dts/r8a7791.dtsi | 12 ++++- arch/arm/boot/dts/r8a7792.dtsi | 2 +- arch/arm/boot/dts/r8a7793.dtsi | 2 +- arch/arm/boot/dts/r8a7794.dtsi | 12 ++++- arch/arm/configs/shmobile_defconfig | 1 + arch/arm/mach-shmobile/common.h | 6 +++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++ arch/arm/mach-shmobile/platsmp-apmu.c | 1 +Quoted 8 lines
arch/arm/mach-shmobile/pm-rcar-gen2.c | 15 ++++-- drivers/clk/renesas/r8a7743-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7745-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7790-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7791-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7794-cpg-mssr.c | 2 + drivers/soc/renesas/rcar-rst.c | 35 +++++++++++--- drivers/watchdog/renesas_wdt.c | 39 +++++++++++++--Thanks, I've queued the clock patches in clk-renesas-for-v4.17, as they are a hard dependency for:
(1) The new reset vector inarch/arm/mach-shmobile/
(2) The watchdog driver.Quoted 6 lines
Quoted 2 lines
Note that the watchdog driver itself (2) has a hard dependency on the new reset vector (1).
Thanks, I have marked the watchdog driver patch as Deferred. Please resubmit or otherwise ping me once they dependencies are in an rc release.
I gave the dependencies a bit more thought.
Quoted 8 lines
Quoted 6 lines
I think we can gain once release cycle if you would postpone the DTS patches (both SMP routine size adjustments and RWDT device node additions) to v4.18. Then all other parts can be upstreamed in parallel in v4.17, as nothing will be activated before the DTS parts are in.
Does this look sane?
What about new DTS on old kernels of a specific vintage?
New DTS would work fine on v4.16 and older, which don't have any of the other patches from this series.
New DTS would work fine on v4.17, assumed all other patches from this series get into v4.17.Quoted 5 lines
Quoted 2 lines
The only issue would be a new DTS on a kernel that has some but not all other patches from this series.
Thanks for the analysis. I think this is the key point. What is the risk of that happening?
I think the risk is fairly low.
You control when the DTS changes go in, and also when they are backported to LTSI.Quoted 4 lines
Quoted 3 lines
If we want to fast-track everything into v4.17, we need a stable branch, to be pulled by all 5 actors (clk-renesas, mach-shmobile, soc-renesas, watchdog, renesas-dts).
Quoted 7 lines
Quoted 5 lines
It seems that watchdog is the only item on that list that neither you nor I sign off on. So I conclude that if the watchdog patch goes in early enough in the cycle then we ought to be in good shape.
None the less, is it worth the risk?
Do we want the functionality early, or can we wait until v4.19?
I understand that the watchdog driver has been accepted and that as things currently stand if it is enabled in the build it will be enabled in DT and a crash will result. From my POV that is a regression so I have decided to adopt the alternate plan proposed by Geert above: in short drop DT patches (to avoid enabling broken driver) and enqueue mach-shmobile patches (which don't make things any worse.
Patch-by-patch things are as follows.
Dropped from "[PATCH v5 00/26] Fix watchdog on Renesas R-Car Gen2 and RZ/G1":
979d28f29742 ARM: dts: r8a7743: Adjust SMP routine size 0b205f679f5d ARM: dts: r8a7745: Adjust SMP routine size 2ad21a1d78b3 ARM: dts: r8a7790: Adjust SMP routine size 82c978459c77 ARM: dts: r8a7791: Adjust SMP routine size d303698e6ff3 ARM: dts: r8a7792: Adjust SMP routine size d8b8b9a1e295 ARM: dts: r8a7793: Adjust SMP routine size 70b3ab369773 ARM: dts: r8a7794: Adjust SMP routine size
ebf26cf1b1de ARM: dts: r8a7743: Add watchdog support to SoC dtsi 5a4566ab3777 ARM: dts: r8a7745: Add watchdog support to SoC dtsi acd58e2bb1e5 ARM: dts: r8a7790: Add watchdog support to SoC dtsi e3f89168e72f ARM: dts: r8a7791: Add watchdog support to SoC dtsi e76a6a69a1fc ARM: dts: r8a7794: Add watchdog support to SoC dtsi 242cc1ab7f7c ARM: dts: iwg20m: Add watchdog support to SoM dtsi 748ed07f6c7c ARM: dts: iwg22m: Add watchdog support to SoM dtsi
Dropped from "[PATCH/RFC 00/11] ARM: dts: rcar-gen2: Enable watchdog support":
c257202482e2 ARM: dts: r8a7792: Add RWDT node 01ec04dec8eb ARM: dts: r8a7793: Add RWDT node 8e6ebe4f2f94 ARM: dts: lager: Enable watchdog support f223ad0198f6 ARM: dts: koelsch: Enable watchdog support 1d14d2bb700d ARM: dts: porter: Enable watchdog support bf71652fc955 ARM: dts: blanche: Enable watchdog support 13a0b10aeea4 ARM: dts: wheat: Enable watchdog support 4e247bf110b8 ARM: dts: gose: Enable watchdog support 2dcbd24bbf5e ARM: dts: alt: Enable watchdog support 7f6844c900b4 ARM: dts: silk: Enable watchdog support
And applied:
[v5] ARM: shmobile: rcar-gen2: Add watchdog support [v5] ARM: shmobile: Add watchdog support
In the case of the last patch above I removed the #ifdef from the header file.
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
Hi Simon,
Quoted 192 lines · Simon Horman
Quoted 142 lines · Geert Uytterhoeven
Quoted 127 lines · Simon Horman
Quoted 126 lines · Geert Uytterhoeven
Quoted 111 lines · Simon Horman
Quoted 110 lines · Geert Uytterhoeven
Quoted 100 lines · Simon Horman
Quoted 99 lines · Geert Uytterhoeven
Quoted 83 lines · Fabrizio Castro
this series has been around for some time as RFC, and it has collected useful comments from the community along the way.
The solution proposed by this patch set works for most R-Car Gen2 and RZ/G1 devices, but not all of them. We now know that for some R-Car Gen2 early revisions there is no proper software fix. Anyway, no product has been built around early revisions, but development boards mounting early revisions (basically prototypes) are still out there. As a result, this series isn't enabling the internal watchdog on R-Car Gen2 boards, developers may enable it in board specific device trees if needed.
This series has been tested by me on the iwg20d, iwg22d, Lager, Alt, and Koelsch boards.The problem
===========
To deal with SMP on R-Car Gen2 and RZ/G1, we install a reset vector to ICRAM1 and we program the [S]BAR registers so that when we turn ON the non-boot CPUs they are redirected to the reset vector installed by Linux in ICRAM1, and eventually they continue the execution to RAM, where the SMP bring-up code will take care of the rest.
The content of the [S]BAR registers survives a watchdog triggered reset, and as such after the watchdog fires the boot core will try and execute the SMP bring-up code instead of jumping to the bootrom code.The fix
=======
The main strategy for the solution is to let the reset vector decide if it needs to jump toshmobile_boot_fnor to the bootrom code. In a watchdog triggered reset scenario, since the [S]BAR registers keep their values, the boot CPU will jump into the newly designed reset vector, the assembly routine will eventually test WOVF (a bit in register RWTCSRA that indicates if the watchdog counter has overflown, the value of this bit gets retained in this scenario), and jump to the bootrom code which will in turn load up the bootloader, etc.
When bringing up SMP or using CPU hotplug, the reset vector will jump toshmobile_boot_fninstead.Thank you All for your help.
Best regards,
Fabrizio Castro (26):
ARM: shmobile: Add watchdog support
ARM: dts: r8a7743: Adjust SMP routine size
ARM: dts: r8a7745: Adjust SMP routine size
ARM: dts: r8a7790: Adjust SMP routine size
ARM: dts: r8a7791: Adjust SMP routine size
ARM: dts: r8a7792: Adjust SMP routine size
ARM: dts: r8a7793: Adjust SMP routine size
ARM: dts: r8a7794: Adjust SMP routine size
soc: renesas: rcar-rst: Enable watchdog as reset trigger for Gen2
ARM: shmobile: rcar-gen2: Add watchdog support
dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add R-Car Gen2 support
watchdog:renesas_wdt: Add restart handler
ARM: shmobile: defconfig: EnableRENESAS_WDT_GEN
clk: renesas: r8a7743: Add rwdt clock
clk: renesas: r8a7745: Add rwdt clock
clk: renesas: r8a7790: Add rwdt clock
clk: renesas: r8a7791/r8a7793: Add rwdt clock
clk: renesas: r8a7794: Add rwdt clock
ARM: dts: r8a7743: Add watchdog support to SoC dtsi
ARM: dts: r8a7745: Add watchdog support to SoC dtsi
ARM: dts: r8a7790: Add watchdog support to SoC dtsi
ARM: dts: r8a7791: Add watchdog support to SoC dtsi
ARM: dts: r8a7794: Add watchdog support to SoC dtsi
ARM: dts: iwg20m: Add watchdog support to SoM dtsi
ARM: dts: iwg22m: Add watchdog support to SoM dtsi.../devicetree/bindings/watchdog/renesas-wdt.txt | 19 ++++++-- arch/arm/boot/dts/r8a7743-iwg20m.dtsi | 5 ++ arch/arm/boot/dts/r8a7743.dtsi | 12 ++++- arch/arm/boot/dts/r8a7745-iwg22m.dtsi | 5 ++ arch/arm/boot/dts/r8a7745.dtsi | 12 ++++- arch/arm/boot/dts/r8a7790.dtsi | 12 ++++- arch/arm/boot/dts/r8a7791.dtsi | 12 ++++- arch/arm/boot/dts/r8a7792.dtsi | 2 +- arch/arm/boot/dts/r8a7793.dtsi | 2 +- arch/arm/boot/dts/r8a7794.dtsi | 12 ++++- arch/arm/configs/shmobile_defconfig | 1 + arch/arm/mach-shmobile/common.h | 6 +++ arch/arm/mach-shmobile/headsmp.S | 55 ++++++++++++++++++++++ arch/arm/mach-shmobile/platsmp-apmu.c | 1 +Quoted 8 lines
arch/arm/mach-shmobile/pm-rcar-gen2.c | 15 ++++-- drivers/clk/renesas/r8a7743-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7745-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7790-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7791-cpg-mssr.c | 2 + drivers/clk/renesas/r8a7794-cpg-mssr.c | 2 + drivers/soc/renesas/rcar-rst.c | 35 +++++++++++--- drivers/watchdog/renesas_wdt.c | 39 +++++++++++++--Thanks, I've queued the clock patches in clk-renesas-for-v4.17, as they are a hard dependency for:
(1) The new reset vector inarch/arm/mach-shmobile/
(2) The watchdog driver.Quoted 6 lines
Quoted 2 lines
Note that the watchdog driver itself (2) has a hard dependency on the new reset vector (1).
Thanks, I have marked the watchdog driver patch as Deferred. Please resubmit or otherwise ping me once they dependencies are in an rc release.
I gave the dependencies a bit more thought.
Quoted 8 lines
Quoted 6 lines
I think we can gain once release cycle if you would postpone the DTS patches (both SMP routine size adjustments and RWDT device node additions) to v4.18. Then all other parts can be upstreamed in parallel in v4.17, as nothing will be activated before the DTS parts are in.
Does this look sane?
What about new DTS on old kernels of a specific vintage?
New DTS would work fine on v4.16 and older, which don't have any of the other patches from this series.
New DTS would work fine on v4.17, assumed all other patches from this series get into v4.17.Quoted 5 lines
Quoted 2 lines
The only issue would be a new DTS on a kernel that has some but not all other patches from this series.
Thanks for the analysis. I think this is the key point. What is the risk of that happening?
I think the risk is fairly low.
You control when the DTS changes go in, and also when they are backported to LTSI.Quoted 4 lines
Quoted 3 lines
If we want to fast-track everything into v4.17, we need a stable branch, to be pulled by all 5 actors (clk-renesas, mach-shmobile, soc-renesas, watchdog, renesas-dts).
Quoted 7 lines
Quoted 5 lines
It seems that watchdog is the only item on that list that neither you nor I sign off on. So I conclude that if the watchdog patch goes in early enough in the cycle then we ought to be in good shape.
None the less, is it worth the risk?
Do we want the functionality early, or can we wait until v4.19?
I understand that the watchdog driver has been accepted and that as things currently stand if it is enabled in the build it will be enabled in DT and a crash will result. From my POV that is a regression so I have decided to adopt the alternate plan proposed by Geert above: in short drop DT patches (to avoid enabling broken driver) and enqueue mach-shmobile patches (which don't make things any worse.
Patch-by-patch things are as follows.
Dropped from "[PATCH v5 00/26] Fix watchdog on Renesas R-Car Gen2 and RZ/G1":
979d28f29742ARM: dts: r8a7743: Adjust SMP routine size0b205f679f5dARM: dts: r8a7745: Adjust SMP routine size2ad21a1d78b3ARM: dts: r8a7790: Adjust SMP routine size82c978459c77ARM: dts: r8a7791: Adjust SMP routine sized303698e6ff3ARM: dts: r8a7792: Adjust SMP routine sized8b8b9a1e295ARM: dts: r8a7793: Adjust SMP routine size70b3ab369773ARM: dts: r8a7794: Adjust SMP routine size
ebf26cf1b1deARM: dts: r8a7743: Add watchdog support to SoC dtsi5a4566ab3777ARM: dts: r8a7745: Add watchdog support to SoC dtsiacd58e2bb1e5ARM: dts: r8a7790: Add watchdog support to SoC dtsie3f89168e72fARM: dts: r8a7791: Add watchdog support to SoC dtsie76a6a69a1fcARM: dts: r8a7794: Add watchdog support to SoC dtsi242cc1ab7f7cARM: dts: iwg20m: Add watchdog support to SoM dtsi748ed07f6c7cARM: dts: iwg22m: Add watchdog support to SoM dtsiDropped from "[PATCH/RFC 00/11] ARM: dts: rcar-gen2: Enable watchdog support":
c257202482e2ARM: dts: r8a7792: Add RWDT node01ec04dec8ebARM: dts: r8a7793: Add RWDT node8e6ebe4f2f94ARM: dts: lager: Enable watchdog supportf223ad0198f6ARM: dts: koelsch: Enable watchdog support1d14d2bb700dARM: dts: porter: Enable watchdog supportbf71652fc955ARM: dts: blanche: Enable watchdog support13a0b10aeea4ARM: dts: wheat: Enable watchdog support4e247bf110b8ARM: dts: gose: Enable watchdog support2dcbd24bbf5eARM: dts: alt: Enable watchdog support7f6844c900b4ARM: dts: silk: Enable watchdog support
Quoted 6 lines
And applied:
[v5] ARM: shmobile: rcar-gen2: Add watchdog support [v5] ARM: shmobile: Add watchdog support
In the case of the last patch above I removed the #ifdef from the header file.
Thank you, sounds good to me.
BTW, who will take "dt-bindings: watchdog: renesas-wdt: Add R-Car Gen2 support"? G?nter, Wim: will you take this through the watchdog tree, too?
Thanks again!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
v5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
In reply to Simon HormanHi Simon,
Quoted 41 lines · Simon Horman
I understand that the watchdog driver has been accepted and that as things currently stand if it is enabled in the build it will be enabled in DT and a crash will result. From my POV that is a regression so I have decided to adopt the alternate plan proposed by Geert above: in short drop DT patches (to avoid enabling broken driver) and enqueue mach-shmobile patches (which don't make things any worse.
Patch-by-patch things are as follows.
Dropped from "[PATCH v5 00/26] Fix watchdog on Renesas R-Car Gen2 and RZ/G1":
979d28f29742ARM: dts: r8a7743: Adjust SMP routine size0b205f679f5dARM: dts: r8a7745: Adjust SMP routine size2ad21a1d78b3ARM: dts: r8a7790: Adjust SMP routine size82c978459c77ARM: dts: r8a7791: Adjust SMP routine sized303698e6ff3ARM: dts: r8a7792: Adjust SMP routine sized8b8b9a1e295ARM: dts: r8a7793: Adjust SMP routine size70b3ab369773ARM: dts: r8a7794: Adjust SMP routine size
ebf26cf1b1deARM: dts: r8a7743: Add watchdog support to SoC dtsi5a4566ab3777ARM: dts: r8a7745: Add watchdog support to SoC dtsiacd58e2bb1e5ARM: dts: r8a7790: Add watchdog support to SoC dtsie3f89168e72fARM: dts: r8a7791: Add watchdog support to SoC dtsie76a6a69a1fcARM: dts: r8a7794: Add watchdog support to SoC dtsi242cc1ab7f7cARM: dts: iwg20m: Add watchdog support to SoM dtsi748ed07f6c7cARM: dts: iwg22m: Add watchdog support to SoM dtsiDropped from "[PATCH/RFC 00/11] ARM: dts: rcar-gen2: Enable watchdog support":
c257202482e2ARM: dts: r8a7792: Add RWDT node01ec04dec8ebARM: dts: r8a7793: Add RWDT node8e6ebe4f2f94ARM: dts: lager: Enable watchdog supportf223ad0198f6ARM: dts: koelsch: Enable watchdog support1d14d2bb700dARM: dts: porter: Enable watchdog supportbf71652fc955ARM: dts: blanche: Enable watchdog support13a0b10aeea4ARM: dts: wheat: Enable watchdog support4e247bf110b8ARM: dts: gose: Enable watchdog support2dcbd24bbf5eARM: dts: alt: Enable watchdog support7f6844c900b4ARM: dts: silk: Enable watchdog support
Quoted 6 lines
And applied:
[v5] ARM: shmobile: rcar-gen2: Add watchdog support [v5] ARM: shmobile: Add watchdog support
In the case of the last patch above I removed the #ifdef from the header file.
I guess the time is ripe to apply the DTS patches again, in the following order:
1. SMP routine size adjustments,
2. Watchdog support additions to dtsi,
3. Watchdog enablement for dts?
Thanks!
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvaldsv5 cover Fix watchdog on Renesas R-Car Gen2 and RZ/G1
Quoted 49 lines · Geert Uytterhoeven
Hi Simon,
Quoted 46 lines · Simon Horman
I understand that the watchdog driver has been accepted and that as things currently stand if it is enabled in the build it will be enabled in DT and a crash will result. From my POV that is a regression so I have decided to adopt the alternate plan proposed by Geert above: in short drop DT patches (to avoid enabling broken driver) and enqueue mach-shmobile patches (which don't make things any worse.
Patch-by-patch things are as follows.
Dropped from "[PATCH v5 00/26] Fix watchdog on Renesas R-Car Gen2 and RZ/G1":
979d28f29742ARM: dts: r8a7743: Adjust SMP routine size0b205f679f5dARM: dts: r8a7745: Adjust SMP routine size2ad21a1d78b3ARM: dts: r8a7790: Adjust SMP routine size82c978459c77ARM: dts: r8a7791: Adjust SMP routine sized303698e6ff3ARM: dts: r8a7792: Adjust SMP routine sized8b8b9a1e295ARM: dts: r8a7793: Adjust SMP routine size70b3ab369773ARM: dts: r8a7794: Adjust SMP routine size
ebf26cf1b1deARM: dts: r8a7743: Add watchdog support to SoC dtsi5a4566ab3777ARM: dts: r8a7745: Add watchdog support to SoC dtsiacd58e2bb1e5ARM: dts: r8a7790: Add watchdog support to SoC dtsie3f89168e72fARM: dts: r8a7791: Add watchdog support to SoC dtsie76a6a69a1fcARM: dts: r8a7794: Add watchdog support to SoC dtsi242cc1ab7f7cARM: dts: iwg20m: Add watchdog support to SoM dtsi748ed07f6c7cARM: dts: iwg22m: Add watchdog support to SoM dtsiDropped from "[PATCH/RFC 00/11] ARM: dts: rcar-gen2: Enable watchdog support":
c257202482e2ARM: dts: r8a7792: Add RWDT node01ec04dec8ebARM: dts: r8a7793: Add RWDT node8e6ebe4f2f94ARM: dts: lager: Enable watchdog supportf223ad0198f6ARM: dts: koelsch: Enable watchdog support1d14d2bb700dARM: dts: porter: Enable watchdog supportbf71652fc955ARM: dts: blanche: Enable watchdog support13a0b10aeea4ARM: dts: wheat: Enable watchdog support4e247bf110b8ARM: dts: gose: Enable watchdog support2dcbd24bbf5eARM: dts: alt: Enable watchdog support7f6844c900b4ARM: dts: silk: Enable watchdog supportAnd applied:
[v5] ARM: shmobile: rcar-gen2: Add watchdog support [v5] ARM: shmobile: Add watchdog support
Quoted 8 lines
Quoted 1 line
In the case of the last patch above I removed the #ifdef from the header file.
I guess the time is ripe to apply the DTS patches again, in the following order:
1. SMP routine size adjustments,
2. Watchdog support additions to dtsi,
3. Watchdog enablement for dts?Thanks!
Thanks, I have tentatively reapplied all of the above.