cfi_flash: Fix logical continuations
[oweals/u-boot.git] / drivers / mtd / nand / nand_spl_simple.c
index b023e00313b634e73dcb7bde67f6212102446484..56e86d1760993f592d45294f76dc3ca67fe5167f 100644 (file)
@@ -209,47 +209,13 @@ static int nand_read_page(int block, int page, void *dst)
 }
 #endif
 
-int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
-{
-       unsigned int block, lastblock;
-       unsigned int page;
-
-       /*
-        * offs has to be aligned to a page address!
-        */
-       block = offs / CONFIG_SYS_NAND_BLOCK_SIZE;
-       lastblock = (offs + size - 1) / CONFIG_SYS_NAND_BLOCK_SIZE;
-       page = (offs % CONFIG_SYS_NAND_BLOCK_SIZE) / CONFIG_SYS_NAND_PAGE_SIZE;
-
-       while (block <= lastblock) {
-               if (!nand_is_bad_block(block)) {
-                       /*
-                        * Skip bad blocks
-                        */
-                       while (page < CONFIG_SYS_NAND_PAGE_COUNT) {
-                               nand_read_page(block, page, dst);
-                               dst += CONFIG_SYS_NAND_PAGE_SIZE;
-                               page++;
-                       }
-
-                       page = 0;
-               } else {
-                       lastblock++;
-               }
-
-               block++;
-       }
-
-       return 0;
-}
-
 /* nand_init() - initialize data to make nand usable by SPL */
 void nand_init(void)
 {
        /*
         * Init board specific nand support
         */
-       mtd = &nand_chip.mtd;
+       mtd = nand_to_mtd(&nand_chip);
        nand_chip.IO_ADDR_R = nand_chip.IO_ADDR_W =
                (void  __iomem *)CONFIG_SYS_NAND_BASE;
        board_nand_init(&nand_chip);
@@ -271,3 +237,5 @@ void nand_deselect(void)
        if (nand_chip.select_chip)
                nand_chip.select_chip(mtd, -1);
 }
+
+#include "nand_spl_loaders.c"