diff options
| author | Jagannadha Sutradharudu Teki <jaganna@xilinx.com> | 2013-06-13 20:37:19 +0530 | 
|---|---|---|
| committer | Jagannadha Sutradharudu Teki <jaganna@xilinx.com> | 2013-06-23 22:02:49 +0530 | 
| commit | c9fcb59d7db74b93df9ee0a830bb9f43888f195c (patch) | |
| tree | 4747a45dda77b26399fba6aec52c92e2d526c61b | |
| parent | 9675fed4742338c71678cd310d0d6922b56e490a (diff) | |
| download | olio-uboot-2014.01-c9fcb59d7db74b93df9ee0a830bb9f43888f195c.tar.xz olio-uboot-2014.01-c9fcb59d7db74b93df9ee0a830bb9f43888f195c.zip | |
sf: Add bank address register writing support
This patch provides support to program a flash bank address
register.
extended/bank address register contains an information to access
the 4th byte addressing in 3-byte address mode.
reff' the spec for more details about bank addr register
in Page-63, Table 8.16
http://www.spansion.com/Support/Datasheets/S25FL128S_256S_00.pdf
Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
| -rw-r--r-- | drivers/mtd/spi/spi_flash.c | 26 | ||||
| -rw-r--r-- | drivers/mtd/spi/spi_flash_internal.h | 3 | 
2 files changed, 29 insertions, 0 deletions
| diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c index 0e38f5948..9ddd07087 100644 --- a/drivers/mtd/spi/spi_flash.c +++ b/drivers/mtd/spi/spi_flash.c @@ -278,6 +278,32 @@ int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr)  	return 0;  } +int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel) +{ +	u8 cmd; +	int ret; + +	ret = spi_flash_cmd_write_enable(flash); +	if (ret < 0) { +		debug("SF: enabling write failed\n"); +		return ret; +	} + +	ret = spi_flash_cmd_write(flash->spi, &cmd, 1, &bank_sel, 1); +	if (ret) { +		debug("SF: fail to write bank addr register\n"); +		return ret; +	} + +	ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT); +	if (ret < 0) { +		debug("SF: write bank addr register timed out\n"); +		return ret; +	} + +	return 0; +} +  #ifdef CONFIG_OF_CONTROL  int spi_flash_decode_fdt(const void *blob, struct spi_flash *flash)  { diff --git a/drivers/mtd/spi/spi_flash_internal.h b/drivers/mtd/spi/spi_flash_internal.h index 141cfa8b2..772fef622 100644 --- a/drivers/mtd/spi/spi_flash_internal.h +++ b/drivers/mtd/spi/spi_flash_internal.h @@ -77,6 +77,9 @@ static inline int spi_flash_cmd_write_disable(struct spi_flash *flash)  /* Program the status register. */  int spi_flash_cmd_write_status(struct spi_flash *flash, u8 sr); +/* Program the bank address register */ +int spi_flash_cmd_bankaddr_write(struct spi_flash *flash, u8 bank_sel); +  /*   * Same as spi_flash_cmd_read() except it also claims/releases the SPI   * bus. Used as common part of the ->read() operation. |