Skip to contentSkip to conversation

tpm_tis: Allow tpm_tis to be bound using DT

PATCH Superseded Jason Gunthorpe 3 participants 4 messages Oct 26, 2016 – Nov 4, 2016 2 messages not in the archive

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tpm_tis: Allow tpm_tis to be bound using DT

This provides an open firwmare driver binding for tpm_tis. OF is useful on arches where ACPI/PNP is not used.

The tcg,tpm-tis-mmio register map interface is specified by the TCG.

---
 .../bindings/security/tpm/tpm_tis_mmio.txt         | 23 ++++++++++++++++++++++
 drivers/char/tpm/Kconfig                           |  2 +-
 drivers/char/tpm/tpm_tis.c                         | 11 +++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt

v2 (from Mark)
- Change name to tpm-tis-mmio (and fix c&p spi)
- Include some valid chip names

Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt new file +23 -0
new file mode 100644
index 000000000000..f9a853165cd0
@@ -0,0 +1,23 @@
+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
+- interrupt: An optional interrupt indicating command completion.
+
+Example:
+
+	tpm_tis@90000 {
+				compatible = "atmel,at97sc3204", "tcg,tpm-tis-mmio";
+				reg = <0x90000 0x5000>;
+			};
drivers/char/tpm/Kconfig +1 -1
index 9faa0b1e7766..277186d3b668 100644
@@ -32,7 +32,7 @@ config TCG_TIS_CORE
 
 config TCG_TIS
 	tristate "TPM Interface Specification 1.2 Interface / TPM 2.0 FIFO Interface"
-	depends on X86
+	depends on X86 || OF
 	select TCG_TIS_CORE
 	---help---
 	  If you have a TPM security chip that is compliant with the
drivers/char/tpm/tpm_tis.c +11 -0
index eaf5730d79eb..0127af130cb1 100644
@@ -28,6 +28,8 @@
 #include <linux/wait.h>
 #include <linux/acpi.h>
 #include <linux/freezer.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include "tpm.h"
 #include "tpm_tis_core.h"
 
@@ -354,12 +356,21 @@ static int tpm_tis_plat_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id tis_of_platform_match[] = {
+	{.compatible = "tcg,tpm-tis-mmio"},
+	{},
+};
+MODULE_DEVICE_TABLE(of, tis_of_platform_match);
+#endif
+
 static struct platform_driver tis_drv = {
 	.probe = tpm_tis_plat_probe,
 	.remove = tpm_tis_plat_remove,
 	.driver = {
 		.name		= "tpm_tis",
 		.pm		= &tpm_tis_pm,
+		.of_match_table = of_match_ptr(tis_of_platform_match),
 	},
 };
 
Signature · 6 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20161026170437.GB13461-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org

#2 lore raw
Quoted 29 lines · Jason Gunthorpe

This provides an open firwmare driver binding for tpm_tis. OF is useful on arches where ACPI/PNP is not used.

The tcg,tpm-tis-mmio register map interface is specified by the TCG.

---
 .../bindings/security/tpm/tpm_tis_mmio.txt         | 23 ++++++++++++++++++++++
 drivers/char/tpm/Kconfig                           |  2 +-
 drivers/char/tpm/tpm_tis.c                         | 11 +++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt

v2 (from Mark)
- Change name to tpm-tis-mmio (and fix c&p spi)
- Include some valid chip names

Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt new file +6 -0
new file mode 100644
index 000000000000..f9a853165cd0
@@ -0,0 +1,23 @@
+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.
+

Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt line 16

Quoted 10 lines
Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt new file +10 -0
+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
+- interrupt: An optional intzerrupt indicating command completion.

s/interrupt/interrupts/

Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt line 22

Quoted 6 lines
Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt new file +6 -0
+
+Example:
+
+	tpm_tis@90000 {
+				compatible = "atmel,at97sc3204", "tcg,tpm-tis-mmio";
+				reg = <0x90000 0x5000>;

Missing the required interrupts property.

Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt line 23

Quoted 1 line
Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt new file +1 -0
+			};

The indentation here is off, otherwise:

Rob

------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers Did the resurgence of CLI tooling catch you by surprise? Reconnect with the command line and become more productive. Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik

Reviewed-by
#3 lore raw
In reply to a message not in the archive
Quoted 6 lines · Jason Gunthorpe

This provides an open firwmare driver binding for tpm_tis. OF is useful on arches where ACPI/PNP is not used.

The tcg,tpm-tis-mmio register map interface is specified by the TCG.

/Jarkko

Quoted 91 lines
---
 .../bindings/security/tpm/tpm_tis_mmio.txt         | 23 ++++++++++++++++++++++
 drivers/char/tpm/Kconfig                           |  2 +-
 drivers/char/tpm/tpm_tis.c                         | 11 +++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt

