[Skiboot] [PATCH v3 2/2] libstb/tpm_i2c_nuvoton: add support for Nuvoton 75x TPMs

Eric Richter erichte at linux.ibm.com
Thu Jan 9 04:59:24 AEDT 2025


This patch adds the new expected values for the 75x chip to the hdat i2c
devices table, and the requisite new constants to the Nuvoton driver as
according to the TCG TPM I2C Interfact Specification for TPM 2.0
Revision 1.0[1].

[1] https://trustedcomputinggroup.org/resource/tcg-tpm-i2c-interface-specification/

Signed-off-by: Eric Richter <erichte at linux.ibm.com>
---
 hdata/i2c.c                      |  1 +
 libstb/drivers/tpm_i2c_nuvoton.c | 13 +++++++++++++
 libstb/drivers/tpm_i2c_nuvoton.h |  1 +
 libstb/tpm_chip.c                |  1 +
 4 files changed, 16 insertions(+)

diff --git a/hdata/i2c.c b/hdata/i2c.c
index 7d5d655a5..235aae8a8 100644
--- a/hdata/i2c.c
+++ b/hdata/i2c.c
@@ -156,6 +156,7 @@ static struct hdat_i2c_type hdat_i2c_devs[] = {
 	{ 0x11, "eeprom", "atmel,24c16" },
 	{ 0x12, "i2c", NULL },   /* NVDIA GPU */
 	{ 0x13, "i2c", "nxp,lpc11u35" },
+	{ 0x15, "tpm", "nuvoton,npct75x" },
 };
 
 struct hdat_i2c_info {
diff --git a/libstb/drivers/tpm_i2c_nuvoton.c b/libstb/drivers/tpm_i2c_nuvoton.c
index 091edbfe0..52860f763 100644
--- a/libstb/drivers/tpm_i2c_nuvoton.c
+++ b/libstb/drivers/tpm_i2c_nuvoton.c
@@ -40,6 +40,16 @@ struct tpm_info tpm_nuvoton_650_info = {
 	.vid_did = 0x60,
 };
 
+struct tpm_info tpm_nuvoton_75x_info = {
+	.compatible = "nuvoton,npct75x",
+	.vendor_id = 0x5010FC00,
+	.sts = 0x18,
+	.burst_count = 0x19,
+	.data_fifo_w = 0x24,
+	.data_fifo_r = 0x24,
+	.vid_did = 0x48,
+};
+
 
 static struct tpm_dev *tpm_device = NULL;
 static struct tpm_info *tpm_info = NULL;
@@ -618,6 +628,9 @@ void tpm_i2c_nuvoton_probe(struct tpm_info *info)
 		/*
 		 * Tweak for linux. It doesn't have a driver compatible
 		 * with "nuvoton,npct650"
+		 *
+		 * Not necessary for 75x, as we use the compatible that
+		 * Linux expects.
 		 */
 		if (dt_node_is_compatible(node, "nuvoton,npct650")) {
 			dt_check_del_prop(node, "compatible");
diff --git a/libstb/drivers/tpm_i2c_nuvoton.h b/libstb/drivers/tpm_i2c_nuvoton.h
index 9311fba22..5bfc565a6 100644
--- a/libstb/drivers/tpm_i2c_nuvoton.h
+++ b/libstb/drivers/tpm_i2c_nuvoton.h
@@ -15,6 +15,7 @@ struct tpm_info {
 };
 
 extern struct tpm_info tpm_nuvoton_650_info;
+extern struct tpm_info tpm_nuvoton_75x_info;
 
 extern void tpm_i2c_nuvoton_probe(struct tpm_info *info);
 
diff --git a/libstb/tpm_chip.c b/libstb/tpm_chip.c
index c741fc991..a84431358 100644
--- a/libstb/tpm_chip.c
+++ b/libstb/tpm_chip.c
@@ -190,6 +190,7 @@ int tpm_init(void)
 
 	/* tpm drivers supported */
 	tpm_i2c_nuvoton_probe(&tpm_nuvoton_650_info);
+	tpm_i2c_nuvoton_probe(&tpm_nuvoton_75x_info);
 
 	if (list_empty(&tpm_list)) {
 		prlog(PR_INFO, "no compatible tpm device found!\n");
-- 
2.47.0



More information about the Skiboot mailing list