summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi
diff options
context:
space:
mode:
authorJagannadha Sutradharudu Teki <jaganna@xilinx.com>2013-12-23 10:17:48 (GMT)
committerJagannadha Sutradharudu Teki <jaganna@xilinx.com>2014-01-11 09:43:25 (GMT)
commit6cba6fdf96f13a0533187b9c16608d9ca44add40 (patch)
treec3d994d378456df00480cefebce49e95d44e6b6c /drivers/mtd/spi
parent3163aaa63fced54bbd6fd190ece0f89b473076ab (diff)
downloadu-boot-fsl-qoriq-6cba6fdf96f13a0533187b9c16608d9ca44add40.tar.xz
sf: ops: Add configuration register writing support
This patch provides support to program a flash config register. Configuration register contains the control bits used to configure the different configurations and security features of a device. Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Diffstat (limited to 'drivers/mtd/spi')
-rw-r--r--drivers/mtd/spi/sf_ops.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
index 3d304ce..39e06ec 100644
--- a/drivers/mtd/spi/sf_ops.c
+++ b/drivers/mtd/spi/sf_ops.c
@@ -38,6 +38,30 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr)
return 0;
}
+static int spi_flash_cmd_write_config(struct spi_flash *flash, u8 cr)
+{
+ u8 data[2];
+ u8 cmd;
+ int ret;
+
+ cmd = CMD_READ_STATUS;
+ ret = spi_flash_read_common(flash, &cmd, 1, &data[0], 1);
+ if (ret < 0) {
+ debug("SF: fail to read status register\n");
+ return ret;
+ }
+
+ cmd = CMD_WRITE_STATUS;
+ data[1] = cr;
+ ret = spi_flash_write_common(flash, &cmd, 1, &data, 2);
+ if (ret) {
+ debug("SF: fail to write config register\n");
+ return ret;
+ }
+
+ return 0;
+}
+
#ifdef CONFIG_SPI_FLASH_BAR
static int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel)
{