diff mbox series

[4/7] dt-bindings: tpm: Merge existing trivial TPMs to YAML

Message ID 20220930165116.13329-5-Alexander.Steffen@infineon.com (mailing list archive)
State New, archived
Headers show
Series Clean up TPM compatibles | expand

Commit Message

Alexander Steffen Sept. 30, 2022, 4:51 p.m. UTC
Several of the existing text files describe trivial TPMs, that fit
perfectly into the new trivial-tpms.yaml. Move them there.

Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
---
 .../bindings/security/tpm/google,cr50.txt     | 19 ----------
 .../bindings/security/tpm/tpm-i2c.txt         | 26 --------------
 .../bindings/security/tpm/tpm_tis_mmio.txt    | 25 -------------
 .../bindings/security/tpm/tpm_tis_spi.txt     | 23 ------------
 .../bindings/security/tpm/trivial-tpms.yaml   | 36 +++++++++++++++++++
 5 files changed, 36 insertions(+), 93 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/security/tpm/google,cr50.txt
 delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
 delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
 delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt

Comments

Rob Herring (Arm) Sept. 30, 2022, 10:05 p.m. UTC | #1
On Fri, 30 Sep 2022 18:51:13 +0200, Alexander Steffen wrote:
> Several of the existing text files describe trivial TPMs, that fit
> perfectly into the new trivial-tpms.yaml. Move them there.
> 
> Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
> ---
>  .../bindings/security/tpm/google,cr50.txt     | 19 ----------
>  .../bindings/security/tpm/tpm-i2c.txt         | 26 --------------
>  .../bindings/security/tpm/tpm_tis_mmio.txt    | 25 -------------
>  .../bindings/security/tpm/tpm_tis_spi.txt     | 23 ------------
>  .../bindings/security/tpm/trivial-tpms.yaml   | 36 +++++++++++++++++++
>  5 files changed, 36 insertions(+), 93 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/security/tpm/google,cr50.txt
>  delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
>  delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
>  delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dts:20.11-21: Warning (reg_format): /example-0/tpm@0:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dts:42.11-24: Warning (reg_format): /example-1/tpm@57:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit.
Alexander Steffen Oct. 4, 2022, 5:38 p.m. UTC | #2
On 01.10.22 00:05, Rob Herring wrote:
> On Fri, 30 Sep 2022 18:51:13 +0200, Alexander Steffen wrote:
>> Several of the existing text files describe trivial TPMs, that fit
>> perfectly into the new trivial-tpms.yaml. Move them there.
>>
>> Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
>> ---
>>   .../bindings/security/tpm/google,cr50.txt     | 19 ----------
>>   .../bindings/security/tpm/tpm-i2c.txt         | 26 --------------
>>   .../bindings/security/tpm/tpm_tis_mmio.txt    | 25 -------------
>>   .../bindings/security/tpm/tpm_tis_spi.txt     | 23 ------------
>>   .../bindings/security/tpm/trivial-tpms.yaml   | 36 +++++++++++++++++++
>>   5 files changed, 36 insertions(+), 93 deletions(-)
>>   delete mode 100644 Documentation/devicetree/bindings/security/tpm/google,cr50.txt
>>   delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
>>   delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
>>   delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt
>>
> 
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dts:20.11-21: Warning (reg_format): /example-0/tpm@0:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
> Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dts:42.11-24: Warning (reg_format): /example-1/tpm@57:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
> Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
> 
> doc reference errors (make refcheckdocs):
> 
> See https://patchwork.ozlabs.org/patch/
> 
> This check can fail if there are any dependencies. The base for a patch
> series is generally the most recent rc1.
> 
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
> 
> pip3 install dtschema --upgrade
> 
> Please check and re-submit.

