Re: [PATCH v4 01/17] dt-bindings: net: wireless: cc33xx: Add ti,cc33xx.yaml

From: Nemanov, Michael
Date: Wed Oct 30 2024 - 08:15:15 EST


On 10/30/2024 1:09 PM, Krzysztof Kozlowski wrote:
On 30/10/2024 11:59, Nemanov, Michael wrote:

Your changelog does not explain these three. "Fixed compatibility" is
way too vague, especially that you do not fix anything here.


I was trying to address the feedback from previous patch. You said:

+static const struct of_device_id cc33xx_sdio_of_match_table[] = {
+ { .compatible = "ti,cc3300", .data = &cc33xx_data },
+ { .compatible = "ti,cc3301", .data = &cc33xx_data },
+ { .compatible = "ti,cc3350", .data = &cc33xx_data },
+ { .compatible = "ti,cc3351", .data = &cc33xx_data },
+ { }
+};


Eh? What happened here? So devices are compatibles thus make them
compatible in the bindings.


I thought this is the right way to do it (originally taken from [1]).
How can I solve it via DT bindings?

It's all over the bindings (also example-schema). Use fallback and oneOf.


Looking at [2] and [3] as an example I tried to do the same (make cc33xx
driver compatible with all chip variants).
How should have I done it?

qcom-wdt is quite a different device. It's true you should have here
oneOf, but for a purpose. oneOf without purpose does not make sense, right?

I think other TI bindings would serve you as an example. Or this one:

https://elixir.bootlin.com/linux/v6.3-rc6/source/Documentation/devicetree/bindings/sound/nvidia,tegra210-ope.yaml#L31


Best regards,
Krzysztof


OK.
So I should make one of the variants the base and declare others as compatible? i.e:

--Bindings--

compatible:
oneOf:
- const: ti,cc3300
- items:
- enum:
- ti,cc3301
- ti,cc3350
- ti,cc3351
- const: ti,cc3300


--Driver--

static const struct of_device_id cc33xx_sdio_of_match_table[] = {
{ .compatible = "ti,cc3300", .data = &cc33xx_data },
{ }
};