public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* 2nd problem with read_subpage() ?
@ 2008-07-29  6:53 Artem Bityutskiy
  2008-07-29  9:30 ` Artem Bityutskiy
  0 siblings, 1 reply; 7+ messages in thread
From: Artem Bityutskiy @ 2008-07-29  6:53 UTC (permalink / raw)
  To: Alexey Korolev; +Cc: linux-mtd

Glance at nand_do_read_ops():


if (likely(sndcmd)) {
        chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
        sndcmd = 0;
}

/* Now read the page into the buffer */
if (unlikely(ops->mode == MTD_OOB_RAW))
        ret = chip->ecc.read_page_raw(mtd, chip, bufpoi);
else if (!aligned && NAND_SUBPAGE_READ(chip) && !oob)
        ret = chip->ecc.read_subpage(mtd, chip, col, bytes, bufpoi);
else
        ret = chip->ecc.read_page(mtd, chip, bufpoi);
if (ret < 0)
        break;


What happens is that first NAND_CMD_READ0 command is sent, and the
chip reads _full_ page 0. Then read_subpage() is called and chip
reads the subpage again. Does it make any sense?

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: 2nd problem with read_subpage() ?
  2008-07-29  6:53 2nd problem with read_subpage() ? Artem Bityutskiy
@ 2008-07-29  9:30 ` Artem Bityutskiy
  2008-07-29  9:31   ` Artem Bityutskiy
  2008-07-29  9:45   ` Artem Bityutskiy
  0 siblings, 2 replies; 7+ messages in thread
From: Artem Bityutskiy @ 2008-07-29  9:30 UTC (permalink / raw)
  To: Alexey Korolev; +Cc: linux-mtd

On Tue, 2008-07-29 at 09:53 +0300, Artem Bityutskiy wrote:
> Glance at nand_do_read_ops():
> 
> 
> if (likely(sndcmd)) {
>         chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
>         sndcmd = 0;
> }

Alexey,

my investigation showed that this "random output" command is not
supported by all flashes. ST-micro NANDs seems to support it
(I checked 2 manuals), while Sumsung NANDs do not (checked manual
for K9XXG08UXA). This means your implementation will break many
systems and should be either fixed or reverted.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: 2nd problem with read_subpage() ?
  2008-07-29  9:30 ` Artem Bityutskiy
@ 2008-07-29  9:31   ` Artem Bityutskiy
  2008-07-29  9:50     ` Alexey Korolev
  2008-07-29  9:45   ` Artem Bityutskiy
  1 sibling, 1 reply; 7+ messages in thread
From: Artem Bityutskiy @ 2008-07-29  9:31 UTC (permalink / raw)
  To: Alexey Korolev; +Cc: linux-mtd

On Tue, 2008-07-29 at 12:30 +0300, Artem Bityutskiy wrote:
> On Tue, 2008-07-29 at 09:53 +0300, Artem Bityutskiy wrote:
> > Glance at nand_do_read_ops():
> > 
> > 
> > if (likely(sndcmd)) {
> >         chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
> >         sndcmd = 0;
> > }
> 
> Alexey,
> 
> my investigation showed that this "random output" command is not
> supported by all flashes. ST-micro NANDs seems to support it
> (I checked 2 manuals), while Sumsung NANDs do not (checked manual
> for K9XXG08UXA). This means your implementation will break many
> systems and should be either fixed or reverted.

Note, the Samsung NAND I referred is a large page device.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: 2nd problem with read_subpage() ?
  2008-07-29  9:30 ` Artem Bityutskiy
  2008-07-29  9:31   ` Artem Bityutskiy
@ 2008-07-29  9:45   ` Artem Bityutskiy
  2008-07-29  9:54     ` Alexey Korolev
  1 sibling, 1 reply; 7+ messages in thread
From: Artem Bityutskiy @ 2008-07-29  9:45 UTC (permalink / raw)
  To: Alexey Korolev; +Cc: linux-mtd


On Tue, 2008-07-29 at 12:30 +0300, Artem Bityutskiy wrote:
> On Tue, 2008-07-29 at 09:53 +0300, Artem Bityutskiy wrote:
> > Glance at nand_do_read_ops():
> > 
> > 
> > if (likely(sndcmd)) {
> >         chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
> >         sndcmd = 0;
> > }
> 
> Alexey,
> 
> my investigation showed that this "random output" command is not
> supported by all flashes. ST-micro NANDs seems to support it
> (I checked 2 manuals), while Sumsung NANDs do not (checked manual
> for K9XXG08UXA). This means your implementation will break many
> systems and should be either fixed or reverted.

I tried to implement this command in nandsim and test it with your
patch and found that there is something wring with how you use it.

What I do is dd if=/dev/mtd0 of=file bs=512 count=1 - just read one
sub-page. And in nandsim I see the following:

1. NAND_CMD_READ0 command, - read from eraseblock 0, column 0. This is
fine and seems to be called from nand_do_read_ops():

if (likely(sndcmd)) {
	chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
        sndcmd = 0;
}

2. Then NAND_CMD_RNDREAD command is issued with column address
0x828, which is completely weird. It is called from nand_read_subpage():

...
if (eccpos[(start_step + num_steps) * chip->ecc.bytes] & (busw - 1))
	aligned_len++;

chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + aligned_pos, -1);
chip->read_buf(mtd, &chip->oob_poi[aligned_pos], aligned_len);
....

I do not understand what is going on.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

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

