Re: [PATCH] dt-bindings: mmc: fsl-imx-esdhc: allow more compatible combinations

From: Krzysztof Kozlowski
Date: Sat Jan 07 2023 - 09:02:25 EST


On 07/01/2023 14:43, Andreas Kemnade wrote:
> On Sat, 7 Jan 2023 14:23:08 +0100
> Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx> wrote:
>
>> On 06/01/2023 20:33, Andreas Kemnade wrote:
>>> On Fri, 6 Jan 2023 09:41:01 +0100
>>> Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxx> wrote:
>>>
>>>> On 05/01/2023 22:38, Andreas Kemnade wrote:
>>>>> Currently make dtbs_check shows lots of errors because imx*.dtsi does
>>>>> not use single compatibles but combinations of them.
>>>>> Allow all the combinations used there.
>>>>>
>>>>> Patches fixing the dtsi files according to binding documentation were
>>>>> submitted multiple times and are commonly rejected, so relax the rules.
>>>>> Example:
>>>>> https://lore.kernel.org/linux-devicetree/72e1194e10ccb4f87aed96265114f0963e805092.camel@xxxxxxxxxxxxxx/
>>>>>
>>>>> Reason: compatibility of new dtbs with old kernels or bootloaders.
>>>>>
>>>>> This will significantly reduce noise on make dtbs_check.
>>>>>
>>>>> Signed-off-by: Andreas Kemnade <andreas@xxxxxxxxxxxx>
>>>>> ---
>>>>> .../bindings/mmc/fsl-imx-esdhc.yaml | 24 +++++++++++++++++++
>>>>> 1 file changed, 24 insertions(+)
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml
>>>>> index dc6256f04b42..118ebb75f136 100644
>>>>> --- a/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml
>>>>> +++ b/Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.yaml
>>>>> @@ -37,6 +37,30 @@ properties:
>>>>> - fsl,imx8mm-usdhc
>>>>> - fsl,imxrt1050-usdhc
>>>>> - nxp,s32g2-usdhc
>>>>
>>>> You must drop the items from enum above. Binding saying:
>>>> compatible="A"
>>>> or:
>>>> compatible="A", "B"
>>>>
>>>> is not correct. Either A is or is not compatible with B.
>>>>
>>> hmm, here we have A = B + some additional features
>>> or
>>> A = B + some additional features and additional quirks required.
>>
>> So why do you allow A alone?
>>
> because A is full-compatible, and B is half-compatible, because
> the additional required quirks are not applied.

As I explained you in private message you sent me:

That's not how compatibles are working. If device is not compatible with
B, then you cannot have it as fallback, so the patch is not correct.

If device is A and is compatible with B, then keeping A and A+B is also
incorrect because it is redundant.

This is not only here, it's everywhere, so I do not see the point to
make exception for this device. Patch is incorrect.

Best regards,
Krzysztof


>>>
>>> For the latter we have e.g.
>>> A=
>>> static const struct esdhc_soc_data usdhc_imx6sx_data = {
>>> .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
>>> | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_HS200
>>> | ESDHC_FLAG_STATE_LOST_IN_LPMODE
>>> | ESDHC_FLAG_BROKEN_AUTO_CMD23,
>>> };
>>> B=
>>> static const struct esdhc_soc_data usdhc_imx6sl_data = {
>>> .flags = ESDHC_FLAG_USDHC | ESDHC_FLAG_STD_TUNING
>>> | ESDHC_FLAG_HAVE_CAP1 | ESDHC_FLAG_ERR004536
>>> | ESDHC_FLAG_HS200
>>> | ESDHC_FLAG_BROKEN_AUTO_CMD23,
>>> };
>>>
>>> so there is the difference in ESDHC_FLAG_STATE_LOST_IN_LPMODE.
>>> That might make no difference in some usage scenario (e.g. some bootloader
>>> not doing any LPMODE), but I wonder why
>>> we need to *enforce* specifying such half-compatible things.
>>
>> I asked to remove half-compatible. Not to enforce.
>>
> well B is half-compatible, I (and others) have sent patches to remove,
> but they were rejected. I consider these patches the way to go.

No, they are not correct.

Best regards,
Krzysztof