Skip to content

Commit 6777381

Browse files
committed
marduk: reset the tpm
The current version of the board has the tpm reset line connected to a gpio. This causes security issues meaning we need a new HW spin but to make do with what we have at least reset the tpm on boot. Therfore have added mfio_setup_tpm function and call it as part of tpm initialisation. This is certainly not the best place to put this but considering the current arch of 'pistachio_bub is king' there isn't much else we can do without refactoring everything. Signed-off-by: Ian Pozella <[email protected]>
1 parent 6ee2478 commit 6777381

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

board/imgtec/pistachio_bub/mfio.c

+14
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* SPDX-License-Identifier: GPL-2.0+
66
*/
77

8+
#include <common.h>
89
#include <asm/io.h>
910
#include <asm/pistachio.h>
1011
#include "mfio.h"
@@ -327,3 +328,16 @@ void mfio_setup_led(void)
327328
pistachio_set_gpio_output_state(76, 1);
328329
}
329330
#endif
331+
332+
#if defined(CONFIG_TARGET_PISTACHIO_MARDUK)
333+
void mfio_setup_tpm(void)
334+
{
335+
/* Reset the TPM, first versions of the board
336+
have the tpm reset connected to gpio 42 instead
337+
of directly connected to system reset */
338+
pistachio_configure_gpio(42, 1);
339+
pistachio_set_gpio_output_state(42, 0);
340+
udelay(100);
341+
pistachio_set_gpio_output_state(42, 1);
342+
}
343+
#endif

board/imgtec/pistachio_bub/mfio.h

+4
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,7 @@ void mfio_setup_usb_pwr(void);
189189
#if defined(CONFIG_TARGET_PISTACHIO_MARDUK)
190190
void mfio_setup_led(void);
191191
#endif
192+
193+
#if defined(CONFIG_TARGET_PISTACHIO_MARDUK)
194+
void mfio_setup_tpm(void);
195+
#endif

board/imgtec/pistachio_bub/pistachio.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,17 @@ int board_early_init_f(void)
197197
int board_late_init(void)
198198
{
199199
#ifdef CONFIG_TPM
200-
if (tpm_init() || tpm_startup(TPM_ST_CLEAR)) {
201-
printf("Failed to enable tpm!\n");
200+
uint32_t result;
201+
202+
mfio_setup_tpm();
203+
udelay(10000);
204+
tpm_init();
205+
result = tpm_startup(TPM_ST_CLEAR);
206+
if (result != 0) {
207+
printf("tpm startup failed with 0x%x\n", result);
202208
return 1;
203209
}
210+
printf("TPM: Infineon (1.2)\n");
204211
#endif
205212
return 0;
206213
}

0 commit comments

Comments
 (0)