From 40f0825fa9e51c13f00b0b78e55e65543b945e6b Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Thu, 14 Nov 2024 18:08:08 +0000 Subject: [PATCH] [silicon_creator,rom,bootstrap] Convert to devicetables Signed-off-by: Amaury Pouly --- sw/device/silicon_creator/rom/bootstrap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sw/device/silicon_creator/rom/bootstrap.c b/sw/device/silicon_creator/rom/bootstrap.c index 22fc4895dce2a8..331e4b4148ab08 100644 --- a/sw/device/silicon_creator/rom/bootstrap.c +++ b/sw/device/silicon_creator/rom/bootstrap.c @@ -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" @@ -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); @@ -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; }