* [RFC/PATCH 1/3] NAND multiple plane feature
@ 2008-05-28 12:41 Alexey Korolev
2008-06-03 17:25 ` Jörn Engel
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Korolev @ 2008-05-28 12:41 UTC (permalink / raw)
To: dwmw2, tglx, joern, dedekind, linux-mtd; +Cc: vasiliy.leonenko
Hi,
This patch provides identification of planes number on NAND device.
According to NAND datasheets the 5th byte of id contains info about
number of planes.
Thanks,
Alexey
Signed-off-by: Vasiliy Leonenko <vasiliy.leonenko@mail.ru>
Signed-off-by: Alexey Korolev <akorolev@infradead.org>
--------
drivers/mtd/nand/nand_base.c | 5 +++++
include/linux/mtd/nand.h | 2 ++
2 files changed, 7 insertions(+)
diff -Nurp linux-2.6.24.3/drivers/mtd/nand/nand_base.c linux-2.6.24.3-dp/drivers/mtd/nand/nand_base.c
--- linux-2.6.24.3/drivers/mtd/nand/nand_base.c 2008-02-26 03:20:20.000000000 +0300
+++ linux-2.6.24.3-dp/drivers/mtd/nand/nand_base.c 2008-05-28 02:06:01.000000000 +0400
@@ -2259,10 +2367,15 @@ static struct nand_flash_dev *nand_get_f
/* Newer devices have all the information in additional id bytes */
if (!type->pagesize) {
int extid;
+ int planeid;
/* The 3rd id byte holds MLC / multichip data */
chip->cellinfo = chip->read_byte(mtd);
/* The 4th id byte is the important one */
extid = chip->read_byte(mtd);
+ /* The 5th id byte contains number of planes */
+ planeid = chip->read_byte(mtd);
+ /* Number of planes*/
+ chip->numplanes = 1 << ((planeid >> 2) & 0x03);
/* Calc pagesize */
mtd->writesize = 1024 << (extid & 0x3);
extid >>= 2;
diff -Nurp linux-2.6.24.3/include/linux/mtd/nand.h linux-2.6.24.3-dp/include/linux/mtd/nand.h
--- linux-2.6.24.3/include/linux/mtd/nand.h 2008-02-26 03:20:20.000000000 +0300
+++ linux-2.6.24.3-dp/include/linux/mtd/nand.h 2008-05-28 02:11:51.000000000 +0400
@@ -343,6 +344,7 @@ struct nand_buffers {
* @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about
* special functionality. See the defines for further explanation
* @badblockpos: [INTERN] position of the bad block marker in the oob area
+ * @numplanes: [INTERN] number of ident planes on NAND device
* @cellinfo: [INTERN] MLC/multichip data from chip ident
* @numchips: [INTERN] number of physical chips
* @chipsize: [INTERN] the size of one chip for multichip arrays
@@ -399,6 +400,7 @@ struct nand_chip {
int subpagesize;
uint8_t cellinfo;
int badblockpos;
+ int numplanes;
nand_state_t state;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC/PATCH 1/3] NAND multiple plane feature
2008-05-28 12:41 [RFC/PATCH 1/3] NAND multiple plane feature Alexey Korolev
@ 2008-06-03 17:25 ` Jörn Engel
2008-06-05 16:24 ` Alexey Korolev
0 siblings, 1 reply; 3+ messages in thread
From: Jörn Engel @ 2008-06-03 17:25 UTC (permalink / raw)
To: Alexey Korolev; +Cc: linux-mtd, tglx, dwmw2, vasiliy.leonenko
On Wed, 28 May 2008 13:41:46 +0100, Alexey Korolev wrote:
> diff -Nurp linux-2.6.24.3/drivers/mtd/nand/nand_base.c linux-2.6.24.3-dp/drivers/mtd/nand/nand_base.c
> --- linux-2.6.24.3/drivers/mtd/nand/nand_base.c 2008-02-26 03:20:20.000000000 +0300
> +++ linux-2.6.24.3-dp/drivers/mtd/nand/nand_base.c 2008-05-28 02:06:01.000000000 +0400
> @@ -2259,10 +2367,15 @@ static struct nand_flash_dev *nand_get_f
> /* Newer devices have all the information in additional id bytes */
> if (!type->pagesize) {
> int extid;
> + int planeid;
> /* The 3rd id byte holds MLC / multichip data */
> chip->cellinfo = chip->read_byte(mtd);
> /* The 4th id byte is the important one */
> extid = chip->read_byte(mtd);
> + /* The 5th id byte contains number of planes */
> + planeid = chip->read_byte(mtd);
> + /* Number of planes*/
This comment seems redundant. And it fooled me for a few seconds.
Remove it?
> + chip->numplanes = 1 << ((planeid >> 2) & 0x03);
> /* Calc pagesize */
> mtd->writesize = 1024 << (extid & 0x3);
> extid >>= 2;
Jörn
--
Fools ignore complexity. Pragmatists suffer it.
Some can avoid it. Geniuses remove it.
-- Perlis's Programming Proverb #58, SIGPLAN Notices, Sept. 1982
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFC/PATCH 1/3] NAND multiple plane feature
2008-06-03 17:25 ` Jörn Engel
@ 2008-06-05 16:24 ` Alexey Korolev
0 siblings, 0 replies; 3+ messages in thread
From: Alexey Korolev @ 2008-06-05 16:24 UTC (permalink / raw)
To: Jörn Engel; +Cc: dwmw2, tglx, linux-mtd, vasiliy.leonenko
[-- Attachment #1: Type: TEXT/PLAIN, Size: 250 bytes --]
Hi Jörn
Thank you very much for patches review.
> > + planeid = chip->read_byte(mtd);
> > + /* Number of planes*/
>
> This comment seems redundant. And it fooled me for a few seconds.
> Remove it?
No problem. Will be removed.
Thanks,
Alexey
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-06-05 16:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-28 12:41 [RFC/PATCH 1/3] NAND multiple plane feature Alexey Korolev
2008-06-03 17:25 ` Jörn Engel
2008-06-05 16:24 ` Alexey Korolev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox