diff mbox series

[v2,2/9] dt-bindings: net: snps,dwmac: Update the maxitems number of resets and reset-names

Message ID 20221216070632.11444-3-yanhong.wang@starfivetech.com (mailing list archive)
State Superseded
Headers show
Series Add Ethernet driver for StarFive JH7110 SoC | expand

Checks

Context Check Description
conchuod/tree_selection fail Guessing tree name failed

Commit Message

yanhong wang Dec. 16, 2022, 7:06 a.m. UTC
Some boards(such as StarFive VisionFive v2) require more than one value
which defined by resets property, so the original definition can not
meet the requirements. In order to adapt to different requirements,
adjust the maxitems number from 1 to 3..

Signed-off-by: Yanhong Wang <yanhong.wang@starfivetech.com>
---
 .../devicetree/bindings/net/snps,dwmac.yaml       | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

Comments

Krzysztof Kozlowski Dec. 16, 2022, 11:03 a.m. UTC | #1
On 16/12/2022 08:06, Yanhong Wang wrote:
> Some boards(such as StarFive VisionFive v2) require more than one value
> which defined by resets property, so the original definition can not
> meet the requirements. In order to adapt to different requirements,
> adjust the maxitems number from 1 to 3..
> 
> Signed-off-by: Yanhong Wang <yanhong.wang@starfivetech.com>
> ---
>  .../devicetree/bindings/net/snps,dwmac.yaml       | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> index e26c3e76ebb7..7870228b4cd3 100644
> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> @@ -133,12 +133,19 @@ properties:
>          - ptp_ref
>  
>    resets:
> -    maxItems: 1
> -    description:
> -      MAC Reset signal.
> +    minItems: 1
> +    maxItems: 3
> +    additionalItems: true
> +    items:
> +      - description: MAC Reset signal
>  
>    reset-names:
> -    const: stmmaceth
> +    minItems: 1
> +    maxItems: 3
> +    additionalItems: true
> +    contains:
> +      enum:
> +        - stmmaceth

No, this is highly unspecific and you know affect all the schemas using
snps,dwmac.yaml. Both lists must be specific - for your device and for
others.

Best regards,
Krzysztof
yanhong wang Dec. 20, 2022, 6:48 a.m. UTC | #2
On 2022/12/16 19:03, Krzysztof Kozlowski wrote:
> On 16/12/2022 08:06, Yanhong Wang wrote:
>> Some boards(such as StarFive VisionFive v2) require more than one value
>> which defined by resets property, so the original definition can not
>> meet the requirements. In order to adapt to different requirements,
>> adjust the maxitems number from 1 to 3..
>> 
>> Signed-off-by: Yanhong Wang <yanhong.wang@starfivetech.com>
>> ---
>>  .../devicetree/bindings/net/snps,dwmac.yaml       | 15 +++++++++++----
>>  1 file changed, 11 insertions(+), 4 deletions(-)
>> 
>> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>> index e26c3e76ebb7..7870228b4cd3 100644
>> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>> @@ -133,12 +133,19 @@ properties:
>>          - ptp_ref
>>  
>>    resets:
>> -    maxItems: 1
>> -    description:
>> -      MAC Reset signal.
>> +    minItems: 1
>> +    maxItems: 3
>> +    additionalItems: true
>> +    items:
>> +      - description: MAC Reset signal
>>  
>>    reset-names:
>> -    const: stmmaceth
>> +    minItems: 1
>> +    maxItems: 3
>> +    additionalItems: true
>> +    contains:
>> +      enum:
>> +        - stmmaceth
> 
> No, this is highly unspecific and you know affect all the schemas using
> snps,dwmac.yaml. Both lists must be specific - for your device and for
> others.
> 

I have tried to define the resets in "starfive,jh71x0-dwmac.yaml", but it can not over-write the maxItems limit in "snps,dwmac.yaml",therefore, it will report error "reset-names: ['stmmaceth', 'ahb'] is too long"  running "make dt_binding_check". Do you have any suggestions to deal with this situation?

> Best regards,
> Krzysztof
>
Krzysztof Kozlowski Dec. 20, 2022, 9:21 a.m. UTC | #3
On 20/12/2022 07:48, yanhong wang wrote:

>>> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>>> index e26c3e76ebb7..7870228b4cd3 100644
>>> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>>> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>>> @@ -133,12 +133,19 @@ properties:
>>>          - ptp_ref
>>>  
>>>    resets:
>>> -    maxItems: 1
>>> -    description:
>>> -      MAC Reset signal.
>>> +    minItems: 1
>>> +    maxItems: 3
>>> +    additionalItems: true
>>> +    items:
>>> +      - description: MAC Reset signal
>>>  
>>>    reset-names:
>>> -    const: stmmaceth
>>> +    minItems: 1
>>> +    maxItems: 3
>>> +    additionalItems: true
>>> +    contains:
>>> +      enum:
>>> +        - stmmaceth
>>
>> No, this is highly unspecific and you know affect all the schemas using
>> snps,dwmac.yaml. Both lists must be specific - for your device and for
>> others.
>>
> 
> I have tried to define the resets in "starfive,jh71x0-dwmac.yaml", but it can not over-write the maxItems limit in "snps,dwmac.yaml",therefore, it will report error "reset-names: ['stmmaceth', 'ahb'] is too long"  running "make dt_binding_check". Do you have any suggestions to deal with this situation?

The solution is not to affect all schemas with allowing anything as reset.

If you need more items for your case, you can change snps,dwmac.yaml and
add constraints in allOf:if:then: allowing it only for your compatible.
There are plenty of examples how this is done, e.g.:

https://elixir.bootlin.com/linux/v5.19-rc6/source/Documentation/devicetree/bindings/clock/samsung,exynos7-clock.yaml#L57

> 
>> Best regards,
>> Krzysztof
>>

Best regards,
Krzysztof
yanhong wang Dec. 27, 2022, 7:48 a.m. UTC | #4
On 2022/12/20 17:21, Krzysztof Kozlowski wrote:
> On 20/12/2022 07:48, yanhong wang wrote:
> 
>>>> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>>>> index e26c3e76ebb7..7870228b4cd3 100644
>>>> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>>>> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>>>> @@ -133,12 +133,19 @@ properties:
>>>>          - ptp_ref
>>>>  
>>>>    resets:
>>>> -    maxItems: 1
>>>> -    description:
>>>> -      MAC Reset signal.
>>>> +    minItems: 1
>>>> +    maxItems: 3
>>>> +    additionalItems: true
>>>> +    items:
>>>> +      - description: MAC Reset signal
>>>>  
>>>>    reset-names:
>>>> -    const: stmmaceth
>>>> +    minItems: 1
>>>> +    maxItems: 3
>>>> +    additionalItems: true
>>>> +    contains:
>>>> +      enum:
>>>> +        - stmmaceth
>>>
>>> No, this is highly unspecific and you know affect all the schemas using
>>> snps,dwmac.yaml. Both lists must be specific - for your device and for
>>> others.
>>>
>> 
>> I have tried to define the resets in "starfive,jh71x0-dwmac.yaml", but it can not over-write the maxItems limit in "snps,dwmac.yaml",therefore, it will report error "reset-names: ['stmmaceth', 'ahb'] is too long"  running "make dt_binding_check". Do you have any suggestions to deal with this situation?
> 
> The solution is not to affect all schemas with allowing anything as reset.
> 
> If you need more items for your case, you can change snps,dwmac.yaml and
> add constraints in allOf:if:then: allowing it only for your compatible.
> There are plenty of examples how this is done, e.g.:
> 
> https://elixir.bootlin.com/linux/v5.19-rc6/source/Documentation/devicetree/bindings/clock/samsung,exynos7-clock.yaml#L57
> 

Thanks. Refer to the definition in the example and update the definition as follows:

snps,dwmac.yaml[Partial Content]:

properties:
  resets:
    maxItems: 1
    description:
      MAC Reset signal.

  reset-names:
    const: stmmaceth

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: starfive,jh7110-dwmac

    then:
      properties:
        resets:
          minItems: 2
          maxItems: 2
        reset-names:
          items:
            - const: stmmaceth
            - const: ahb
      required:
        - resets
        - reset-names


starfive,jh7110-dwmac.yaml[Partial Content]:

properties:
  resets:
    items:
      - description: MAC Reset signal.
      - description: AHB Reset signal.

  reset-names:
    items:
      - const: stmmaceth
      - const: ahb

allOf:
  - $ref: snps,dwmac.yaml#

It will also report error "reset-names: ['stmmaceth', 'ahb'] is too long"  running "make dt_binding_check" with 'starfive,jh7110-dwmac.yaml'. Do you have any better suggestions to solve this problem?