v2 (from Mark)
- Change name to tpm-tis-mmio (and fix c&p spi)
- Include some valid chip names

Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt new file +23 -0
new file mode 100644
index 000000000000..f9a853165cd0
@@ -0,0 +1,23 @@
+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
+- interrupt: An optional interrupt indicating command completion.
+
+Example:
+
+	tpm_tis@90000 {
+				compatible = "atmel,at97sc3204", "tcg,tpm-tis-mmio";
+				reg = <0x90000 0x5000>;
+			};
drivers/char/tpm/Kconfig +1 -1
index 9faa0b1e7766..277186d3b668 100644
@@ -32,7 +32,7 @@ config TCG_TIS_CORE
 
 config TCG_TIS
 	tristate "TPM Interface Specification 1.2 Interface / TPM 2.0 FIFO Interface"
-	depends on X86
+	depends on X86 || OF
 	select TCG_TIS_CORE
 	---help---
 	  If you have a TPM security chip that is compliant with the
drivers/char/tpm/tpm_tis.c +11 -0
index eaf5730d79eb..0127af130cb1 100644
@@ -28,6 +28,8 @@
 #include <linux/wait.h>
 #include <linux/acpi.h>
 #include <linux/freezer.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include "tpm.h"
 #include "tpm_tis_core.h"
 
@@ -354,12 +356,21 @@ static int tpm_tis_plat_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id tis_of_platform_match[] = {
+	{.compatible = "tcg,tpm-tis-mmio"},
+	{},
+};
+MODULE_DEVICE_TABLE(of, tis_of_platform_match);
+#endif
+
 static struct platform_driver tis_drv = {
 	.probe = tpm_tis_plat_probe,
 	.remove = tpm_tis_plat_remove,
 	.driver = {
 		.name		= "tpm_tis",
 		.pm		= &tpm_tis_pm,
+		.of_match_table = of_match_ptr(tis_of_platform_match),
 	},
 };
 
Signature · 1 line
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20161104042658.oaqd5cvrejdd7azb-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#5 lore raw
Quoted 9 lines · Jarkko Sakkinen
Quoted 6 lines · Jason Gunthorpe

This provides an open firwmare driver binding for tpm_tis. OF is useful on arches where ACPI/PNP is not used.

The tcg,tpm-tis-mmio register map interface is specified by the TCG.

Oops. Didn't notice Robs comments. Would you mind rolling one more version? Thanks and sorry.

/Jarkko

Quoted 91 lines

/Jarkko

Quoted 88 lines
---
 .../bindings/security/tpm/tpm_tis_mmio.txt         | 23 ++++++++++++++++++++++
 drivers/char/tpm/Kconfig                           |  2 +-
 drivers/char/tpm/tpm_tis.c                         | 11 +++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt

v2 (from Mark)
- Change name to tpm-tis-mmio (and fix c&p spi)
- Include some valid chip names

Documentation/devicetree/bindings/security/tpm/tpm_tis_mmio.txt new file +23 -0
new file mode 100644
index 000000000000..f9a853165cd0
@@ -0,0 +1,23 @@
+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
+- interrupt: An optional interrupt indicating command completion.
+
+Example:
+
+	tpm_tis@90000 {
+				compatible = "atmel,at97sc3204", "tcg,tpm-tis-mmio";
+				reg = <0x90000 0x5000>;
+			};
drivers/char/tpm/Kconfig +1 -1
index 9faa0b1e7766..277186d3b668 100644
@@ -32,7 +32,7 @@ config TCG_TIS_CORE
 
 config TCG_TIS
 	tristate "TPM Interface Specification 1.2 Interface / TPM 2.0 FIFO Interface"
-	depends on X86
+	depends on X86 || OF
 	select TCG_TIS_CORE
 	---help---
 	  If you have a TPM security chip that is compliant with the
drivers/char/tpm/tpm_tis.c +11 -0
index eaf5730d79eb..0127af130cb1 100644
@@ -28,6 +28,8 @@
 #include <linux/wait.h>
 #include <linux/acpi.h>
 #include <linux/freezer.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
 #include "tpm.h"
 #include "tpm_tis_core.h"
 
@@ -354,12 +356,21 @@ static int tpm_tis_plat_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id tis_of_platform_match[] = {
+	{.compatible = "tcg,tpm-tis-mmio"},
+	{},
+};
+MODULE_DEVICE_TABLE(of, tis_of_platform_match);
+#endif
+
 static struct platform_driver tis_drv = {
 	.probe = tpm_tis_plat_probe,
 	.remove = tpm_tis_plat_remove,
 	.driver = {
 		.name		= "tpm_tis",
 		.pm		= &tpm_tis_pm,
+		.of_match_table = of_match_ptr(tis_of_platform_match),
 	},
 };
 
Quoted 3 lines
Quoted 3 lines
Signature · 1 line
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html