summaryrefslogtreecommitdiff
path: root/src/drivers/spi/winbond.c
diff options
context:
space:
mode:
authorDan Ehrenberg <dehrenberg@chromium.org>2015-01-08 10:29:19 -0800
committerPatrick Georgi <pgeorgi@google.com>2015-04-17 09:21:07 +0200
commita5aac76ac6be23448c164b0bc8047facb7238cdf (patch)
tree50bdd770ce2e8b1d257cd6c9cf56fd5cd8635b52 /src/drivers/spi/winbond.c
parentf9b49e8782efb7628984e1f3c3abc1ef7a58b84b (diff)
downloadcoreboot-a5aac76ac6be23448c164b0bc8047facb7238cdf.tar.xz
drivers/spi: Pass flash parameters from coreboot to payload
A payload may want to run erase operations on SPI NOR flash without re-probing the device to get its properties. This patch passes up three properties of flash to achieve that: - The size of the flash device - The sector size, i.e., the granularity of erase - The command used for erase The patch sends the parameters through coreboot and then libpayload. The patch also includes a minor refactoring of the flash erase code. Parameters are sent up for just one flash device. If multiple SPI flash devices are probed, the second one will "win" and its parameters will be sent up to the payload. TEST=Observed parameters to be passed up to depthcharge through libpayload and be used to correctly initialize flash and do an erase. TEST=Winbond and Gigadevices spi flash drivers compile with the changes; others don't, for seemingly unrelated reasons. BRANCH=none BUG=chromium:446377 Change-Id: Ib8be86494b5a3d1cfe1d23d3492e3b5cba5f99c6 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 988c8c68bbfcdfa69d497ea5f806567bc80f8126 Original-Change-Id: Ie2b3a7f5b6e016d212f4f9bac3fabd80daf2ce72 Original-Signed-off-by: Dan Ehrenberg <dehrenberg@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/239570 Original-Reviewed-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: http://review.coreboot.org/9726 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/drivers/spi/winbond.c')
-rw-r--r--src/drivers/spi/winbond.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/drivers/spi/winbond.c b/src/drivers/spi/winbond.c
index 5fc7b4274a..18ef105134 100644
--- a/src/drivers/spi/winbond.c
+++ b/src/drivers/spi/winbond.c
@@ -189,11 +189,6 @@ out:
return ret;
}
-static int winbond_erase(struct spi_flash *flash, u32 offset, size_t len)
-{
- return spi_flash_cmd_erase(flash, CMD_W25_SE, offset, len);
-}
-
static struct winbond_spi_flash stm;
struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
@@ -222,7 +217,7 @@ struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
page_size = 1 << params->l2_page_size;
stm.flash.write = winbond_write;
- stm.flash.erase = winbond_erase;
+ stm.flash.erase = spi_flash_cmd_erase;
#if CONFIG_SPI_FLASH_NO_FAST_READ
stm.flash.read = spi_flash_cmd_read_slow;
#else
@@ -233,6 +228,7 @@ struct spi_flash *spi_flash_probe_winbond(struct spi_slave *spi, u8 *idcode)
stm.flash.size = page_size * params->pages_per_sector
* params->sectors_per_block
* params->nr_blocks;
+ stm.flash.erase_cmd = CMD_W25_SE;
return &stm.flash;
}