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.
Change-Id: I1c7beedce7747bc89ab865fd844b568ad50d2dae
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/197931
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
This commit is contained in:
parent
60eb16ebe6
commit
57ee2fd875
1 changed files with 4 additions and 6 deletions
|
|
@ -207,6 +207,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;
|
||||
|
|
@ -230,11 +232,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;
|
||||
|
|
@ -242,7 +240,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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue