Commit 2e9a9e0f authored by Ye Li's avatar Ye Li Committed by Peng Fan

MLK-18243-15 spi: fspi: Fix 3bytes access

The address size is 3 bytes when using BAR mode, but the driver
supposes the 4bytes mode is enabled and uses 4 bytes address. This
cause address issue.

Also the mask needs set to 23bits for 3 bytes address.
Signed-off-by: 's avatarYe Li <ye.li@nxp.com>
Signed-off-by: 's avatarPeng Fan <peng.fan@nxp.com>
parent c4bd49c7
......@@ -21,7 +21,11 @@ DECLARE_GLOBAL_DATA_PTR;
#define TX_BUFFER_SIZE 0x400
#define AHB_BUFFER_SIZE 0x800
#ifdef CONFIG_SPI_FLASH_4BYTES_ADDR
#define OFFSET_BITS_MASK GENMASK(31, 0)
#else
#define OFFSET_BITS_MASK GENMASK(23, 0)
#endif
#define FLASH_STATUS_WEL 0x02
......@@ -925,8 +929,10 @@ int fspi_xfer(struct fsl_fspi_priv *priv, unsigned int bitlen,
if (dout) {
if (flags & SPI_XFER_BEGIN) {
priv->cur_seqid = *(u8 *)dout;
#ifdef CONFIG_SPI_FLASH_4BYTES_ADDR
if (FSL_FSPI_FLASH_SIZE > SZ_16M)
dout = (u8 *)dout + 1;
#endif
memcpy(&txbuf, dout, 4);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment