diff --git a/source/board/flash/ospi/flash_nor_ospi.c b/source/board/flash/ospi/flash_nor_ospi.c index 9b3225a..46a20cf 100644 --- a/source/board/flash/ospi/flash_nor_ospi.c +++ b/source/board/flash/ospi/flash_nor_ospi.c @@ -856,20 +856,29 @@ static int32_t Flash_norOspiReadId(Flash_Config *config) Flash_NorOspiObject *obj = (Flash_NorOspiObject *)(config->object); Flash_DevConfig *devCfg = config->devConfig; FlashCfg_ReadIDConfig *idCfg = &(devCfg->idCfg); - FlashCfg_ProtoEnConfig *pCfg = &(devCfg->protocolCfg); - uint8_t seq = pCfg->enableSeq; - uint8_t idCode[FLASH_OSPI_JEDEC_ID_SIZE_MAX] = {0}; + uint8_t idCode[FLASH_OSPI_JEDEC_ID_SIZE_MAX]; uint32_t cmdAddr = OSPI_CMD_INVALID_ADDR; uint32_t dummyBits = 0; uint32_t idNumBytes = 3; - uint32_t numAddrBytes = idCfg->addrSize; + uint32_t numAddrBytes = 0; if(obj->currentProtocol == FLASH_CFG_PROTO_8D_8D_8D) { - dummyBits = idCfg->dummy8; - cmdAddr = 0U; - idNumBytes = 4; /* Can't read odd bytes in octal DDR */ + if (config->attrs->manufacturerId == 0x34) + { + dummyBits = 4; + cmdAddr = 0; + numAddrBytes = obj->numAddrBytes; + idNumBytes = 4; /* Can't read odd bytes in octal DDR */ + } + else + { + dummyBits = 8; + cmdAddr = OSPI_CMD_INVALID_ADDR; + numAddrBytes = obj->numAddrBytes; + idNumBytes = 4; /* Can't read odd bytes in octal DDR */ + } } else { @@ -883,10 +892,13 @@ static int32_t Flash_norOspiReadId(Flash_Config *config) { uint32_t manfID, devID; - if((obj->currentProtocol == FLASH_CFG_PROTO_8D_8D_8D) && ((seq & (1 << 2)) != 0)) + manfID = (uint32_t)idCode[0]; + devID = ((uint32_t)idCode[1] << 8) | ((uint32_t)idCode[2]); + if (!((manfID == config->attrs->manufacturerId) && (devID == config->attrs->deviceId))) { + /* Try the other 3 bytes */ manfID = (uint32_t)idCode[3]; - devID = ((uint32_t)idCode[0] << 8) | ((uint32_t)idCode[1]); + devID = ((uint32_t)idCode[4] << 8) | ((uint32_t)idCode[5]); if (!((manfID == config->attrs->manufacturerId) && (devID == config->attrs->deviceId))) { status = SystemP_FAILURE; @@ -894,25 +906,8 @@ static int32_t Flash_norOspiReadId(Flash_Config *config) } else { - manfID = (uint32_t)idCode[0]; - devID = ((uint32_t)idCode[1] << 8) | ((uint32_t)idCode[2]); - - if (!((manfID == config->attrs->manufacturerId) && (devID == config->attrs->deviceId))) - { - /* Try the other 3 bytes */ - manfID = (uint32_t)idCode[3]; - devID = ((uint32_t)idCode[4] << 8) | ((uint32_t)idCode[5]); - if (!((manfID == config->attrs->manufacturerId) && (devID == config->attrs->deviceId))) - { - status = SystemP_FAILURE; - } - } - else - { - /* Success, nothing to do */; - } + /* Success, nothing to do */; } } return status;