2023-12-06 01:43:03

by Jia Jie Ho

[permalink] [raw]
Subject: [PATCH 0/3] hwrng: starfive: Add support for JH8100

This series adds driver support for StarFive JH8100 trng. It also adds
suspend-to-idle support for the original driver.

Thanks,
Jia Jie

Jia Jie Ho (3):
dt-bindings: rng: starfive: Add jh8100 compatible string
hwrng: starfive - Update compatible string
hwrng: starfive - Add suspend-to-idle support

.../devicetree/bindings/rng/starfive,jh7110-trng.yaml | 4 +++-
drivers/char/hw_random/jh7110-trng.c | 11 ++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)

--
2.34.1


2023-12-06 01:43:10

by Jia Jie Ho

[permalink] [raw]
Subject: [PATCH 1/3] dt-bindings: rng: starfive: Add jh8100 compatible string

Add compatible string for StarFive JH8100 trng.

Signed-off-by: Jia Jie Ho <[email protected]>
---
.../devicetree/bindings/rng/starfive,jh7110-trng.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml b/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml
index 2b76ce25acc4..d275bdc4d009 100644
--- a/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml
+++ b/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml
@@ -11,7 +11,9 @@ maintainers:

properties:
compatible:
- const: starfive,jh7110-trng
+ enum:
+ - starfive,jh7110-trng
+ - starfive,jh8100-trng

reg:
maxItems: 1
--
2.34.1

2023-12-06 01:43:28

by Jia Jie Ho

[permalink] [raw]
Subject: [PATCH 2/3] hwrng: starfive - Update compatible string

Add compatible string for StarFive JH8100 SoC.

Signed-off-by: Jia Jie Ho <[email protected]>
---
drivers/char/hw_random/jh7110-trng.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/char/hw_random/jh7110-trng.c b/drivers/char/hw_random/jh7110-trng.c
index 38474d48a25e..46272a9e5964 100644
--- a/drivers/char/hw_random/jh7110-trng.c
+++ b/drivers/char/hw_random/jh7110-trng.c
@@ -374,6 +374,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(starfive_trng_pm_ops, starfive_trng_suspend,

static const struct of_device_id trng_dt_ids[] __maybe_unused = {
{ .compatible = "starfive,jh7110-trng" },
+ { .compatible = "starfive,jh8100-trng" },
{ }
};
MODULE_DEVICE_TABLE(of, trng_dt_ids);
@@ -381,7 +382,7 @@ MODULE_DEVICE_TABLE(of, trng_dt_ids);
static struct platform_driver starfive_trng_driver = {
.probe = starfive_trng_probe,
.driver = {
- .name = "jh7110-trng",
+ .name = "starfive-trng",
.pm = &starfive_trng_pm_ops,
.of_match_table = of_match_ptr(trng_dt_ids),
},
--
2.34.1

2023-12-06 01:43:30

by Jia Jie Ho

[permalink] [raw]
Subject: [PATCH 3/3] hwrng: starfive - Add suspend-to-idle support

Define SET_SYSTEM_SLEEP_PM_OPS for StarFive TRNG driver.

Signed-off-by: Jia Jie Ho <[email protected]>
---
drivers/char/hw_random/jh7110-trng.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/jh7110-trng.c b/drivers/char/hw_random/jh7110-trng.c
index 46272a9e5964..2f77f811a383 100644
--- a/drivers/char/hw_random/jh7110-trng.c
+++ b/drivers/char/hw_random/jh7110-trng.c
@@ -369,8 +369,12 @@ static int __maybe_unused starfive_trng_resume(struct device *dev)
return 0;
}

-static DEFINE_SIMPLE_DEV_PM_OPS(starfive_trng_pm_ops, starfive_trng_suspend,
- starfive_trng_resume);
+static const struct dev_pm_ops starfive_trng_pm_ops = {
+ SET_SYSTEM_SLEEP_PM_OPS(starfive_trng_suspend,
+ starfive_trng_resume)
+ SET_RUNTIME_PM_OPS(starfive_trng_suspend,
+ starfive_trng_resume, NULL)
+};

static const struct of_device_id trng_dt_ids[] __maybe_unused = {
{ .compatible = "starfive,jh7110-trng" },
--
2.34.1

2023-12-06 10:17:36

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: rng: starfive: Add jh8100 compatible string

On 06/12/2023 02:42, Jia Jie Ho wrote:
> Add compatible string for StarFive JH8100 trng.
>
> Signed-off-by: Jia Jie Ho <[email protected]>
> ---
> .../devicetree/bindings/rng/starfive,jh7110-trng.yaml | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml b/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml
> index 2b76ce25acc4..d275bdc4d009 100644
> --- a/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml
> +++ b/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml
> @@ -11,7 +11,9 @@ maintainers:
>
> properties:
> compatible:
> - const: starfive,jh7110-trng
> + enum:
> + - starfive,jh7110-trng
> + - starfive,jh8100-trng

Your driver change suggests these are compatible, so express this here
and drop driver change.

Best regards,
Krzysztof

2023-12-07 02:34:01

by Jia Jie Ho

[permalink] [raw]
Subject: Re: [PATCH 1/3] dt-bindings: rng: starfive: Add jh8100 compatible string

On 6/12/2023 6:17 pm, Krzysztof Kozlowski wrote:
> On 06/12/2023 02:42, Jia Jie Ho wrote:
>> Add compatible string for StarFive JH8100 trng.
>>
>> Signed-off-by: Jia Jie Ho <[email protected]>
>> ---
>> .../devicetree/bindings/rng/starfive,jh7110-trng.yaml | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml b/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml
>> index 2b76ce25acc4..d275bdc4d009 100644
>> --- a/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml
>> +++ b/Documentation/devicetree/bindings/rng/starfive,jh7110-trng.yaml
>> @@ -11,7 +11,9 @@ maintainers:
>>
>> properties:
>> compatible:
>> - const: starfive,jh7110-trng
>> + enum:
>> + - starfive,jh7110-trng
>> + - starfive,jh8100-trng
>
> Your driver change suggests these are compatible, so express this here
> and drop driver change.
>

I'll update the series accordingly. Thanks for reviewing this.

Best regards,
Jia Jie