[v7,6/7] tpm: Add YAML schema for TPM TIS I2C options
diff mbox series

Message ID 20200427124931.115697-7-amirmizi6@gmail.com
State Superseded
Headers show
Series
  • Add tpm i2c ptp driver
Related show

Commit Message

Amir Mizinski April 27, 2020, 12:49 p.m. UTC
From: Amir Mizinski <amirmizi6@gmail.com>

Added a YAML schema to support tpm tis i2c related dt-bindings for the I2c
PTP based physical layer.

This patch adds the documentation for corresponding device tree bindings of
I2C based Physical TPM.
Refer to the 'I2C Interface Definition' section in
'TCG PC Client PlatformTPMProfile(PTP) Specification' publication
for specification.

Signed-off-by: Amir Mizinski <amirmizi6@gmail.com>
---
 .../bindings/security/tpm/tpm-tis-i2c.yaml         | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/security/tpm/tpm-tis-i2c.yaml

Comments

Rob Herring May 5, 2020, 4:12 p.m. UTC | #1
On Mon, Apr 27, 2020 at 03:49:30PM +0300, amirmizi6@gmail.com wrote:
> From: Amir Mizinski <amirmizi6@gmail.com>
> 
> Added a YAML schema to support tpm tis i2c related dt-bindings for the I2c
> PTP based physical layer.
> 
> This patch adds the documentation for corresponding device tree bindings of
> I2C based Physical TPM.
> Refer to the 'I2C Interface Definition' section in
> 'TCG PC Client PlatformTPMProfile(PTP) Specification' publication
> for specification.

Again, DT bindings describe h/w devices, not just a protocol. A device 
is more than just a protocol interface. There's clocks, power rails, 
resets, interrupts, firmware, etc. 

Unless there's something special about TPM chips that makes none of this 
applicable and no chip will ever have any quirks (or extensions) in 
their protocol to work-around, then you need compatible string(s) that 
are specific to the TPM chip. You can have tcg,tpm-tis-i2c as a 
fallback, but you need specific compatible to handle any quirks.

Rob
Amir Mizinski May 6, 2020, 3:20 p.m. UTC | #2
On 2020-05-05 16:12, Rob Herring wrote:
> On Mon, Apr 27, 2020 at 03:49:30PM +0300, amirmizi6@gmail.com wrote:
>> From: Amir Mizinski <amirmizi6@gmail.com>
>>
>> Added a YAML schema to support tpm tis i2c related dt-bindings for the I2c
>> PTP based physical layer.
>>
>> This patch adds the documentation for corresponding device tree bindings of
>> I2C based Physical TPM.
>> Refer to the 'I2C Interface Definition' section in
>> 'TCG PC Client PlatformTPMProfile(PTP) Specification' publication
>> for specification.
>
> Again, DT bindings describe h/w devices, not just a protocol. A device
> is more than just a protocol interface. There's clocks, power rails,
> resets, interrupts, firmware, etc.
>
> Unless there's something special about TPM chips that makes none of this
> applicable and no chip will ever have any quirks (or extensions) in
> their protocol to work-around, then you need compatible string(s) that
> are specific to the TPM chip. You can have tcg,tpm-tis-i2c as a
> fallback, but you need specific compatible to handle any quirks.
>
> Rob

Hello Rob, currently yes. All TPM chip are implemented according to the TGC specs and should use the same properties for this I2C driver.
I can't say for sure that it will be the case in the future. Shouldn't we use the standard "tcg,tpm-tis-i2c" compatible, and if a specific TPM chip will deviate from the specs, the vendor should add an additional compatible string for it?
Thank you,
Amir
Rob Herring May 6, 2020, 7:02 p.m. UTC | #3
On Wed, May 6, 2020 at 10:20 AM Amir Mizinski <amirmizi6@gmail.com> wrote:
>
>
> On 2020-05-05 16:12, Rob Herring wrote:
> > On Mon, Apr 27, 2020 at 03:49:30PM +0300, amirmizi6@gmail.com wrote:
> >> From: Amir Mizinski <amirmizi6@gmail.com>
> >>
> >> Added a YAML schema to support tpm tis i2c related dt-bindings for the I2c
> >> PTP based physical layer.
> >>
> >> This patch adds the documentation for corresponding device tree bindings of
> >> I2C based Physical TPM.
> >> Refer to the 'I2C Interface Definition' section in
> >> 'TCG PC Client PlatformTPMProfile(PTP) Specification' publication
> >> for specification.
> >
> > Again, DT bindings describe h/w devices, not just a protocol. A device
> > is more than just a protocol interface. There's clocks, power rails,
> > resets, interrupts, firmware, etc.
> >
> > Unless there's something special about TPM chips that makes none of this
> > applicable and no chip will ever have any quirks (or extensions) in
> > their protocol to work-around, then you need compatible string(s) that
> > are specific to the TPM chip. You can have tcg,tpm-tis-i2c as a
> > fallback, but you need specific compatible to handle any quirks.
> >
> > Rob
>
> Hello Rob, currently yes. All TPM chip are implemented according to the TGC specs and should use the same properties for this I2C driver.
> I can't say for sure that it will be the case in the future.

Exactly. That's the issue. If you have just "tcg,tpm-tis-i2c" and need
to handle some difference in the future, then you can't without
updating the DT. You must be able to handle future issues without
updating the DT.

> Shouldn't we use the standard "tcg,tpm-tis-i2c" compatible, and if a specific TPM chip will deviate from the specs, the vendor should add an additional compatible string for it?

Name something where multiple vendors have implemented a spec and
there's no deviation. It simply doesn't exist. How would you know?

Does the TPM spec define all the things I listed above outside of just
the I2C protocol?

Also, what version of the spec is "tcg,tpm-tis-i2c"? Few specs have
only 1 version.

Rob

Patch
diff mbox series

diff --git a/Documentation/devicetree/bindings/security/tpm/tpm-tis-i2c.yaml b/Documentation/devicetree/bindings/security/tpm/tpm-tis-i2c.yaml
new file mode 100644
index 0000000..2ab8b80
--- /dev/null
+++ b/Documentation/devicetree/bindings/security/tpm/tpm-tis-i2c.yaml
@@ -0,0 +1,47 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/security/tpm/tpm-tis-i2c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: I2C PTP based TPM Device Tree Bindings
+
+maintainers:
+  - Amir Mizinski <amirmizi6@gmail.com>
+
+description:
+  Device Tree Bindings for I2C based Trusted Platform Module(TPM).
+
+properties:
+  compatible:
+    contains:
+      const: tcg,tpm-tis-i2c
+
+  reg:
+    maxItems: 1
+
+  interrupt:
+    maxItems: 1
+
+  crc-checksum:
+    $ref: /schemas/types.yaml#/definitions/flag
+    description:
+      Set this flag to enable CRC checksum.
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      tpm_tis@2e {
+        compatible = "tcg,tpm-tis-i2c";
+        reg = <0x2e>;
+        crc-checksum;
+      };
+    };
+...