Skip to content

Commit 980745b

Browse files
Merge pull request #27 from Ham22/issue-32
pistachio: don't fail boot due to TPM missing
2 parents cc290ef + 27ae9a9 commit 980745b

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

board/imgtec/pistachio_bub/pistachio.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,23 @@
66
*/
77

88
#include <common.h>
9+
#include <dm.h>
910
#include <dwmmc.h>
1011
#include <fdtdec.h>
1112
#include <miiphy.h>
1213
#include <malloc.h>
1314
#include <netdev.h>
1415
#include <serial.h>
16+
#include <watchdog.h>
17+
#include <winbond-otp.h>
18+
#include <tpm.h>
1519

1620
#include <asm/addrspace.h>
1721
#include <asm/io.h>
1822
#include <asm/mmu.h>
1923
#include <asm/mipsregs.h>
2024
#include <asm/pistachio.h>
2125
#include <asm-generic/sections.h>
22-
#include <watchdog.h>
23-
#include <tpm.h>
24-
#include <winbond-otp.h>
2526
#include "mfio.h"
2627
#include "otp.h"
2728

@@ -197,17 +198,30 @@ int board_early_init_f(void)
197198
int board_late_init(void)
198199
{
199200
#ifdef CONFIG_TPM
201+
struct udevice *dev;
202+
char buf[80];
203+
int err;
200204
uint32_t result;
201205

206+
/* reset the tpm */
202207
mfio_setup_tpm();
203208
udelay(10000);
204-
tpm_init();
209+
210+
/* If a TPM can be found then initialise and start it */
211+
puts("TPM: ");
212+
err = tpm_init();
213+
if (err < 0) {
214+
puts("none\n");
215+
return 0;
216+
}
217+
uclass_first_device(UCLASS_TPM, &dev);
218+
tpm_get_desc(dev, buf, sizeof(buf));
219+
printf("%s\n", buf);
205220
result = tpm_startup(TPM_ST_CLEAR);
206-
if (result != 0) {
207-
printf("tpm startup failed with 0x%x\n", result);
208-
return 1;
221+
if (result) {
222+
printf("WARNING: failed to startup TPM (%d)\n", result);
223+
return 0;
209224
}
210-
printf("TPM: Infineon (1.2)\n");
211225
#endif
212226
return 0;
213227
}

0 commit comments

Comments
 (0)