]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - nand_spl/nand_boot_fsl_elbc.c
post, i2c: add missing curly bracket in i2c_post_test
[karo-tx-uboot.git] / nand_spl / nand_boot_fsl_elbc.c
index 4a961ea7b01fdca8647762aaced8caeacbc08261..9547d44238885fbd36e23eda1403f5c79f5d6b79 100644 (file)
@@ -25,7 +25,6 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include <asm/immap_83xx.h>
 #include <asm/fsl_lbc.h>
 #include <linux/mtd/nand.h>
 
@@ -33,7 +32,7 @@
 
 static void nand_wait(void)
 {
-       fsl_lbus_t *regs = (fsl_lbus_t *)(CONFIG_SYS_IMMR + 0x5000);
+       fsl_lbc_t *regs = LBC_BASE_ADDR;
 
        for (;;) {
                uint32_t status = in_be32(&regs->ltesr);
@@ -50,7 +49,7 @@ static void nand_wait(void)
 
 static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 {
-       fsl_lbus_t *regs = (fsl_lbus_t *)(CONFIG_SYS_IMMR + 0x5000);
+       fsl_lbc_t *regs = LBC_BASE_ADDR;
        uchar *buf = (uchar *)CONFIG_SYS_NAND_BASE;
        int large = in_be32(&regs->bank[0].or) & OR_FCM_PGS;
        int block_shift = large ? 17 : 14;
@@ -120,7 +119,7 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 
                        pos += page_size;
                        offs += page_size;
-               } while (offs & (block_size - 1));
+               } while ((offs & (block_size - 1)) && (pos < uboot_size));
        }
 }
 
@@ -143,6 +142,11 @@ void nand_boot(void)
         * Jump to U-Boot image
         */
        puts("transfering control\n");
+       /*
+        * Clean d-cache and invalidate i-cache, to
+        * make sure that no stale data is executed.
+        */
+       flush_cache(CONFIG_SYS_NAND_U_BOOT_DST, CONFIG_SYS_NAND_U_BOOT_SIZE);
        uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START;
        uboot();
 }