1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 06:18:07 +00:00

fix(core): reset optiga during initialization

[no changelog]
This commit is contained in:
tychovrahe 2023-09-26 11:44:43 +02:00 committed by TychoVrahe
parent 510281590f
commit 5d017e928d
4 changed files with 37 additions and 0 deletions

View File

@ -136,6 +136,7 @@ if TREZOR_MODEL in ('R', ):
] ]
SOURCE_TREZORHAL += [ SOURCE_TREZORHAL += [
'embed/trezorhal/unix/secret.c', 'embed/trezorhal/unix/secret.c',
'embed/trezorhal/unix/optiga_hal.c',
] ]
SOURCE_UNIX = [ SOURCE_UNIX = [

View File

@ -35,6 +35,9 @@
#ifdef USE_I2C #ifdef USE_I2C
#include "i2c.h" #include "i2c.h"
#endif #endif
#ifdef USE_OPTIGA
#include "optiga_hal.h"
#endif
#ifdef USE_TOUCH #ifdef USE_TOUCH
#include "touch.h" #include "touch.h"
#endif #endif
@ -452,6 +455,10 @@ int bootloader_main(void) {
i2c_init(); i2c_init();
#endif #endif
#ifdef USE_OPTIGA
optiga_hal_init();
#endif
#ifdef USE_TOUCH #ifdef USE_TOUCH
touch_power_on(); touch_power_on();
touch_init(); touch_init();

View File

@ -11,6 +11,9 @@ void optiga_hal_init(void) {
GPIO_InitStructure.Alternate = 0; GPIO_InitStructure.Alternate = 0;
GPIO_InitStructure.Pin = GPIO_PIN_9; GPIO_InitStructure.Pin = GPIO_PIN_9;
HAL_GPIO_Init(GPIOD, &GPIO_InitStructure); HAL_GPIO_Init(GPIOD, &GPIO_InitStructure);
// perform reset on every initialization
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_9, GPIO_PIN_RESET);
hal_delay(10);
HAL_GPIO_WritePin(GPIOD, GPIO_PIN_9, GPIO_PIN_SET); HAL_GPIO_WritePin(GPIOD, GPIO_PIN_9, GPIO_PIN_SET);
// warm reset startup time min 15ms // warm reset startup time min 15ms
hal_delay(20); hal_delay(20);

View File

@ -0,0 +1,26 @@
/*
* This file is part of the Trezor project, https://trezor.io/
*
* Copyright (c) SatoshiLabs
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
void optiga_hal_init(void) {
// nothing to do
}
void optiga_reset(void) {
// nothing to do
}