Any idea what is wrong here with reg_format? I just copied the existing 
examples, so something was broken there before.
Rob Herring (Arm) Nov. 1, 2022, 12:03 p.m. UTC | #3
On Tue, Oct 04, 2022 at 07:38:00PM +0200, Alexander Steffen wrote:
> On 01.10.22 00:05, Rob Herring wrote:
> > On Fri, 30 Sep 2022 18:51:13 +0200, Alexander Steffen wrote:
> > > Several of the existing text files describe trivial TPMs, that fit
> > > perfectly into the new trivial-tpms.yaml. Move them there.
> > > 
> > > Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
> > > ---
> > >   .../bindings/security/tpm/google,cr50.txt     | 19 ----------
> > >   .../bindings/security/tpm/tpm-i2c.txt         | 26 --------------
> > >   .../bindings/security/tpm/tpm_tis_mmio.txt    | 25 -------------
> > >   .../bindings/security/tpm/tpm_tis_spi.txt     | 23 ------------
> > >   .../bindings/security/tpm/trivial-tpms.yaml   | 36 +++++++++++++++++++
> > >   5 files changed, 36 insertions(+), 93 deletions(-)
> > >   delete mode 100644 Documentation/devicetree/bindings/security/tpm/google,cr50.txt
> > >   delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
> > >   delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
> > >   delete mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt
> > > 
> > 
> > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> > 
> > yamllint warnings/errors:
> > 
> > dtschema/dtc warnings/errors:
> > Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dts:20.11-21: Warning (reg_format): /example-0/tpm@0:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
> > Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dts:42.11-24: Warning (reg_format): /example-1/tpm@57:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
> > Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format'
> > Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
> > Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
> > Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
> > Documentation/devicetree/bindings/security/tpm/trivial-tpms.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
> > 
> > doc reference errors (make refcheckdocs):
> > 
> > See https://patchwork.ozlabs.org/patch/
> > 
> > This check can fail if there are any dependencies. The base for a patch
> > series is generally the most recent rc1.
> > 
> > If you already ran 'make dt_binding_check' and didn't see the above
> > error(s), then make sure 'yamllint' is installed and dt-schema is up to
> > date:
> > 
> > pip3 install dtschema --upgrade
> > 
> > Please check and re-submit.
> 
> Any idea what is wrong here with reg_format? I just copied the existing
> examples, so something was broken there before.

The default bus is 1 address cell and 1 size cell. If you need something 
different, like I2C or SPI, you need to define the bus node in the 
example. This is explained in example-schema.yaml.

Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/security/tpm/google,cr50.txt b/Documentation/devicetree/bindings/security/tpm/google,cr50.txt
deleted file mode 100644
index cd69c2efdd37..000000000000
--- a/Documentation/devicetree/bindings/security/tpm/google,cr50.txt
+++ /dev/null
@@ -1,19 +0,0 @@ 
-* H1 Secure Microcontroller with Cr50 Firmware on SPI Bus.
-
-H1 Secure Microcontroller running Cr50 firmware provides several
-functions, including TPM-like functionality. It communicates over
-SPI using the FIFO protocol described in the PTP Spec, section 6.
-
-Required properties:
-- compatible: Should be "google,cr50".
-- spi-max-frequency: Maximum SPI frequency.
-
-Example:
-
-&spi0 {
-	tpm@0 {
-		compatible = "google,cr50";
-		reg = <0>;
-		spi-max-frequency = <800000>;
-	};
-};
diff --git a/Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt b/Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
deleted file mode 100644
index a65d7b71e81a..000000000000
--- a/Documentation/devicetree/bindings/security/tpm/tpm-i2c.txt
+++ /dev/null
@@ -1,26 +0,0 @@ 
-* Device Tree Bindings for I2C based Trusted Platform Module(TPM)
-
-Required properties:
-
-- compatible     : 'manufacturer,model', eg. nuvoton,npct650
-- label          : human readable string describing the device, eg. "tpm"
-- linux,sml-base : 64-bit base address of the reserved memory allocated for
-                   the firmware event log
-- linux,sml-size : size of the memory allocated for the firmware event log
-
-Optional properties:
-
-- powered-while-suspended: present when the TPM is left powered on between
-                           suspend and resume (makes the suspend/resume
-                           callbacks do nothing).
-
-Example (for OpenPower Systems with Nuvoton TPM 2.0 on I2C)
-----------------------------------------------------------
-
-tpm@57 {
-	reg = <0x57>;
-	label = "tpm";
-	compatible = "nuvoton,npct650", "nuvoton,npct601";
-	linux,sml-base = <0x7f 0xfd450000>;
-	linux,sml-size = <0x10000>;
-};
diff --git a/Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt b/Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
deleted file mode 100644
index 7c6304426da1..000000000000
--- a/Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt
+++ /dev/null
@@ -1,25 +0,0 @@ 
-Trusted Computing Group MMIO Trusted Platform Module
-
-The TCG defines multi vendor standard for accessing a TPM chip, this
-is the standard protocol defined to access the TPM via MMIO. Typically
-this interface will be implemented over Intel's LPC bus.
-
-Refer to the 'TCG PC Client Specific TPM Interface Specification (TIS)' TCG
-publication for the specification.
-
-Required properties:
-
-- compatible: should contain a string below for the chip, followed by
-              "tcg,tpm-tis-mmio". Valid chip strings are:
-	          * "atmel,at97sc3204"
-- reg: The location of the MMIO registers, should be at least 0x5000 bytes
-- interrupts: An optional interrupt indicating command completion.
-
-Example:
-
-	tpm_tis@90000 {
-				compatible = "atmel,at97sc3204", "tcg,tpm-tis-mmio";
-				reg = <0x90000 0x5000>;
-				interrupt-parent = <&EIC0>;
-				interrupts = <1 2>;
-	};
diff --git a/Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt b/Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt
deleted file mode 100644
index b800667da92b..000000000000
--- a/Documentation/devicetree/bindings/security/tpm/tpm_tis_spi.txt
+++ /dev/null
@@ -1,23 +0,0 @@ 
-Required properties:
-- compatible: should be one of the following
-    "st,st33htpm-spi"
-    "infineon,slb9670"
-    "tcg,tpm_tis-spi"
-- spi-max-frequency: Maximum SPI frequency (depends on TPMs).
-
-Optional SoC Specific Properties:
-- pinctrl-names: Contains only one value - "default".
-- pintctrl-0: Specifies the pin control groups used for this controller.
-
-Example (for ARM-based BeagleBoard xM with TPM_TIS on SPI4):
-
-&mcspi4 {
-
-
-        tpm_tis@0 {
-
-                compatible = "tcg,tpm_tis-spi";
-
-                spi-max-frequency = <10000000>;
-        };
-};
diff --git a/Documentation/devicetree/bindings/security/tpm/trivial-tpms.yaml b/Documentation/devicetree/bindings/security/tpm/trivial-tpms.yaml
index a9e2dd17b1ca..1fd7f38b7b6d 100644
--- a/Documentation/devicetree/bindings/security/tpm/trivial-tpms.yaml
+++ b/Documentation/devicetree/bindings/security/tpm/trivial-tpms.yaml
@@ -44,20 +44,34 @@  properties:
   compatible:
     contains:
       enum:
