Merge branch 'next' of git://git.denx.de/u-boot-video
[oweals/u-boot.git] / drivers / mtd / nand / sunxi_nand_spl.c
index 1ef7366d4c42d0cd4fdcb77af7acd29bc5251d96..eed4472bdc34b60cdb6aa2759bc961f32f70f7f0 100644 (file)
@@ -245,7 +245,7 @@ static int nand_read_page(const struct nfc_config *conf, u32 offs,
 {
        dma_addr_t dst = (dma_addr_t)dest;
        int nsectors = len / conf->ecc_size;
-       u16 rand_seed;
+       u16 rand_seed = 0;
        u32 val;
        int page;
 
@@ -258,8 +258,9 @@ static int nand_read_page(const struct nfc_config *conf, u32 offs,
        /* clear ecc status */
        writel(0, SUNXI_NFC_BASE + NFC_ECC_ST);
 
-       /* Choose correct seed */
-       rand_seed = random_seed[page % conf->nseeds];
+       /* Choose correct seed if randomized */
+       if (conf->randomize)
+               rand_seed = random_seed[page % conf->nseeds];
 
        writel((rand_seed << 16) | (conf->ecc_strength << 12) |
                (conf->randomize ? NFC_ECC_RANDOM_EN : 0) |