diff --git a/board/imgtec/pistachio_bub/mfio.c b/board/imgtec/pistachio_bub/mfio.c index 7e960faff9..17251f8996 100644 --- a/board/imgtec/pistachio_bub/mfio.c +++ b/board/imgtec/pistachio_bub/mfio.c @@ -5,6 +5,7 @@ * SPDX-License-Identifier: GPL-2.0+ */ +#include #include #include #include "mfio.h" @@ -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 diff --git a/board/imgtec/pistachio_bub/mfio.h b/board/imgtec/pistachio_bub/mfio.h index e7d4d68e13..e6c7b54563 100644 --- a/board/imgtec/pistachio_bub/mfio.h +++ b/board/imgtec/pistachio_bub/mfio.h @@ -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 diff --git a/board/imgtec/pistachio_bub/pistachio.c b/board/imgtec/pistachio_bub/pistachio.c index e0113028ca..285e389093 100644 --- a/board/imgtec/pistachio_bub/pistachio.c +++ b/board/imgtec/pistachio_bub/pistachio.c @@ -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; } diff --git a/common/board_f.c b/common/board_f.c index 99b4d8eba2..fffb2772e6 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -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"); diff --git a/include/configs/pistachio_bub.h b/include/configs/pistachio_bub.h index c8c21fa77c..fedd629db3 100644 --- a/include/configs/pistachio_bub.h +++ b/include/configs/pistachio_bub.h @@ -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 @@ -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