UPSTREAM: 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

Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://review.coreboot.org/17465
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>

Change-Id: I4163593eea034fa044ec2216e56d0ea3fbc86c7d
Reviewed-on: https://chromium-review.googlesource.com/415056
Commit-Ready: Aaron Durbin <adurbin@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Furquan Shaikh 2016-11-17 20:38:07 -08:00 committed by chrome-bot
commit b6e6fbc554
9 changed files with 65 additions and 53 deletions

View file

@ -27,16 +27,12 @@
/*-----------------------------------------------------------------------
* Representation of a SPI slave, i.e. what we're communicating with.
*
* Drivers are expected to extend this with controller-specific data.
*
* bus: ID of the bus that the slave is attached to.
* cs: ID of the chip select connected to the slave.
*/
struct spi_slave {
unsigned int bus;
unsigned int cs;
int force_programmer_specific;
struct spi_flash * (*programmer_specific_probe) (struct spi_slave *spi);
};
/*-----------------------------------------------------------------------

View file

@ -45,6 +45,13 @@ void lb_spi_flash(struct lb_header *header);
/* SPI Flash Driver Public API */
struct spi_flash *spi_flash_probe(unsigned int bus, unsigned int cs);
/*
* Specialized probing performed by platform. This is a weak function which can
* be overriden by platform driver.
* spi = Pointer to spi_slave structure.
* force = Indicates if the platform driver can skip specialized probing.
*/
struct spi_flash *spi_flash_programmer_probe(struct spi_slave *spi, int force);
/* All the following functions return 0 on success and non-zero on error. */
int spi_flash_read(const struct spi_flash *flash, u32 offset, size_t len,