2023-12-09 14:28:15

by Ji Sheng Teoh

[permalink] [raw]
Subject: [PATCH v1 0/2] Add StarFive JH8100 watchdog

StarFive's JH8100 watchdog reuses JH7100 register mapping.
This patchset extends the JH7100 watchdog driver to support
JH8100 by adding "starfive,jh8100-wdt" to the compatible field.

DT-binding of JH7100 watchdog is also extended to support JH8100.
Since JH8100 only uses 1 reset signal, update the binding to
support one reset for "starfive,jh8100-wdt" compatible.

Ji Sheng Teoh (2):
watchdog: starfive-wdt: Add JH8100 watchdog compatible string
dt-bindings: watchdog: starfive,jh7100-wdt: Add compatible for JH8100

.../watchdog/starfive,jh7100-wdt.yaml | 29 ++++++++++++++-----
drivers/watchdog/starfive-wdt.c | 1 +
2 files changed, 22 insertions(+), 8 deletions(-)

--
2.25.1


2023-12-09 14:28:27

by Ji Sheng Teoh

[permalink] [raw]
Subject: [PATCH v1 2/2] dt-bindings: watchdog: starfive,jh7100-wdt: Add compatible for JH8100

Add "starfive,jh8100-wdt" compatible string for StarFive's JH8100
watchdog.
Since JH8100 watchdog only has 1 reset signal, update binding
document to support one reset for "starfive,jh8100-wdt" compatible.

Signed-off-by: Ley Foon Tan <[email protected]>
Signed-off-by: Ji Sheng Teoh <[email protected]>
---
.../watchdog/starfive,jh7100-wdt.yaml | 29 ++++++++++++++-----
1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
index 68f3f6fd08a6..eec182317219 100644
--- a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
+++ b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
@@ -19,14 +19,12 @@ description:
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
+ - starfive,jh8100-wdt

reg:
maxItems: 1
@@ -44,11 +42,6 @@ properties:
- const: apb
- const: core

- resets:
- items:
- - description: APB reset
- - description: Core reset
-
required:
- compatible
- reg
@@ -56,6 +49,26 @@ required:
- clock-names
- resets

+allOf:
+ - $ref: watchdog.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - starfive,jh8100-wdt
+ then:
+ properties:
+ resets:
+ items:
+ - description: Watchdog reset
+ else:
+ properties:
+ resets:
+ items:
+ - description: APB reset
+ - description: Core reset
+
unevaluatedProperties: false

examples:
--
2.25.1

2023-12-09 14:28:27

by Ji Sheng Teoh

[permalink] [raw]
Subject: [PATCH v1 1/2] watchdog: starfive-wdt: Add JH8100 watchdog compatible string

Add "starfive,jh8100-wdt" compatible for StarFive's JH8100 watchdog.
JH8100 watchdog reuses JH7110 register mapping.

Signed-off-by: Ley Foon Tan <[email protected]>
Signed-off-by: Ji Sheng Teoh <[email protected]>
---
drivers/watchdog/starfive-wdt.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
index 5f501b41faf9..31785bb373d5 100644
--- a/drivers/watchdog/starfive-wdt.c
+++ b/drivers/watchdog/starfive-wdt.c
@@ -581,6 +581,7 @@ static const struct dev_pm_ops starfive_wdt_pm_ops = {
static const struct of_device_id starfive_wdt_match[] = {
{ .compatible = "starfive,jh7100-wdt", .data = &starfive_wdt_jh7100_variant },
{ .compatible = "starfive,jh7110-wdt", .data = &starfive_wdt_jh7110_variant },
+ { .compatible = "starfive,jh8100-wdt", .data = &starfive_wdt_jh7110_variant },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, starfive_wdt_match);
--
2.25.1

2023-12-09 15:07:47

by Guenter Roeck

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] watchdog: starfive-wdt: Add JH8100 watchdog compatible string

On 12/9/23 06:27, Ji Sheng Teoh wrote:
> Add "starfive,jh8100-wdt" compatible for StarFive's JH8100 watchdog.
> JH8100 watchdog reuses JH7110 register mapping.
>
> Signed-off-by: Ley Foon Tan <[email protected]>
> Signed-off-by: Ji Sheng Teoh <[email protected]>

