Skip to content

Commit f7f73bd

Browse files
JBarberUkartben
authored andcommitted
driver: flash: mcux_flexspi_nor: Second attempt to fix is25lpXXX chips
This commit changes the implementation to distinguish between is25lpXXX and is25lpXXXd. Using RDERP as in the original solution didn't work for is25wpXXX chips and would cause a halt. This new implementation reads the AutoBoot register instead, which is not present in is25lpXXX but present in is25lpXXXd, is25wpXXX and is25wpXXXd. Tested on: - mimxrt1020-evk - mimxrt1170-evk rev. A - custom board with mimxrt1170 and is25lp128d Signed-off-by: John Barbero Unenge <git@lsrkttn.com>
1 parent a9fd230 commit f7f73bd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/flash/flash_mcux_flexspi_nor.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -970,20 +970,20 @@ flash_flexspi_nor_is25_clear_dummy_cycles(struct flash_flexspi_nor_data *data,
970970
};
971971

972972
/*
973-
* Get Extended Read Parameters (Non-Volatile) command (RDERP, 81h)
973+
* Read AutoBoot Register command (RDABR, 14h)
974974
*
975975
* This is done to distinguish between an IS25LPXXX and IS25LPXXXD since
976976
* the former uses the read parameters (SRPV) to set drive strength and
977977
* dummy cycles, while IS25LPXXXD uses extended read parameters (SERPV)
978978
* for drive strength and read parameters (SRPV) for dummy cycles.
979979
*/
980-
uint32_t resp_data;
980+
uint32_t resp_data = 0;
981981

982982
transfer.data = &resp_data;
983983
transfer.cmdType = kFLEXSPI_Read;
984984

985985
flexspi_lut[SCRATCH_CMD][0] =
986-
FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x81,
986+
FLEXSPI_LUT_SEQ(kFLEXSPI_Command_SDR, kFLEXSPI_1PAD, 0x14,
987987
kFLEXSPI_Command_READ_SDR, kFLEXSPI_1PAD, 0x1);
988988
ret = memc_flexspi_set_device_config(&data->controller, &config, (uint32_t *)flexspi_lut,
989989
FLEXSPI_INSTR_END * MEMC_FLEXSPI_CMD_PER_SEQ,
@@ -996,12 +996,12 @@ flash_flexspi_nor_is25_clear_dummy_cycles(struct flash_flexspi_nor_data *data,
996996
ret = memc_flexspi_transfer(&data->controller, &transfer);
997997

998998
/*
999-
* Check that EB[7:4] is not all zero and that EB[0] (WIP)
1000-
* is not 1, which should catch a chip responding to an
1001-
* unsupported 81h command with either 0x00 or 0xFF
999+
* IS25LPXXX -> 0xff
1000+
* IS25WPXXX -> 0
1001+
* IS25LPXXXD -> 0
1002+
* IS25WPXXXD -> 0
10021003
*/
1003-
const int has_extended_read_reg = resp_data & 0xF0 && !(resp_data & 0x01);
1004-
uint32_t read_params = has_extended_read_reg ? 0 : 0xE0U;
1004+
uint32_t read_params = resp_data == 0xff ? 0xE0U : 0;
10051005

10061006
/* Switch over to writing read_params (SRPV, C0h) */
10071007
transfer.cmdType = kFLEXSPI_Write;

0 commit comments

Comments
 (0)