From: Samuel Holland <samuel@sholland.org> Date: 2021-09-02 22:57:57
This series adds bindings and driver support for the R329 and D1
watchdogs. The R329 is fully backward-compatible, so no driver changes
are needed for it.
v3 of this series adds two new compatibles, as I discovered that the
immediate "soft reset" functionality was specific to the watchdog that
is part of the same block as the sun4i timer, and is not available in
the RISC-V or DSP watchdog instances.
My intention is to use the soft reset function as OpenSBI's system reset
backend, so it needs to know which watchdog instance has that feature.
Samuel Holland (3):
dt-bindings: watchdog: sunxi: Add compatibles for R329
dt-bindings: watchdog: sunxi: Add compatibles for D1
watchdog: sunxi_wdt: Add support for D1
.../watchdog/allwinner,sun4i-a10-wdt.yaml | 48 ++++++++++++++++++-
drivers/watchdog/sunxi_wdt.c | 20 +++++++-
2 files changed, 66 insertions(+), 2 deletions(-)
--
2.31.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Samuel Holland <samuel@sholland.org> Date: 2021-09-02 22:58:09
On existing SoCs, the watchdog has a single clock input: HOSC (OSC24M)
divided by 750. However, starting with R329, LOSC (OSC32k) is added as
an alternative clock source, with a bit to switch between them.
Since 24 MHz / 750 == 32 kHz, not 32.768 kHz, the hardware adjusts the
cycle counts to keep the timeouts independent of the clock source. This
keeps the programming interface backward-compatible.
Furthermore, the R329 has two watchdogs: one for use by the ARM CPUs
at 0x20000a0, and a second one for use by the DSPs at 0x7020400. The
first of these adds two more new registers, to allow software to
immediately assert the SoC reset signal. Add an additional "-reset"
suffix to signify the presence of this feature.
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
Changes v2 to v3:
- Add else case
- Add additional allwinner,sun50i-r329-wdt-reset compatible
Changes v1 to v2:
- Switch clock-names from enum to const
- Add descriptions to "clocks" items
.../watchdog/allwinner,sun4i-a10-wdt.yaml | 42 ++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
@@ -33,7 +35,18 @@ properties:maxItems:1clocks:-maxItems:1+minItems:1+maxItems:2+items:+-description:High-frequency oscillator input, divided internally+-description:Low-frequency oscillator input, only found on some variants++clock-names:+minItems:1+maxItems:2+items:+-const:hosc+-const:loscinterrupts:maxItems:1
From: Samuel Holland <samuel@sholland.org> Date: 2021-09-02 22:58:14
D1 keeps the same register layout and clock sources as the R329, but it
adds a key field which must be set to update the watchdog's "CFG" and
"MODE" registers. Therefore it is not backward-compatible.
Similarly to the R329, the D1 has three watchdog instances, and only one
of them has the "soft reset" registers. So that instance needs an extra
compatible string.
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
Changes v2 to v3:
- Add additional allwinner,sun20i-d1-wdt-reset compatible
Changes v1 to v2:
- None
.../bindings/watchdog/allwinner,sun4i-a10-wdt.yaml | 6 ++++++
1 file changed, 6 insertions(+)
From: Samuel Holland <samuel@sholland.org> Date: 2021-09-02 22:58:15
D1 adds a key field to the "CFG" and "MODE" registers, that must be set
to change the other bits. Add logic to set the key when updating those
registers.
Acked-by: Maxime Ripard <redacted>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
Changes v2 to v3:
- None
Changes v1 to v2:
- None
drivers/watchdog/sunxi_wdt.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
From: Maxime Ripard <hidden> Date: 2021-09-03 09:30:15
On Thu, Sep 02, 2021 at 05:57:48PM -0500, Samuel Holland wrote:
On existing SoCs, the watchdog has a single clock input: HOSC (OSC24M)
divided by 750. However, starting with R329, LOSC (OSC32k) is added as
an alternative clock source, with a bit to switch between them.
Since 24 MHz / 750 == 32 kHz, not 32.768 kHz, the hardware adjusts the
cycle counts to keep the timeouts independent of the clock source. This
keeps the programming interface backward-compatible.
Furthermore, the R329 has two watchdogs: one for use by the ARM CPUs
at 0x20000a0, and a second one for use by the DSPs at 0x7020400. The
first of these adds two more new registers, to allow software to
immediately assert the SoC reset signal. Add an additional "-reset"
suffix to signify the presence of this feature.
Signed-off-by: Samuel Holland <samuel@sholland.org>
From: Maxime Ripard <hidden> Date: 2021-09-03 09:30:30
On Thu, Sep 02, 2021 at 05:57:49PM -0500, Samuel Holland wrote:
D1 keeps the same register layout and clock sources as the R329, but it
adds a key field which must be set to update the watchdog's "CFG" and
"MODE" registers. Therefore it is not backward-compatible.
Similarly to the R329, the D1 has three watchdog instances, and only one
of them has the "soft reset" registers. So that instance needs an extra
compatible string.
Signed-off-by: Samuel Holland <samuel@sholland.org>
From: Rob Herring <robh@kernel.org> Date: 2021-09-03 16:07:51
On Thu, 02 Sep 2021 17:57:48 -0500, Samuel Holland wrote:
On existing SoCs, the watchdog has a single clock input: HOSC (OSC24M)
divided by 750. However, starting with R329, LOSC (OSC32k) is added as
an alternative clock source, with a bit to switch between them.
Since 24 MHz / 750 == 32 kHz, not 32.768 kHz, the hardware adjusts the
cycle counts to keep the timeouts independent of the clock source. This
keeps the programming interface backward-compatible.
Furthermore, the R329 has two watchdogs: one for use by the ARM CPUs
at 0x20000a0, and a second one for use by the DSPs at 0x7020400. The
first of these adds two more new registers, to allow software to
immediately assert the SoC reset signal. Add an additional "-reset"
suffix to signify the presence of this feature.
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
Changes v2 to v3:
- Add else case
- Add additional allwinner,sun50i-r329-wdt-reset compatible
Changes v1 to v2:
- Switch clock-names from enum to const
- Add descriptions to "clocks" items
.../watchdog/allwinner,sun4i-a10-wdt.yaml | 42 ++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
On Thu, Sep 02, 2021 at 05:57:48PM -0500, Samuel Holland wrote:
On existing SoCs, the watchdog has a single clock input: HOSC (OSC24M)
divided by 750. However, starting with R329, LOSC (OSC32k) is added as
an alternative clock source, with a bit to switch between them.
Since 24 MHz / 750 == 32 kHz, not 32.768 kHz, the hardware adjusts the
cycle counts to keep the timeouts independent of the clock source. This
keeps the programming interface backward-compatible.
Furthermore, the R329 has two watchdogs: one for use by the ARM CPUs
at 0x20000a0, and a second one for use by the DSPs at 0x7020400. The
first of these adds two more new registers, to allow software to
immediately assert the SoC reset signal. Add an additional "-reset"
suffix to signify the presence of this feature.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Maxime Ripard <redacted>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>
quoted hunk
---
Changes v2 to v3:
- Add else case
- Add additional allwinner,sun50i-r329-wdt-reset compatible
Changes v1 to v2:
- Switch clock-names from enum to const
- Add descriptions to "clocks" items
.../watchdog/allwinner,sun4i-a10-wdt.yaml | 42 ++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
@@ -33,7 +35,18 @@ properties:maxItems:1clocks:-maxItems:1+minItems:1+maxItems:2+items:+-description:High-frequency oscillator input, divided internally+-description:Low-frequency oscillator input, only found on some variants++clock-names:+minItems:1+maxItems:2+items:+-const:hosc+-const:loscinterrupts:maxItems:1
On Thu, Sep 02, 2021 at 05:57:49PM -0500, Samuel Holland wrote:
D1 keeps the same register layout and clock sources as the R329, but it
adds a key field which must be set to update the watchdog's "CFG" and
"MODE" registers. Therefore it is not backward-compatible.
Similarly to the R329, the D1 has three watchdog instances, and only one
of them has the "soft reset" registers. So that instance needs an extra
compatible string.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Maxime Ripard <redacted>
From: Rob Herring <robh@kernel.org> Date: 2021-09-07 19:09:13
On Thu, 02 Sep 2021 17:57:49 -0500, Samuel Holland wrote:
D1 keeps the same register layout and clock sources as the R329, but it
adds a key field which must be set to update the watchdog's "CFG" and
"MODE" registers. Therefore it is not backward-compatible.
Similarly to the R329, the D1 has three watchdog instances, and only one
of them has the "soft reset" registers. So that instance needs an extra
compatible string.
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
Changes v2 to v3:
- Add additional allwinner,sun20i-d1-wdt-reset compatible
Changes v1 to v2:
- None
.../bindings/watchdog/allwinner,sun4i-a10-wdt.yaml | 6 ++++++
1 file changed, 6 insertions(+)