All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd : add parsing code for one kind of Hynix's nand chip
@ 2012-04-10  2:56 Huang Shijie
  2012-04-11 16:52 ` Brian Norris
  0 siblings, 1 reply; 11+ messages in thread
From: Huang Shijie @ 2012-04-10  2:56 UTC (permalink / raw)
  To: dedekind1; +Cc: Huang Shijie, linux-mtd, Huang Shijie

From: Huang Shijie <shijie8@gmail.com>

The H27UBG8T2A is not supported by the current code.
Its full-id is : 0xad, 0xd7, 0x94, 0x9a, 0x74, 0x42.

Now, add the parsing code for it.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
 drivers/mtd/nand/nand_base.c |   43 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 6315b94..8997023 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3028,6 +3028,49 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,
 			mtd->erasesize = (128 * 1024) <<
 				(((extid >> 1) & 0x04) | (extid & 0x03));
 			busw = 0;
+		} else if (id_data[0] == NAND_MFR_HYNIX && id_data[1] == 0xd7) {
+			/* Calc pagesize */
+			mtd->writesize = 2048 << (extid & 0x03);
+			extid >>= 2;
+
+			/* Calc oobsize */
+			switch (extid & 0x03) {
+			case 0:
+				mtd->oobsize = 128;
+				break;
+			case 1:
+				mtd->oobsize = 224;
+				break;
+			case 2:
+				mtd->oobsize = 448;
+				break;
+			default:
+				pr_info("Cannot parse out the oobsize.\n");
+				break;
+			}
+			extid >>= 2;
+
+			/* Calc blocksize */
+			extid = (((extid >> 1) & 0x04) | (extid & 0x03));
+
+			switch (extid) {
+			case 0:
+			case 1:
+			case 2:
+				mtd->erasesize = (128 * 1024) << extid;
+				break;
+			case 3:
+				mtd->erasesize = (128 * 1024) * 6;
+				break;
+			case 4:
+			case 5:
+				mtd->erasesize = (128 * 1024) << (extid - 1);
+				break;
+			default:
+				pr_info("Cannot parse out the blocksize.\n");
+				break;
+			}
+			busw = 0;
 		} else {
 			/* Calc pagesize */
 			mtd->writesize = 1024 << (extid & 0x03);
-- 
1.7.0.4

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

end of thread, other threads:[~2012-09-15  5:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-10  2:56 [PATCH] mtd : add parsing code for one kind of Hynix's nand chip Huang Shijie
2012-04-11 16:52 ` Brian Norris
2012-04-12  2:43   ` Huang Shijie
2012-04-18  5:00     ` Brian Norris
2012-04-18  7:52       ` Huang Shijie
2012-09-15  5:27         ` Brian Norris
2012-04-18  5:00     ` Brian Norris
2012-08-17  8:43   ` Huang Shijie
2012-08-18  2:51     ` Brian Norris
2012-08-20  6:01       ` Huang Shijie
2012-09-15  4:39         ` Brian Norris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.