From d2fb6ae813880b8fd1b3983e0e61c7e51fb9b20b Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 17 Nov 2016 20:38:07 -0800 Subject: spi: Get rid of flash_programmer_probe in spi_slave structure flash_programmer_probe is a property of the spi flash driver and does not belong in the spi_slave structure. Thus, make spi_flash_programmer_probe a callback from the spi_flash_probe function. Logic still remains the same as before (order matters): 1. Try spi_flash_programmer_probe without force option 2. Try generic flash probing 3. Try spi_flash_programmer_probe with force option If none of the above steps work, fail probing. Flash controller is expected to honor force option to decide whether to perform specialized probing or to defer to generic probing. BUG=None BRANCH=None TEST=Compiles successfully Change-Id: I4163593eea034fa044ec2216e56d0ea3fbc86c7d Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/17465 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin --- src/southbridge/intel/common/spi.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/southbridge') diff --git a/src/southbridge/intel/common/spi.c b/src/southbridge/intel/common/spi.c index e0414220c6..36102c201c 100644 --- a/src/southbridge/intel/common/spi.c +++ b/src/southbridge/intel/common/spi.c @@ -66,7 +66,6 @@ #endif /* !__SMM__ */ static int spi_is_multichip(void); -static struct spi_flash *spi_flash_hwseq(struct spi_slave *spi); typedef struct spi_slave ich_spi_slave; @@ -299,8 +298,6 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs) slave->bus = bus; slave->cs = cs; - slave->force_programmer_specific = spi_is_multichip (); - slave->programmer_specific_probe = spi_flash_hwseq; return slave; } @@ -920,11 +917,19 @@ static int ich_hwseq_write(const struct spi_flash *flash, u32 addr, size_t len, } -static struct spi_flash *spi_flash_hwseq(struct spi_slave *spi) +struct spi_flash *spi_flash_programmer_probe(struct spi_slave *spi, int force) { struct spi_flash *flash = NULL; uint32_t flcomp; + /* + * Perform SPI flash probing only if: + * 1. spi_is_multichip returns 1 or + * 2. Specialized probing is forced by SPI flash driver. + */ + if (!spi_is_multichip() && !force) + return NULL; + flash = malloc(sizeof(*flash)); if (!flash) { printk(BIOS_WARNING, "SF: Failed to allocate memory\n"); -- cgit v1.2.3