Skip to content

Commit a982b6f

Browse files
gmccollistersjg20
authored andcommitted
tpm: tpm_tis_lpc: Add support for AT97SC3204
The Atmel AT97SC3204 is also TIS compliant. Modify the tpm_tis_lpc driver to check for the vid/did used by the Atmel AT97SC3204 and report an appropriate description. Signed-off-by: George McCollister <[email protected]> Reviewed-by: Simon Glass <[email protected]>
1 parent 0427b9c commit a982b6f

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

drivers/tpm/tpm_tis_lpc.c

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,21 @@
2121

2222
#define PREFIX "lpc_tpm: "
2323

24+
enum i2c_chip_type {
25+
SLB9635,
26+
AT97SC3204,
27+
};
28+
29+
static const char * const chip_name[] = {
30+
[SLB9635] = "Infineon SLB9635 TT 1.2",
31+
[AT97SC3204] = "Atmel AT97SC3204",
32+
};
33+
34+
static const u32 chip_didvid[] = {
35+
[SLB9635] = 0xb15d1,
36+
[AT97SC3204] = 0x32041114,
37+
};
38+
2439
struct tpm_locality {
2540
u32 access;
2641
u8 padding0[4];
@@ -146,24 +161,25 @@ static int tis_wait_reg(struct tpm_tis_lpc_priv *priv, u32 *reg, u8 mask,
146161
static int tpm_tis_lpc_probe(struct udevice *dev)
147162
{
148163
struct tpm_tis_lpc_priv *priv = dev_get_priv(dev);
149-
u32 vid, did;
150164
fdt_addr_t addr;
151165
u32 didvid;
166+
ulong chip_type = dev_get_driver_data(dev);
152167

153168
addr = dev_get_addr(dev);
154169
if (addr == FDT_ADDR_T_NONE)
155170
return -EINVAL;
156171
priv->regs = map_sysmem(addr, 0);
157172
didvid = tpm_read_word(priv, &priv->regs[0].did_vid);
158173

159-
vid = didvid & 0xffff;
160-
did = (didvid >> 16) & 0xffff;
161-
if (vid != 0x15d1 || did != 0xb) {
174+
if (didvid != chip_didvid[chip_type]) {
175+
u32 vid, did;
176+
vid = didvid & 0xffff;
177+
did = (didvid >> 16) & 0xffff;
162178
debug("Invalid vendor/device ID %04x/%04x\n", vid, did);
163-
return -ENOSYS;
179+
return -ENODEV;
164180
}
165181

166-
debug("Found TPM %s by %s\n", "SLB9635 TT 1.2", "Infineon");
182+
debug("Found TPM: %s\n", chip_name[chip_type]);
167183

168184
return 0;
169185
}
@@ -421,11 +437,13 @@ static int tpm_tis_lpc_close(struct udevice *dev)
421437

422438
static int tpm_tis_get_desc(struct udevice *dev, char *buf, int size)
423439
{
440+
ulong chip_type = dev_get_driver_data(dev);
441+
424442
if (size < 50)
425443
return -ENOSPC;
426444

427-
return snprintf(buf, size, "1.2 TPM (vendor %s, chip %s)",
428-
"Infineon", "SLB9635 TT 1.2");
445+
return snprintf(buf, size, "1.2 TPM (%s)",
446+
chip_name[chip_type]);
429447
}
430448

431449

@@ -438,7 +456,8 @@ static const struct tpm_ops tpm_tis_lpc_ops = {
438456
};
439457

440458
static const struct udevice_id tpm_tis_lpc_ids[] = {
441-
{ .compatible = "infineon,slb9635lpc" },
459+
{ .compatible = "infineon,slb9635lpc", .data = SLB9635 },
460+
{ .compatible = "atmel,at97sc3204", .data = AT97SC3204 },
442461
{ }
443462
};
444463

0 commit comments

Comments
 (0)