devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT
@ 2025-10-17 11:51 Wolfram Sang
  2025-10-17 11:54 ` Marek Vasut
  2025-10-20 13:07 ` Geert Uytterhoeven
  0 siblings, 2 replies; 11+ messages in thread
From: Wolfram Sang @ 2025-10-17 11:51 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Marek Vasut, Wolfram Sang, Geert Uytterhoeven, Magnus Damm,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, devicetree

SparrowHawk may run without ATF but with U-Boot SPL which does not
reserve the SWDT. Remove the default "reserved" marking.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Tested it by using the SWDT on my board.

 arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dts | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dts b/arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dts
index 161c083241f9..1da8e476b219 100644
--- a/arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dts
+++ b/arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dts
@@ -942,8 +942,3 @@ &sensor_thermal_cr52 {
 &sensor_thermal_ddr1 {
 	critical-action = "shutdown";
 };
-
-/* Firmware should reserve it but sadly doesn't */
-&swdt {
-	status = "reserved";
-};
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT
  2025-10-17 11:51 [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT Wolfram Sang
@ 2025-10-17 11:54 ` Marek Vasut
  2025-10-20 13:07 ` Geert Uytterhoeven
  1 sibling, 0 replies; 11+ messages in thread
From: Marek Vasut @ 2025-10-17 11:54 UTC (permalink / raw)
  To: Wolfram Sang, linux-renesas-soc
  Cc: Geert Uytterhoeven, Magnus Damm, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree

On 10/17/25 1:51 PM, Wolfram Sang wrote:
> SparrowHawk may run without ATF

Nitpick: It is abbreviated "TFA" now.

Reviewed-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT
  2025-10-17 11:51 [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT Wolfram Sang
  2025-10-17 11:54 ` Marek Vasut
@ 2025-10-20 13:07 ` Geert Uytterhoeven
  2025-10-20 19:48   ` Wolfram Sang
  1 sibling, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2025-10-20 13:07 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Marek Vasut, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree

Hi Wolfram,

Thanks for your patch!

On Fri, 17 Oct 2025 at 13:51, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> SparrowHawk may run without ATF but with U-Boot SPL which does not
> reserve the SWDT. Remove the default "reserved" marking.

The same is true for other boards (e.g. my SPL-enabled White Hawk)...

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

> --- a/arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dts
> +++ b/arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dts
> @@ -942,8 +942,3 @@ &sensor_thermal_cr52 {
>  &sensor_thermal_ddr1 {
>         critical-action = "shutdown";
>  };
> -
> -/* Firmware should reserve it but sadly doesn't */
> -&swdt {
> -       status = "reserved";
> -};

As commit c38c85613ba2b7e9 ("arm64: dts: renesas: sparrow/white-hawk:
Mark SWDT as reserved") is not yet in soc/for-next, I can still fold
this fix into the original commit.

Or better: drop all these swdt = reserved commits?
TBH, I always had my doubts about making them reserved in the upstream
DTS, and there does not seem to be much gain in doing so...

Thoughts?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT
  2025-10-20 13:07 ` Geert Uytterhoeven
@ 2025-10-20 19:48   ` Wolfram Sang
  2025-10-21  7:09     ` Geert Uytterhoeven
  0 siblings, 1 reply; 11+ messages in thread
From: Wolfram Sang @ 2025-10-20 19:48 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-renesas-soc, Marek Vasut, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree

[-- Attachment #1: Type: text/plain, Size: 352 bytes --]


> Or better: drop all these swdt = reserved commits?

Maybe. Since Marek is maybe interested in fixing FW...

> TBH, I always had my doubts about making them reserved in the upstream
> DTS, and there does not seem to be much gain in doing so...

No strong opinion here. With "reserved" I think I followed your
suggestion but I personally don't mind.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT
  2025-10-20 19:48   ` Wolfram Sang
@ 2025-10-21  7:09     ` Geert Uytterhoeven
  2025-10-21 13:14       ` Marek Vasut
  0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2025-10-21  7:09 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Marek Vasut, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree

Hi Wolfram,

On Mon, 20 Oct 2025 at 21:48, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> > Or better: drop all these swdt = reserved commits?
>
> Maybe. Since Marek is maybe interested in fixing FW...
>
> > TBH, I always had my doubts about making them reserved in the upstream
> > DTS, and there does not seem to be much gain in doing so...
>
> No strong opinion here. With "reserved" I think I followed your
> suggestion but I personally don't mind.

Well, the proper mechanism would be that firmware using SWDT would
override the status to reserved, preventing the user from using it if
it was enabled in the DTB passed by the user.  But (a) the current
firmware doesn't do that, and (b) we currently do not have a use-case
for enabling SWDT in the DTB.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT
  2025-10-21  7:09     ` Geert Uytterhoeven
@ 2025-10-21 13:14       ` Marek Vasut
  2025-10-21 13:22         ` Geert Uytterhoeven
  0 siblings, 1 reply; 11+ messages in thread
From: Marek Vasut @ 2025-10-21 13:14 UTC (permalink / raw)
  To: Geert Uytterhoeven, Wolfram Sang
  Cc: linux-renesas-soc, Magnus Damm, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree

On 10/21/25 9:09 AM, Geert Uytterhoeven wrote:

Hello everyone,

> On Mon, 20 Oct 2025 at 21:48, Wolfram Sang
> <wsa+renesas@sang-engineering.com> wrote:
>>> Or better: drop all these swdt = reserved commits?
>>
>> Maybe. Since Marek is maybe interested in fixing FW...
>>
>>> TBH, I always had my doubts about making them reserved in the upstream
>>> DTS, and there does not seem to be much gain in doing so...
>>
>> No strong opinion here. With "reserved" I think I followed your
>> suggestion but I personally don't mind.
> 
> Well, the proper mechanism would be that firmware using SWDT would
> override the status to reserved, preventing the user from using it if
> it was enabled in the DTB passed by the user.  But (a) the current
> firmware doesn't do that, and (b) we currently do not have a use-case
> for enabling SWDT in the DTB.

Upstream TFA does enable SWDT for R-Car Gen3, but not for Gen4.

I can pass SWDT node from upstream TFA to next stage on Gen3 if you 
would like that ?

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT
  2025-10-21 13:14       ` Marek Vasut
@ 2025-10-21 13:22         ` Geert Uytterhoeven
  2025-10-21 16:07           ` Marek Vasut
  0 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2025-10-21 13:22 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Wolfram Sang, linux-renesas-soc, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree

Hi Marek,

On Tue, 21 Oct 2025 at 15:14, Marek Vasut <marek.vasut@mailbox.org> wrote:
> On 10/21/25 9:09 AM, Geert Uytterhoeven wrote:
> > On Mon, 20 Oct 2025 at 21:48, Wolfram Sang
> > <wsa+renesas@sang-engineering.com> wrote:
> >>> Or better: drop all these swdt = reserved commits?
> >>
> >> Maybe. Since Marek is maybe interested in fixing FW...
> >>
> >>> TBH, I always had my doubts about making them reserved in the upstream
> >>> DTS, and there does not seem to be much gain in doing so...
> >>
> >> No strong opinion here. With "reserved" I think I followed your
> >> suggestion but I personally don't mind.
> >
> > Well, the proper mechanism would be that firmware using SWDT would
> > override the status to reserved, preventing the user from using it if
> > it was enabled in the DTB passed by the user.  But (a) the current
> > firmware doesn't do that, and (b) we currently do not have a use-case
> > for enabling SWDT in the DTB.
>
> Upstream TFA does enable SWDT for R-Car Gen3, but not for Gen4.

Oh, so this is a "generic" R-Car Gen4 issue?
Does that mean we can use SWDT in Linux on R-Car Gen4 with TF-A,
or does TF-A still block access to it?

> I can pass SWDT node from upstream TFA to next stage on Gen3 if you
> would like that ?

I guess that would be a good thing to do.  But I am afraid it is a bit
late in the product life cycle.  Ideally, everything that is used by
firmware should be marked reserved...

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT
  2025-10-21 13:22         ` Geert Uytterhoeven
@ 2025-10-21 16:07           ` Marek Vasut
  2025-10-22  7:01             ` Wolfram Sang
  2025-10-27 10:09             ` Geert Uytterhoeven
  0 siblings, 2 replies; 11+ messages in thread
From: Marek Vasut @ 2025-10-21 16:07 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfram Sang, linux-renesas-soc, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree

On 10/21/25 3:22 PM, Geert Uytterhoeven wrote:

Hello Geert,

> On Tue, 21 Oct 2025 at 15:14, Marek Vasut <marek.vasut@mailbox.org> wrote:
>> On 10/21/25 9:09 AM, Geert Uytterhoeven wrote:
>>> On Mon, 20 Oct 2025 at 21:48, Wolfram Sang
>>> <wsa+renesas@sang-engineering.com> wrote:
>>>>> Or better: drop all these swdt = reserved commits?
>>>>
>>>> Maybe. Since Marek is maybe interested in fixing FW...
>>>>
>>>>> TBH, I always had my doubts about making them reserved in the upstream
>>>>> DTS, and there does not seem to be much gain in doing so...
>>>>
>>>> No strong opinion here. With "reserved" I think I followed your
>>>> suggestion but I personally don't mind.
>>>
>>> Well, the proper mechanism would be that firmware using SWDT would
>>> override the status to reserved, preventing the user from using it if
>>> it was enabled in the DTB passed by the user.  But (a) the current
>>> firmware doesn't do that, and (b) we currently do not have a use-case
>>> for enabling SWDT in the DTB.
>>
>> Upstream TFA does enable SWDT for R-Car Gen3, but not for Gen4.
> 
> Oh, so this is a "generic" R-Car Gen4 issue?
> Does that mean we can use SWDT in Linux on R-Car Gen4 with TF-A,
> or does TF-A still block access to it?

I think this can be tested on Sparrow Hawk easily , with and without 
TFA. Wolfram, how do I test the SWDT ?

>> I can pass SWDT node from upstream TFA to next stage on Gen3 if you
>> would like that ?
> 
> I guess that would be a good thing to do.  But I am afraid it is a bit
> late in the product life cycle.  Ideally, everything that is used by
> firmware should be marked reserved...

It seems SWDT is not used by upstream TFA, but maybe it is used by 
downstream one (or downstream loader). I can enable SWDT in either TFA 
or U-Boot if that would be preferable, or leave it available for Linux.

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT
  2025-10-21 16:07           ` Marek Vasut
@ 2025-10-22  7:01             ` Wolfram Sang
  2025-10-27 10:09             ` Geert Uytterhoeven
  1 sibling, 0 replies; 11+ messages in thread
From: Wolfram Sang @ 2025-10-22  7:01 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Geert Uytterhoeven, linux-renesas-soc, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree


[-- Attachment #1.1: Type: text/plain, Size: 731 bytes --]

Hi Marek,

sorry for the late reply. I am on holiday this week with only limited
time for work and net access.

> I think this can be tested on Sparrow Hawk easily , with and without TFA.
> Wolfram, how do I test the SWDT ?

1) enable the node in DT
2) apply the patch "[PATCH] soc: renesas: rcar-rst: keep RESBAR2S in default state"
3) apply the diff attached to this mail (untested but quite sure that's
   what i did a few days ago) which allows SWDT to reset
4) access it like any other watchdog. IIRC I did this to enforce a reset
   # watchdog -T1 -t3 /dev/watchdog1
   (with busybox watchdog)

I think that's it. It uses the same driver as the RWDT, so you probably
have this activated already.

Happy hacking,

   Wolfram


[-- Attachment #1.2: v4h_allow_swdt_to_reset.diff --]
[-- Type: text/x-diff, Size: 903 bytes --]

diff --git a/drivers/soc/renesas/rcar-rst.c b/drivers/soc/renesas/rcar-rst.c
index 0541990901fc..a78ea77dba16 100644
--- a/drivers/soc/renesas/rcar-rst.c
+++ b/drivers/soc/renesas/rcar-rst.c
@@ -12,7 +12,7 @@
 
 #define WDTRSTCR_RESET		0xA55A0002
 #define WDTRSTCR		0x0054
-#define GEN4_WDTRSTCR_RESET	0xA55A8002
+#define GEN4_WDTRSTCR_RESET	0xA55A8000
 #define GEN4_WDTRSTCR		0x0010
 
 #define CR7BAR			0x0070
@@ -117,7 +117,7 @@ static const struct of_device_id rcar_rst_matches[] __initconst = {
 	/* R-Car Gen4 */
 	{ .compatible = "renesas,r8a779a0-rst", .data = &rcar_rst_v3u },
 	{ .compatible = "renesas,r8a779f0-rst", .data = &rcar_rst_gen4 },
-	{ .compatible = "renesas,r8a779g0-rst", .data = &rcar_rst_gen4 },
+	{ .compatible = "renesas,r8a779g0-rst", .data = &rcar_rst_v3u },
 	{ .compatible = "renesas,r8a779h0-rst", .data = &rcar_rst_gen4 },
 	{ /* sentinel */ }
 };

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT
  2025-10-21 16:07           ` Marek Vasut
  2025-10-22  7:01             ` Wolfram Sang
@ 2025-10-27 10:09             ` Geert Uytterhoeven
  2025-10-27 18:21               ` Marek Vasut
  1 sibling, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2025-10-27 10:09 UTC (permalink / raw)
  To: Marek Vasut
  Cc: Wolfram Sang, linux-renesas-soc, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree

Hi Marek,

On Tue, 21 Oct 2025 at 18:07, Marek Vasut <marek.vasut@mailbox.org> wrote:
> On 10/21/25 3:22 PM, Geert Uytterhoeven wrote:
> > On Tue, 21 Oct 2025 at 15:14, Marek Vasut <marek.vasut@mailbox.org> wrote:
> >> On 10/21/25 9:09 AM, Geert Uytterhoeven wrote:
> >>> On Mon, 20 Oct 2025 at 21:48, Wolfram Sang
> >>> <wsa+renesas@sang-engineering.com> wrote:
> >>>>> Or better: drop all these swdt = reserved commits?
> >>>>
> >>>> Maybe. Since Marek is maybe interested in fixing FW...
> >>>>
> >>>>> TBH, I always had my doubts about making them reserved in the upstream
> >>>>> DTS, and there does not seem to be much gain in doing so...
> >>>>
> >>>> No strong opinion here. With "reserved" I think I followed your
> >>>> suggestion but I personally don't mind.
> >>>
> >>> Well, the proper mechanism would be that firmware using SWDT would
> >>> override the status to reserved, preventing the user from using it if
> >>> it was enabled in the DTB passed by the user.  But (a) the current
> >>> firmware doesn't do that, and (b) we currently do not have a use-case
> >>> for enabling SWDT in the DTB.
> >>
> >> Upstream TFA does enable SWDT for R-Car Gen3, but not for Gen4.
> >
> > Oh, so this is a "generic" R-Car Gen4 issue?
> > Does that mean we can use SWDT in Linux on R-Car Gen4 with TF-A,
> > or does TF-A still block access to it?
>
> I think this can be tested on Sparrow Hawk easily , with and without
> TFA. Wolfram, how do I test the SWDT ?
>
> >> I can pass SWDT node from upstream TFA to next stage on Gen3 if you
> >> would like that ?
> >
> > I guess that would be a good thing to do.  But I am afraid it is a bit
> > late in the product life cycle.  Ideally, everything that is used by
> > firmware should be marked reserved...
>
> It seems SWDT is not used by upstream TFA, but maybe it is used by
> downstream one (or downstream loader). I can enable SWDT in either TFA
> or U-Boot if that would be preferable, or leave it available for Linux.

My Gray Hawk Single still has downstream firmware, and I can modify the
SWDT registers from U-Boot (unlike on Salvator-XS with R-Car H3 ES2),
so access is not blocked.
Hence I plan to drop the SWDT patches for all R-Car Gen4 boards.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT
  2025-10-27 10:09             ` Geert Uytterhoeven
@ 2025-10-27 18:21               ` Marek Vasut
  0 siblings, 0 replies; 11+ messages in thread
From: Marek Vasut @ 2025-10-27 18:21 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Wolfram Sang, linux-renesas-soc, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree

On 10/27/25 11:09 AM, Geert Uytterhoeven wrote:

Hello Geert,

> My Gray Hawk Single still has downstream firmware, and I can modify the
> SWDT registers from U-Boot (unlike on Salvator-XS with R-Car H3 ES2),
> so access is not blocked.
> Hence I plan to drop the SWDT patches for all R-Car Gen4 boards.

Thank you for testing. You can also flip the DIP switches on WhiteHawk 
to boot the original firmware on it, it is left unmodified . Then we 
would know whether even the WH is unaffected, but I suspect it likely is.

-- 
Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-10-27 18:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-17 11:51 [PATCH] arm64: dts: renesas: sparrow-hawk: don't reserve SWDT Wolfram Sang
2025-10-17 11:54 ` Marek Vasut
2025-10-20 13:07 ` Geert Uytterhoeven
2025-10-20 19:48   ` Wolfram Sang
2025-10-21  7:09     ` Geert Uytterhoeven
2025-10-21 13:14       ` Marek Vasut
2025-10-21 13:22         ` Geert Uytterhoeven
2025-10-21 16:07           ` Marek Vasut
2025-10-22  7:01             ` Wolfram Sang
2025-10-27 10:09             ` Geert Uytterhoeven
2025-10-27 18:21               ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).