this brake the nand support on at91sam9x5ek
where we have a non compliant ONFI nand
NAND device: Manufacturer ID: 0xad, Chip ID: 0xda (Hynix NAND 256MiB 3,3V 
8-bit), 256MiB, page size: 2048, OOB size: 64

This reverts commit 4c2bdc8728016b3412523e3264651651fe752860.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagn...@jcrosoft.com>
---
 drivers/mtd/nand/nand_base.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index e8103cf..67e913a 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1179,15 +1179,16 @@ static struct nand_flash_dev 
*nand_get_flash_type(struct mtd_info *mtd,
                return ERR_PTR(-ENODEV);
        }
 
-       if (!type)
-               type = nand_flash_ids;
-
-       for (; type->name != NULL; type++)
-               if (dev_id == type->id)
+       /* 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];
                        break;
+               }
+       }
 
        chip->onfi_version = 0;
-       if (!type->name || !type->pagesize) {
+       if (!type) {
                /* Check is chip is ONFI compliant */
                ret = nand_flash_detect_onfi(mtd, chip, &busw);
                if (ret)
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to