]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
spi: spi_flash: Add Octal read command support
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Sat, 11 Aug 2018 08:52:35 +0000 (14:22 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 27 Feb 2019 07:50:28 +0000 (08:50 +0100)
This patch adds octal read command support if flash
device  and controller supports it.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/mtd/spi/sf_internal.h
drivers/mtd/spi/spi_flash.c
drivers/spi/spi-uclass.c
include/spi.h

index 98fdf6f5b9dd1682dec26aaa7770abafe599a2f1..b684cad8dd29a5719e34159e58f1b5894a295b62 100644 (file)
@@ -63,6 +63,7 @@ enum spi_nor_option_flags {
 #define CMD_READ_DUAL_IO_FAST          0xbb
 #define CMD_READ_QUAD_OUTPUT_FAST      0x6b
 #define CMD_READ_QUAD_IO_FAST          0xeb
+#define CMD_READ_OCTAL_OUTPUT_FAST     0x8B
 #define CMD_READ_ID                    0x9f
 #define CMD_READ_STATUS                        0x05
 #define CMD_READ_STATUS1               0x35
@@ -150,6 +151,7 @@ struct spi_flash_info {
 #define RD_DUAL                        BIT(5)  /* use Dual Read */
 #define RD_QUADIO              BIT(6)  /* use Quad IO Read */
 #define RD_DUALIO              BIT(7)  /* use Dual IO Read */
+#define RD_OCTAL               BIT(8)  /* use Octal Read */
 #define RD_FULL                        (RD_QUAD | RD_DUAL | RD_QUADIO | RD_DUALIO)
 };
 
index 87771d16913be77d183beeab7cfe046e1a5d63e1..570613acc31919f8ffce540fa59ee97f0ba5ab6f 100644 (file)
@@ -1670,6 +1670,8 @@ int spi_flash_scan(struct spi_flash *flash)
        flash->read_cmd = CMD_READ_ARRAY_FAST;
        if (spi->mode & SPI_RX_SLOW) {
                flash->read_cmd = CMD_READ_ARRAY_SLOW;
+       } else if (spi->mode & SPI_RX_OCTAL && info->flags & RD_OCTAL) {
+               flash->read_cmd = CMD_READ_OCTAL_OUTPUT_FAST;
        } else if (spi->mode & SPI_RX_QUAD && info->flags & RD_QUAD) {
                flash->read_cmd = CMD_READ_QUAD_OUTPUT_FAST;
                if (((JEDEC_MFR(info) == SPI_FLASH_CFI_MFR_SPANSION) &&
index 2bc289a74ccb57a28e4e27c22689bca85fdb1a4f..4fd7be5395b42a3b8792c8be7b4a1c8d3e2d5ae4 100644 (file)
@@ -421,6 +421,9 @@ int spi_slave_ofdata_to_platdata(struct udevice *dev,
        case 4:
                mode |= SPI_RX_QUAD;
                break;
+       case 8:
+               mode |= SPI_RX_OCTAL;
+               break;
        default:
                warn_non_spl("spi-rx-bus-width %d not supported\n", value);
                break;
index 2b74930429e3dacd7233d17e9f409d2e7e4bebbc..670b05ec21fe5b28d9a7629e54a45cd0dba38ae6 100644 (file)
@@ -57,6 +57,7 @@
 #define SPI_RX_FAST    BIT(1)                  /* receive with 1 wire fast */
 #define SPI_RX_DUAL    BIT(2)                  /* receive with 2 wires */
 #define SPI_RX_QUAD    BIT(3)                  /* receive with 4 wires */
+#define SPI_RX_OCTAL   BIT(4)
 
 /* Header byte that marks the start of the message */
 #define SPI_PREAMBLE_END_BYTE  0xec