spi: spi_flash: Add Octal read command support

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>
This commit is contained in:
Siva Durga Prasad Paladugu
2018-08-11 14:22:35 +05:30
committed by Michal Simek
parent f0fd90cf3d
commit 2f7e82b674
4 changed files with 8 additions and 0 deletions

View 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)
};

View 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) &&

View 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;

View 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