* NAND programming bug in Linux 2.6.8?
@ 2004-10-15 10:53 Mikael Starvik
2004-10-15 11:13 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Mikael Starvik @ 2004-10-15 10:53 UTC (permalink / raw)
To: linux-mtd
In nand_base.c:nand_command() the following happens (stripped pseudo-code):
if (NAND_CMD_SEQIN) {
if (column > OOB) {
column -= OOB;
use READ_OOB;
}
else if (column < 256)
use READ0;
else {
column -= 256;
use READ1;
}
send_command();
}
if (16bit)
column >>= 1;
write_column();
The problem is that for a 16-bit device the READ1 command will be issued
even though the column address fits in 8 bits. Suggested patch below.
Comments?
/Mikael (not a member of this list)
Index: nand_base.c
===================================================================
RCS file: /usr/local/cvs/linux/os/lx25/drivers/mtd/nand/nand_base.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 nand_base.c
--- nand_base.c 16 Aug 2004 08:14:36 -0000 1.1.1.1
+++ nand_base.c 15 Oct 2004 10:46:16 -0000
@@ -506,8 +506,8 @@
/* OOB area */
column -= mtd->oobblock;
readcmd = NAND_CMD_READOOB;
- } else if (column < 256) {
- /* First 256 bytes --> READ0 */
+ } else if ((column < 256) || (this->options &
NAND_BUSWIDTH_16)) {
+ /* First 256 bytes/words --> READ0 */
readcmd = NAND_CMD_READ0;
} else {
column -= 256;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: NAND programming bug in Linux 2.6.8?
2004-10-15 10:53 Mikael Starvik
@ 2004-10-15 11:13 ` Thomas Gleixner
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2004-10-15 11:13 UTC (permalink / raw)
To: Mikael Starvik; +Cc: linux-mtd
On Fri, 2004-10-15 at 12:53, Mikael Starvik wrote:
> The problem is that for a 16-bit device the READ1 command will be issued
> even though the column address fits in 8 bits. Suggested patch below.
There is no problem at all.
1. As we do only full page reads, this will never happen. The READ1 code
could go away complete.
2. If you want to read the second half of the page, then it's completely
correct to issue the READ1 command, because the column address is
shifted right by 1 later. The READ1 command selects the second half of
the page whether the chip is in 8 or in 16 bit mode.
read from offset 256
command = READ1, column address = 0
it will read from offset 256
read from offset 260
command = READ1, column address = 2
it will read from offset 256 + 2*2 = 260
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: NAND programming bug in Linux 2.6.8?
[not found] <BFECAF9E178F144FAEF2BF4CE739C668018E2C8E@exmail1.se.axis.com>
@ 2004-10-15 11:50 ` Mikael Starvik
2004-10-15 12:05 ` Thomas Gleixner
0 siblings, 1 reply; 4+ messages in thread
From: Mikael Starvik @ 2004-10-15 11:50 UTC (permalink / raw)
To: tglx, Mikael Starvik; +Cc: linux-mtd
>1. As we do only full page reads, this will never happen. The READ1 code
>could go away complete.
Hmm. I could swear that I have seen it at least once since my NAND model
complained about it but now I can't repeat it.
>2. If you want to read the second half of the page, then it's completely
>correct to issue the READ1 command, because the column address is
>shifted right by 1 later. The READ1 command selects the second half of
>the page whether the chip is in 8 or in 16 bit mode.
Ok, good! My Samsung datasheet (K9F2816U0C) is very vague on this point. In
the programming examples for the 16 bit device only READ0 and READ_OOB is
mentioned (while for the 8-bits device READ1 is also mentioned).
You clarification make my patch pointless, so just ignore it and I update my
NAND flash model instead.
Thanks!
/Mikael
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: NAND programming bug in Linux 2.6.8?
2004-10-15 11:50 ` NAND programming bug in Linux 2.6.8? Mikael Starvik
@ 2004-10-15 12:05 ` Thomas Gleixner
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2004-10-15 12:05 UTC (permalink / raw)
To: Mikael Starvik; +Cc: linux-mtd
On Fri, 2004-10-15 at 13:50, Mikael Starvik wrote:
> >1. As we do only full page reads, this will never happen. The READ1 code
> >could go away complete.
>
> Hmm. I could swear that I have seen it at least once since my NAND model
> complained about it but now I can't repeat it.
Can you add a BUG() in there ? If it ever happens again we can figure
out where it's called from.
> >2. If you want to read the second half of the page, then it's completely
> >correct to issue the READ1 command, because the column address is
> >shifted right by 1 later. The READ1 command selects the second half of
> >the page whether the chip is in 8 or in 16 bit mode.
>
> Ok, good! My Samsung datasheet (K9F2816U0C) is very vague on this point. In
> the programming examples for the 16 bit device only READ0 and READ_OOB is
> mentioned (while for the 8-bits device READ1 is also mentioned).
Yeah, its not neccecary for 16 bit, as the column address always fits
into 8bit.
tglx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-10-15 12:13 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <BFECAF9E178F144FAEF2BF4CE739C668018E2C8E@exmail1.se.axis.com>
2004-10-15 11:50 ` NAND programming bug in Linux 2.6.8? Mikael Starvik
2004-10-15 12:05 ` Thomas Gleixner
2004-10-15 10:53 Mikael Starvik
2004-10-15 11:13 ` Thomas Gleixner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox