
Matvejchikov Ilya wrote:
Hi all,
While I try to examine cfi_flash.c file I have found that flash_detect_cfi() function used uninitialized value of info->cmd_reset:
flash_get_size() { .... if (flash_detect_cfi(info)) { .... switch (info->vendor) { .... info->cmd_reset = x_CMD_RESET; .... } } }
flash_detect_cfi(info) { .... flash_write_cmd (info, 0, 0, info->cmd_reset); .... }
Am I right? Or may be - 'Is it true?' :)
Good obvervation... It is true but mostly harmless (if the garbage in cmd_reset does not happen to be a valid command). The reset command is issued if the attempt to put flash in CFI mode has failed. The line could be removed and it would still work. When I designed my last patch flash_read_jedec_ids(), I've specifically avoided the info->cmd_reset for this reason.
Actually, AMD_CMD_RESET should be applicable to most Intel parts as well per CFI spec documents. I think the Linux MTD driver choose to send the Intel sequence followed by AMD sequence back to back during the probe.
BTW, Were you able to read my proposals to extend the CFI flash driver to handle non-cfi chips. I've only received one comment so far. I am waiting to get more comments before I go ahead with coding effort....
Best regards, Tolunay