Marc Jones (marc.jones@se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7933
-gerrit
commit 1282e28becdf933c3b6284b534c628a99781e64f Author: Vadim Bendebury vbendeb@chromium.org Date: Thu May 1 19:30:46 2014 -0700
Prepare Spansion driver for use in CBFS wrapper
Since the same driver is going to be used at all coreboot stages, it can not use malloc() anymore. Replace it with static allocation of the driver container structure.
The read interface is changed to spi_flash_cmd_read_slow(), because of the problems with spi_flash_cmd_read_fast() implementation. In fact there is no performance difference in the way the two interface functions are implemented.
BUG=chrome-os-partner:27784 TEST=manual . with all patches applied coreboot proceeds to attempting to load the payload.
Original-Change-Id: I1c7beedce7747bc89ab865fd844b568ad50d2dae Original-Signed-off-by: Vadim Bendebury vbendeb@chromium.org Original-Reviewed-on: https://chromium-review.googlesource.com/197931 Original-Reviewed-by: Aaron Durbin adurbin@chromium.org Original-Reviewed-by: David Hendricks dhendrix@chromium.org (cherry picked from commit 57ee2fd875c689706c70338e073acefb806787e7) Signed-off-by: Marc Jones marc.jones@se-eng.com
Change-Id: I9d9e7e343148519580ed4986800dc6c6b9a5f5d2 --- src/drivers/spi/spansion.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/drivers/spi/spansion.c b/src/drivers/spi/spansion.c index e17f890..c7e31fe 100644 --- a/src/drivers/spi/spansion.c +++ b/src/drivers/spi/spansion.c @@ -208,6 +208,8 @@ static int spansion_erase(struct spi_flash *flash, u32 offset, size_t len) return spi_flash_cmd_erase(flash, CMD_S25FLXX_SE, offset, len); }
+static struct spansion_spi_flash spsn_flash; + struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode) { const struct spansion_spi_flash_params *params; @@ -231,11 +233,7 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode) return NULL; }
- spsn = malloc(sizeof(struct spansion_spi_flash)); - if (!spsn) { - printk(BIOS_WARNING, "SF: Failed to allocate memory\n"); - return NULL; - } + spsn = &spsn_flash;
spsn->params = params; spsn->flash.spi = spi; @@ -243,7 +241,7 @@ struct spi_flash *spi_flash_probe_spansion(struct spi_slave *spi, u8 *idcode)
spsn->flash.write = spansion_write; spsn->flash.erase = spansion_erase; - spsn->flash.read = spi_flash_cmd_read_fast; + spsn->flash.read = spi_flash_cmd_read_slow; spsn->flash.sector_size = params->page_size * params->pages_per_sector; spsn->flash.size = spsn->flash.sector_size * params->nr_sectors;