linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: Take celltype into account when parsing Samsung ext. nand ID's
@ 2012-10-31 10:32 Robin van der Gracht
  2012-10-31 16:17 ` Brian Norris
  0 siblings, 1 reply; 6+ messages in thread
From: Robin van der Gracht @ 2012-10-31 10:32 UTC (permalink / raw)
  To: linux-mtd; +Cc: sjhill, tglx, computersforpeace, dwmw2, Robin van der Gracht

When using a Samsung nandflash with 2 level cells, the wrong page size,
erase size and oobsize is calculated.

I'm using a Samsung K9K8G08U0B nandflash (ID: 0xECD3519558). When booting the kernel i get:
NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB 3,3V 8-bit), page size: 4096, OOB size: 128

This is wrong. My nand flash has a pagesize of 2048 and oobsize 64.

This patch should work for all Samsung 6 byte ID chips, found on:
http://www.linux-mtd.infradead.org/nand-data/nanddata.html

Signed-off-by: Robin van der Gracht <robin@protonic.nl>
---
 drivers/mtd/nand/nand_base.c |    3 ++-
 include/linux/mtd/nand.h     |    4 ++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ec6841d..e292074 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2989,7 +2989,8 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
 	 * Check for ID length, cell type, and Hynix/Samsung ID to decide what
 	 * to do.
 	 */
-	if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG) {
+	if (id_len == 6 && id_data[0] == NAND_MFR_SAMSUNG &&
+			(chip->cellinfo & NAND_CI_CELLTYPE_4LVL)) {
 		/* Calc pagesize */
 		mtd->writesize = 2048 << (extid & 0x03);
 		extid >>= 2;
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 24e9159..3e3860e 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -227,6 +227,10 @@ typedef enum {
 /* Cell info constants */
 #define NAND_CI_CHIPNR_MSK	0x03
 #define NAND_CI_CELLTYPE_MSK	0x0C
+#define NAND_CI_CELLTYPE_2LVL	0x00
+#define NAND_CI_CELLTYPE_4LVL	0x04
+#define NAND_CI_CELLTYPE_8LVL	0x08
+#define NAND_CI_CELLTYPE_16LVL	0x0C
 
 /* Keep gcc happy */
 struct nand_chip;
-- 
1.7.5.4

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

* Re: [PATCH] mtd: nand: Take celltype into account when parsing Samsung ext. nand ID's
  2012-10-31 10:32 [PATCH] mtd: nand: Take celltype into account when parsing Samsung ext. nand ID's Robin van der Gracht
@ 2012-10-31 16:17 ` Brian Norris
  2012-10-31 16:30   ` David Woodhouse
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Norris @ 2012-10-31 16:17 UTC (permalink / raw)
  To: Robin van der Gracht, dwmw2; +Cc: sjhill, tglx, linux-mtd

Hi Robin,

On 10/31/2012 03:32 AM, Robin van der Gracht wrote:
> When using a Samsung nandflash with 2 level cells, the wrong page size,
> erase size and oobsize is calculated.
>
> I'm using a Samsung K9K8G08U0B nandflash (ID: 0xECD3519558). When booting the kernel i get:
> NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB 3,3V 8-bit), page size: 4096, OOB size: 128
>
> This is wrong. My nand flash has a pagesize of 2048 and oobsize 64.
>
> This patch should work for all Samsung 6 byte ID chips, found on:
> http://www.linux-mtd.infradead.org/nand-data/nanddata.html
>
> Signed-off-by: Robin van der Gracht <robin@protonic.nl>

I believe this regression has already been fixed and accepted by David 
Woodhouse and is awaiting upstream submission - hopefully for the 3.7-rc 
cycle. This should be its ID, in linux-mtd.git (and linux-next):

commit bc86cf7af2ebda88056538e8edff852ee627f76a
mtd: nand: fix Samsung SLC NAND identification regression

http://lists.infradead.org/pipermail/linux-mtd/2012-October/044458.html

Please test this fix to see if it fixes your problem, if possible. BTW, 
I would prefer not to use your solution, as the new Samsung ID decode 
table actually applies to some 2-level (i.e., SLC) Samsung NAND, 
particularly K9FAG08U0M.

Brian

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

* Re: [PATCH] mtd: nand: Take celltype into account when parsing Samsung ext. nand ID's
  2012-10-31 16:17 ` Brian Norris
@ 2012-10-31 16:30   ` David Woodhouse
  2012-10-31 17:18     ` Brian Norris
                       ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: David Woodhouse @ 2012-10-31 16:30 UTC (permalink / raw)
  To: Brian Norris; +Cc: Robin van der Gracht, tglx, linux-mtd, sjhill

