2023-03-08 03:41:05

by Xingyu Wu

[permalink] [raw]
Subject: [PATCH v4 0/3] Add watchdog driver for StarFive JH7100/JH7110 RISC-V SoCs

This patch serises are to add watchdog driver for the StarFive
JH7100 and JH7110 RISC-V SoCs. The first patch adds docunmentation to
describe device tree bindings. The subsequent patch adds watchdog driver
and support JH7100/JH7110 SoCs. And the last patch adds watchdog node in
the JH7100 dts. And the addition of JH7110 device tree node will be
submitted after the JH7110 dts merge. This patchset is based on 6.3-rc1.

The watchdog driver has been tested on the VisionFive 1 and VisionFive 2
boards which equip with JH7100 and JH7110 SoCs respectively and both
works normally.

Changes since v3:
- Modified the dt-binding, driver and dts to support JH7100 watchdog.
- Modified the register comments.
- Changed the return value and order when getting clock rate.
- Used dev_err_probe() when getting clocks and resets.
- Improved the codes of setting default timeout.
- Moved the watchdog_register_device() after setting WDOG_HW_RUNNING.
- Changed 'SOC_STARFIVE' to 'ARCH_STARFIVE' in Kconfig file.
- Dropped the struct of platform_device_id.
- Used new functions to enable or disable clock.

Changes since v2:
- Added watchdog.yaml and unevaluatedProperties in the dt-binding.
- Removed some unnecessary include files.
- Changed the 'module_param' name and dropped 'soft_noboot'.
- Rrmoved 'CONFIG_OF'.
- Added a check if clock rate is 0.
- Modified the max_timeout calculation formula.
- Removed restart function.
- Removed duplicate checks on the upper and lower bounds of 'count'.
- Removed 'started' variable.
- Added pm_runtime_get_sync() and pm_runtime_put_sync().
- Removed 'firmware_version = 0' variable.
- Drop the device tree node commit.

Changes since v1:
- Renamed the dt-binding 'starfive,wdt.yaml' to 'starfive,jh7110-wdt.yaml'.
- Dropped the '_clk' and 'rst_' about the 'clock-names' and 'reset-names'
in the dt-binding.
- Updated the example context in the dt-binding 'starfive,jh7110-wdt.yaml'
to be independent of other patchset.
- Deleted unused macros like 'JH7110_WDOG_INT_EN'.
- Changed the type of 'freq' in the struct from u64 to u32.
- Used 'devm_clk_get_enabled()' instead of 'devm_clk_get()' and
'clk_prepare_enable()'.
- Removed the operation to get the frequency from the device tree.
- Added watchdog_stop_on_unregister() and watchdog_stop_on_reboot().
- Removed any operations about interrupt.

v3:
--- https://lore.kernel.org/all/[email protected]/
v2:
--- https://lore.kernel.org/all/[email protected]/
v1:
--- https://lore.kernel.org/all/[email protected]/

Xingyu Wu (3):
dt-bindings: watchdog: Add watchdog for StarFive JH7100 and JH7110
drivers: watchdog: Add StarFive Watchdog driver
riscv: dts: starfive: jh7100: Add watchdog node

.../watchdog/starfive,jh7100-wdt.yaml | 71 ++
MAINTAINERS | 7 +
arch/riscv/boot/dts/starfive/jh7100.dtsi | 10 +
drivers/watchdog/Kconfig | 9 +
drivers/watchdog/Makefile | 2 +
drivers/watchdog/starfive-wdt.c | 675 ++++++++++++++++++
6 files changed, 774 insertions(+)
create mode 100644 Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
create mode 100644 drivers/watchdog/starfive-wdt.c


base-commit: 8ca09d5fa3549d142c2080a72a4c70ce389163cd
prerequisite-patch-id: 558a5b43260d13a6f5229b139ccd45f737a4f686
--
2.25.1



2023-03-08 03:41:19

by Xingyu Wu

[permalink] [raw]
Subject: [PATCH v4 1/3] dt-bindings: watchdog: Add watchdog for StarFive JH7100 and JH7110

Add bindings to describe the watchdog for the StarFive JH7100/JH7110 SoC.
And Use JH7100 as first StarFive SoC with watchdog.

Signed-off-by: Xingyu Wu <[email protected]>
---
.../watchdog/starfive,jh7100-wdt.yaml | 71 +++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml

