Re: [PATCH v3 1/2] tpm: Add tpm_tis_i2c backend for tpm_tis_core
From: Krzysztof Kozlowski
Date: Mon May 23 2022 - 05:46:46 EST
On 23/05/2022 11:32, Krzysztof Kozlowski wrote:
> On 23/05/2022 10:55, Alexander Steffen wrote:
>> On 22.05.22 10:30, Krzysztof Kozlowski wrote:
>>> On 20/05/2022 19:24, Alexander Steffen wrote:
>>>>
>>>> +MODULE_DEVICE_TABLE(i2c, tpm_tis_i2c_id);
>>>> +
>>>> +#ifdef CONFIG_OF
>>>> +static const struct of_device_id of_tis_i2c_match[] = {
>>>> + { .compatible = "infineon,slb9673", },
>>>> + { .compatible = "tcg,tpm_tis-i2c", },
>>>
>>> Please run checkpatch on your patches. You add undocumented compatibles.
>>
>> Sorry, the old infrastructure I had to do that automatically is not in
>> place at the moment, so it slipped through.
>>
>>> Without bindings, new compatibles and properties cannot be accepted, so NAK.
>>
>> Could you be more specific as to what the correct solution is here?
>> Usually, I'd just look at what the existing code does, but that is a
>> little messy:
>>
>>
>>
>> * socionext,synquacer-tpm-mmio is documented only in
>> Documentation/devicetree/bindings/trivial-devices.yaml
>>
>> * nuvoton,npct601 is documented in trivial-devices.yaml and is also
>> mentioned in Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
>>
>> * nuvoton,npct650 is only mentioned in tpm-i2c.txt, but appears nowhere
>> in the code
>>
>> * infineon,tpm_i2c_infineon appears only in tpm_i2c_infineon.c, but is
>> documented nowhere
>>
>> * tpm_tis_spi_main.c has all its compatibles documented in
>> tpm_tis_spi.txt, except google,cr50, which is documented in
>> google,cr50.txt, even though it has the same properties
>>
>> * tpm_tis_i2c_cr50.c uses the exact same google,cr50, even though that
>> is explicitly documented as a device "on SPI Bus" and lists
>> spi-max-frequency as one of its required properties, which does not make
>> any sense for an I2C device
>>
>> * According to the feedback in
>> https://patchwork.kernel.org/project/linux-integrity/patch/20220404081835.495-4-johannes.holland@xxxxxxxxxxxx/#24801807,
>> the text format, that is currently used everywhere in
>> Documentation/devicetree/bindings/security/tpm/, is deprecated anyway
>> and should be replaced by YAML
>>
>>
>>
>> So would you be okay with just adding the compatibles from tpm_tis_i2c.c
>> to trivial-devices.yaml, so that checkpatch does not complain anymore,
>> and leave the cleanup of the mess above for later?
>
> To trivial-devices you should add only bindings really trivial devices,
> which do not have any other properties, even when the bindings are
> finished. This means you entirely fully the hardware and still have only
> reg+compatible.
>
> If this device fits such case - no other hardware properties than reg -
> then, feel free to document it in trivial-devices. However I am not sure
> that TPM devices are that trivial... For example tpm-i2c.txt defines
> also interrupts and label.
>
> If the device is not trivial, it should be documented in bindings,
> either dedicated or some existing ones.
It seems I lost few words in my message, so let me write it again, but
maybe closer to English:
To trivial-devices you should add only bindings of really trivial
devices, which do not have any other properties, even when the bindings
are finished. This means you describe fully the hardware and still have
only reg+compatible.
If this device fits such case - no other hardware properties than reg -
then, feel free to document it in trivial-devices. However I am not sure
that TPM devices are that trivial... For example tpm-i2c.txt defines
also interrupts and label.
If the device is not trivial, it should be documented in bindings,
either dedicated or some existing ones.
Best regards,
Krzysztof