[-- Attachment #1: Type: text/plain, Size: 410 bytes --]

On Wed, 2012-10-31 at 09:17 -0700, Brian Norris wrote:
> I believe this regression has already been fixed and accepted by David 
> Woodhouse and is awaiting upstream submission - hopefully for the 3.7-rc 
> cycle. This should be its ID, in linux-mtd.git (and linux-next):

Hm, did I not push that to Linus yet? I'll do so shortly. Anything else
we need to get in to 3.7 while I'm at it?

-- 
dwmw2


[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 6171 bytes --]

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

* Re: [PATCH] mtd: nand: Take celltype into account when parsing Samsung ext. nand ID's
  2012-10-31 16:30   ` David Woodhouse
@ 2012-10-31 17:18     ` Brian Norris
  2012-11-01  6:54     ` Artem Bityutskiy
  2012-11-08  8:03     ` Brian Norris
  2 siblings, 0 replies; 6+ messages in thread
From: Brian Norris @ 2012-10-31 17:18 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Artem Bityutskiy, Robin van der Gracht, Vipin Kumar, linux-mtd,
	sjhill, tglx

On Wed, Oct 31, 2012 at 9:30 AM, David Woodhouse <dwmw2@infradead.org> wrote:
> On Wed, 2012-10-31 at 09:17 -0700, Brian Norris wrote:
>> I believe this regression has already been fixed and accepted by David
>> Woodhouse and is awaiting upstream submission - hopefully for the 3.7-rc
>> cycle. This should be its ID, in linux-mtd.git (and linux-next):
>
> Hm, did I not push that to Linus yet? I'll do so shortly. Anything else
> we need to get in to 3.7 while I'm at it?

I don't know of much, but this commit is actually relevant to the same
patch series, since I increased the max OOB size. In l2-mtd-2.6.git:

commit acc6ceeb2ee2f1c7dae1e25914b40f0c294f6b42
mtd: nand: Increase the ecc placement locations to 640

I'll leave it to the author (Vipin), Artem, and you to decide if it
needs to be pushed ahead to 3.7.

Brian

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

* Re: [PATCH] mtd: nand: Take celltype into account when parsing Samsung ext. nand ID's
  2012-10-31 16:30   ` David Woodhouse
  2012-10-31 17:18     ` Brian Norris
@ 2012-11-01  6:54     ` Artem Bityutskiy
  2012-11-08  8:03     ` Brian Norris
  2 siblings, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2012-11-01  6:54 UTC (permalink / raw)
  To: David Woodhouse
  Cc: Robin van der Gracht, tglx, Brian Norris, linux-mtd, sjhill

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

On Wed, 2012-10-31 at 16:30 +0000, David Woodhouse wrote:
> On Wed, 2012-10-31 at 09:17 -0700, Brian Norris wrote:
> > I believe this regression has already been fixed and accepted by David 
> > Woodhouse and is awaiting upstream submission - hopefully for the 3.7-rc 
> > cycle. This should be its ID, in linux-mtd.git (and linux-next):
> 
> Hm, did I not push that to Linus yet? I'll do so shortly. Anything else
> we need to get in to 3.7 while I'm at it?

The 'for-3.7' branch in the l2-mtd.git tree.

-- 
Best Regards,
Artem Bityutskiy

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH] mtd: nand: Take celltype into account when parsing Samsung ext. nand ID's
  2012-10-31 16:30   ` David Woodhouse
  2012-10-31 17:18     ` Brian Norris
  2012-11-01  6:54     ` Artem Bityutskiy
@ 2012-11-08  8:03     ` Brian Norris
  2 siblings, 0 replies; 6+ messages in thread
From: Brian Norris @ 2012-11-08  8:03 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd, Artem Bityutskiy

On Wed, Oct 31, 2012 at 9:30 AM, David Woodhouse <dwmw2@infradead.org> wrote:
> On Wed, 2012-10-31 at 09:17 -0700, Brian Norris wrote:
>> I believe this regression has already been fixed and accepted by David
>> Woodhouse and is awaiting upstream submission - hopefully for the 3.7-rc
>> cycle. This should be its ID, in linux-mtd.git (and linux-next):
>
> Hm, did I not push that to Linus yet? I'll do so shortly. Anything else
> we need to get in to 3.7 while I'm at it?

I haven't seen any pull requests to Linus. Bump?

Regards,
Brian

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

end of thread, other threads:[~2012-11-08  8:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-31 10:32 [PATCH] mtd: nand: Take celltype into account when parsing Samsung ext. nand ID's Robin van der Gracht
2012-10-31 16:17 ` Brian Norris
2012-10-31 16:30   ` David Woodhouse
2012-10-31 17:18     ` Brian Norris
2012-11-01  6:54     ` Artem Bityutskiy
2012-11-08  8:03     ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).