diff --git a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
new file mode 100644
index 000000000000..68f3f6fd08a6
--- /dev/null
+++ b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
@@ -0,0 +1,71 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/watchdog/starfive,jh7100-wdt.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive Watchdog for JH7100 and JH7110 SoC
+
+maintainers:
+ - Xingyu Wu <[email protected]>
+ - Samin Guo <[email protected]>
+
+description:
+ The JH7100 and JH7110 watchdog both are 32 bit counters. JH7100 watchdog
+ has only one timeout phase and reboots. And JH7110 watchdog has two
+ timeout phases. At the first phase, the signal of watchdog interrupt
+ output(WDOGINT) will rise when counter is 0. The counter will reload
+ the timeout value. And then, if counter decreases to 0 again and WDOGINT
+ isn't cleared, the watchdog will reset the system unless the watchdog
+ reset is disabled.
+
+allOf:
+ - $ref: watchdog.yaml#
+
+properties:
+ compatible:
+ enum:
+ - starfive,jh7100-wdt
+ - starfive,jh7110-wdt
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ clocks:
+ items:
+ - description: APB clock
+ - description: Core clock
+
+ clock-names:
+ items:
+ - const: apb
+ - const: core
+
+ resets:
+ items:
+ - description: APB reset
+ - description: Core reset
+
+required:
+ - compatible
+ - reg
+ - clocks
+ - clock-names
+ - resets
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ watchdog@12480000 {
+ compatible = "starfive,jh7100-wdt";
+ reg = <0x12480000 0x10000>;
+ clocks = <&clk 171>,
+ <&clk 172>;
+ clock-names = "apb", "core";
+ resets = <&rst 99>,
+ <&rst 100>;
+ };
--
2.25.1


2023-03-08 03:41:22

by Xingyu Wu

[permalink] [raw]
Subject: [PATCH v4 3/3] riscv: dts: starfive: jh7100: Add watchdog node

Add watchdog node for the StarFive JH7100 RISC-V SoC.

Signed-off-by: Xingyu Wu <[email protected]>
---
arch/riscv/boot/dts/starfive/jh7100.dtsi | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/arch/riscv/boot/dts/starfive/jh7100.dtsi b/arch/riscv/boot/dts/starfive/jh7100.dtsi
index 000447482aca..1eb7c21a94fd 100644
--- a/arch/riscv/boot/dts/starfive/jh7100.dtsi
+++ b/arch/riscv/boot/dts/starfive/jh7100.dtsi
@@ -238,5 +238,15 @@ i2c3: i2c@12460000 {
#size-cells = <0>;
status = "disabled";
};
+
+ wdog: watchdog@12480000 {
+ compatible = "starfive,jh7100-wdt";
+ reg = <0x0 0x12480000 0x0 0x10000>;
+ clocks = <&clkgen JH7100_CLK_WDTIMER_APB>,
+ <&clkgen JH7100_CLK_WDT_CORE>;
+ clock-names = "apb", "core";
+ resets = <&rstgen JH7100_RSTN_WDTIMER_APB>,
+ <&rstgen JH7100_RSTN_WDT>;
+ };
};
};
--
2.25.1


2023-03-08 16:10:31

by Emil Renner Berthing

[permalink] [raw]
Subject: Re: [PATCH v4 3/3] riscv: dts: starfive: jh7100: Add watchdog node

On Wed, 8 Mar 2023 at 04:42, Xingyu Wu <[email protected]> wrote:
>
> Add watchdog node for the StarFive JH7100 RISC-V SoC.
>
> Signed-off-by: Xingyu Wu <[email protected]>
> ---
> arch/riscv/boot/dts/starfive/jh7100.dtsi | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/arch/riscv/boot/dts/starfive/jh7100.dtsi b/arch/riscv/boot/dts/starfive/jh7100.dtsi
> index 000447482aca..1eb7c21a94fd 100644
> --- a/arch/riscv/boot/dts/starfive/jh7100.dtsi
> +++ b/arch/riscv/boot/dts/starfive/jh7100.dtsi
> @@ -238,5 +238,15 @@ i2c3: i2c@12460000 {
> #size-cells = <0>;
> status = "disabled";
> };
> +
> + wdog: watchdog@12480000 {

I don't see anything referencing this node, so the label can be dropped.
With that fixed:
Reviewed-by: Emil Renner Berthing <[email protected]>

> + compatible = "starfive,jh7100-wdt";
> + reg = <0x0 0x12480000 0x0 0x10000>;
> + clocks = <&clkgen JH7100_CLK_WDTIMER_APB>,
> + <&clkgen JH7100_CLK_WDT_CORE>;
> + clock-names = "apb", "core";
> + resets = <&rstgen JH7100_RSTN_WDTIMER_APB>,
> + <&rstgen JH7100_RSTN_WDT>;
> + };
> };
> };
> --
> 2.25.1
>
>
> _______________________________________________
> linux-riscv mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-riscv

2023-03-09 02:54:48

by Xingyu Wu

[permalink] [raw]
Subject: Re: [PATCH v4 3/3] riscv: dts: starfive: jh7100: Add watchdog node

On 2023/3/9 0:09, Emil Renner Berthing wrote:
> On Wed, 8 Mar 2023 at 04:42, Xingyu Wu <[email protected]> wrote:
>>
>> Add watchdog node for the StarFive JH7100 RISC-V SoC.
>>
>> Signed-off-by: Xingyu Wu <[email protected]>
>> ---
>> arch/riscv/boot/dts/starfive/jh7100.dtsi | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/arch/riscv/boot/dts/starfive/jh7100.dtsi b/arch/riscv/boot/dts/starfive/jh7100.dtsi
>> index 000447482aca..1eb7c21a94fd 100644
>> --- a/arch/riscv/boot/dts/starfive/jh7100.dtsi
>> +++ b/arch/riscv/boot/dts/starfive/jh7100.dtsi
>> @@ -238,5 +238,15 @@ i2c3: i2c@12460000 {
>> #size-cells = <0>;
>> status = "disabled";
>> };
>> +
>> + wdog: watchdog@12480000 {
>
> I don't see anything referencing this node, so the label can be dropped.
> With that fixed:
> Reviewed-by: Emil Renner Berthing <[email protected]>
>

Will drop the label and just use:
watchdog@12480000 {

Best regards,
Xingyu Wu

2023-03-09 07:30:23

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] dt-bindings: watchdog: Add watchdog for StarFive JH7100 and JH7110

On 08/03/2023 04:40, Xingyu Wu wrote:
> Add bindings to describe the watchdog for the StarFive JH7100/JH7110 SoC.
> And Use JH7100 as first StarFive SoC with watchdog.
>
> Signed-off-by: Xingyu Wu <[email protected]>
> ---

What happened here? You wrote in changelog "Modified" but what exactly?
How am I supposed to find it?

Provide detailed description, since you decided to remove my tag.
Otherwise, standard response:

This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new
versions. However, there's no need to repost patches *only* to add the
tags. The upstream maintainer will do that for acks received on the
version they apply.

https://elixir.bootlin.com/linux/v5.17/source/Documentation/process/submitting-patches.rst#L540

If a tag was not added on purpose, please state why and what changed.



Best regards,
Krzysztof


2023-03-09 08:19:03

by Xingyu Wu

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] dt-bindings: watchdog: Add watchdog for StarFive JH7100 and JH7110

On 2023/3/9 15:30, Krzysztof Kozlowski wrote:
> On 08/03/2023 04:40, Xingyu Wu wrote:
>> Add bindings to describe the watchdog for the StarFive JH7100/JH7110 SoC.
>> And Use JH7100 as first StarFive SoC with watchdog.
>>
>> Signed-off-by: Xingyu Wu <[email protected]>
>> ---
>
> What happened here? You wrote in changelog "Modified" but what exactly?
> How am I supposed to find it?
>
> Provide detailed description, since you decided to remove my tag.
> Otherwise, standard response:
>
> This is a friendly reminder during the review process.
>
> It looks like you received a tag and forgot to add it.
>
> If you do not know the process, here is a short explanation:
> Please add Acked-by/Reviewed-by/Tested-by tags when posting new
> versions. However, there's no need to repost patches *only* to add the
> tags. The upstream maintainer will do that for acks received on the
> version they apply.
>
> https://elixir.bootlin.com/linux/v5.17/source/Documentation/process/submitting-patches.rst#L540
>
> If a tag was not added on purpose, please state why and what changed.
>

I am sorry I did not elaborate it. The dt-bindings was only supported JH7110 watchdog in v3 patchset
and you had sent Reviewed-by tags. But at the same time tried to add JH7100 watchdog after discussion
and used JH7100 as the dt-binding's name because JH7100 is the first StarFive SoCs about watchdog.
The compatible also add 'starfive,jh7100-wdt' in the dt-binding. It is different from the v3 patch and
I did not add the Reviewed-by tag.

Best regards,
Xingyu Wu


2023-03-09 08:37:36

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] dt-bindings: watchdog: Add watchdog for StarFive JH7100 and JH7110

On 09/03/2023 09:13, Xingyu Wu wrote:
> On 2023/3/9 15:30, Krzysztof Kozlowski wrote:
>> On 08/03/2023 04:40, Xingyu Wu wrote:
>>> Add bindings to describe the watchdog for the StarFive JH7100/JH7110 SoC.
>>> And Use JH7100 as first StarFive SoC with watchdog.
>>>
>>> Signed-off-by: Xingyu Wu <[email protected]>
>>> ---
>>
>> What happened here? You wrote in changelog "Modified" but what exactly?
>> How am I supposed to find it?
>>
>> Provide detailed description, since you decided to remove my tag.
>> Otherwise, standard response:
>>
>> This is a friendly reminder during the review process.
>>
>> It looks like you received a tag and forgot to add it.
>>
>> If you do not know the process, here is a short explanation:
>> Please add Acked-by/Reviewed-by/Tested-by tags when posting new
>> versions. However, there's no need to repost patches *only* to add the
>> tags. The upstream maintainer will do that for acks received on the
>> version they apply.
>>
>> https://elixir.bootlin.com/linux/v5.17/source/Documentation/process/submitting-patches.rst#L540
>>
>> If a tag was not added on purpose, please state why and what changed.
>>
>
> I am sorry I did not elaborate it. The dt-bindings was only supported JH7110 watchdog in v3 patchset
> and you had sent Reviewed-by tags. But at the same time tried to add JH7100 watchdog after discussion
> and used JH7100 as the dt-binding's name because JH7100 is the first StarFive SoCs about watchdog.
> The compatible also add 'starfive,jh7100-wdt' in the dt-binding. It is different from the v3 patch and
> I did not add the Reviewed-by tag.

So what is the difference? Filename and new compatible?

Best regards,
Krzysztof


2023-03-09 08:45:00

by Xingyu Wu

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] dt-bindings: watchdog: Add watchdog for StarFive JH7100 and JH7110

On 2023/3/9 16:35, Krzysztof Kozlowski wrote:
> On 09/03/2023 09:13, Xingyu Wu wrote:
>> On 2023/3/9 15:30, Krzysztof Kozlowski wrote:
>>> On 08/03/2023 04:40, Xingyu Wu wrote:
>>>> Add bindings to describe the watchdog for the StarFive JH7100/JH7110 SoC.
>>>> And Use JH7100 as first StarFive SoC with watchdog.
>>>>
>>>> Signed-off-by: Xingyu Wu <[email protected]>
>>>> ---
>>>
>>> What happened here? You wrote in changelog "Modified" but what exactly?
>>> How am I supposed to find it?
>>>
>>> Provide detailed description, since you decided to remove my tag.
>>> Otherwise, standard response:
>>>
>>> This is a friendly reminder during the review process.
>>>
>>> It looks like you received a tag and forgot to add it.
>>>
>>> If you do not know the process, here is a short explanation:
>>> Please add Acked-by/Reviewed-by/Tested-by tags when posting new
>>> versions. However, there's no need to repost patches *only* to add the
>>> tags. The upstream maintainer will do that for acks received on the
>>> version they apply.
>>>
>>> https://elixir.bootlin.com/linux/v5.17/source/Documentation/process/submitting-patches.rst#L540
>>>
>>> If a tag was not added on purpose, please state why and what changed.
>>>
>>
>> I am sorry I did not elaborate it. The dt-bindings was only supported JH7110 watchdog in v3 patchset
>> and you had sent Reviewed-by tags. But at the same time tried to add JH7100 watchdog after discussion
>> and used JH7100 as the dt-binding's name because JH7100 is the first StarFive SoCs about watchdog.
>> The compatible also add 'starfive,jh7100-wdt' in the dt-binding. It is different from the v3 patch and
>> I did not add the Reviewed-by tag.
>
> So what is the difference? Filename and new compatible?
>

Yes. So are these acceptable and can still add the tag?

Best regards,
Xingyu Wu

2023-03-09 08:59:01

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] dt-bindings: watchdog: Add watchdog for StarFive JH7100 and JH7110

On 08/03/2023 04:40, Xingyu Wu wrote:
> Add bindings to describe the watchdog for the StarFive JH7100/JH7110 SoC.
> And Use JH7100 as first StarFive SoC with watchdog.
>
> Signed-off-by: Xingyu Wu <[email protected]>
> ---


Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof


2023-03-09 09:02:43

by Xingyu Wu

[permalink] [raw]
Subject: Re: [PATCH v4 1/3] dt-bindings: watchdog: Add watchdog for StarFive JH7100 and JH7110

On 2023/3/9 16:56, Krzysztof Kozlowski wrote:
> On 08/03/2023 04:40, Xingyu Wu wrote:
>> Add bindings to describe the watchdog for the StarFive JH7100/JH7110 SoC.
>> And Use JH7100 as first StarFive SoC with watchdog.
>>
>> Signed-off-by: Xingyu Wu <[email protected]>
>> ---
>
>
> Reviewed-by: Krzysztof Kozlowski <[email protected]>
>

Thank you for your understanding

Best regards,
Xingyu Wu