summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/drivers/spi/spansion.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/drivers/spi/spansion.c b/src/drivers/spi/spansion.c
index e17f890aa1..c7e31fe5b5 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;