Skip to content

Commit

Permalink
Merge pull request #23 from Ham22/bug-32
Browse files Browse the repository at this point in the history
Reset TPM on boot
  • Loading branch information
Ham22 authored Dec 9, 2016
2 parents 455f049 + 6777381 commit cc290ef
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 11 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
19 changes: 9 additions & 10 deletions board/imgtec/pistachio_bub/pistachio.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,18 @@ 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
#ifdef CONFIG_PISTACHIO_WATCHDOG
hw_watchdog_init();
#endif
return 0;
}

int misc_init_r(void)
{
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion common/board_f.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ static int init_func_watchdog_init(void)
# if defined(CONFIG_HW_WATCHDOG) && (defined(CONFIG_BLACKFIN) || \
defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
defined(CONFIG_SH) || defined(CONFIG_AT91SAM9_WATCHDOG) || \
defined(CONFIG_IMX_WATCHDOG))
defined(CONFIG_IMX_WATCHDOG) || defined(CONFIG_PISTACHIO_WATCHDOG))
hw_watchdog_init();
# endif
puts(" Watchdog enabled\n");
Expand Down
2 changes: 2 additions & 0 deletions include/configs/pistachio_bub.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define CONFIG_PISTACHIO
#define PISTACHIO_BOARD_NAME CONFIG_SYS_CONFIG_NAME
#define CONFIG_BOARD_EARLY_INIT_F
#define CONFIG_BOARD_LATE_INIT
#define CONFIG_DISPLAY_BOARDINFO
#define CONFIG_WINBOND_OTP
#define CONFIG_OF_LIBFDT
Expand Down Expand Up @@ -233,6 +234,7 @@
#define CONFIG_TPM_TIS_I2C_SLAVE_ADDRESS 0x20
#define CONFIG_TPM_TIS_I2C
#define CONFIG_CMD_TPM
#define CONFIG_CMD_TPM_TEST

/* MMC - Sdhost */
#define CONFIG_MMC
Expand Down

0 comments on commit cc290ef

Please sign in to comment.