diff mbox series

[v2,1/2] dt-bindings: lan9662-otpc: document Lan9662 OTPC

Message ID 20220825204041.1485731-2-horatiu.vultur@microchip.com
State Accepted
Commit d1b274c4819deed7673e5edec12fea1e57110ad8
Headers show
Series [v2,1/2] dt-bindings: lan9662-otpc: document Lan9662 OTPC | expand

Commit Message

Horatiu Vultur Aug. 25, 2022, 8:40 p.m. UTC
Document Lan9662 OTP controller.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 .../nvmem/microchip,lan9662-otpc.yaml         | 42 +++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/nvmem/microchip,lan9662-otpc.yaml

Comments

Rob Herring Aug. 26, 2022, 4:05 p.m. UTC | #1
On Thu, 25 Aug 2022 22:40:40 +0200, Horatiu Vultur wrote:
> Document Lan9662 OTP controller.
> 
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
>  .../nvmem/microchip,lan9662-otpc.yaml         | 42 +++++++++++++++++++
>  1 file changed, 42 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/nvmem/microchip,lan9662-otpc.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/nvmem/microchip,lan9662-otpc.example.dtb: otp@e0021000: compatible: ['microchip,lan9662-otpc'] is too short
	From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/nvmem/microchip,lan9662-otpc.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/nvmem/microchip,lan9662-otpc.example.dtb: otp@e0021000: Unevaluated properties are not allowed ('compatible' was unexpected)
	From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/nvmem/microchip,lan9662-otpc.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Krzysztof Kozlowski Aug. 26, 2022, 5:37 p.m. UTC | #2
On 26/08/2022 10:31, Horatiu Vultur wrote:
> The 08/26/2022 09:42, Krzysztof Kozlowski wrote:
> 
> Hi Krzysztof,
> 
>>> +properties:
>>> +  compatible:
>>> +    items:
>>> +      - const: microchip,lan9662-otpc
>>> +      - const: microchip,lan9668-otpc
>>
>> Does not look like you tested the bindings. Please run `make
>> dt_binding_check` (see
>> Documentation/devicetree/bindings/writing-schema.rst for instructions).
>>
>> This won't work...
> 
> You are right. That was a silly mistake on my side.
> 
> It should be:
> ---
> properties:
>   compatible:
>     enum:
>       - microchip,lan9662-otpc
>       - microchip,lan9668-otpc
> ---
> Because what I want to achive is to be able to use any of
> string(microchip,lan9662-otpc or microchip,lan9668-otpc) as compatible
> string.
> 
> Or this is not the correct change?
> At least with this change dt_binding_check is happy.

This would be correct from syntax point of view, however maybe not the
best choice from functional point of view. How you wrote the driver and
bindings, these devices are compatible, so why this is not expressed as
compatible devices?

Best regards,
Krzysztof
Krzysztof Kozlowski Aug. 30, 2022, 10:10 a.m. UTC | #3
On 29/08/2022 09:35, Horatiu Vultur wrote:
> The 08/26/2022 20:37, Krzysztof Kozlowski wrote:
>>
>> On 26/08/2022 10:31, Horatiu Vultur wrote:
>>> The 08/26/2022 09:42, Krzysztof Kozlowski wrote:
>>>
>>> Hi Krzysztof,
>>>
>>>>> +properties:
>>>>> +  compatible:
>>>>> +    items:
>>>>> +      - const: microchip,lan9662-otpc
>>>>> +      - const: microchip,lan9668-otpc
>>>>
>>>> Does not look like you tested the bindings. Please run `make
>>>> dt_binding_check` (see
>>>> Documentation/devicetree/bindings/writing-schema.rst for instructions).
>>>>
>>>> This won't work...
>>>
>>> You are right. That was a silly mistake on my side.
>>>
>>> It should be:
>>> ---
>>> properties:
>>>   compatible:
>>>     enum:
>>>       - microchip,lan9662-otpc
>>>       - microchip,lan9668-otpc
>>> ---
>>> Because what I want to achive is to be able to use any of
>>> string(microchip,lan9662-otpc or microchip,lan9668-otpc) as compatible
>>> string.
>>>
>>> Or this is not the correct change?
>>> At least with this change dt_binding_check is happy.
>>
>> This would be correct from syntax point of view, however maybe not the
>> best choice from functional point of view. How you wrote the driver and
>> bindings, these devices are compatible, so why this is not expressed as
>> compatible devices?
> 
> OK, so then it should be something like this?
> ---
> properties:
>   compatible:
>     items:
>        - const: microchip,lan9662-otpc
>        - const: microchip,lan9668-otpc
> ---
> 

I would expect:

oneOf:
  - items:
       - const: microchip,lan9668-otpc
       - const: microchip,lan9662-otpc
  - enum:
       - microchip,lan9662-otpc

(but you need to fix indentation)

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/nvmem/microchip,lan9662-otpc.yaml b/Documentation/devicetree/bindings/nvmem/microchip,lan9662-otpc.yaml
new file mode 100644
index 000000000000..3307f6a7a373
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/microchip,lan9662-otpc.yaml
@@ -0,0 +1,42 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/microchip,lan9662-otpc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip LAN9662 OTP Controller (OTPC)
+
+maintainers:
+  - Horatiu Vultur <horatiu.vultur@microchip.com>
+
+description: |
+  OTP controller drives a NVMEM memory where system specific data
+  (e.g. hardware configuration settings, chip identifiers) or
+  user specific data could be stored.
+
+allOf:
+  - $ref: nvmem.yaml#
+
+properties:
+  compatible:
+    items:
+      - const: microchip,lan9662-otpc
+      - const: microchip,lan9668-otpc
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    otpc: otp@e0021000 {
+        compatible = "microchip,lan9662-otpc";
+        reg = <0xe0021000 0x300>;
+    };
+
+...