* [PATCH V2 0/2] mtd: nand: parse the Hynix nand which uses <26nm technology
@ 2013-12-25 7:37 Huang Shijie
2013-12-25 7:37 ` [PATCH V2 1/2] mtd: nand: add a helper to parse the Hynix nand Huang Shijie
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Huang Shijie @ 2013-12-25 7:37 UTC (permalink / raw)
To: dwmw2; +Cc: Huang Shijie, computersforpeace, linux-mtd
With this patch set, we can parse out the Hynix nand which uses <26nm
technology.
v1 --> v2:
[1] do not parse the ECC info anymore.
[2] split out a function to parse the Hynix MLC nand whose ID length is
6 bytes.
Huang Shijie (2):
mtd: nand: add a helper to parse the Hynix nand
mtd: nand: parse the Hynix nand which uses <26nm technology
drivers/mtd/nand/nand_base.c | 130 +++++++++++++++++++++++++++++-------------
1 files changed, 91 insertions(+), 39 deletions(-)
--
1.7.2.rc3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V2 1/2] mtd: nand: add a helper to parse the Hynix nand
2013-12-25 7:37 [PATCH V2 0/2] mtd: nand: parse the Hynix nand which uses <26nm technology Huang Shijie
@ 2013-12-25 7:37 ` Huang Shijie
2013-12-25 7:37 ` [PATCH V2 2/2] mtd: nand: parse the Hynix nand which uses <26nm technology Huang Shijie
2013-12-27 6:56 ` [PATCH V2 0/2] " Huang Shijie
2 siblings, 0 replies; 5+ messages in thread
From: Huang Shijie @ 2013-12-25 7:37 UTC (permalink / raw)
To: dwmw2; +Cc: Huang Shijie, computersforpeace, linux-mtd
This patch adds a nand_parse_hynix() to parse the Hynix MLC nand
whose ID length is 6 bytes.
This patch makes preparations for parsing other Hynix nand.
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/nand/nand_base.c | 89 +++++++++++++++++++++++------------------
1 files changed, 50 insertions(+), 39 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index bd39f7b..79f0050 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3104,6 +3104,55 @@ static int nand_get_bits_per_cell(u8 cellinfo)
return bits + 1;
}
+/* Parse for the Hynix MLC nand which has 6-bytes ID */
+static void nand_parse_hynix(struct mtd_info *mtd, struct nand_chip *chip,
+ u8 id_data[8], int *busw)
+{
+ int extid = id_data[3];
+ unsigned int tmp;
+
+ /* Calc pagesize */
+ mtd->writesize = 2048 << (extid & 0x03);
+ extid >>= 2;
+
+ /* Calc oobsize */
+ switch (((extid >> 2) & 0x04) | (extid & 0x03)) {
+ case 0:
+ mtd->oobsize = 128;
+ break;
+ case 1:
+ mtd->oobsize = 224;
+ break;
+ case 2:
+ mtd->oobsize = 448;
+ break;
+ case 3:
+ mtd->oobsize = 64;
+ break;
+ case 4:
+ mtd->oobsize = 32;
+ break;
+ case 5:
+ mtd->oobsize = 16;
+ break;
+ default:
+ mtd->oobsize = 640;
+ break;
+ }
+ extid >>= 2;
+
+ /* Calc blocksize */
+ tmp = ((extid >> 1) & 0x04) | (extid & 0x03);
+ if (tmp < 0x03)
+ mtd->erasesize = (128 * 1024) << tmp;
+ else if (tmp == 0x03)
+ mtd->erasesize = 768 * 1024;
+ else
+ mtd->erasesize = (64 * 1024) << tmp;
+
+ *busw = 0;
+}
+
/*
* Many new NAND share similar device ID codes, which represent the size of the
* chip. The rest of the parameters must be decoded according to generic or
@@ -3163,45 +3212,7 @@ static void nand_decode_ext_id(struct mtd_info *mtd, struct nand_chip *chip,
*busw = 0;
} else if (id_len == 6 && id_data[0] == NAND_MFR_HYNIX &&
!nand_is_slc(chip)) {
- unsigned int tmp;
-
- /* Calc pagesize */
- mtd->writesize = 2048 << (extid & 0x03);
- extid >>= 2;
- /* Calc oobsize */
- switch (((extid >> 2) & 0x04) | (extid & 0x03)) {
- case 0:
- mtd->oobsize = 128;
- break;
- case 1:
- mtd->oobsize = 224;
- break;
- case 2:
- mtd->oobsize = 448;
- break;
- case 3:
- mtd->oobsize = 64;
- break;
- case 4:
- mtd->oobsize = 32;
- break;
- case 5:
- mtd->oobsize = 16;
- break;
- default:
- mtd->oobsize = 640;
- break;
- }
- extid >>= 2;
- /* Calc blocksize */
- tmp = ((extid >> 1) & 0x04) | (extid & 0x03);
- if (tmp < 0x03)
- mtd->erasesize = (128 * 1024) << tmp;
- else if (tmp == 0x03)
- mtd->erasesize = 768 * 1024;
- else
- mtd->erasesize = (64 * 1024) << tmp;
- *busw = 0;
+ nand_parse_hynix(mtd, chip, id_data, busw);
} else {
/* Calc pagesize */
mtd->writesize = 1024 << (extid & 0x03);
--
1.7.2.rc3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V2 2/2] mtd: nand: parse the Hynix nand which uses <26nm technology
2013-12-25 7:37 [PATCH V2 0/2] mtd: nand: parse the Hynix nand which uses <26nm technology Huang Shijie
2013-12-25 7:37 ` [PATCH V2 1/2] mtd: nand: add a helper to parse the Hynix nand Huang Shijie
@ 2013-12-25 7:37 ` Huang Shijie
2013-12-25 8:05 ` [PATCH v2 2/2 fix] " Huang Shijie
2013-12-27 6:56 ` [PATCH V2 0/2] " Huang Shijie
2 siblings, 1 reply; 5+ messages in thread
From: Huang Shijie @ 2013-12-25 7:37 UTC (permalink / raw)
To: dwmw2; +Cc: Huang Shijie, computersforpeace, linux-mtd
The Hynix uses different ID parsing rules for <26nm technology.
We should check the id_data[5] for Hynix nand now.
This patch adds the parsing code for the Hynix nand which use <26nm technology.
Tested with H27UBG8T2CTR(8192 + 640).
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
drivers/mtd/nand/nand_base.c | 87 +++++++++++++++++++++++++++++++-----------
1 files changed, 64 insertions(+), 23 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 79f0050..070884a 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3109,36 +3109,77 @@ static void nand_parse_hynix(struct mtd_info *mtd, struct nand_chip *chip,
u8 id_data[8], int *busw)
{
int extid = id_data[3];
+ int tech = id_data[5];
unsigned int tmp;
+ /*
+ * The (id_data[5] <= 3) means the nand uses >=26nm technology;
+ * The (id_data[5] > 3) means the nand uses <26nm technology;
+ *
+ * Please reference the H27UBG8T2B (p.23) and H27UBG8T2C (p.23).
+ */
+ tmp = (tech <= 3) ? SZ_2K : SZ_4K;
+
/* Calc pagesize */
- mtd->writesize = 2048 << (extid & 0x03);
+ mtd->writesize = tmp << (extid & 0x03);
extid >>= 2;
/* Calc oobsize */
- switch (((extid >> 2) & 0x04) | (extid & 0x03)) {
- case 0:
- mtd->oobsize = 128;
- break;
- case 1:
- mtd->oobsize = 224;
- break;
- case 2:
- mtd->oobsize = 448;
- break;
- case 3:
- mtd->oobsize = 64;
- break;
- case 4:
- mtd->oobsize = 32;
- break;
- case 5:
- mtd->oobsize = 16;
- break;
- default:
- mtd->oobsize = 640;
- break;
+ tmp = ((extid >> 2) & 0x04) | (extid & 0x03);
+
+ if (tech <= 3) {
+ switch (tmp) {
+ case 0:
+ mtd->oobsize = 128;
+ break;
+ case 1:
+ mtd->oobsize = 224;
+ break;
+ case 2:
+ mtd->oobsize = 448;
+ break;
+ case 3:
+ mtd->oobsize = 64;
+ break;
+ case 4:
+ mtd->oobsize = 32;
+ break;
+ case 5:
+ mtd->oobsize = 16;
+ break;
+ default:
+ mtd->oobsize = 640;
+ break;
+ }
+ } else {
+ switch (tmp) {
+ case 0:
+ mtd->oobsize = 640;
+ break;
+ case 1:
+ mtd->oobsize = 448;
+ break;
+ case 2:
+ mtd->oobsize = 224;
+ break;
+ case 3:
+ mtd->oobsize = 128;
+ break;
+ case 4:
+ mtd->oobsize = 64;
+ break;
+ case 5:
+ mtd->oobsize = 32;
+ break;
+ case 6:
+ mtd->oobsize = 16;
+ break;
+ default:
+ mtd->oobsize = 640;
+ break;
+ }
}
+
extid >>= 2;
/* Calc blocksize */
--
1.7.2.rc3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2 fix] mtd: nand: parse the Hynix nand which uses <26nm technology
2013-12-25 7:37 ` [PATCH V2 2/2] mtd: nand: parse the Hynix nand which uses <26nm technology Huang Shijie
@ 2013-12-25 8:05 ` Huang Shijie
0 siblings, 0 replies; 5+ messages in thread
From: Huang Shijie @ 2013-12-25 8:05 UTC (permalink / raw)
To: dwmw2; +Cc: Huang Shijie, computersforpeace, linux-mtd
The Hynix uses different ID parsing rules for <26nm technology.
We should check the id_data[5] for Hynix nand now.
This patch adds the parsing code for the Hynix nand which use <26nm technology.
Tested with H27UBG8T2CTR(8192 + 640).
Signed-off-by: Huang Shijie <b32955@freescale.com>
---
mask the technology field
---
drivers/mtd/nand/nand_base.c | 87 +++++++++++++++++++++++++++++++-----------
1 files changed, 64 insertions(+), 23 deletions(-)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 79f0050..ce4dec7 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3110,34 +3110,75 @@ static void nand_parse_hynix(struct mtd_info *mtd, struct nand_chip *chip,
{
int extid = id_data[3];
unsigned int tmp;
+ int tech;
+ /*
+ * The ((id_data[5] & 0x7) <= 3) means the nand uses >=26nm technology;
+ * The ((id_data[5] & 0x7) > 3) means the nand uses <26nm technology;
+ *
+ * Please reference to the H27UBG8T2B (p.23) and H27UBG8T2C (p.23).
+ */
+ tech = id_data[5] & 0x7;
+
+ tmp = (tech <= 3) ? SZ_2K : SZ_4K;
/* Calc pagesize */
- mtd->writesize = 2048 << (extid & 0x03);
+ mtd->writesize = tmp << (extid & 0x03);
extid >>= 2;
/* Calc oobsize */
- switch (((extid >> 2) & 0x04) | (extid & 0x03)) {
- case 0:
- mtd->oobsize = 128;
- break;
- case 1:
- mtd->oobsize = 224;
- break;
- case 2:
- mtd->oobsize = 448;
- break;
- case 3:
- mtd->oobsize = 64;
- break;
- case 4:
- mtd->oobsize = 32;
- break;
- case 5:
- mtd->oobsize = 16;
- break;
- default:
- mtd->oobsize = 640;
- break;
+ tmp = ((extid >> 2) & 0x04) | (extid & 0x03);
+
+ if (tech <= 3) {
+ switch (tmp) {
+ case 0:
+ mtd->oobsize = 128;
+ break;
+ case 1:
+ mtd->oobsize = 224;
+ break;
+ case 2:
+ mtd->oobsize = 448;
+ break;
+ case 3:
+ mtd->oobsize = 64;
+ break;
+ case 4:
+ mtd->oobsize = 32;
+ break;
+ case 5:
+ mtd->oobsize = 16;
+ break;
+ default:
+ mtd->oobsize = 640;
+ break;
+ }
+ } else {
+ switch (tmp) {
+ case 0:
+ mtd->oobsize = 640;
+ break;
+ case 1:
+ mtd->oobsize = 448;
+ break;
+ case 2:
+ mtd->oobsize = 224;
+ break;
+ case 3:
+ mtd->oobsize = 128;
+ break;
+ case 4:
+ mtd->oobsize = 64;
+ break;
+ case 5:
+ mtd->oobsize = 32;
+ break;
+ case 6:
+ mtd->oobsize = 16;
+ break;
+ default:
+ mtd->oobsize = 640;
+ break;
+ }
}
extid >>= 2;
--
1.7.2.rc3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2 0/2] mtd: nand: parse the Hynix nand which uses <26nm technology
2013-12-25 7:37 [PATCH V2 0/2] mtd: nand: parse the Hynix nand which uses <26nm technology Huang Shijie
2013-12-25 7:37 ` [PATCH V2 1/2] mtd: nand: add a helper to parse the Hynix nand Huang Shijie
2013-12-25 7:37 ` [PATCH V2 2/2] mtd: nand: parse the Hynix nand which uses <26nm technology Huang Shijie
@ 2013-12-27 6:56 ` Huang Shijie
2 siblings, 0 replies; 5+ messages in thread
From: Huang Shijie @ 2013-12-27 6:56 UTC (permalink / raw)
To: dwmw2; +Cc: computersforpeace, linux-mtd
On Wed, Dec 25, 2013 at 03:37:17PM +0800, Huang Shijie wrote:
> With this patch set, we can parse out the Hynix nand which uses <26nm
> technology.
>
> v1 --> v2:
> [1] do not parse the ECC info anymore.
> [2] split out a function to parse the Hynix MLC nand whose ID length is
> 6 bytes.
>
> Huang Shijie (2):
> mtd: nand: add a helper to parse the Hynix nand
> mtd: nand: parse the Hynix nand which uses <26nm technology
>
Please ignore this patch set. I finally found a H27UCG8T2A. I found this patch set
is wrong. I have already contacted with Hynix's FAE to discuss this issue.
thanks
Huang Shijie
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-12-27 7:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-25 7:37 [PATCH V2 0/2] mtd: nand: parse the Hynix nand which uses <26nm technology Huang Shijie
2013-12-25 7:37 ` [PATCH V2 1/2] mtd: nand: add a helper to parse the Hynix nand Huang Shijie
2013-12-25 7:37 ` [PATCH V2 2/2] mtd: nand: parse the Hynix nand which uses <26nm technology Huang Shijie
2013-12-25 8:05 ` [PATCH v2 2/2 fix] " Huang Shijie
2013-12-27 6:56 ` [PATCH V2 0/2] " Huang Shijie
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).