Skip to content

Commit

Permalink
drivers: flash: flash_mcux_flexspi_nor: check all 3 bytes of JEDEC ID
Browse files Browse the repository at this point in the history
The FlexSPI NOR driver should verify all 3 bytes of the JEDEC ID match
the expected value before attempting to use a custom LUT table with a
flash chip. This reduces the odds that an incompatible LUT will be used
with a flash chip, as some flash chips may share the same first byte of
their device ID but not be compatible with the custom LUT table.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
  • Loading branch information
danieldegrasse authored and nashif committed Dec 14, 2024
1 parent 7109586 commit c52903c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/flash/flash_mcux_flexspi_nor.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,9 +885,9 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data,
}

/* Switch on manufacturer and vendor ID */
switch (vendor_id & 0xFFFF) {
case 0x40ef:
/* W25Q512JV flash, use 4 byte read/write */
switch (vendor_id & 0xFFFFFF) {
case 0x2040ef:
/* W25Q512JV-IQ/IN flash, use 4 byte read/write */
flexspi_lut[READ][0] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_4READ_4B,
kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_4PAD, 32);
Expand Down Expand Up @@ -917,8 +917,8 @@ static int flash_flexspi_nor_check_jedec(struct flash_flexspi_nor_data *data,
/* Device uses bit 1 of status reg 2 for QE */
return flash_flexspi_nor_quad_enable(data, flexspi_lut,
JESD216_DW15_QER_VAL_S2B1v5);
case 0x25C2:
/* MX25 flash, use 4 byte read/write */
case 0x3A25C2:
/* MX25U51245G flash, use 4 byte read/write */
flexspi_lut[READ][0] = FLEXSPI_LUT_SEQ(
kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, SPI_NOR_CMD_4READ_4B,
kFLEXSPI_Command_RADDR_SDR, kFLEXSPI_4PAD, 32);
Expand Down

0 comments on commit c52903c

Please sign in to comment.