+          # Atmel AT97SC3204 LPC TPM 1.2
+        - atmel,at97sc3204
           # Atmel AT97SC3204T I2C TPM 1.2
         - atmel,at97sc3204t
+          # Google Titan H1/Cr50 I2C/SPI TPM 2.0
+        - google,cr50
           # Infineon SLB9635 I2C TPM 1.2 (old protocol, max 100khz)
         - infineon,slb9635tt
           # Infineon SLB9645 I2C TPM 1.2 (new protocol, max 400khz)
         - infineon,slb9645tt
+          # Infineon SLB9670 SPI TPM 2.0
+        - infineon,slb9670
           # Infineon SLB9673 I2C TPM 2.0
         - infineon,slb9673
           # Nuvoton NPCT501 I2C TPM 1.2
         - nuvoton,npct501
           # Nuvoton NPCT601 I2C TPM 2.0
         - nuvoton,npct601
+          # Nuvoton NPCT650 I2C TPM 2.0
+        - nuvoton,npct650
           # Socionext SynQuacer MMIO TPM
         - socionext,synquacer-tpm-mmio
+          # STMicroelectronics ST33TPHF2xSPI TPM 2.0
+        - st,st33htpm-spi
+          # TCG TIS-compliant MMIO TPM (generic fallback)
+        - tcg,tpm-tis-mmio
+          # TCG TIS-compliant SPI TPM (generic fallback)
+        - tcg,tpm_tis-spi
           # Winbond WPCT301 I2C TPM 1.2
         - winbond,wpct301
 
@@ -67,4 +81,26 @@  required:
 
 additionalProperties: false
 
+examples:
+  - |
+    tpm@0 {
+      compatible = "google,cr50";
+      reg = <0>;
+      spi-max-frequency = <800000>;
+    };
+  - |
+    tpm@57 {
+      compatible = "nuvoton,npct601";
+      reg = <0x57>;
+      linux,sml-base = <0x7f 0xfd450000>;
+      linux,sml-size = <0x10000>;
+    };
+  - |
+    tpm_tis@90000 {
+      compatible = "atmel,at97sc3204";
+      reg = <0x90000 0x5000>;
+      interrupt-parent = <&EIC0>;
+      interrupts = <1 2>;
+    };
+
 ...