Reviewed-by: Guenter Roeck <[email protected]>

> ---
> drivers/watchdog/starfive-wdt.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
> index 5f501b41faf9..31785bb373d5 100644
> --- a/drivers/watchdog/starfive-wdt.c
> +++ b/drivers/watchdog/starfive-wdt.c
> @@ -581,6 +581,7 @@ static const struct dev_pm_ops starfive_wdt_pm_ops = {
> static const struct of_device_id starfive_wdt_match[] = {
> { .compatible = "starfive,jh7100-wdt", .data = &starfive_wdt_jh7100_variant },
> { .compatible = "starfive,jh7110-wdt", .data = &starfive_wdt_jh7110_variant },
> + { .compatible = "starfive,jh8100-wdt", .data = &starfive_wdt_jh7110_variant },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, starfive_wdt_match);

2023-12-11 10:06:21

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] dt-bindings: watchdog: starfive,jh7100-wdt: Add compatible for JH8100

On 09/12/2023 15:27, Ji Sheng Teoh wrote:
> Add "starfive,jh8100-wdt" compatible string for StarFive's JH8100
> watchdog.
> Since JH8100 watchdog only has 1 reset signal, update binding
> document to support one reset for "starfive,jh8100-wdt" compatible.
>
> Signed-off-by: Ley Foon Tan <[email protected]>
> Signed-off-by: Ji Sheng Teoh <[email protected]>
> ---
> .../watchdog/starfive,jh7100-wdt.yaml | 29 ++++++++++++++-----
> 1 file changed, 21 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> index 68f3f6fd08a6..eec182317219 100644
> --- a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> +++ b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> @@ -19,14 +19,12 @@ description:
> 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
> + - starfive,jh8100-wdt
>
> reg:
> maxItems: 1
> @@ -44,11 +42,6 @@ properties:
> - const: apb
> - const: core
>
> - resets:

No, keep it here with min/maxItems.

> - items:
> - - description: APB reset
> - - description: Core reset
> -
> required:
> - compatible
> - reg
> @@ -56,6 +49,26 @@ required:
> - clock-names
> - resets
>
> +allOf:
> + - $ref: watchdog.yaml#
> + - if:
> + properties:
> + compatible:
> + contains:
> + enum:
> + - starfive,jh8100-wdt
> + then:
> + properties:
> + resets:
> + items:
> + - description: Watchdog reset

Why is it called "Watchdog"? How is it different from "Core"?

Best regards,
Krzysztof

2023-12-11 10:06:56

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] watchdog: starfive-wdt: Add JH8100 watchdog compatible string

