sf: unify status register writing (and thus block unlocking)
The only two drivers to write the status register do it in the same
way, so unify the implementations. This also makes the block unlock
logic the same.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
diff --git a/drivers/mtd/spi/sst.c b/drivers/mtd/spi/sst.c
index 04cc50a..ced4f24 100644
--- a/drivers/mtd/spi/sst.c
+++ b/drivers/mtd/spi/sst.c
@@ -185,27 +185,6 @@
return ret;
}
-static int
-sst_unlock(struct spi_flash *flash)
-{
- int ret;
- u8 cmd, status;
-
- ret = spi_flash_cmd_write_enable(flash);
- if (ret)
- return ret;
-
- cmd = CMD_WRITE_STATUS;
- status = 0;
- ret = spi_flash_cmd_write(flash->spi, &cmd, 1, &status, 1);
- if (ret)
- debug("SF: Unable to set status byte\n");
-
- debug("SF: sst: status = %x\n", spi_w8r8(flash->spi, CMD_READ_STATUS));
-
- return ret;
-}
-
struct spi_flash *
spi_flash_probe_sst(struct spi_slave *spi, u8 *idcode)
{
@@ -245,7 +224,7 @@
stm->flash.size = stm->flash.sector_size * params->nr_sectors;
/* Flash powers up read-only, so clear BP# bits */
- sst_unlock(&stm->flash);
+ spi_flash_cmd_write_status(&stm->flash, 0);
return &stm->flash;
}