Skip to content

Commit

Permalink
tpm_i2c_nuvoton: Add support for Nuvoton 75x TPMs
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Reza Arbab <[email protected]>
  • Loading branch information
erichte-ibm authored and rarbab committed Jan 15, 2025
1 parent 18c316a commit 670af42
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions hdata/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 15 additions & 1 deletion libstb/drivers/tpm_i2c_nuvoton.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ static const struct tpm_info tpm_nuvoton_650 = {
.vid_did = 0x60,
};

static const struct tpm_info tpm_nuvoton_75x = {
.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 const struct tpm_info *tpm_info = NULL;

Expand Down Expand Up @@ -626,8 +636,11 @@ static void __tpm_i2c_nuvoton_probe(const 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,npct601")) {
if (dt_node_is_compatible(node, "nuvoton,npct650")) {
dt_check_del_prop(node, "compatible");
dt_add_property_strings(node, "compatible",
"nuvoton,npct650", "nuvoton,npct601");
Expand All @@ -643,4 +656,5 @@ static void __tpm_i2c_nuvoton_probe(const struct tpm_info *info)
void tpm_i2c_nuvoton_probe(void)
{
__tpm_i2c_nuvoton_probe(&tpm_nuvoton_650);
__tpm_i2c_nuvoton_probe(&tpm_nuvoton_75x);
}

0 comments on commit 670af42

Please sign in to comment.