diff options
author | Wolfgang Denk <wd@denx.de> | 2009-04-03 22:42:44 +0200 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-04-03 22:42:44 +0200 |
commit | ca41ef301b21b3ac25af71750624e0b3d5ddbb3e (patch) | |
tree | 0d459df505672e82cd6f30bec418b6f54738da68 /drivers/mtd/spi/stmicro.c | |
parent | 0d8cb9c04facc029baf4beee5a7e389be343a915 (diff) | |
parent | d9596ffbdc79cea285010b67dd20a4618303f624 (diff) | |
download | u-boot-imx-ca41ef301b21b3ac25af71750624e0b3d5ddbb3e.zip u-boot-imx-ca41ef301b21b3ac25af71750624e0b3d5ddbb3e.tar.gz u-boot-imx-ca41ef301b21b3ac25af71750624e0b3d5ddbb3e.tar.bz2 |
Merge branch 'sf' of git://git.denx.de/u-boot-blackfin
Diffstat (limited to 'drivers/mtd/spi/stmicro.c')
-rw-r--r-- | drivers/mtd/spi/stmicro.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c index e7dda91..9b910c1 100644 --- a/drivers/mtd/spi/stmicro.c +++ b/drivers/mtd/spi/stmicro.c @@ -133,12 +133,12 @@ static int stmicro_wait_ready(struct spi_flash *flash, unsigned long timeout) struct spi_slave *spi = flash->spi; unsigned long timebase; int ret; + u8 cmd = CMD_M25PXX_RDSR; u8 status; - u8 cmd[4] = { CMD_M25PXX_RDSR, 0xff, 0xff, 0xff }; - ret = spi_xfer(spi, 32, &cmd[0], NULL, SPI_XFER_BEGIN); + ret = spi_xfer(spi, 8, &cmd, NULL, SPI_XFER_BEGIN); if (ret) { - debug("SF: Failed to send command %02x: %d\n", cmd[0], ret); + debug("SF: Failed to send command %02x: %d\n", cmd, ret); return ret; } @@ -295,8 +295,7 @@ int stmicro_erase(struct spi_flash *flash, u32 offset, size_t len) break; } - /* Up to 2 seconds */ - ret = stmicro_wait_ready(flash, 2 * CONFIG_SYS_HZ); + ret = stmicro_wait_ready(flash, SPI_FLASH_PAGE_ERASE_TIMEOUT); if (ret < 0) { debug("SF: STMicro page erase timed out\n"); break; @@ -315,12 +314,6 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode) const struct stmicro_spi_flash_params *params; struct stmicro_spi_flash *stm; unsigned int i; - int ret; - u8 id[3]; - - ret = spi_flash_cmd(spi, CMD_READ_ID, id, sizeof(id)); - if (ret) - return NULL; for (i = 0; i < ARRAY_SIZE(stmicro_spi_flash_table); i++) { params = &stmicro_spi_flash_table[i]; @@ -330,7 +323,7 @@ struct spi_flash *spi_flash_probe_stmicro(struct spi_slave *spi, u8 * idcode) } if (i == ARRAY_SIZE(stmicro_spi_flash_table)) { - debug("SF: Unsupported STMicro ID %02x\n", id[1]); + debug("SF: Unsupported STMicro ID %02x\n", idcode[1]); return NULL; } |