On 09/12/2023 15:27, Ji Sheng Teoh wrote:
> Add "starfive,jh8100-wdt" compatible for StarFive's JH8100 watchdog.
> JH8100 watchdog reuses JH7110 register mapping.
>
> Signed-off-by: Ley Foon Tan <[email protected]>
> Signed-off-by: Ji Sheng Teoh <[email protected]>
> ---
> drivers/watchdog/starfive-wdt.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c
> index 5f501b41faf9..31785bb373d5 100644
> --- a/drivers/watchdog/starfive-wdt.c
> +++ b/drivers/watchdog/starfive-wdt.c
> @@ -581,6 +581,7 @@ static const struct dev_pm_ops starfive_wdt_pm_ops = {
> static const struct of_device_id starfive_wdt_match[] = {
> { .compatible = "starfive,jh7100-wdt", .data = &starfive_wdt_jh7100_variant },
> { .compatible = "starfive,jh7110-wdt", .data = &starfive_wdt_jh7110_variant },
> + { .compatible = "starfive,jh8100-wdt", .data = &starfive_wdt_jh7110_variant },

Device is compatible, so why not expressing it in the bindings and
dropping this change?

Best regards,
Krzysztof

2023-12-11 16:47:48

by Ji Sheng Teoh

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] watchdog: starfive-wdt: Add JH8100 watchdog compatible string

On Mon, 11 Dec 2023 11:06:42 +0100
Krzysztof Kozlowski <[email protected]> wrote:

> On 09/12/2023 15:27, Ji Sheng Teoh wrote:
> > Add "starfive,jh8100-wdt" compatible for StarFive's JH8100 watchdog.
> > JH8100 watchdog reuses JH7110 register mapping.
> >
> > Signed-off-by: Ley Foon Tan <[email protected]>
> > Signed-off-by: Ji Sheng Teoh <[email protected]>
> > ---
> > drivers/watchdog/starfive-wdt.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/watchdog/starfive-wdt.c
> > b/drivers/watchdog/starfive-wdt.c index 5f501b41faf9..31785bb373d5
> > 100644 --- a/drivers/watchdog/starfive-wdt.c
> > +++ b/drivers/watchdog/starfive-wdt.c
> > @@ -581,6 +581,7 @@ static const struct dev_pm_ops
> > starfive_wdt_pm_ops = { static const struct of_device_id
> > starfive_wdt_match[] = { { .compatible = "starfive,jh7100-wdt",
> > .data = &starfive_wdt_jh7100_variant }, { .compatible =
> > "starfive,jh7110-wdt", .data = &starfive_wdt_jh7110_variant },
> > + { .compatible = "starfive,jh8100-wdt", .data =
> > &starfive_wdt_jh7110_variant },
>
> Device is compatible, so why not expressing it in the bindings and
> dropping this change?
>
> Best regards,
> Krzysztof
>

Ok, will drop this change.

Thanks,
Ji Sheng

2023-12-11 16:58:17

by Ji Sheng Teoh

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] dt-bindings: watchdog: starfive,jh7100-wdt: Add compatible for JH8100

On Mon, 11 Dec 2023 11:06:09 +0100
Krzysztof Kozlowski <[email protected]> wrote:

> On 09/12/2023 15:27, Ji Sheng Teoh wrote:
> > Add "starfive,jh8100-wdt" compatible string for StarFive's JH8100
> > watchdog.
> > Since JH8100 watchdog only has 1 reset signal, update binding
> > document to support one reset for "starfive,jh8100-wdt" compatible.
> >
> > Signed-off-by: Ley Foon Tan <[email protected]>
> > Signed-off-by: Ji Sheng Teoh <[email protected]>
> > ---
> > .../watchdog/starfive,jh7100-wdt.yaml | 29
> > ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> > b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> > index 68f3f6fd08a6..eec182317219 100644 ---
> > a/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> > +++
> > b/Documentation/devicetree/bindings/watchdog/starfive,jh7100-wdt.yaml
> > @@ -19,14 +19,12 @@ description: 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
> > + - starfive,jh8100-wdt
> >
> > reg:
> > maxItems: 1
> > @@ -44,11 +42,6 @@ properties:
> > - const: apb
> > - const: core
> >
> > - resets:
>
> No, keep it here with min/maxItems.
>

Ok, will change it up to use min/maxItems.

> > - items:
> > - - description: APB reset
> > - - description: Core reset
> > -
> > required:
> > - compatible
> > - reg
> > @@ -56,6 +49,26 @@ required:
> > - clock-names
> > - resets
> >
> > +allOf:
> > + - $ref: watchdog.yaml#
> > + - if:
> > + properties:
> > + compatible:
> > + contains:
> > + enum:
> > + - starfive,jh8100-wdt
> > + then:
> > + properties:
> > + resets:
> > + items:
> > + - description: Watchdog reset
>
> Why is it called "Watchdog"? How is it different from "Core"?

Will standardize them to use "Core" instead. Thanks.

>
> Best regards,
> Krzysztof
>

2023-12-12 03:09:15

by Xingyu Wu

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] watchdog: starfive-wdt: Add JH8100 watchdog compatible string

On 2023/12/12 0:47, Ji Sheng Teoh wrote:
> On Mon, 11 Dec 2023 11:06:42 +0100
> Krzysztof Kozlowski <[email protected]> wrote:
>
>> On 09/12/2023 15:27, Ji Sheng Teoh wrote:
>> > Add "starfive,jh8100-wdt" compatible for StarFive's JH8100 watchdog.
>> > JH8100 watchdog reuses JH7110 register mapping.
>> >
>> > Signed-off-by: Ley Foon Tan <[email protected]>
>> > Signed-off-by: Ji Sheng Teoh <[email protected]>
>> > ---
>> > drivers/watchdog/starfive-wdt.c | 1 +
>> > 1 file changed, 1 insertion(+)
>> >
>> > diff --git a/drivers/watchdog/starfive-wdt.c
>> > b/drivers/watchdog/starfive-wdt.c index 5f501b41faf9..31785bb373d5
>> > 100644 --- a/drivers/watchdog/starfive-wdt.c
>> > +++ b/drivers/watchdog/starfive-wdt.c
>> > @@ -581,6 +581,7 @@ static const struct dev_pm_ops
>> > starfive_wdt_pm_ops = { static const struct of_device_id
>> > starfive_wdt_match[] = { { .compatible = "starfive,jh7100-wdt",
>> > .data = &starfive_wdt_jh7100_variant }, { .compatible =
>> > "starfive,jh7110-wdt", .data = &starfive_wdt_jh7110_variant },
>> > + { .compatible = "starfive,jh8100-wdt", .data =
>> > &starfive_wdt_jh7110_variant },
>>
>> Device is compatible, so why not expressing it in the bindings and
>> dropping this change?
>>
>> Best regards,
>> Krzysztof
>>
>
> Ok, will drop this change.
>
> Thanks,
> Ji Sheng

Hi Ji Sheng,

You can add the compatible "starfive,jh8100-wdt" in the bindings and add this:

compatible = "starfive,jh8100-wdt", "starfive,jh7110-wdt";

in the dts. I think it would be better and does not change the driver.

Best regards,
Xingyu Wu

2023-12-12 03:27:51

by Ji Sheng Teoh

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] watchdog: starfive-wdt: Add JH8100 watchdog compatible string

On Tue, 12 Dec 2023 11:01:21 +0800
Xingyu Wu <[email protected]> wrote:

> On 2023/12/12 0:47, Ji Sheng Teoh wrote:
> > On Mon, 11 Dec 2023 11:06:42 +0100
> > Krzysztof Kozlowski <[email protected]> wrote:
> >
> >> On 09/12/2023 15:27, Ji Sheng Teoh wrote:
> >> > Add "starfive,jh8100-wdt" compatible for StarFive's JH8100
> >> > watchdog. JH8100 watchdog reuses JH7110 register mapping.
> >> >
> >> > Signed-off-by: Ley Foon Tan <[email protected]>
> >> > Signed-off-by: Ji Sheng Teoh <[email protected]>
> >> > ---
> >> > drivers/watchdog/starfive-wdt.c | 1 +
> >> > 1 file changed, 1 insertion(+)
> >> >
> >> > diff --git a/drivers/watchdog/starfive-wdt.c
> >> > b/drivers/watchdog/starfive-wdt.c index
> >> > 5f501b41faf9..31785bb373d5 100644 ---
> >> > a/drivers/watchdog/starfive-wdt.c +++
> >> > b/drivers/watchdog/starfive-wdt.c @@ -581,6 +581,7 @@ static
> >> > const struct dev_pm_ops starfive_wdt_pm_ops = { static const
> >> > struct of_device_id starfive_wdt_match[] = { { .compatible =
> >> > "starfive,jh7100-wdt", .data = &starfive_wdt_jh7100_variant }, {
> >> > .compatible = "starfive,jh7110-wdt", .data =
> >> > &starfive_wdt_jh7110_variant },
> >> > + { .compatible = "starfive,jh8100-wdt", .data =
> >> > &starfive_wdt_jh7110_variant },
> >>
> >> Device is compatible, so why not expressing it in the bindings and
> >> dropping this change?
> >>
> >> Best regards,
> >> Krzysztof
> >>
> >
> > Ok, will drop this change.
> >
> > Thanks,
> > Ji Sheng
>
> Hi Ji Sheng,
>
> You can add the compatible "starfive,jh8100-wdt" in the bindings and
> add this:
>
> compatible = "starfive,jh8100-wdt", "starfive,jh7110-wdt";
>
> in the dts. I think it would be better and does not change the driver.
>
> Best regards,
> Xingyu Wu

Thanks for the suggestion, will go with this approach.
I have respin a v2 for this, as it only requires small changes.
v2: https://lore.kernel.org/all/[email protected]/