Skip to content

Commit

Permalink
[silicon_creator,rom,bootstrap] Convert to devicetables
Browse files Browse the repository at this point in the history
Signed-off-by: Amaury Pouly <[email protected]>
  • Loading branch information
pamaury committed Nov 14, 2024
1 parent d6b7657 commit 40f0825
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sw/device/silicon_creator/rom/bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "sw/device/silicon_creator/lib/bootstrap.h"

#include "devicetables.h"
#include "sw/device/lib/base/abs_mmio.h"
#include "sw/device/lib/base/hardened.h"
#include "sw/device/silicon_creator/lib/base/chip.h"
Expand All @@ -13,9 +14,10 @@

#include "flash_ctrl_regs.h"
#include "gpio_regs.h"
#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
#include "otp_ctrl_regs.h"

static const dt_gpio_t *kGpioDt = &kDtGpio[0];

rom_error_t bootstrap_chip_erase(void) {
flash_ctrl_bank_erase_perms_set(kHardenedBoolTrue);
rom_error_t err_0 = flash_ctrl_data_erase(0, kFlashCtrlEraseTypeBank);
Expand Down Expand Up @@ -48,9 +50,9 @@ hardened_bool_t bootstrap_requested(void) {
// enable the internal pull-downs on the strap pins. As such, an external
// weak pull-up will not be detected as a logic-high.
uint32_t res = launder32(kHardenedBoolTrue) ^ SW_STRAP_BOOTSTRAP;
res ^=
abs_mmio_read32(TOP_EARLGREY_GPIO_BASE_ADDR + GPIO_DATA_IN_REG_OFFSET) &
SW_STRAP_MASK;
res ^= abs_mmio_read32(dt_gpio_reg_block(kGpioDt, kDtGpioRegBlockCore) +
GPIO_DATA_IN_REG_OFFSET) &
SW_STRAP_MASK;
if (launder32(res) != kHardenedBoolTrue) {
return kHardenedBoolFalse;
}
Expand Down

0 comments on commit 40f0825

Please sign in to comment.