[v2,3/6] dt-bindings: soc: starfive: syscon: Add optional patternProperties

Message ID 20230316030514.137427-4-xingyu.wu@starfivetech.com
State New
Headers
Series Add PLL clocks driver for StarFive JH7110 SoC |

Commit Message

Xingyu Wu March 16, 2023, 3:05 a.m. UTC
  Add optional compatible and patternProperties.

Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
---
 .../soc/starfive/starfive,jh7110-syscon.yaml  | 39 ++++++++++++++++---
 1 file changed, 33 insertions(+), 6 deletions(-)
  

Comments

Krzysztof Kozlowski March 19, 2023, 12:28 p.m. UTC | #1
On 16/03/2023 04:05, Xingyu Wu wrote:
> Add optional compatible and patternProperties.
> 
> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
> ---
>  .../soc/starfive/starfive,jh7110-syscon.yaml  | 39 ++++++++++++++++---
>  1 file changed, 33 insertions(+), 6 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
> index ae7f1d6916af..b61d8921ef42 100644
> --- a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
> +++ b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
> @@ -15,16 +15,31 @@ description: |
>  
>  properties:
>    compatible:
> -    items:
> -      - enum:
> -          - starfive,jh7110-aon-syscon
> -          - starfive,jh7110-stg-syscon
> -          - starfive,jh7110-sys-syscon
> -      - const: syscon
> +    oneOf:
> +      - items:
> +          - enum:
> +              - starfive,jh7110-aon-syscon
> +              - starfive,jh7110-stg-syscon
> +              - starfive,jh7110-sys-syscon
> +          - const: syscon
> +      - items:
> +          - enum:
> +              - starfive,jh7110-aon-syscon
> +              - starfive,jh7110-stg-syscon
> +              - starfive,jh7110-sys-syscon
> +          - const: syscon
> +          - const: simple-mfd
>  
>    reg:
>      maxItems: 1
>  
> +patternProperties:
> +  # Optional children
> +  "pll-clock-controller":

It's not a pattern.

Anyway should be clock-controller

> +    type: object
> +    $ref: /schemas/clock/starfive,jh7110-pll.yaml#
> +    description: Clock provider for PLL.
> +

You just added these bindings! So the initial submission was incomplete
on purpose?

No, add complete bindings.

