From 70b9746dc5421f4d13f9e9eca75146e4bbb40a15 Mon Sep 17 00:00:00 2001 From: tychovrahe Date: Wed, 20 Nov 2024 10:49:02 +0100 Subject: [PATCH] feat(core): support powering up optiga on T3T1 rev. G and T3B1 rev. C PCBs [no changelog] --- core/embed/models/T3B1/boards/trezor_t3b1_revB.h | 3 +++ core/embed/models/T3T1/boards/trezor_t3t1_revE.h | 3 +++ core/embed/sec/optiga/stm32f4/optiga_hal.c | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/core/embed/models/T3B1/boards/trezor_t3b1_revB.h b/core/embed/models/T3B1/boards/trezor_t3b1_revB.h index 85b5774a17..f46b908758 100644 --- a/core/embed/models/T3B1/boards/trezor_t3b1_revB.h +++ b/core/embed/models/T3B1/boards/trezor_t3b1_revB.h @@ -53,6 +53,9 @@ #define OPTIGA_RST_PORT GPIOE #define OPTIGA_RST_PIN GPIO_PIN_13 #define OPTIGA_RST_CLK_EN __HAL_RCC_GPIOE_CLK_ENABLE +#define OPTIGA_PWR_PORT GPIOF +#define OPTIGA_PWR_PIN GPIO_PIN_13 +#define OPTIGA_PWR_CLK_EN __HAL_RCC_GPIOF_CLK_ENABLE #define SBU_1_PIN GPIO_PIN_2 #define SBU_1_PORT GPIOA diff --git a/core/embed/models/T3T1/boards/trezor_t3t1_revE.h b/core/embed/models/T3T1/boards/trezor_t3t1_revE.h index ebae58b5f3..1cacc78778 100644 --- a/core/embed/models/T3T1/boards/trezor_t3t1_revE.h +++ b/core/embed/models/T3T1/boards/trezor_t3t1_revE.h @@ -98,6 +98,9 @@ #define OPTIGA_RST_PORT GPIOB #define OPTIGA_RST_PIN GPIO_PIN_1 #define OPTIGA_RST_CLK_EN __HAL_RCC_GPIOB_CLK_ENABLE +#define OPTIGA_PWR_PORT GPIOF +#define OPTIGA_PWR_PIN GPIO_PIN_13 +#define OPTIGA_PWR_CLK_EN __HAL_RCC_GPIOF_CLK_ENABLE #define SD_DETECT_PORT GPIOC #define SD_DETECT_PIN GPIO_PIN_13 diff --git a/core/embed/sec/optiga/stm32f4/optiga_hal.c b/core/embed/sec/optiga/stm32f4/optiga_hal.c index 9a35af5ecc..7cc5919d16 100644 --- a/core/embed/sec/optiga/stm32f4/optiga_hal.c +++ b/core/embed/sec/optiga/stm32f4/optiga_hal.c @@ -19,7 +19,8 @@ void optiga_hal_init(void) { HAL_GPIO_Init(OPTIGA_RST_PORT, &GPIO_InitStructure); #ifdef OPTIGA_PWR_PIN - GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; + OPTIGA_PWR_CLK_EN(); + GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_OD; GPIO_InitStructure.Pull = GPIO_NOPULL; GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStructure.Alternate = 0;