Skip to content

Commit cc290ef

Browse files
authored
Merge pull request #23 from Ham22/bug-32
Reset TPM on boot
2 parents 455f049 + 6777381 commit cc290ef

File tree

5 files changed

+30
-11
lines changed

5 files changed

+30
-11
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-10
Original file line numberDiff line numberDiff line change
@@ -197,19 +197,18 @@ 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
205-
#ifdef CONFIG_PISTACHIO_WATCHDOG
206-
hw_watchdog_init();
207-
#endif
208-
return 0;
209-
}
210-
211-
int misc_init_r(void)
212-
{
213212
return 0;
214213
}
215214

common/board_f.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static int init_func_watchdog_init(void)
115115
# if defined(CONFIG_HW_WATCHDOG) && (defined(CONFIG_BLACKFIN) || \
116116
defined(CONFIG_M68K) || defined(CONFIG_MICROBLAZE) || \
117117
defined(CONFIG_SH) || defined(CONFIG_AT91SAM9_WATCHDOG) || \
118-
defined(CONFIG_IMX_WATCHDOG))
118+
defined(CONFIG_IMX_WATCHDOG) || defined(CONFIG_PISTACHIO_WATCHDOG))
119119
hw_watchdog_init();
120120
# endif
121121
puts(" Watchdog enabled\n");

include/configs/pistachio_bub.h

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define CONFIG_PISTACHIO
2222
#define PISTACHIO_BOARD_NAME CONFIG_SYS_CONFIG_NAME
2323
#define CONFIG_BOARD_EARLY_INIT_F
24+
#define CONFIG_BOARD_LATE_INIT
2425
#define CONFIG_DISPLAY_BOARDINFO
2526
#define CONFIG_WINBOND_OTP
2627
#define CONFIG_OF_LIBFDT
@@ -233,6 +234,7 @@
233234
#define CONFIG_TPM_TIS_I2C_SLAVE_ADDRESS 0x20
234235
#define CONFIG_TPM_TIS_I2C
235236
#define CONFIG_CMD_TPM
237+
#define CONFIG_CMD_TPM_TEST
236238

237239
/* MMC - Sdhost */
238240
#define CONFIG_MMC

0 commit comments

Comments
 (0)