summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/sst.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2013-03-11 06:08:03 +0000
committerSimon Glass <sjg@chromium.org>2013-03-19 08:45:36 -0700
commitc0f87dd4ffa0c012d1dc8f737412c58200a93c93 (patch)
treead8bc5cfdeac09a81bde0f16626b0625d7bcc836 /drivers/mtd/spi/sst.c
parentb5aec1424d191c51f694ba85d5577e7a635363d9 (diff)
downloadu-boot-imx-c0f87dd4ffa0c012d1dc8f737412c58200a93c93.zip
u-boot-imx-c0f87dd4ffa0c012d1dc8f737412c58200a93c93.tar.gz
u-boot-imx-c0f87dd4ffa0c012d1dc8f737412c58200a93c93.tar.bz2
sf: Use spi_flash_alloc() in each SPI flash driver
Rather than each device having its own way to allocate a SPI flash structure, use the new allocation function everywhere. This will make it easier to extend the interface without breaking devices. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/mtd/spi/sst.c')
-rw-r--r--drivers/mtd/spi/sst.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/mtd/spi/sst.c b/drivers/mtd/spi/sst.c
index ced4f24..95f5490 100644
--- a/drivers/mtd/spi/sst.c
+++ b/drivers/mtd/spi/sst.c
@@ -203,22 +203,16 @@ spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode)
return NULL;
}
- stm = malloc(sizeof(*stm));
+ stm = spi_flash_alloc(struct sst_spi_flash, spi, params->name);
if (!stm) {
debug("SF: Failed to allocate memory\n");
return NULL;
}
stm->params = params;
- stm->flash.spi = spi;
- stm->flash.name = params->name;
if (stm->params->flags & SST_FEAT_WP)
stm->flash.write = sst_write_wp;
- else
- stm->flash.write = spi_flash_cmd_write_multi;
- stm->flash.erase = spi_flash_cmd_erase;
- stm->flash.read = spi_flash_cmd_read_fast;
stm->flash.page_size = 256;
stm->flash.sector_size = 4096;
stm->flash.size = stm->flash.sector_size * params->nr_sectors;