>  required:
>    - compatible
>    - reg
> @@ -38,4 +53,16 @@ examples:
>          reg = <0x10240000 0x1000>;
>      };
>  
> +  - |
> +    syscon@13030000 {

No need for new example... Just put it in existing one.


Best regards,
Krzysztof
  
Xingyu Wu March 20, 2023, 3:54 a.m. UTC | #2
On 2023/3/19 20:28, Krzysztof Kozlowski wrote:
> On 16/03/2023 04:05, Xingyu Wu wrote:
>> Add optional compatible and patternProperties.
>> 
>> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
>> ---
>>  .../soc/starfive/starfive,jh7110-syscon.yaml  | 39 ++++++++++++++++---
>>  1 file changed, 33 insertions(+), 6 deletions(-)
>> 
>> diff --git a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>> index ae7f1d6916af..b61d8921ef42 100644
>> --- a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>> +++ b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>> @@ -15,16 +15,31 @@ description: |
>>  
>>  properties:
>>    compatible:
>> -    items:
>> -      - enum:
>> -          - starfive,jh7110-aon-syscon
>> -          - starfive,jh7110-stg-syscon
>> -          - starfive,jh7110-sys-syscon
>> -      - const: syscon
>> +    oneOf:
>> +      - items:
>> +          - enum:
>> +              - starfive,jh7110-aon-syscon
>> +              - starfive,jh7110-stg-syscon
>> +              - starfive,jh7110-sys-syscon
>> +          - const: syscon
>> +      - items:
>> +          - enum:
>> +              - starfive,jh7110-aon-syscon
>> +              - starfive,jh7110-stg-syscon
>> +              - starfive,jh7110-sys-syscon
>> +          - const: syscon
>> +          - const: simple-mfd
>>  
>>    reg:
>>      maxItems: 1
>>  
>> +patternProperties:
>> +  # Optional children
>> +  "pll-clock-controller":
> 
> It's not a pattern.

Does it use 'properties' instead of 'patternProperties'?

> 
> Anyway should be clock-controller

Will fix.

> 
>> +    type: object
>> +    $ref: /schemas/clock/starfive,jh7110-pll.yaml#
>> +    description: Clock provider for PLL.
>> +
> 
> You just added these bindings! So the initial submission was incomplete
> on purpose?
> 
> No, add complete bindings.

Does you mean that it should drop the 'description', or add complete 'description',
or add 'compatible', 'clocks' and 'clock-cells' of complete clock-controller bindings?

> 
>>  required:
>>    - compatible
>>    - reg
>> @@ -38,4 +53,16 @@ examples:
>>          reg = <0x10240000 0x1000>;
>>      };
>>  
>> +  - |
>> +    syscon@13030000 {
> 
> No need for new example... Just put it in existing one.
> 

Actually, the PLL clock-controller are just set in sys-syscon resgisters. The stg-syscon and
aon-syscon don't need it. So PLL clock-controller node only is added in sys-syscon node.

Best regards,
Xingyu Wu
  
Krzysztof Kozlowski March 20, 2023, 6:37 a.m. UTC | #3
On 20/03/2023 04:54, Xingyu Wu wrote:
> On 2023/3/19 20:28, Krzysztof Kozlowski wrote:
>> On 16/03/2023 04:05, Xingyu Wu wrote:
>>> Add optional compatible and patternProperties.
>>>
>>> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
>>> ---
>>>  .../soc/starfive/starfive,jh7110-syscon.yaml  | 39 ++++++++++++++++---
>>>  1 file changed, 33 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>> index ae7f1d6916af..b61d8921ef42 100644
>>> --- a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>> +++ b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>> @@ -15,16 +15,31 @@ description: |
>>>  
>>>  properties:
>>>    compatible:
>>> -    items:
>>> -      - enum:
>>> -          - starfive,jh7110-aon-syscon
>>> -          - starfive,jh7110-stg-syscon
>>> -          - starfive,jh7110-sys-syscon
>>> -      - const: syscon
>>> +    oneOf:
>>> +      - items:
>>> +          - enum:
>>> +              - starfive,jh7110-aon-syscon
>>> +              - starfive,jh7110-stg-syscon
>>> +              - starfive,jh7110-sys-syscon
>>> +          - const: syscon
>>> +      - items:
>>> +          - enum:
>>> +              - starfive,jh7110-aon-syscon
>>> +              - starfive,jh7110-stg-syscon
>>> +              - starfive,jh7110-sys-syscon
>>> +          - const: syscon
>>> +          - const: simple-mfd
>>>  
>>>    reg:
>>>      maxItems: 1
>>>  
>>> +patternProperties:
>>> +  # Optional children
>>> +  "pll-clock-controller":
>>
>> It's not a pattern.
> 
> Does it use 'properties' instead of 'patternProperties'?

Yes.

> 
>>
>> Anyway should be clock-controller
> 
> Will fix.
> 
>>
>>> +    type: object
>>> +    $ref: /schemas/clock/starfive,jh7110-pll.yaml#
>>> +    description: Clock provider for PLL.
>>> +
>>
>> You just added these bindings! So the initial submission was incomplete
>> on purpose?
>>
>> No, add complete bindings.
> 
> Does you mean that it should drop the 'description', or add complete 'description',
> or add 'compatible', 'clocks' and 'clock-cells' of complete clock-controller bindings?

It means it should be squashed with the patch which adds it.

> 
>>
>>>  required:
>>>    - compatible
>>>    - reg
>>> @@ -38,4 +53,16 @@ examples:
>>>          reg = <0x10240000 0x1000>;
>>>      };
>>>  
>>> +  - |
>>> +    syscon@13030000 {
>>
>> No need for new example... Just put it in existing one.
>>
> 
> Actually, the PLL clock-controller are just set in sys-syscon resgisters. The stg-syscon and
> aon-syscon don't need it. So PLL clock-controller node only is added in sys-syscon node.

So why having other examples if they are included here? Drop them.



Best regards,
Krzysztof
  
Xingyu Wu March 20, 2023, 7:29 a.m. UTC | #4
On 2023/3/20 14:37, Krzysztof Kozlowski wrote:
> On 20/03/2023 04:54, Xingyu Wu wrote:
>> On 2023/3/19 20:28, Krzysztof Kozlowski wrote:
>>> On 16/03/2023 04:05, Xingyu Wu wrote:
>>>> Add optional compatible and patternProperties.
>>>>
>>>> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
>>>> ---
>>>>  .../soc/starfive/starfive,jh7110-syscon.yaml  | 39 ++++++++++++++++---
>>>>  1 file changed, 33 insertions(+), 6 deletions(-)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>> index ae7f1d6916af..b61d8921ef42 100644
>>>> --- a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>> +++ b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>> @@ -15,16 +15,31 @@ description: |
>>>>  
>>>>  properties:
>>>>    compatible:
>>>> -    items:
>>>> -      - enum:
>>>> -          - starfive,jh7110-aon-syscon
>>>> -          - starfive,jh7110-stg-syscon
>>>> -          - starfive,jh7110-sys-syscon
>>>> -      - const: syscon
>>>> +    oneOf:
>>>> +      - items:
>>>> +          - enum:
>>>> +              - starfive,jh7110-aon-syscon
>>>> +              - starfive,jh7110-stg-syscon
>>>> +              - starfive,jh7110-sys-syscon
>>>> +          - const: syscon
>>>> +      - items:
>>>> +          - enum:
>>>> +              - starfive,jh7110-aon-syscon
>>>> +              - starfive,jh7110-stg-syscon
>>>> +              - starfive,jh7110-sys-syscon
>>>> +          - const: syscon
>>>> +          - const: simple-mfd
>>>>  
>>>>    reg:
>>>>      maxItems: 1
>>>>  
>>>> +patternProperties:
>>>> +  # Optional children
>>>> +  "pll-clock-controller":
>>>
>>> It's not a pattern.
>> 
>> Does it use 'properties' instead of 'patternProperties'?
> 
> Yes.
> 
>> 
>>>
>>> Anyway should be clock-controller
>> 
>> Will fix.
>> 
>>>
>>>> +    type: object
>>>> +    $ref: /schemas/clock/starfive,jh7110-pll.yaml#
>>>> +    description: Clock provider for PLL.
>>>> +
>>>
>>> You just added these bindings! So the initial submission was incomplete
>>> on purpose?
>>>
>>> No, add complete bindings.
>> 
>> Does you mean that it should drop the 'description', or add complete 'description',
>> or add 'compatible', 'clocks' and 'clock-cells' of complete clock-controller bindings?
> 
> It means it should be squashed with the patch which adds it.

Should I drop the 'decription' here and keep the 'decription' in patch1?

> 
>> 
>>>
>>>>  required:
>>>>    - compatible
>>>>    - reg
>>>> @@ -38,4 +53,16 @@ examples:
>>>>          reg = <0x10240000 0x1000>;
>>>>      };
>>>>  
>>>> +  - |
>>>> +    syscon@13030000 {
>>>
>>> No need for new example... Just put it in existing one.
>>>
>> 
>> Actually, the PLL clock-controller are just set in sys-syscon resgisters. The stg-syscon and
>> aon-syscon don't need it. So PLL clock-controller node only is added in sys-syscon node.
> 
> So why having other examples if they are included here? Drop them.
> 

Should I drop the old example of stg-syscon and add a new example of sys-syscon which
include clock-controller child node?

Best regards,
Xingyu Wu
  
Krzysztof Kozlowski March 20, 2023, 7:40 a.m. UTC | #5
On 20/03/2023 08:29, Xingyu Wu wrote:
> On 2023/3/20 14:37, Krzysztof Kozlowski wrote:
>> On 20/03/2023 04:54, Xingyu Wu wrote:
>>> On 2023/3/19 20:28, Krzysztof Kozlowski wrote:
>>>> On 16/03/2023 04:05, Xingyu Wu wrote:
>>>>> Add optional compatible and patternProperties.
>>>>>
>>>>> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
>>>>> ---
>>>>>  .../soc/starfive/starfive,jh7110-syscon.yaml  | 39 ++++++++++++++++---
>>>>>  1 file changed, 33 insertions(+), 6 deletions(-)
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>> index ae7f1d6916af..b61d8921ef42 100644
>>>>> --- a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>> +++ b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>> @@ -15,16 +15,31 @@ description: |
>>>>>  
>>>>>  properties:
>>>>>    compatible:
>>>>> -    items:
>>>>> -      - enum:
>>>>> -          - starfive,jh7110-aon-syscon
>>>>> -          - starfive,jh7110-stg-syscon
>>>>> -          - starfive,jh7110-sys-syscon
>>>>> -      - const: syscon
>>>>> +    oneOf:
>>>>> +      - items:
>>>>> +          - enum:
>>>>> +              - starfive,jh7110-aon-syscon
>>>>> +              - starfive,jh7110-stg-syscon
>>>>> +              - starfive,jh7110-sys-syscon
>>>>> +          - const: syscon
>>>>> +      - items:
>>>>> +          - enum:
>>>>> +              - starfive,jh7110-aon-syscon
>>>>> +              - starfive,jh7110-stg-syscon
>>>>> +              - starfive,jh7110-sys-syscon
>>>>> +          - const: syscon
>>>>> +          - const: simple-mfd

BTW, this also looks wrong. You just said that clock controller exists
only in few variants. Also, why sometimes the same device  goes with
simple-mfd and sometimies without? It's the same device.

>>>>>  
>>>>>    reg:
>>>>>      maxItems: 1
>>>>>  
>>>>> +patternProperties:
>>>>> +  # Optional children
>>>>> +  "pll-clock-controller":
>>>>
>>>> It's not a pattern.
>>>
>>> Does it use 'properties' instead of 'patternProperties'?
>>
>> Yes.
>>
>>>
>>>>
>>>> Anyway should be clock-controller
>>>
>>> Will fix.
>>>
>>>>
>>>>> +    type: object
>>>>> +    $ref: /schemas/clock/starfive,jh7110-pll.yaml#
>>>>> +    description: Clock provider for PLL.
>>>>> +
>>>>
>>>> You just added these bindings! So the initial submission was incomplete
>>>> on purpose?
>>>>
>>>> No, add complete bindings.
>>>
>>> Does you mean that it should drop the 'description', or add complete 'description',
>>> or add 'compatible', 'clocks' and 'clock-cells' of complete clock-controller bindings?
>>
>> It means it should be squashed with the patch which adds it.
> 
> Should I drop the 'decription' here and keep the 'decription' in patch1?

There should be no this patch at all. However I do not understand what
you want to do with description. What's wrong with description?
> 
>>
>>>
>>>>
>>>>>  required:
>>>>>    - compatible
>>>>>    - reg
>>>>> @@ -38,4 +53,16 @@ examples:
>>>>>          reg = <0x10240000 0x1000>;
>>>>>      };
>>>>>  
>>>>> +  - |
>>>>> +    syscon@13030000 {
>>>>
>>>> No need for new example... Just put it in existing one.
>>>>
>>>
>>> Actually, the PLL clock-controller are just set in sys-syscon resgisters. The stg-syscon and
>>> aon-syscon don't need it. So PLL clock-controller node only is added in sys-syscon node.
>>
>> So why having other examples if they are included here? Drop them.
>>
> 
> Should I drop the old example of stg-syscon and add a new example of sys-syscon which
> include clock-controller child node?

No, there should be no stg-syscon example, it's useless.

Best regards,
Krzysztof
  
Xingyu Wu March 20, 2023, 8:26 a.m. UTC | #6
On 2023/3/20 15:40, Krzysztof Kozlowski wrote:
> On 20/03/2023 08:29, Xingyu Wu wrote:
>> On 2023/3/20 14:37, Krzysztof Kozlowski wrote:
>>> On 20/03/2023 04:54, Xingyu Wu wrote:
>>>> On 2023/3/19 20:28, Krzysztof Kozlowski wrote:
>>>>> On 16/03/2023 04:05, Xingyu Wu wrote:
>>>>>> Add optional compatible and patternProperties.
>>>>>>
>>>>>> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
>>>>>> ---
>>>>>>  .../soc/starfive/starfive,jh7110-syscon.yaml  | 39 ++++++++++++++++---
>>>>>>  1 file changed, 33 insertions(+), 6 deletions(-)
>>>>>>
>>>>>> diff --git a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>>> index ae7f1d6916af..b61d8921ef42 100644
>>>>>> --- a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>>> +++ b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>>> @@ -15,16 +15,31 @@ description: |
>>>>>>  
>>>>>>  properties:
>>>>>>    compatible:
>>>>>> -    items:
>>>>>> -      - enum:
>>>>>> -          - starfive,jh7110-aon-syscon
>>>>>> -          - starfive,jh7110-stg-syscon
>>>>>> -          - starfive,jh7110-sys-syscon
>>>>>> -      - const: syscon
>>>>>> +    oneOf:
>>>>>> +      - items:
>>>>>> +          - enum:
>>>>>> +              - starfive,jh7110-aon-syscon
>>>>>> +              - starfive,jh7110-stg-syscon
>>>>>> +              - starfive,jh7110-sys-syscon
>>>>>> +          - const: syscon
>>>>>> +      - items:
>>>>>> +          - enum:
>>>>>> +              - starfive,jh7110-aon-syscon
>>>>>> +              - starfive,jh7110-stg-syscon
>>>>>> +              - starfive,jh7110-sys-syscon
>>>>>> +          - const: syscon
>>>>>> +          - const: simple-mfd
> 
> BTW, this also looks wrong. You just said that clock controller exists
> only in few variants. Also, why sometimes the same device  goes with
> simple-mfd and sometimies without? It's the same device.

Oh yes, If modified to:

oneOf:
      - items:
          - enum:
              - starfive,jh7110-aon-syscon
              - starfive,jh7110-stg-syscon
          - const: syscon
      - items:
          - const: starfive,jh7110-sys-syscon
          - const: syscon
          - const: simple-mfd

Or:

     - minItems: 2
       items:
         - enum:
             - starfive,jh7110-aon-syscon
             - starfive,jh7110-stg-syscon
             - starfive,jh7110-sys-syscon
         - const: syscon
         - const: simple-mfd


Which one is better?

> 
>>>>>>  
>>>>>>    reg:
>>>>>>      maxItems: 1
>>>>>>  
>>>>>> +patternProperties:
>>>>>> +  # Optional children
>>>>>> +  "pll-clock-controller":
>>>>>
>>>>> It's not a pattern.
>>>>
>>>> Does it use 'properties' instead of 'patternProperties'?
>>>
>>> Yes.
>>>
>>>>
>>>>>
>>>>> Anyway should be clock-controller
>>>>
>>>> Will fix.
>>>>
>>>>>
>>>>>> +    type: object
>>>>>> +    $ref: /schemas/clock/starfive,jh7110-pll.yaml#
>>>>>> +    description: Clock provider for PLL.
>>>>>> +
>>>>>
>>>>> You just added these bindings! So the initial submission was incomplete
>>>>> on purpose?
>>>>>
>>>>> No, add complete bindings.
>>>>
>>>> Does you mean that it should drop the 'description', or add complete 'description',
>>>> or add 'compatible', 'clocks' and 'clock-cells' of complete clock-controller bindings?
>>>
>>> It means it should be squashed with the patch which adds it.
>> 
>> Should I drop the 'decription' here and keep the 'decription' in patch1?
> 
> There should be no this patch at all. However I do not understand what
> you want to do with description. What's wrong with description?

I thought you were commenting under description, saying a conflict with pll dtbindings' description.
Is that mean I should add it in the syscon patch fo william not this patchset?

>> 
>>>
>>>>
>>>>>
>>>>>>  required:
>>>>>>    - compatible
>>>>>>    - reg
>>>>>> @@ -38,4 +53,16 @@ examples:
>>>>>>          reg = <0x10240000 0x1000>;
>>>>>>      };
>>>>>>  
>>>>>> +  - |
>>>>>> +    syscon@13030000 {
>>>>>
>>>>> No need for new example... Just put it in existing one.
>>>>>
>>>>
>>>> Actually, the PLL clock-controller are just set in sys-syscon resgisters. The stg-syscon and
>>>> aon-syscon don't need it. So PLL clock-controller node only is added in sys-syscon node.
>>>
>>> So why having other examples if they are included here? Drop them.
>>>
>> 
>> Should I drop the old example of stg-syscon and add a new example of sys-syscon which
>> include clock-controller child node?
> 
> No, there should be no stg-syscon example, it's useless.
> 

Thanks. I will remind william to use sys-syscon example instead.

Best regards,
Xingyu Wu
  
Krzysztof Kozlowski March 20, 2023, 8:36 a.m. UTC | #7
On 20/03/2023 09:26, Xingyu Wu wrote:
> On 2023/3/20 15:40, Krzysztof Kozlowski wrote:
>> On 20/03/2023 08:29, Xingyu Wu wrote:
>>> On 2023/3/20 14:37, Krzysztof Kozlowski wrote:
>>>> On 20/03/2023 04:54, Xingyu Wu wrote:
>>>>> On 2023/3/19 20:28, Krzysztof Kozlowski wrote:
>>>>>> On 16/03/2023 04:05, Xingyu Wu wrote:
>>>>>>> Add optional compatible and patternProperties.
>>>>>>>
>>>>>>> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
>>>>>>> ---
>>>>>>>  .../soc/starfive/starfive,jh7110-syscon.yaml  | 39 ++++++++++++++++---
>>>>>>>  1 file changed, 33 insertions(+), 6 deletions(-)
>>>>>>>
>>>>>>> diff --git a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>>>> index ae7f1d6916af..b61d8921ef42 100644
>>>>>>> --- a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>>>> +++ b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>>>> @@ -15,16 +15,31 @@ description: |
>>>>>>>  
>>>>>>>  properties:
>>>>>>>    compatible:
>>>>>>> -    items:
>>>>>>> -      - enum:
>>>>>>> -          - starfive,jh7110-aon-syscon
>>>>>>> -          - starfive,jh7110-stg-syscon
>>>>>>> -          - starfive,jh7110-sys-syscon
>>>>>>> -      - const: syscon
>>>>>>> +    oneOf:
>>>>>>> +      - items:
>>>>>>> +          - enum:
>>>>>>> +              - starfive,jh7110-aon-syscon
>>>>>>> +              - starfive,jh7110-stg-syscon
>>>>>>> +              - starfive,jh7110-sys-syscon
>>>>>>> +          - const: syscon
>>>>>>> +      - items:
>>>>>>> +          - enum:
>>>>>>> +              - starfive,jh7110-aon-syscon
>>>>>>> +              - starfive,jh7110-stg-syscon
>>>>>>> +              - starfive,jh7110-sys-syscon
>>>>>>> +          - const: syscon
>>>>>>> +          - const: simple-mfd
>>
>> BTW, this also looks wrong. You just said that clock controller exists
>> only in few variants. Also, why sometimes the same device  goes with
>> simple-mfd and sometimies without? It's the same device.
> 
> Oh yes, If modified to:
> 
> oneOf:
>       - items:
>           - enum:
>               - starfive,jh7110-aon-syscon
>               - starfive,jh7110-stg-syscon
>           - const: syscon
>       - items:
>           - const: starfive,jh7110-sys-syscon
>           - const: syscon
>           - const: simple-mfd
> 
> Or:
> 
>      - minItems: 2
>        items:
>          - enum:
>              - starfive,jh7110-aon-syscon
>              - starfive,jh7110-stg-syscon
>              - starfive,jh7110-sys-syscon
>          - const: syscon
>          - const: simple-mfd
> 
> 
> Which one is better?

If aon and stg are not supposed to have children, then only the first is
correct. It's not which is better, the second is not really correct in
such case.

Best regards,
Krzysztof
  
Xingyu Wu March 20, 2023, 9:16 a.m. UTC | #8
On 2023/3/20 16:36, Krzysztof Kozlowski wrote:
> On 20/03/2023 09:26, Xingyu Wu wrote:
>> On 2023/3/20 15:40, Krzysztof Kozlowski wrote:
>>> On 20/03/2023 08:29, Xingyu Wu wrote:
>>>> On 2023/3/20 14:37, Krzysztof Kozlowski wrote:
>>>>> On 20/03/2023 04:54, Xingyu Wu wrote:
>>>>>> On 2023/3/19 20:28, Krzysztof Kozlowski wrote:
>>>>>>> On 16/03/2023 04:05, Xingyu Wu wrote:
>>>>>>>> Add optional compatible and patternProperties.
>>>>>>>>
>>>>>>>> Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
>>>>>>>> ---
>>>>>>>>  .../soc/starfive/starfive,jh7110-syscon.yaml  | 39 ++++++++++++++++---
>>>>>>>>  1 file changed, 33 insertions(+), 6 deletions(-)
>>>>>>>>
>>>>>>>> diff --git a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>>>>> index ae7f1d6916af..b61d8921ef42 100644
>>>>>>>> --- a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>>>>> +++ b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
>>>>>>>> @@ -15,16 +15,31 @@ description: |
>>>>>>>>  
>>>>>>>>  properties:
>>>>>>>>    compatible:
>>>>>>>> -    items:
>>>>>>>> -      - enum:
>>>>>>>> -          - starfive,jh7110-aon-syscon
>>>>>>>> -          - starfive,jh7110-stg-syscon
>>>>>>>> -          - starfive,jh7110-sys-syscon
>>>>>>>> -      - const: syscon
>>>>>>>> +    oneOf:
>>>>>>>> +      - items:
>>>>>>>> +          - enum:
>>>>>>>> +              - starfive,jh7110-aon-syscon
>>>>>>>> +              - starfive,jh7110-stg-syscon
>>>>>>>> +              - starfive,jh7110-sys-syscon
>>>>>>>> +          - const: syscon
>>>>>>>> +      - items:
>>>>>>>> +          - enum:
>>>>>>>> +              - starfive,jh7110-aon-syscon
>>>>>>>> +              - starfive,jh7110-stg-syscon
>>>>>>>> +              - starfive,jh7110-sys-syscon
>>>>>>>> +          - const: syscon
>>>>>>>> +          - const: simple-mfd
>>>
>>> BTW, this also looks wrong. You just said that clock controller exists
>>> only in few variants. Also, why sometimes the same device  goes with
>>> simple-mfd and sometimies without? It's the same device.
>> 
>> Oh yes, If modified to:
>> 
>> oneOf:
>>       - items:
>>           - enum:
>>               - starfive,jh7110-aon-syscon
>>               - starfive,jh7110-stg-syscon
>>           - const: syscon
>>       - items:
>>           - const: starfive,jh7110-sys-syscon
>>           - const: syscon
>>           - const: simple-mfd
>> 
>> Or:
>> 
>>      - minItems: 2
>>        items:
>>          - enum:
>>              - starfive,jh7110-aon-syscon
>>              - starfive,jh7110-stg-syscon
>>              - starfive,jh7110-sys-syscon
>>          - const: syscon
>>          - const: simple-mfd
>> 
>> 
>> Which one is better?
> 
> If aon and stg are not supposed to have children, then only the first is
> correct. It's not which is better, the second is not really correct in
> such case.
> 

OK, will modify it in next version. Thanks.

Best regards,
Xingyu Wu
  

Patch

diff --git a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
index ae7f1d6916af..b61d8921ef42 100644
--- a/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
+++ b/Documentation/devicetree/bindings/soc/starfive/starfive,jh7110-syscon.yaml
@@ -15,16 +15,31 @@  description: |
 
 properties:
   compatible:
-    items:
-      - enum:
-          - starfive,jh7110-aon-syscon
-          - starfive,jh7110-stg-syscon
-          - starfive,jh7110-sys-syscon
-      - const: syscon
+    oneOf:
+      - items:
+          - enum:
+              - starfive,jh7110-aon-syscon
+              - starfive,jh7110-stg-syscon
+              - starfive,jh7110-sys-syscon
+          - const: syscon
+      - items:
+          - enum:
+              - starfive,jh7110-aon-syscon
+              - starfive,jh7110-stg-syscon
+              - starfive,jh7110-sys-syscon
+          - const: syscon
+          - const: simple-mfd
 
   reg:
     maxItems: 1
 
+patternProperties:
+  # Optional children
+  "pll-clock-controller":
+    type: object
+    $ref: /schemas/clock/starfive,jh7110-pll.yaml#
+    description: Clock provider for PLL.
+
 required:
   - compatible
   - reg
@@ -38,4 +53,16 @@  examples:
         reg = <0x10240000 0x1000>;
     };
 
+  - |
+    syscon@13030000 {
+        compatible = "starfive,jh7110-sys-syscon", "syscon", "simple-mfd";
+        reg = <0x13030000 0x1000>;
+
+        pll-clock-controller {
+            compatible = "starfive,jh7110-pll";
+            clocks = <&osc>;
+            #clock-cells = <1>;
+        };
+    };
+
 ...