sunxi_nand_spl: We only need to reset the nand chip once
authorHans de Goede <hdegoede@redhat.com>
Sat, 15 Aug 2015 09:38:33 +0000 (11:38 +0200)
committerHans de Goede <hdegoede@redhat.com>
Mon, 31 Aug 2015 06:43:41 +0000 (08:43 +0200)
There is no need to reset the nand chip for every ecc-block read.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Ian Campbell <ijc@hellion.org.uk>
drivers/mtd/nand/sunxi_nand_spl.c

index 46654e4ef66a884468ea9eaa2d02e349794ef703..56c0be02f5b6c8ac93b979447aa126203a44eae4 100644 (file)
@@ -162,6 +162,16 @@ void nand_init(void)
                                 NFC_CTL_RESET, MAX_RETRIES)) {
                printf("Couldn't initialize nand\n");
        }
+
+       /* reset NAND */
+       writel(NFC_SEND_CMD1 | NFC_WAIT_FLAG | NAND_CMD_RESET,
+              SUNXI_NFC_BASE + NFC_CMD);
+
+       if (!check_value(SUNXI_NFC_BASE + NFC_ST, NFC_CMD_INT_FLAG,
+                        MAX_RETRIES)) {
+               printf("Error timeout waiting for nand reset\n");
+               return;
+       }
 }
 
 static void nand_read_page(unsigned int real_addr, dma_addr_t dst,
@@ -223,16 +233,6 @@ static void nand_read_page(unsigned int real_addr, dma_addr_t dst,
                return;
        }
 
-       /* set CMD  */
-       writel(NFC_SEND_CMD1 | NFC_WAIT_FLAG | NAND_CMD_RESET,
-              SUNXI_NFC_BASE + NFC_CMD);
-
-       if (!check_value(SUNXI_NFC_BASE + NFC_ST, NFC_CMD_INT_FLAG,
-                        MAX_RETRIES)) {
-               printf("Error while initilizing command interrupt\n");
-               return;
-       }
-
        page = real_addr / CONFIG_NAND_SUNXI_SPL_PAGE_SIZE;
        column = real_addr % CONFIG_NAND_SUNXI_SPL_PAGE_SIZE;