>> 
>>> Best regards,
>>> Krzysztof
>>>
> 
> Best regards,
> Krzysztof
>
Krzysztof Kozlowski Dec. 27, 2022, 8:18 a.m. UTC | #5
On 27/12/2022 08:48, yanhong wang wrote:
> 
> 
> On 2022/12/20 17:21, Krzysztof Kozlowski wrote:
>> On 20/12/2022 07:48, yanhong wang wrote:
>>
>>>>> diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>>>>> index e26c3e76ebb7..7870228b4cd3 100644
>>>>> --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>>>>> +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
>>>>> @@ -133,12 +133,19 @@ properties:
>>>>>          - ptp_ref
>>>>>  
>>>>>    resets:
>>>>> -    maxItems: 1
>>>>> -    description:
>>>>> -      MAC Reset signal.
>>>>> +    minItems: 1
>>>>> +    maxItems: 3
>>>>> +    additionalItems: true
>>>>> +    items:
>>>>> +      - description: MAC Reset signal
>>>>>  
>>>>>    reset-names:
>>>>> -    const: stmmaceth
>>>>> +    minItems: 1
>>>>> +    maxItems: 3
>>>>> +    additionalItems: true
>>>>> +    contains:
>>>>> +      enum:
>>>>> +        - stmmaceth
>>>>
>>>> No, this is highly unspecific and you know affect all the schemas using
>>>> snps,dwmac.yaml. Both lists must be specific - for your device and for
>>>> others.
>>>>
>>>
>>> I have tried to define the resets in "starfive,jh71x0-dwmac.yaml", but it can not over-write the maxItems limit in "snps,dwmac.yaml",therefore, it will report error "reset-names: ['stmmaceth', 'ahb'] is too long"  running "make dt_binding_check". Do you have any suggestions to deal with this situation?
>>
>> The solution is not to affect all schemas with allowing anything as reset.
>>
>> If you need more items for your case, you can change snps,dwmac.yaml and
>> add constraints in allOf:if:then: allowing it only for your compatible.
>> There are plenty of examples how this is done, e.g.:
>>
>> https://elixir.bootlin.com/linux/v5.19-rc6/source/Documentation/devicetree/bindings/clock/samsung,exynos7-clock.yaml#L57
>>
> 
> Thanks. Refer to the definition in the example and update the definition as follows:
> 
> snps,dwmac.yaml[Partial Content]:
> 
> properties:
>   resets:
>     maxItems: 1
>     description:
>       MAC Reset signal.
> 
>   reset-names:
>     const: stmmaceth
> 
> allOf:
>   - if:
>       properties:
>         compatible:
>           contains:
>             const: starfive,jh7110-dwmac
> 
>     then:
>       properties:
>         resets:
>           minItems: 2
>           maxItems: 2
>         reset-names:
>           items:
>             - const: stmmaceth
>             - const: ahb
>       required:
>         - resets
>         - reset-names
> 
> 
> starfive,jh7110-dwmac.yaml[Partial Content]:
> 
> properties:
>   resets:
>     items:
>       - description: MAC Reset signal.
>       - description: AHB Reset signal.
> 
>   reset-names:
>     items:
>       - const: stmmaceth
>       - const: ahb
> 
> allOf:
>   - $ref: snps,dwmac.yaml#
> 
> It will also report error "reset-names: ['stmmaceth', 'ahb'] is too long"  running "make dt_binding_check" with 'starfive,jh7110-dwmac.yaml'. Do you have any better suggestions to solve this problem?

Because it is not correct. The top-level properties must have the widest
constraints which in allOf:if:then:else you are further narrowing for
all of variants. ALL.

https://elixir.bootlin.com/linux/v5.19-rc6/source/Documentation/devicetree/bindings/clock/samsung,exynos7-clock.yaml#L57

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
index e26c3e76ebb7..7870228b4cd3 100644
--- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
+++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
@@ -133,12 +133,19 @@  properties:
         - ptp_ref
 
   resets:
-    maxItems: 1
-    description:
-      MAC Reset signal.
+    minItems: 1
+    maxItems: 3
+    additionalItems: true
+    items:
+      - description: MAC Reset signal
 
   reset-names:
-    const: stmmaceth
+    minItems: 1
+    maxItems: 3
+    additionalItems: true
+    contains:
+      enum:
+        - stmmaceth
 
   power-domains:
     maxItems: 1