Linux-mtd Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Trivial (?) question about nand_command_[lp]()
@ 2016-08-22 11:19 Ricard Wanderlof
  2016-08-26  9:38 ` Boris Brezillon
  0 siblings, 1 reply; 3+ messages in thread
From: Ricard Wanderlof @ 2016-08-22 11:19 UTC (permalink / raw)
  To: Linux mtd


I'm having a close look at nand_base.c:nand_command(), and there's 
something I can't get my head around: According to the code, when the 
command to be sent is NAND_CMD_SEQIN (0x80), used for programming a page, 
first a read command (READ0, READ1 or READOOB depending on the column 
address) is sent to the flash, followed by the SEQIN proper. Are there 
flashes which require a read command to be sent (with no 
address or data bytes) immediately before Page Program?

A related issue is a difference versus nand_command_lp(). In the latter, 
NAND_NCE is set for every command towards the flash, which makes sense, as 
the chip enable should be active throughout the whole sequence. However, 
in nand_command(), NAND_NCE is only set when neither NAND_ALE nor NAND_CLE 
are set. Is this an older convention in the code that CE is implied for 
small-page flashes when ALE or CLE is set, but not for the large-page 
case?

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

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

* Re: Trivial (?) question about nand_command_[lp]()
  2016-08-22 11:19 Trivial (?) question about nand_command_[lp]() Ricard Wanderlof
@ 2016-08-26  9:38 ` Boris Brezillon
  2016-08-26 15:34   ` Ricard Wanderlof
  0 siblings, 1 reply; 3+ messages in thread
From: Boris Brezillon @ 2016-08-26  9:38 UTC (permalink / raw)
  To: Ricard Wanderlof; +Cc: Linux mtd

Hi Ricard,

Please Cc the NAND and MTD maintainers when sending NAND related
questions.

On Mon, 22 Aug 2016 13:19:17 +0200
Ricard Wanderlof <ricard.wanderlof@axis.com> wrote:

> I'm having a close look at nand_base.c:nand_command(), and there's 
> something I can't get my head around: According to the code, when the 
> command to be sent is NAND_CMD_SEQIN (0x80), used for programming a page, 
> first a read command (READ0, READ1 or READOOB depending on the column 
> address) is sent to the flash, followed by the SEQIN proper. Are there 
> flashes which require a read command to be sent (with no 
> address or data bytes) immediately before Page Program?

No, it's probably a bug. Should be

	if (command == NAND_CMD_RNDOUT) {
		...
	} else {
		chip->cmd_ctrl(mtd, command, ctrl);
	}

instead of

	if (command == NAND_CMD_SEQIN) {
		...
	}
	chip->cmd_ctrl(mtd, command, ctrl);

Not sure we have a lot of people testing this code (it's only used
when interacting with really old NANDs).

> 
> A related issue is a difference versus nand_command_lp(). In the latter, 
> NAND_NCE is set for every command towards the flash, which makes sense, as 
> the chip enable should be active throughout the whole sequence. However, 
> in nand_command(), NAND_NCE is only set when neither NAND_ALE nor NAND_CLE 
> are set. Is this an older convention in the code that CE is implied for 
> small-page flashes when ALE or CLE is set, but not for the large-page 
> case?

No, again, it's probably a bug.

Feel free to send fixes. BTW, do you have a way to test the changes?

Thanks,

Boris

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

* Re: Trivial (?) question about nand_command_[lp]()
  2016-08-26  9:38 ` Boris Brezillon
@ 2016-08-26 15:34   ` Ricard Wanderlof
  0 siblings, 0 replies; 3+ messages in thread
From: Ricard Wanderlof @ 2016-08-26 15:34 UTC (permalink / raw)
  To: Boris Brezillon; +Cc: Linux mtd


On Fri, 26 Aug 2016, Boris Brezillon wrote:

> Please Cc the NAND and MTD maintainers when sending NAND related
> questions.

Ok, will do.

> Ricard Wanderlof <ricard.wanderlof@axis.com> wrote:
> 
> > I'm having a close look at nand_base.c:nand_command(), and there's 
> > something I can't get my head around: According to the code, when the 
> > command to be sent is NAND_CMD_SEQIN (0x80), used for programming a page, 
> > first a read command (READ0, READ1 or READOOB depending on the column 
> > address) is sent to the flash, followed by the SEQIN proper. Are there 
> > flashes which require a read command to be sent (with no 
> > address or data bytes) immediately before Page Program?
> 
> No, it's probably a bug. Should be
> 
> 	if (command == NAND_CMD_RNDOUT) {
> 		...
> 	} else {
> 		chip->cmd_ctrl(mtd, command, ctrl);
> 	}
> 
> instead of
> 
> 	if (command == NAND_CMD_SEQIN) {
> 		...
> 	}
> 	chip->cmd_ctrl(mtd, command, ctrl);
> 
> Not sure we have a lot of people testing this code (it's only used
> when interacting with really old NANDs).
> 
> > 
> > A related issue is a difference versus nand_command_lp(). In the latter, 
> > NAND_NCE is set for every command towards the flash, which makes sense, as 
> > the chip enable should be active throughout the whole sequence. However, 
> > in nand_command(), NAND_NCE is only set when neither NAND_ALE nor NAND_CLE 
> > are set. Is this an older convention in the code that CE is implied for 
> > small-page flashes when ALE or CLE is set, but not for the large-page 
> > case?
> 
> No, again, it's probably a bug.
> 
> Feel free to send fixes. BTW, do you have a way to test the changes?

I might be able to find some combination of hardware platform here which 
has a byte-banged NAND interface, on which we still support recent 
kernels, and a board which has a socket into which I can put a 256 Mbit 
flash or similar. I know I have flash chips lying around.

Right now I'm back on the Evatronix driver, so I'll see if I can have a 
look at the above when that's finished.

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

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

end of thread, other threads:[~2016-08-26 15:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-22 11:19 Trivial (?) question about nand_command_[lp]() Ricard Wanderlof
2016-08-26  9:38 ` Boris Brezillon
2016-08-26 15:34   ` Ricard Wanderlof

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