Re: [PATCH v3] dt-bindings: usb: uhci: convert to dt schema

From: Krzysztof Kozlowski
Date: Tue Apr 23 2024 - 04:40:08 EST


On 23/04/2024 09:54, Mohammad Shehar Yaar Tausif wrote:
> On 4/23/24 12:24 PM, Krzysztof Kozlowski wrote:
>> On 22/04/2024 14:21, Mohammad Shehar Yaar Tausif wrote:
>>> Convert USB UHCI bindings to DT schema. Documenting aspeed compatibles
>>> and missing properties. Adding aspeed/generic-uhci example and fix previous
>>> incorrect example.
>>>
>>> Signed-off-by: Mohammad Shehar Yaar Tausif <sheharyaar48@xxxxxxxxx>
>>
>>> +required:
>>> + - compatible
>>> + - reg
>>> + - interrupts
>>> +
>>> +allOf:
>>> + - if:
>>> + properties:
>>> + compatible:
>>> + contains:
>>> + const: generic-uhci
>>> + then:
>>> + $ref: usb-hcd.yaml
>>
>> Nothing improved here.
>
> Sorry, I could not understand this, please guide me about the correction
> required here.
> I added $ref inside the if-then block because it was raising errors when
> tested against
> dts files that used "platform-uhci" as the compatible. Putting it above
> the if block did
> not work.

Where is it explained? The answer to such problem is not make bindings
incorrect... I mean, the easiest to understand if you are doing
something unusual is to check if you see such pattern. How many bindings
reference other schema in if:then:? Is this common?


>
> When I ref the usb-hcd.yaml, it also includes usb.yaml which requires
> the nodename to start with usb*,

Yeah, because DTS should be fixed, not bindings made incorrect.

> but the dtsi that use the deprecated compatible
> (arch/arm/boot/dts/vt8500/wm8505.dtsi) have their nodename with
> uhci*, which causes the tests to fail.

So fix the DTS.

>
>>> + required:
>>> + - clocks
>>
>> And this was not tested.
>>> +
>>> +unevaluatedProperties: false
>>> +
>>> +examples:
>>> + - |
>>> + uhci@d8007b00 {
>>> + compatible = "platform-uhci";
>>
>> What happened here? This is deprecated!
>
> The original example has the nodename as uhci* which causes the schema
> to fail as mentioned earlier.

So the solution is to correct the name, not use deprecated compatible
and incorrect name.

> Should I just remove the example or should I rename the node here and
> add clock field to the original example ?

I assume you understand the concept of bindings and went briefly through
DT specification or some tutorials. So yes, you must fix the node name.

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation

Best regards,
Krzysztof