CFI vs JEDEC read commands
Folks
In adding support for ST M29W160DT I've come across what looks like a bug in the chip, but but which has exposed what looks like an inconsistency in the probing in MTD.
The board I'm working on has two banks of Flash mapped into contiguous addresses, and I was seeing problems when probing for the second bank of Flash. The problem is that the first bank is being left in command mode after the probe, and so the second bank is detected as an alias for the first.
In cfi_cfi_probe() there is a call to cfi_send_cmd(0xff, ...) which I assume is supposed to reset the device back to read mode to avoid this problem. However the ST chip uses 0xf0 as its reset code, and changing the 0xff to 0xf0 appears to fix the problem.
All the documentation I've been able to check, for both CFI and JEDEC devices, including the ST M29W160DT indicates that an unrecognised command should put the device back into read mode. Unfortunately the ST chip doesn't appear to be doing this, which I assume is a bug.
Has anybody else come across a problem like this?
However, this got me looking at the code. In virtually every case, a 'read' command is 0xf0, apart from two (one in cfi_cfi_probe and the other in cfi_cmdset_unknown), when is it 0xff. Is this deliberate, and would changing the remaining two to 0xf0 cause any problems?
Many thanks
Stuart
Quoted 4 lines · [email protected] said:
However, this got me looking at the code. In virtually every case, a
'read' command is0xf0, apart from two (one incfi_cfi_probeand the other incfi_cmdset_unknown), when is it0xff. Is this deliberate, and would changing the remaining two to0xf0cause any problems?
They were originally 0xFF because I was dealing with Intel flash when I wrote the CFI probe code, and that's the 'Read Array' command for Intel flash. AFAICT CFI doesn't actually specify a way to take the chip _out_ of read mode, and hence to detect aliases. I suspect 0xF0 should work. Let's change it and see if it breaks - if it does we have to implement a cmdset-specific 'switch back to read mode' function.
--
dwmw2