mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2025-12-10 07:44:53 +01:00
ipq6018: Adding support for new read id command sequence for spi nand
Some spi nand flash uses single byte read id(9FH) command, for those devices the sequence is byte1 byte2 byte3 byte4 9FH MID DID DID some other spi nand flashes uses two byte read id(9F 00H) command for those devices the sequence is byte1 byte2 byte3 byte4 9FH A7-A0 MID DID The first byte is the actual command and the second byte is a dummy byte. For devices which uses new sequence, we need to pass appropriate read id command with dummy byte. Change-Id: Idf2e8740f8341596cd8f58d22d5e33a4b4972a31 Signed-off-by: Antony Arun T <antothom@codeaurora.org>
This commit is contained in:
parent
51eda13d9c
commit
fc4ec308a0
2 changed files with 24 additions and 0 deletions
|
|
@ -1040,9 +1040,20 @@ int spi_flash_scan(struct spi_flash *flash)
|
|||
u8 idcode[5];
|
||||
u8 cmd;
|
||||
int ret;
|
||||
#ifdef CONFIG_SPI_NAND_MULTI_BYTE_READ_ID
|
||||
u8 command[2];
|
||||
int dummy_byte = 0;
|
||||
|
||||
command[0] = CMD_READ_ID;
|
||||
command[1] = 0; /*dummy byte*/
|
||||
|
||||
try_with_dummy_byte:
|
||||
/* Read the ID codes */
|
||||
ret = spi_flash_cmd_read(spi, command, dummy_byte+1, idcode,
|
||||
sizeof(idcode));
|
||||
#else
|
||||
ret = spi_flash_cmd(spi, CMD_READ_ID, idcode, sizeof(idcode));
|
||||
#endif
|
||||
if (ret) {
|
||||
printf("SF: Failed to get idcodes\n");
|
||||
return -EINVAL;
|
||||
|
|
@ -1084,10 +1095,22 @@ int spi_flash_scan(struct spi_flash *flash)
|
|||
if (!ret)
|
||||
goto do_generic_probe;
|
||||
#endif
|
||||
#ifdef CONFIG_SPI_NAND_MULTI_BYTE_READ_ID
|
||||
if (dummy_byte == 0) {
|
||||
dummy_byte = 1;
|
||||
goto try_with_dummy_byte;
|
||||
} else {
|
||||
printf("SF: Unsupported flash IDs: ");
|
||||
printf("manuf %02x, jedec %04x, ext_jedec %04x\n",
|
||||
idcode[0], jedec, ext_jedec);
|
||||
return -EPROTONOSUPPORT;
|
||||
}
|
||||
#else
|
||||
printf("SF: Unsupported flash IDs: ");
|
||||
printf("manuf %02x, jedec %04x, ext_jedec %04x\n",
|
||||
idcode[0], jedec, ext_jedec);
|
||||
return -EPROTONOSUPPORT;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Flash powers up read-only, so clear BP# bits */
|
||||
|
|
|
|||
|
|
@ -212,6 +212,7 @@ extern loff_t board_env_size;
|
|||
#define CONFIG_SF_SPI_NAND_CS 1
|
||||
#define CONFIG_IPQ_SPI_NAND_INFO_IDX 1
|
||||
#define CONFIG_SF_NAND_BUS 1
|
||||
#define CONFIG_SPI_NAND_MULTI_BYTE_READ_ID
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue