Re: [PATCH v2 1/2] dt-bindings: PCI: mediatek-gen3: add SoC based clock config

From: Frank Wunderlich
Date: Fri Oct 28 2022 - 06:31:21 EST


Am 28. Oktober 2022 11:24:36 MESZ schrieb Jianjun Wang <jianjun.wang@xxxxxxxxxxxx>:
>Hi Frank,
>
>After apply this patch, we found some dtbs_check error with the
>following patch which adds the PCIe node for MT8195:
>
>https://lore.kernel.org/linux-pci/20221020111925.30002-3-tinghan.shen@xxxxxxxxxxxx/
>
>arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dtb: pcie@112f0000
>: clock-names: 5: 'top_133m' was expected
> From schema: Documentation/devicetree/bindings/pci/mediatek-pcie-
>gen3.yaml
>arch/arm64/boot/dts/mediatek/mt8195-cherry-tomato-r2.dtb: pcie@112f8000
>: clock-names: 5: 'top_133m' was expected
> From schema: Documentation/devicetree/bindings/pci/mediatek-pcie-
>gen3.yaml
>
>Did you get the same error when adding the PCIe node for MT7986?
>
>Thanks.
>
>On Tue, 2022-10-25 at 09:28 +0200, Frank Wunderlich wrote:
>> From: Frank Wunderlich <frank-w@xxxxxxxxxxxxxxx>
>>

As far as i see the problem is the fallback-node which requires different clockconfig than the main compatible.

6th clock was defined as this enum
- top_133m # for MT8192
- peri_mem # for MT8188/MT8195

By using lower compatible as main compatible and first one as fallback you cannot success all parts of allOf.

>> clock-names:
>> - items:
>> - - const: pl_250m
>> - - const: tl_26m
>> - - const: tl_96m
>> - - const: tl_32k
>> - - const: peri_26m
>> - - enum:
>> - - top_133m # for MT8192
>> - - peri_mem # for MT8188/MT8195

From my PoV the dts is wrong as the 2 SoC are not compatible to each other...mt8192 needs top_133m as 6th clock whereas mt8195 needs peri_mem. Of course we can change it back to enum in both branches,but imho fallback does not match to main compatible in the dts.

>> +allOf:
>> + - $ref: /schemas/pci/pci-bus.yaml#
>> + - if:
>> + properties:
>> + compatible:
>> + contains:
>> + const: mediatek,mt8192-pcie
>> + then:
>> + properties:
>> + clock-names:
>> + items:
>> + - const: pl_250m
>> + - const: tl_26m
>> + - const: tl_96m
>> + - const: tl_32k
>> + - const: peri_26m
>> + - const: top_133m
>> + - if:
>> + properties:
>> + compatible:
>> + contains:
>> + enum:
>> + - mediatek,mt8188-pcie
>> + - mediatek,mt8195-pcie
>> + then:
>> + properties:
>> + clock-names:
>> + items:
>> + - const: pl_250m
>> + - const: tl_26m
>> + - const: tl_96m
>> + - const: tl_32k
>> + - const: peri_26m
>> + - const: peri_mem
>> +
>> unevaluatedProperties: false
>>
>> examples:
>


regards Frank