From cb01aa586f45277043d36500d9694d750ed33190 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Sat, 11 Jan 2020 11:44:47 -0700 Subject: drivers/spi/spi_flash: assume spi_flash read callback exists spi_flash_erase() and spi_flash_write() already assume their respective callbacks are supplied in the spi_flash_ops object. Make the same assumption in spi_flash_read(). In order to do this the spi_flash_ops objects from the drivers need to reference the the previously used fallback read command, spi_flash_read_chunked(). This function is made global and renamed to spi_flash_cmd_read() for consistency. By doing this further dead code elimination can be achieved when the spi flash drivers aren't included in the build. A Hatch Chrome OS build achieves a further text segment reduction of 0.5KiB in verstage, romstage, and ramstage. Change-Id: I7fee55e6ffc1983657c3adde025a0e8c9d12ca23 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/c/coreboot/+/38366 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/drivers/spi/spi_flash_internal.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/drivers/spi/spi_flash_internal.h') diff --git a/src/drivers/spi/spi_flash_internal.h b/src/drivers/spi/spi_flash_internal.h index 58172ce929..ef756c78d7 100644 --- a/src/drivers/spi/spi_flash_internal.h +++ b/src/drivers/spi/spi_flash_internal.h @@ -66,6 +66,9 @@ int spi_flash_cmd_status(const struct spi_flash *flash, u8 *reg); int spi_flash_cmd_write_page_program(const struct spi_flash *flash, u32 offset, size_t len, const void *buf); +/* Read len bytes into buf at offset. */ +int spi_flash_cmd_read(const struct spi_flash *flash, u32 offset, size_t len, void *buf); + /* Manufacturer-specific probe functions */ int spi_flash_probe_spansion(const struct spi_slave *spi, u8 *idcode, struct spi_flash *flash); -- cgit v1.2.3