public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* M29W640DB bad address for writing (0x554)
@ 2006-03-06 14:26 Philippe Bentz
  2006-10-18 15:20 ` Ronny L Nilsson
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Bentz @ 2006-03-06 14:26 UTC (permalink / raw)
  To: linux-mtd

Hi all,

I'm working with a M29W640DB, a 16 bits flash, in a 8 bits mode.
With CFI detection the MTD driver fails to program memory.
After a lot of debugging we discover that the cfi_send_gem_cmd generates a 
command with a 0x554 adress that could'not be recognized by the flash whereas 
it's waiting for 0x555. 
The formula cmd_ofs * interleave * type (our type is 2 and cmd_ofs 0x2AA) 
seems to be incorrect. So we add a conditional statement after the formula 
that changes 0x554 to 0x555, and it works perfectly. 
So what's the issue ?
It seems that this formula will never work for 16bits flash that are used in 8 
bits mode ?

Thanks for your help.

-- 
Philippe Bentz

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: M29W640DB bad address for writing (0x554)
  2006-03-06 14:26 M29W640DB bad address for writing (0x554) Philippe Bentz
@ 2006-10-18 15:20 ` Ronny L Nilsson
  0 siblings, 0 replies; 2+ messages in thread
From: Ronny L Nilsson @ 2006-10-18 15:20 UTC (permalink / raw)
  To: Philippe Bentz, linux-mtd


Hi
I've been bitten by the same bug as Philippe discovered in march:
http://lists.infradead.org/pipermail/linux-mtd/2006-March/014934.html


Using a 16-bit NOR flash in 8-bit mode doesn't work. (At least with 
chips from STMicroelectronics and kernel 2.6.18 and kernel 2.6.16). The 
function
	include/linux/mtd/cfi.h:cfi_build_cmd_addr()
makes a faulty address calculation so the chip doesn't receive commands 
properly. What cfi_build_cmd_addr() is doing is calculating: 
	0x2aa * 2 = 0x554
This is however a bad value! It should be 0x555 or the chip will simply 
ignore the command.



I can see no obvious clean method for fixing this issue. A Philippe 
mentions though, one can insert an ugly conditional statement and it'll 
work.

return ((cmd_ofs * type * interleave == 0x554u) ? 0x555u :
	cmd_ofs * type * interleave);



BR
/Ronny Nilsson

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-10-18 15:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-06 14:26 M29W640DB bad address for writing (0x554) Philippe Bentz
2006-10-18 15:20 ` Ronny L Nilsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox