nand_base: detect more ONFI flash
Subsystems (2)
PATCH 1/1 nand_base: detect more ONFI flash
if the flash has a known type, the ONFI detection won't occur and thus we may not detect the right parameters.
By testing both namd and pagesize, as done in the kernel, we can detect ONFI flash with know IDs.
As an example on an i.MX53 board :
- without the patch :
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron NAND 1GiB 3,3V 8-bit), page size: 4096, OOB size: 128
- with the patch :
ONFI flash detected ... ONFI param page 0 valid NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron MT29F8G08ABACAWP), page size: 4096, OOB size: 224
in the first case the OOB size is wrong.
--- drivers/mtd/nand/nand_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/nand_base.c +1 -1
@@ -1188,7 +1188,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, } chip->onfi_version =0 ; -if (!type) { +if (!type->name || !type->pagesize) {/* Check is chip is ONFI compliant */ ret =nand_flash_detect_onfi (mtd, chip, &busw);if (ret)
Signature · 7 lines
1.7.11.7 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Hi Sascha,
Quoted 27 lines · Eric Bénard
if the flash has a known type, the ONFI detection won't occur and thus we may not detect the right parameters.
By testing both namd and pagesize, as done in the kernel, we can detect ONFI flash with know IDs.As an example on an i.MX53 board :
- without the patch :
NAND device: Manufacturer ID:0x2c, Chip ID:0xd3(Micron NAND 1GiB 3,3V 8-bit), page size: 4096, OOB size: 128- with the patch :
ONFI flash detected ... ONFI param page 0 valid NAND device: Manufacturer ID:0x2c, Chip ID:0xd3(Micron MT29F8G08ABACAWP), page size: 4096, OOB size: 224in the first case the OOB size is wrong.
Signed-off-by Eric Bénard <[email protected]>--- drivers/mtd/nand/nand_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/mtd/nand/nand_base.c +0
-0
drivers/mtd/nand/nand_base.c static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, · line 1194
Quoted 8 lines
drivers/mtd/nand/nand_base.c +1
-1@@ -1188,7 +1188,7 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd, } chip->onfi_version =0 ; -if (!type) { +if (!type->name || !type->pagesize) {/* Check is chip is ONFI compliant */ ret =nand_flash_detect_onfi (mtd, chip, &busw);if (ret)
please dont apply this patch as it breaks the support with an ONFI flash not listed in the id tables. I'm reworking it right now.
Eric
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v2 1/1 nand_base: detect more ONFI flash
if the flash has a known type, the ONFI detection won't occur and thus we may not detect the right parameters.
By testing both namd and pagesize, as done in the kernel, we can detect ONFI flash with know IDs.
As an example on an i.MX53 board :
- without the patch :
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron NAND 1GiB 3,3V 8-bit), page size: 4096, OOB size: 128
- with the patch :
ONFI flash detected ... ONFI param page 0 valid NAND device: Manufacturer ID: 0x2c, Chip ID: 0xd3 (Micron MT29F8G08ABACAWP), page size: 4096, OOB size: 224
in the first case the OOB size is wrong.
---
v2: correctly integrate the kernel change so that if the flash ID is not known (when the flash in a recent ONFI one), we don't get a NULL pointer for type and thus a crash.
drivers/mtd/nand/nand_base.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/mtd/nand/nand_base.c +6 -7
@@ -1179,16 +1179,15 @@ static struct nand_flash_dev *nand_get_flash_type(struct mtd_info *mtd,return ERR_PTR (-ENODEV ); } -/* Lookup the flash id */ -for (i =0 ; nand_flash_ids[i].name !=NULL ; i++) { -if (dev_id == nand_flash_ids[i].id) { - type = &nand_flash_ids[i]; +if (!type) + type = nand_flash_ids; + +for (; type->name !=NULL ; type++) +if (dev_id == type->id)break ; - } - } chip->onfi_version =0 ; -if (!type) { +if (!type->name || !type->pagesize) {/* Check is chip is ONFI compliant */ ret =nand_flash_detect_onfi (mtd, chip, &busw);if (ret)
Signature · 7 lines
1.7.11.7 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 10 lines · Eric Bénard
if the flash has a known type, the ONFI detection won't occur and thus we may not detect the right parameters.
By testing both namd and pagesize, as done in the kernel, we can detect ONFI flash with know IDs.As an example on an i.MX53 board :
- without the patch :
NAND device: Manufacturer ID:0x2c, Chip ID:0xd3(Micron NAND 1GiB 3,3V 8-bit), page size: 4096, OOB size: 128
Quoted 8 lines
- with the patch :
ONFI flash detected ... ONFI param page 0 valid NAND device: Manufacturer ID:0x2c, Chip ID:0xd3(Micron MT29F8G08ABACAWP), page size: 4096, OOB size: 224in the first case the OOB size is wrong.
Signed-off-by Eric Bénard <[email protected]>
Applied, thanks
Sascha
Signature · 9 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox