summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/sf_ops.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2015-11-19 13:27:26 -0500
committerTom Rini <trini@konsulko.com>2015-11-19 13:27:26 -0500
commit9ef671c9d4c70af3f8b21d8a31a89af4dc74d6b3 (patch)
treeda4d08ed85efe51d8799eee94b2ccf4a79c4b278 /drivers/mtd/spi/sf_ops.c
parentaa7077fcee6cf00cde59bb9709ebd6205720f8bf (diff)
parent3e56ecec435d30e25fcffb971f8c9627e85ac1df (diff)
downloadu-boot-imx-9ef671c9d4c70af3f8b21d8a31a89af4dc74d6b3.zip
u-boot-imx-9ef671c9d4c70af3f8b21d8a31a89af4dc74d6b3.tar.gz
u-boot-imx-9ef671c9d4c70af3f8b21d8a31a89af4dc74d6b3.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-spi
Diffstat (limited to 'drivers/mtd/spi/sf_ops.c')
-rw-r--r--drivers/mtd/spi/sf_ops.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
index 384224d..3a56d7f 100644
--- a/drivers/mtd/spi/sf_ops.c
+++ b/drivers/mtd/spi/sf_ops.c
@@ -583,7 +583,7 @@ int sst_write_bp(struct spi_flash *flash, u32 offset, size_t len,
}
#endif
-#ifdef CONFIG_SPI_FLASH_STMICRO
+#if defined(CONFIG_SPI_FLASH_STMICRO) || defined(CONFIG_SPI_FLASH_SST)
static void stm_get_locked_range(struct spi_flash *flash, u8 sr, loff_t *ofs,
u32 *len)
{
@@ -663,8 +663,11 @@ int stm_lock(struct spi_flash *flash, u32 ofs, size_t len)
u8 status_old, status_new;
u8 mask = SR_BP2 | SR_BP1 | SR_BP0;
u8 shift = ffs(mask) - 1, pow, val;
+ int ret;
- spi_flash_cmd_read_status(flash, &status_old);
+ ret = spi_flash_cmd_read_status(flash, &status_old);
+ if (ret < 0)
+ return ret;
/* SPI NOR always locks to the end */
if (ofs + len != flash->size) {
@@ -714,8 +717,11 @@ int stm_unlock(struct spi_flash *flash, u32 ofs, size_t len)
uint8_t status_old, status_new;
u8 mask = SR_BP2 | SR_BP1 | SR_BP0;
u8 shift = ffs(mask) - 1, pow, val;
+ int ret;
- spi_flash_cmd_read_status(flash, &status_old);
+ ret = spi_flash_cmd_read_status(flash, &status_old);
+ if (ret < 0)
+ return ret;
/* Cannot unlock; would unlock larger region than requested */
if (stm_is_locked_sr(flash, status_old, ofs - flash->erase_size,
@@ -750,4 +756,4 @@ int stm_unlock(struct spi_flash *flash, u32 ofs, size_t len)
return 0;
}
-#endif /* CONFIG_SPI_FLASH_STMICRO */
+#endif