2023-09-05 16:06:56

by Martin Botka

[permalink] [raw]
Subject: [PATCH 0/6] cpufreq for H616

Hello,

This patch series adds support for cpufreq on H616 SoC.

H616 is bit interesting. It has SoC versions that have different
frequencies and uV but some versions have the same version ID and
we have to check the SoC revision to differentiate between them.

This is done via SMCCC. Thus the exporting of the symbol.

Please note that this series depends on my THS series which
depends on my SID series.

I also have not enabled the cpufreq on any devices to minimize
the series dependencies and I did test it only on CB1 where
it works.

Cheers,
Martin

Signed-off-by: Martin Botka <[email protected]>
---
Martin Botka (6):
firmware: smccc: Export revision soc_id function
cpufreq: dt-platdev: Blocklist allwinner,h616 SoC
dt-bindings: opp: Add compatible for H616
cpufreq: sun50i: Add H616 support
arm64: dts: allwinner: h616: Add CPU Operating Performance Points table
arm64: dts: allwinner: h616: Add cooling cells

.../opp/allwinner,sun50i-h6-operating-points.yaml | 6 +-
.../boot/dts/allwinner/sun50i-h616-cpu-opp.dtsi | 129 ++++++++++++++++++
arch/arm64/boot/dts/allwinner/sun50i-h616.dtsi | 8 ++
drivers/cpufreq/cpufreq-dt-platdev.c | 1 +
drivers/cpufreq/sun50i-cpufreq-nvmem.c | 149 +++++++++++++++++----
drivers/firmware/smccc/smccc.c | 1 +
6 files changed, 270 insertions(+), 24 deletions(-)
---
base-commit: a384547b9656aa2c98f643037b0e940476c41f51
change-id: 20230824-cpufreq-h616-0370df5aea34

Best regards,
--
Martin Botka <[email protected]>


2023-09-05 16:12:36

by Martin Botka

[permalink] [raw]
Subject: [PATCH 3/6] dt-bindings: opp: Add compatible for H616

We need to add compatible for H616 to H6 cpufreq driver bindings.

Also enable opp_supported_hw property that will be needed for H616.

Signed-off-by: Martin Botka <[email protected]>
---
.../bindings/opp/allwinner,sun50i-h6-operating-points.yaml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
index 51f62c3ae194..2fa1199f2d23 100644
--- a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
+++ b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
@@ -23,7 +23,10 @@ allOf:

properties:
compatible:
- const: allwinner,sun50i-h6-operating-points
+ contains:
+ enum:
+ - allwinner,sun50i-h6-operating-points
+ - allwinner,sun50i-h616-operating-points

nvmem-cells:
description: |
@@ -47,6 +50,7 @@ patternProperties:
properties:
opp-hz: true
clock-latency-ns: true
+ opp-supported-hw: true

patternProperties:
"^opp-microvolt-speed[0-9]$": true

--
2.42.0

2023-09-05 16:21:51

by Martin Botka

[permalink] [raw]
Subject: Re: [PATCH 3/6] dt-bindings: opp: Add compatible for H616



On Mon, Sep 4 2023 at 09:53:05 PM +02:00:00, Krzysztof Kozlowski
<[email protected]> wrote:
> On 04/09/2023 21:48, Martin Botka wrote:
>>
>>
>> On Mon, Sep 4 2023 at 09:32:44 PM +02:00:00, Krzysztof Kozlowski
>> <[email protected]> wrote:
>>> On 04/09/2023 21:31, Krzysztof Kozlowski wrote:
>>>> On 04/09/2023 17:57, Martin Botka wrote:
>>>>> We need to add compatible for H616 to H6 cpufreq driver
>>>>> bindings.
>>>>
>>>> Please describe the hardware, not what is needed for drivers.
>>>>
>>>>>
>>>>> Also enable opp_supported_hw property that will be needed for
>>>>> H616.
>>>>>
>>>>> Signed-off-by: Martin Botka <[email protected]>
>>>>> ---
>>>>> .../bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>> | 6 +++++-
>>>>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git
>>>>>
>>>>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>>
>>>>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>> index 51f62c3ae194..2fa1199f2d23 100644
>>>>> ---
>>>>>
>>>>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>> +++
>>>>>
>>>>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>>>>> @@ -23,7 +23,10 @@ allOf:
>>>>>
>>>>> properties:
>>>>> compatible:
>>>>> - const: allwinner,sun50i-h6-operating-points
>>>>> + contains:
>>>>
>>>> This does not look like part of allOf, so contains is no correct
>>>> here.
>>>> This must be specific, so drop contains.
>>>
>>> BTW, I also do no see it used by the driver at all.
>> Function sun50i_cpufreq_get_efuse uses it. It checks for H6
>> compatible
>> and if that fails we check for H616 compatible.
>
> Such code does no scale. It also does not look reasonable - you cannot
> have different compatible there. Device binds to h6 or h616, so you
> cannot have OPP table from other devices.
>
Heya. I checked how qcom nvmem driver does it. And yea this indeed does
not scale. matchlist should have SoC compatible and driver needs to
have single compatible. Thus also dropping this patch :)

Will do in V2. Thanks Krzystof for pointing me to the right way of
doing it :)

Cheers,
Martin
> Best regards,
> Krzysztof
>


2023-09-05 19:10:10

by Martin Botka

[permalink] [raw]
Subject: Re: [PATCH 3/6] dt-bindings: opp: Add compatible for H616



On Mon, Sep 4 2023 at 09:31:34 PM +02:00:00, Krzysztof Kozlowski
<[email protected]> wrote:
> On 04/09/2023 17:57, Martin Botka wrote:
>> We need to add compatible for H616 to H6 cpufreq driver bindings.
>
> Please describe the hardware, not what is needed for drivers.
Got it. Sorry.
>
>>
>> Also enable opp_supported_hw property that will be needed for H616.
>>
>> Signed-off-by: Martin Botka <[email protected]>
>> ---
>> .../bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>> | 6 +++++-
>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git
>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>> index 51f62c3ae194..2fa1199f2d23 100644
>> ---
>> a/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>> +++
>> b/Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
>> @@ -23,7 +23,10 @@ allOf:
>>
>> properties:
>> compatible:
>> - const: allwinner,sun50i-h6-operating-points
>> + contains:
>
> This does not look like part of allOf, so contains is no correct here.
> This must be specific, so drop contains.
ack.
>
>> + enum:
>> + - allwinner,sun50i-h6-operating-points
>> + - allwinner,sun50i-h616-operating-points
>>
>> nvmem-cells:
>> description: |
>> @@ -47,6 +50,7 @@ patternProperties:
>> properties:
>> opp-hz: true
>> clock-latency-ns: true
>> + opp-supported-hw: true
>
> Why? It is already allowed. You should rather explain the values.
Yea this can be dropped. I forgot to remove it. My bad.
Also the values i think are very clear ? The values converted to binary
represent which chip revision is allowed to use the specified frequency.
1 bit for each revision.
>
>>
>
> Best regards,
> Krzysztof
>