* Re: 2nd problem with read_subpage() ?
  2008-07-29  9:31   ` Artem Bityutskiy
@ 2008-07-29  9:50     ` Alexey Korolev
  2008-07-29 10:32       ` Artem Bityutskiy
  0 siblings, 1 reply; 7+ messages in thread
From: Alexey Korolev @ 2008-07-29  9:50 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd

Hi Artem,

> On Tue, 2008-07-29 at 12:30 +0300, Artem Bityutskiy wrote:
> > On Tue, 2008-07-29 at 09:53 +0300, Artem Bityutskiy wrote:
> > > Glance at nand_do_read_ops():
> > > 
> > > 
> > > if (likely(sndcmd)) {
> > >         chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
> > >         sndcmd = 0;
> > > }
> > 
> > Alexey,
> > 
> > my investigation showed that this "random output" command is not
> > supported by all flashes. ST-micro NANDs seems to support it
> > (I checked 2 manuals), while Sumsung NANDs do not (checked manual
> > for K9XXG08UXA). This means your implementation will break many
> > systems and should be either fixed or reverted.
> 
> Note, the Samsung NAND I referred is a large page device.
> 
AFAIK this is a standard feature for LP NANDS. I glanced at spec for
K9XXG08UXA - device supports subpage oprations.

To check it I did this. 
Google -> K9XXG08UXA -> the first link -> open PDF page 41. 

Thanks,
Alexey

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

* Re: 2nd problem with read_subpage() ?
  2008-07-29  9:45   ` Artem Bityutskiy
@ 2008-07-29  9:54     ` Alexey Korolev
  0 siblings, 0 replies; 7+ messages in thread
From: Alexey Korolev @ 2008-07-29  9:54 UTC (permalink / raw)
  To: Artem Bityutskiy; +Cc: linux-mtd

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2071 bytes --]

Hi,

Oh thanks for explanation. 
Now I understand what has puzzled you. 

Nothing wrong is here. 
Driver reads one subpage - then it needs to check ECC for the subpage -
it jumps to position of ECC for that region and reads it. 
Then it checks if it is correct. 
> 
> On Tue, 2008-07-29 at 12:30 +0300, Artem Bityutskiy wrote:
> > On Tue, 2008-07-29 at 09:53 +0300, Artem Bityutskiy wrote:
> > > Glance at nand_do_read_ops():
> > > 
> > > 
> > > if (likely(sndcmd)) {
> > >         chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
> > >         sndcmd = 0;
> > > }
> > 
> > Alexey,
> > 
> > my investigation showed that this "random output" command is not
> > supported by all flashes. ST-micro NANDs seems to support it
> > (I checked 2 manuals), while Sumsung NANDs do not (checked manual
> > for K9XXG08UXA). This means your implementation will break many
> > systems and should be either fixed or reverted.
> 
> I tried to implement this command in nandsim and test it with your
> patch and found that there is something wring with how you use it.
> 
> What I do is dd if=/dev/mtd0 of=file bs=512 count=1 - just read one
> sub-page. And in nandsim I see the following:
> 
> 1. NAND_CMD_READ0 command, - read from eraseblock 0, column 0. This is
> fine and seems to be called from nand_do_read_ops():
> 
> if (likely(sndcmd)) {
> 	chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
>         sndcmd = 0;
> }
> 
> 2. Then NAND_CMD_RNDREAD command is issued with column address
> 0x828, which is completely weird. It is called from nand_read_subpage():
> 
> ...
> if (eccpos[(start_step + num_steps) * chip->ecc.bytes] & (busw - 1))
> 	aligned_len++;
> 
> chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize + aligned_pos, -1);
> chip->read_buf(mtd, &chip->oob_poi[aligned_pos], aligned_len);
> ....
> 
> I do not understand what is going on.
> 
> -- 
> Best regards,
> Artem Bityutskiy (Битюцкий Артём)
> 
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
> 

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

* Re: 2nd problem with read_subpage() ?
  2008-07-29  9:50     ` Alexey Korolev
@ 2008-07-29 10:32       ` Artem Bityutskiy
  0 siblings, 0 replies; 7+ messages in thread
From: Artem Bityutskiy @ 2008-07-29 10:32 UTC (permalink / raw)
  To: Alexey Korolev; +Cc: linux-mtd


On Tue, 2008-07-29 at 10:50 +0100, Alexey Korolev wrote:
> Hi Artem,
> 
> > On Tue, 2008-07-29 at 12:30 +0300, Artem Bityutskiy wrote:
> > > On Tue, 2008-07-29 at 09:53 +0300, Artem Bityutskiy wrote:
> > > > Glance at nand_do_read_ops():
> > > > 
> > > > 
> > > > if (likely(sndcmd)) {
> > > >         chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
> > > >         sndcmd = 0;
> > > > }
> > > 
> > > Alexey,
> > > 
> > > my investigation showed that this "random output" command is not
> > > supported by all flashes. ST-micro NANDs seems to support it
> > > (I checked 2 manuals), while Sumsung NANDs do not (checked manual
> > > for K9XXG08UXA). This means your implementation will break many
> > > systems and should be either fixed or reverted.
> > 
> > Note, the Samsung NAND I referred is a large page device.
> > 
> AFAIK this is a standard feature for LP NANDS. I glanced at spec for
> K9XXG08UXA - device supports subpage oprations.
> 
> To check it I did this. 
> Google -> K9XXG08UXA -> the first link -> open PDF page 41. 

Ops, right, sorry for the fake alarm.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

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

end of thread, other threads:[~2008-07-29 10:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-29  6:53 2nd problem with read_subpage() ? Artem Bityutskiy
2008-07-29  9:30 ` Artem Bityutskiy
2008-07-29  9:31   ` Artem Bityutskiy
2008-07-29  9:50     ` Alexey Korolev
2008-07-29 10:32       ` Artem Bityutskiy
2008-07-29  9:45   ` Artem Bityutskiy
2008-07-29  9:54     ` Alexey Korolev

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