]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: cadence_qspi: Address the comparison failure for 0-8 bytes of data
authorTejas Bhumkar <tejas.arvind.bhumkar@amd.com>
Sun, 28 Jan 2024 06:37:46 +0000 (12:07 +0530)
committerJagan Teki <jagan@edgeble.ai>
Mon, 29 Jan 2024 14:04:17 +0000 (19:34 +0530)
The current implementation encounters issues when testing data ranging
from 0 to 8 bytes. This was confirmed through testing with both ISSI
(IS25WX256) and Micron (MT35XU02G) Flash exclusively in SDR mode.

Upon investigation, it was observed that utilizing the
"SPI_NOR_OCTAL_READ" flag and attempting to read less than 8 bytes in
STIG mode results in a read failure, leading to a compare test failure.

To resolve this issue, the CMD_4BYTE_FAST_READ opcode is now utilized
instead of CMD_4BYTE_OCTAL_READ, specifically in SDR mode.

This is based on patch series:
https://lore.kernel.org/all/cover.1701853668.git.tejas.arvind.bhumkar@amd.com/

Signed-off-by: Tejas Bhumkar <tejas.arvind.bhumkar@amd.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
drivers/spi/cadence_ospi_versal.c
drivers/spi/cadence_qspi.h
drivers/spi/cadence_qspi_apb.c

index e02a3b3de37d31375ff896310a3945d572804bad..c2be307f1d87675beaf7debae9b8b4f58546fe6d 100644 (file)
@@ -18,9 +18,6 @@
 #include "cadence_qspi.h"
 #include <dt-bindings/power/xlnx-versal-power.h>
 
-#define CMD_4BYTE_READ  0x13
-#define CMD_4BYTE_FAST_READ  0x0C
-
 int cadence_qspi_apb_dma_read(struct cadence_spi_priv *priv,
                              const struct spi_mem_op *op)
 {
index 12825f8911ce09c09ca6354a0c32ea2ca87c2f1d..693474a287134cbd9f011b7b578ec916aa3d4d80 100644 (file)
 #define CQSPI_DUMMY_BYTES_MAX                   4
 #define CQSPI_DUMMY_CLKS_MAX                    31
 
+#define CMD_4BYTE_FAST_READ                    0x0C
+#define CMD_4BYTE_OCTAL_READ                   0x7c
+#define CMD_4BYTE_READ                         0x13
+
 /****************************************************************************
  * Controller's configuration and status register (offset from QSPI_BASE)
  ****************************************************************************/
index d033184aa466c55bb794263d8103fabf9bb0b0c7..fb905322178244d5f4bdeba88ae09ba16ee1949c 100644 (file)
@@ -469,6 +469,9 @@ int cadence_qspi_apb_command_read(struct cadence_spi_priv *priv,
        else
                opcode = op->cmd.opcode;
 
+       if (opcode == CMD_4BYTE_OCTAL_READ && !priv->dtr)
+               opcode = CMD_4BYTE_FAST_READ;
+
        reg = opcode << CQSPI_REG_CMDCTRL_OPCODE_LSB;
 
        /* Set up dummy cycles. */