drivers/spi/spi_flash: Clean up SPI flash probe

1. Rename __spi_flash_probe to spi_flash_generic_probe and export it
so that drivers can use it outside spi_flash.c.
2. Make southbridge intel spi driver use spi_flash_generic_probe if
spi_is_multichip returns 0.
3. Add spi_flash_probe to spi_ctrlr structure to allow platforms to
provide specialized probe functions. With this change, the specialized
spi flash probe functions are now associated with a particular spi
ctrlr structure and no longer disconnected from the spi controller.

BUG=b:38330715

Change-Id: I35f3bd8ddc5e71515df3ef0c1c4b1a68ee56bf4b
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://review.coreboot.org/19708
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
Furquan Shaikh
2017-05-17 19:14:06 -07:00
committed by Furquan Shaikh
parent bd9e32efdd
commit a1491574ef
8 changed files with 53 additions and 62 deletions

View File

@@ -228,14 +228,8 @@ static int nor_erase(const struct spi_flash *flash, u32 offset, size_t len)
return 0;
}
int spi_flash_programmer_probe(const struct spi_slave *spi,
int force, struct spi_flash *flash)
int mtk_spi_flash_probe(const struct spi_slave *spi, struct spi_flash *flash)
{
static int done;
if (done)
return 0;
write32(&mt8173_nor->wrprot, SFLASH_COMMAND_ENABLE);
memcpy(&flash->spi, spi, sizeof(*spi));
flash->name = "mt8173 flash controller";
@@ -246,6 +240,6 @@ int spi_flash_programmer_probe(const struct spi_slave *spi,
flash->sector_size = 0x1000;
flash->erase_cmd = SECTOR_ERASE_CMD;
flash->size = CONFIG_ROM_SIZE;
done = 1;
return 0;
}