summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuresh Gupta <suresh.gupta@nxp.com>2017-04-25 07:38:48 (GMT)
committerPrabhakar Kushwaha <prabhakar.kushwaha@nxp.com>2018-01-12 06:24:32 (GMT)
commit57be279277d5c2d61ebbe21a767efd8e3b05c364 (patch)
treef9ff52ada9aba583d6f2d28dc2839bbb2fc0da10
parent7d961dcd5b35034357196c384edea6210ef49794 (diff)
downloadu-boot-57be279277d5c2d61ebbe21a767efd8e3b05c364.tar.xz
spi: fsl_qspi: Add 4bytes address support
The QSPI support the direct 4bytes address command for flash read/write/erase. And the address can cover the whole QSPI memory space. signed-off-by: Yuan Yao <yao.yuan@nxp.com>
-rw-r--r--drivers/spi/fsl_qspi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index 0f3f7d9..59eb1ce 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -26,7 +26,9 @@ DECLARE_GLOBAL_DATA_PTR;
#define TX_BUFFER_SIZE 0x40
#endif
-#define OFFSET_BITS_MASK GENMASK(23, 0)
+#define OFFSET_BITS_MASK ((FSL_QSPI_FLASH_SIZE > SZ_16M) ? \
+ GENMASK(27, 0) : GENMASK(23, 0))
+
#define FLASH_STATUS_WEL 0x02
@@ -767,7 +769,10 @@ int qspi_xfer(struct fsl_qspi_priv *priv, unsigned int bitlen,
if (dout) {
if (flags & SPI_XFER_BEGIN) {
priv->cur_seqid = *(u8 *)dout;
- memcpy(&txbuf, dout, 4);
+ if (FSL_QSPI_FLASH_SIZE > SZ_16M && bytes > 4)
+ memcpy(&txbuf, dout + 1, 4);
+ else
+ memcpy(&txbuf, dout, 4);
}
if (flags == SPI_XFER_END) {