From 985736f0b574252217290f4987134001e49d793e Mon Sep 17 00:00:00 2001 From: Mary Ruthven Date: Wed, 5 May 2021 11:06:02 -0500 Subject: add CONFIG_SPI_HASH Add CONFIG_SPI_HASH to control building spi hash support. BUG=b:186663661 TEST=flash usage doesn't change with make -j BOARD=cr50 Change-Id: If2f731897bcddec226cd0f388e94e82f7eeaeb8f Signed-off-by: Mary Ruthven Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2875475 Reviewed-by: Vadim Sukhomlinov Reviewed-by: Namyoon Woo --- board/cr50/board.h | 1 + board/cr50/usb_spi.c | 17 +++++++++++------ include/config.h | 3 +++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/board/cr50/board.h b/board/cr50/board.h index 8173125947..99a40211cf 100644 --- a/board/cr50/board.h +++ b/board/cr50/board.h @@ -501,6 +501,7 @@ enum nvmem_users { #define CONFIG_RW_B #define CONFIG_AP_RO_VERIFICATION +#define CONFIG_SPI_HASH /* Firmware upgrade options. */ #define CONFIG_NON_HC_FW_UPDATE diff --git a/board/cr50/usb_spi.c b/board/cr50/usb_spi.c index 392cb8e8e7..251b735b50 100644 --- a/board/cr50/usb_spi.c +++ b/board/cr50/usb_spi.c @@ -24,6 +24,7 @@ #define CPRINTS(format, args...) cprints(CC_USB, format, ## args) +#ifdef CONFIG_SPI_HASH /* Don't hash more than this at once */ #define MAX_SPI_HASH_SIZE (4 * 1024 * 1024) @@ -37,12 +38,6 @@ /* Timeout for auto-disabling SPI hash device, in microseconds */ #define SPI_HASH_TIMEOUT_US (60 * SECOND) -/* - * If True, don't touch the reset signals while setting up AP usb spi. This - * doesn't affect spi hash. - */ -static uint8_t usb_spi_custom_reset; - /* Current device for SPI hashing */ static uint8_t spi_hash_device = USB_SPI_DISABLE; @@ -85,6 +80,8 @@ bool usb_spi_shortcut_active(void) return shortcut_active_; } #endif /* CONFIG_AP_RO_VERIFICATION */ +#endif /* CONFIG_SPI_HASH */ + /*****************************************************************************/ /* @@ -101,6 +98,12 @@ static enum spi_bus_user_t { SPI_BUS_USER_HASH } spi_bus_user = SPI_BUS_USER_NONE; +/* + * If True, don't touch the reset signals while setting up AP usb spi. This + * doesn't affect spi hash. + */ +static uint8_t usb_spi_custom_reset; + /** * Set who's using the SPI bus. * @@ -379,6 +382,7 @@ int usb_spi_interface(struct usb_spi_config const *config, return 0; } +#ifdef CONFIG_SPI_HASH /*****************************************************************************/ /* Hashing support */ @@ -879,3 +883,4 @@ static int hash_command_wrapper(int argc, char *argv[]) DECLARE_SAFE_CONSOLE_COMMAND(spihash, hash_command_wrapper, "ap | ec [gang] | disable | [dump] ", "Hash SPI flash via TPM vendor command"); +#endif /* CONFIG_SPI_HASH */ diff --git a/include/config.h b/include/config.h index 9ef32893ae..9d6baf576f 100644 --- a/include/config.h +++ b/include/config.h @@ -3159,6 +3159,9 @@ */ #undef CONFIG_SPI_CONTROLLER_NO_CS_GPIOS +/* Add support for hashing AP RO */ +#undef CONFIG_SPI_HASH + /* Support testing SPI periph interface driver. */ #undef CONFIG_SPP_TEST -- cgit v1.2.1