spi: Add support for 4Byte addressing commands
Thsi patch adds support for 4-byte addressing Read, write and erase commands. Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
This commit is contained in:
committed by
Michal Simek
parent
c879ab6c71
commit
9ba61fc244
@@ -45,10 +45,12 @@ enum spi_nor_option_flags {
|
||||
#define CMD_ERASE_4K 0x20
|
||||
#define CMD_ERASE_CHIP 0xc7
|
||||
#define CMD_ERASE_64K 0xd8
|
||||
#define CMD_ERASE_64K_4B 0xdc
|
||||
|
||||
/* Write commands */
|
||||
#define CMD_WRITE_STATUS 0x01
|
||||
#define CMD_PAGE_PROGRAM 0x02
|
||||
#define CMD_PAGE_PROGRAM_4B 0x12
|
||||
#define CMD_WRITE_DISABLE 0x04
|
||||
#define CMD_WRITE_ENABLE 0x06
|
||||
#define CMD_QUAD_PAGE_PROGRAM 0x32
|
||||
@@ -64,6 +66,7 @@ enum spi_nor_option_flags {
|
||||
#define CMD_READ_QUAD_OUTPUT_FAST 0x6b
|
||||
#define CMD_READ_QUAD_IO_FAST 0xeb
|
||||
#define CMD_READ_OCTAL_OUTPUT_FAST 0x8B
|
||||
#define CMD_READ_OCTAL_OUTPUT_FAST_4B 0x7C
|
||||
#define CMD_READ_ID 0x9f
|
||||
#define CMD_READ_STATUS 0x05
|
||||
#define CMD_READ_STATUS1 0x35
|
||||
|
||||
@@ -1698,6 +1698,12 @@ int spi_flash_scan(struct spi_flash *flash)
|
||||
flash->write_cmd = CMD_PAGE_PROGRAM;
|
||||
}
|
||||
|
||||
if (spi->mode & SPI_RX_OCTAL && info->flags & RD_OCTAL &&
|
||||
flash->spi->bytemode) {
|
||||
flash->read_cmd = CMD_READ_OCTAL_OUTPUT_FAST_4B;
|
||||
flash->write_cmd = CMD_PAGE_PROGRAM_4B;
|
||||
flash->erase_cmd = CMD_ERASE_64K_4B;
|
||||
}
|
||||
|
||||
/* Set the quad enable bit - only for quad commands */
|
||||
if ((flash->read_cmd == CMD_READ_QUAD_OUTPUT_FAST) ||
|
||||
|
||||
@@ -150,6 +150,15 @@ static int cadence_spi_set_speed(struct udevice *bus, uint hz)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cadence_spi_child_pre_probe(struct udevice *bus)
|
||||
{
|
||||
struct spi_slave *slave = dev_get_parent_priv(bus);
|
||||
|
||||
slave->bytemode = SPI_4BYTE_MODE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cadence_spi_probe(struct udevice *bus)
|
||||
{
|
||||
struct cadence_spi_platdata *plat = bus->platdata;
|
||||
@@ -345,4 +354,5 @@ U_BOOT_DRIVER(cadence_spi) = {
|
||||
.platdata_auto_alloc_size = sizeof(struct cadence_spi_platdata),
|
||||
.priv_auto_alloc_size = sizeof(struct cadence_spi_priv),
|
||||
.probe = cadence_spi_probe,
|
||||
.child_pre_probe = cadence_spi_child_pre_probe,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user