summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi/sf_ops.c
diff options
context:
space:
mode:
authorJagannadha Sutradharudu Teki <jaganna@xilinx.com>2013-12-26 13:54:57 +0530
committerJagannadha Sutradharudu Teki <jaganna@xilinx.com>2014-01-11 15:13:26 +0530
commitd08a1baf617a8b7f1959c6b24c1ee7590a0c06a5 (patch)
treecc3d76e62567f51f9051d3aabd224689a7bd17b8 /drivers/mtd/spi/sf_ops.c
parent6cba6fdf96f13a0533187b9c16608d9ca44add40 (diff)
downloadu-boot-imx-d08a1baf617a8b7f1959c6b24c1ee7590a0c06a5.zip
u-boot-imx-d08a1baf617a8b7f1959c6b24c1ee7590a0c06a5.tar.gz
u-boot-imx-d08a1baf617a8b7f1959c6b24c1ee7590a0c06a5.tar.bz2
sf: Set quad enable bit support
This patch provides support to set the quad enable bit on flash. quad enable bit needs to set before performing any quad IO operations on respective SPI flashes. Currently added set quad enable bit for winbond and spansion flash devices. stmicro flash doesn't require to set as qeb is volatile. remaining flash devices support will add in future patches. Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Diffstat (limited to 'drivers/mtd/spi/sf_ops.c')
-rw-r--r--drivers/mtd/spi/sf_ops.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/mtd/spi/sf_ops.c b/drivers/mtd/spi/sf_ops.c
index 39e06ec..827f719 100644
--- a/drivers/mtd/spi/sf_ops.c
+++ b/drivers/mtd/spi/sf_ops.c
@@ -38,6 +38,7 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr)
return 0;
}
+#if defined(CONFIG_SPI_FLASH_SPANSION) || defined(CONFIG_SPI_FLASH_WINBOND)
static int spi_flash_cmd_write_config(struct spi_flash *flash, u8 cr)
{
u8 data[2];
@@ -62,6 +63,31 @@ static int spi_flash_cmd_write_config(struct spi_flash *flash, u8 cr)
return 0;
}
+int spi_flash_set_qeb_winspan(struct spi_flash *flash)
+{
+ u8 qeb_status;
+ u8 cmd;
+ int ret;
+
+ cmd = CMD_READ_CONFIG;
+ ret = spi_flash_read_common(flash, &cmd, 1, &qeb_status, 1);
+ if (ret < 0) {
+ debug("SF: fail to read config register\n");
+ return ret;
+ }
+
+ if (qeb_status & STATUS_QEB_WINSPAN) {
+ debug("SF: Quad enable bit is already set\n");
+ } else {
+ ret = spi_flash_cmd_write_config(flash, STATUS_QEB_WINSPAN);
+ if (ret < 0)
+ return ret;
+ }
+
+ return ret;
+}
+#endif
+
#ifdef CONFIG_SPI_FLASH_BAR
static int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel)
{