From 7943ac224e3807839b515ebfc35ab02a1f804964 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Fri, 20 Sep 2024 14:00:19 +0000 Subject: [PATCH] EB test_rom WIP Signed-off-by: Amaury Pouly --- sw/device/lib/dif/BUILD | 16 ++++++++++++++-- sw/device/lib/testing/test_rom/BUILD | 8 ++++---- .../silicon_creator/lib/drivers/flash_ctrl.c | 11 ++++++++++- .../lib/drivers/flash_ctrl_info_pages.c | 9 +++++++++ .../silicon_creator/lib/drivers/spi_device.c | 11 ++++++++++- 5 files changed, 47 insertions(+), 8 deletions(-) diff --git a/sw/device/lib/dif/BUILD b/sw/device/lib/dif/BUILD index 9a757e7f4d709b..d282ffd4bf3284 100644 --- a/sw/device/lib/dif/BUILD +++ b/sw/device/lib/dif/BUILD @@ -129,6 +129,11 @@ cc_test( ":test_base", "@googletest//:gtest_main", ], + # This test is not compatible with english_breakfast + target_compatible_with = select({ + "//sw/device:is_english_breakfast": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) cc_library( @@ -820,7 +825,10 @@ cc_library( name = "rstmgr_intf", srcs = ["autogen/dif_rstmgr_autogen.h"], hdrs = ["dif_rstmgr.h"], - deps = [":base"], + deps = [ + ":base", + "//hw/top:rstmgr_dt", + ], ) cc_library( @@ -833,7 +841,6 @@ cc_library( ":base", ":rstmgr_intf", "//hw/top:rstmgr_c_regs", - "//hw/top:rstmgr_dt", "//sw/device/lib/base:bitfield", "//sw/device/lib/base:macros", "//sw/device/lib/base:memory", @@ -953,6 +960,11 @@ cc_test( ":test_base", "@googletest//:gtest_main", ], + # This test is not compatible with english_breakfast + target_compatible_with = select({ + "//sw/device:is_english_breakfast": ["@platforms//:incompatible"], + "//conditions:default": [], + }), ) cc_library( diff --git a/sw/device/lib/testing/test_rom/BUILD b/sw/device/lib/testing/test_rom/BUILD index af8a085532a7fb..58625d647618b4 100644 --- a/sw/device/lib/testing/test_rom/BUILD +++ b/sw/device/lib/testing/test_rom/BUILD @@ -80,8 +80,8 @@ cc_library( "//hw/ip/gpio/data:gpio_c_regs", "//hw/ip/otp_ctrl/data:otp_ctrl_c_regs", "//hw/ip/spi_device/data:spi_device_c_regs", - "//hw/top_englishbreakfast:flash_ctrl_c_regs", - "//hw/top_englishbreakfast:top_lib", + "//hw/top_englishbreakfast/ip_autogen/flash_ctrl:flash_ctrl_c_regs", + "//hw/top_englishbreakfast/sw/autogen:top_englishbreakfast", "//sw/device/lib/base:abs_mmio", "//sw/device/lib/base:multibits", "//sw/device/lib/dif:rstmgr_intf", @@ -123,8 +123,8 @@ cc_library( deps = [ "//hw/ip/otp_ctrl/data:otp_ctrl_c_regs", "//hw/ip/spi_device/data:spi_device_c_regs", - "//hw/top_englishbreakfast:flash_ctrl_c_regs", - "//hw/top_englishbreakfast:top_lib", + "//hw/top_englishbreakfast/ip_autogen/flash_ctrl:flash_ctrl_c_regs", + "//hw/top_englishbreakfast/sw/autogen:top_englishbreakfast", "//sw/device/lib/base:abs_mmio", "//sw/device/lib/base:macros", "//sw/device/lib/base:multibits", diff --git a/sw/device/silicon_creator/lib/drivers/flash_ctrl.c b/sw/device/silicon_creator/lib/drivers/flash_ctrl.c index 94ae26cb7affd2..6e7ab33442d528 100644 --- a/sw/device/silicon_creator/lib/drivers/flash_ctrl.c +++ b/sw/device/silicon_creator/lib/drivers/flash_ctrl.c @@ -17,9 +17,14 @@ #include "sw/device/silicon_creator/lib/error.h" #include "flash_ctrl_regs.h" -#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h" #include "otp_ctrl_regs.h" +#ifdef OT_IS_ENGLISH_BREAKFAST +#include "hw/top_englishbreakfast/sw/autogen/top_englishbreakfast.h" +#else +#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h" +#endif + // Values of `flash_ctrl_partition_t` constants must be distinct from each // other, and `kFlashCtrlRegionInfo* >> 1` should give the correct // CONTROL.INFO_SEL value. @@ -36,7 +41,11 @@ enum { /** * Base address of the flash_ctrl registers. */ +#ifdef OT_IS_ENGLISH_BREAKFAST + kBase = TOP_ENGLISHBREAKFAST_FLASH_CTRL_CORE_BASE_ADDR, +#else kBase = TOP_EARLGREY_FLASH_CTRL_CORE_BASE_ADDR, +#endif }; /** diff --git a/sw/device/silicon_creator/lib/drivers/flash_ctrl_info_pages.c b/sw/device/silicon_creator/lib/drivers/flash_ctrl_info_pages.c index f29952250cf38a..05994dcec4966a 100644 --- a/sw/device/silicon_creator/lib/drivers/flash_ctrl_info_pages.c +++ b/sw/device/silicon_creator/lib/drivers/flash_ctrl_info_pages.c @@ -5,13 +5,22 @@ #include "sw/device/silicon_creator/lib/drivers/flash_ctrl.h" #include "flash_ctrl_regs.h" + +#ifdef OT_IS_ENGLISH_BREAKFAST +#include "hw/top_englishbreakfast/sw/autogen/top_englishbreakfast.h" +#else #include "hw/top_earlgrey/sw/autogen/top_earlgrey.h" +#endif enum { /** * Base address of the flash_ctrl registers. */ +#ifdef OT_IS_ENGLISH_BREAKFAST + kBase = TOP_ENGLISHBREAKFAST_FLASH_CTRL_CORE_BASE_ADDR, +#else kBase = TOP_EARLGREY_FLASH_CTRL_CORE_BASE_ADDR, +#endif }; #define INFO_PAGE_STRUCT_(name_, bank_, page_) \ diff --git a/sw/device/silicon_creator/lib/drivers/spi_device.c b/sw/device/silicon_creator/lib/drivers/spi_device.c index 0cd3c61791c543..237aa06159e639 100644 --- a/sw/device/silicon_creator/lib/drivers/spi_device.c +++ b/sw/device/silicon_creator/lib/drivers/spi_device.c @@ -11,14 +11,23 @@ #include "sw/device/silicon_creator/lib/error.h" #include "flash_ctrl_regs.h" -#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h" #include "spi_device_regs.h" +#ifdef OT_IS_ENGLISH_BREAKFAST +#include "hw/top_englishbreakfast/sw/autogen/top_englishbreakfast.h" +#else +#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h" +#endif + enum { /** * Base address of the spi_device registers. */ +#ifdef OT_IS_ENGLISH_BREAKFAST + kBase = TOP_ENGLISHBREAKFAST_SPI_DEVICE_BASE_ADDR, +#else kBase = TOP_EARLGREY_SPI_DEVICE_BASE_ADDR, +#endif /** * Start address of the SFDP space in spi_device buffer. */