Fix for Infineon SLB9672 max speed. For older SLB9670 use `--enable-infineon=slb9670` or define `WOLFTPM_SLB9670`. Fixes #223

pull/228/head
David Garske 2022-07-15 15:52:37 -07:00
parent 63be95dd1b
commit 2ce8062f06
2 changed files with 18 additions and 11 deletions

View File

@ -310,9 +310,14 @@ AC_ARG_ENABLE([infineon],
[ ENABLED_INFINEON=$enableval ],
[ ENABLED_INFINEON=no ]
)
if test "x$ENABLED_INFINEON" = "xyes"
if test "x$ENABLED_INFINEON" != "xno"
then
AM_CFLAGS="$AM_CFLAGS -DWOLFTPM_SLB9670 -DWOLFTPM_SLB9672"
if test "x$ENABLED_INFINEON" = "xslb9670"
then
AM_CFLAGS="$AM_CFLAGS -DWOLFTPM_SLB9670"
else
AM_CFLAGS="$AM_CFLAGS -DWOLFTPM_SLB9672"
fi
fi
@ -402,7 +407,7 @@ AM_CONDITIONAL([BUILD_I2C], [test "x$ENABLED_I2C" = "xyes"])
AM_CONDITIONAL([BUILD_ADVIO], [test "x$ENABLED_ADVIO" = "xyes"])
AM_CONDITIONAL([BUILD_ST], [test "x$ENABLED_ST" = "xyes"])
AM_CONDITIONAL([BUILD_MICROCHIP], [test "x$ENABLED_MICROCHIP" = "xyes"])
AM_CONDITIONAL([BUILD_INFINEON], [test "x$ENABLED_INFINEON" = "xyes"])
AM_CONDITIONAL([BUILD_INFINEON], [test "x$ENABLED_INFINEON" != "xno"])
AM_CONDITIONAL([BUILD_DEVTPM], [test "x$ENABLED_DEVTPM" = "xyes"])
AM_CONDITIONAL([BUILD_SWTPM], [test "x$ENABLED_SWTPM" = "xyes"])
AM_CONDITIONAL([BUILD_WINAPI], [test "x$ENABLED_WINAPI" = "xyes"])

View File

@ -215,11 +215,6 @@ typedef int64_t INT64;
/* #define WOLFTPM_SLB9670 */
/* #define WOLFTPM_SLB9672 */
/* Define a default chip */
#if !defined(WOLFTPM_ST33) && !defined(WOLFTPM_MCHP) && \
!defined(WOLFTPM_NUVOTON) && !defined(WOLFTPM_SLB9670)
#define WOLFTPM_SLB9670
#endif
/* Chip Specific Settings */
#ifdef WOLFTPM_MCHP
@ -257,8 +252,15 @@ typedef int64_t INT64;
#endif
#else
/* Infineon OPTIGA SLB9670/SLB9672 */
/* Max: 43MHz */
#define TPM2_SPI_MAX_HZ_INFINEON 43000000
#ifdef WOLFTPM_SLB9670
/* Max: 43MHz */
#define TPM2_SPI_MAX_HZ_INFINEON 43000000
#else
#undef WOLFTPM_SLB9672
#define WOLFTPM_SLB9672
/* Max: 33MHz */
#define TPM2_SPI_MAX_HZ_INFINEON 33000000
#endif
#ifndef TPM2_SPI_MAX_HZ
#define TPM2_SPI_MAX_HZ TPM2_SPI_MAX_HZ_INFINEON
#endif
@ -271,7 +273,7 @@ typedef int64_t INT64;
#define WOLFTPM_CHECK_WAIT_STATE
/* use a safe MHz (minimum of above) */
#undef TPM2_SPI_MAX_HZ
#undef TPM2_SPI_MAX_HZ
#define TPM2_SPI_MAX_HZ 33000000
/* always perform self-test (some chips require) */