do_erase_oneblock failing to detect lock-bit failure

Dan Eisenhut deisenhut at wi.rr.com
Fri Mar 26 12:50:46 EST 2004


On Thu, 2004-03-25 at 07:40, David Woodhouse wrote:
> On Thu, 2004-03-25 at 07:30 -0600, Dan Eisenhut wrote:
> > Is byte-lane swapping common?  
> 
> Not really. It's generally a symptom of hardware engineers who really
> don't understand the problem, and think it might help.

I looked into why they did this and apparently it was a recommendation
from Motorola.  We are using a MPC8270 processor.

> > Wouldn't this code fail for someone
> > without byte-lane swapping but requiring little endian enabled?  By
> > changing the if statements with (chipstatus & 0xNN) with (status &
> > CMD(0xNN)) appears to correct my problem, but I sure this is not the
> > best solution.
> 
> You made me think about it again and now my head hurts. I suspect that
> we should be using cfi_read_query() to read the status bits, not
> cfi_read(). 

I tried changing cfi_read to cfi_read_query, which sets status to
0x00a2.  But the immediate next check of "if (status & CMD(0x3a))" fails
since CMD(0x3a) resolves to 0x3a00.

Looking at it a little more, I made a couple changes which corrects the
problem for me.  (See attached diff)  How would this effect other boards
that are currently working on the existing code?  I'm not sure how
boards that do any kind of swapping were working in the first place. 
Maybe just never tested the return value on an erase to a locked block?

Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mtd_cfi_erase.diff
Type: text/x-patch
Size: 1272 bytes
Desc: not available
Url : http://lists.infradead.org/pipermail/linux-mtd/attachments/20040326/2df7bfb5/attachment.bin 


More information about the linux-mtd mailing list