Skip to content

Commit

Permalink
marduk: reset the tpm
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Ham22 committed Dec 9, 2016
1 parent 6ee2478 commit 6777381
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
14 changes: 14 additions & 0 deletions board/imgtec/pistachio_bub/mfio.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* SPDX-License-Identifier: GPL-2.0+
*/

#include <common.h>
#include <asm/io.h>
#include <asm/pistachio.h>
#include "mfio.h"
Expand Down Expand Up @@ -327,3 +328,16 @@ void mfio_setup_led(void)
pistachio_set_gpio_output_state(76, 1);
}
#endif

#if defined(CONFIG_TARGET_PISTACHIO_MARDUK)
void mfio_setup_tpm(void)
{
/* Reset the TPM, first versions of the board
have the tpm reset connected to gpio 42 instead
of directly connected to system reset */
pistachio_configure_gpio(42, 1);
pistachio_set_gpio_output_state(42, 0);
udelay(100);
pistachio_set_gpio_output_state(42, 1);
}
#endif
4 changes: 4 additions & 0 deletions board/imgtec/pistachio_bub/mfio.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,7 @@ void mfio_setup_usb_pwr(void);
#if defined(CONFIG_TARGET_PISTACHIO_MARDUK)
void mfio_setup_led(void);
#endif

#if defined(CONFIG_TARGET_PISTACHIO_MARDUK)
void mfio_setup_tpm(void);
#endif
11 changes: 9 additions & 2 deletions board/imgtec/pistachio_bub/pistachio.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,17 @@ int board_early_init_f(void)
int board_late_init(void)
{
#ifdef CONFIG_TPM
if (tpm_init() || tpm_startup(TPM_ST_CLEAR)) {
printf("Failed to enable tpm!\n");
uint32_t result;

mfio_setup_tpm();
udelay(10000);
tpm_init();
result = tpm_startup(TPM_ST_CLEAR);
if (result != 0) {
printf("tpm startup failed with 0x%x\n", result);
return 1;
}
printf("TPM: Infineon (1.2)\n");
#endif
return 0;
}
Expand Down

0 comments on commit 6777381

Please sign in to comment.