Fix the method of flashing FCB blocks into NAND. The new env
writes all four FCB blocks and also does not scrub such a big
part of the NAND. This fixed complains about busted NAND blocks
in Linux.

Signed-off-by: Marek Vasut <ma...@denx.de>
Cc: Fabio Estevam <fabio.este...@freescale.com>
Cc: Stefano Babic <sba...@denx.de>
---
 include/configs/m28evk.h  |   22 ++++++++++++++++++++--
 include/configs/mx28evk.h |   22 ++++++++++++++++++++--
 2 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/include/configs/m28evk.h b/include/configs/m28evk.h
index eba8759..8a0587c 100644
--- a/include/configs/m28evk.h
+++ b/include/configs/m28evk.h
@@ -170,11 +170,29 @@
                "nand info ; "                                          \
                "setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \
                "setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \
+       "update_nand_write_fcb="                                        \
+               "setenv i ${update_nand_count} ; "                      \
+               "setenv update_nand_offset 0x0 ; "                      \
+               "setexpr update_nand_step "                             \
+                       "${update_nand_stride} * ${nand_writesize} ; "  \
+               "while test ${i} -gt 0 ; do "                           \
+                       "echo ${update_nand_offset} ; "                 \
+                       "nand scrub -y ${update_nand_offset} "          \
+                               "${nand_erasesize} ; "                  \
+                       "nand write.raw ${loadaddr} "                   \
+                               "${update_nand_offset} 0x1 ; "  \
+                       "setexpr i ${i} - 1 ; "                         \
+                       "setexpr update_nand_offset "                   \
+                               "${update_nand_offset} + "              \
+                               "${update_nand_step} ; "                \
+               "done ; "                                               \
+               "setenv i ; "                                           \
+               "setenv update_nand_offset ; "                          \
+               "setenv update_nand_step\0"                             \
        "update_nand_full="             /* Update FCB, DBBT and FW */   \
                "if tftp ${update_nand_full_filename} ; then "          \
                "run update_nand_get_fcb_size ; "                       \
-               "nand scrub -y 0x0 ${filesize} ; "                      \
-               "nand write.raw ${loadaddr} 0x0 ${fcb_sz} ; "   \
+               "run update_nand_write_fcb ; "                          \
                "setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \
                "setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \
                "nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \
diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
index 07f88ca..b0ae031 100644
--- a/include/configs/mx28evk.h
+++ b/include/configs/mx28evk.h
@@ -172,11 +172,29 @@
                "nand info ; " \
                "setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \
                "setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \
+       "update_nand_write_fcb="                                        \
+               "setenv i ${update_nand_count} ; "                      \
+               "setenv update_nand_offset 0x0 ; "                      \
+               "setexpr update_nand_step "                             \
+                       "${update_nand_stride} * ${nand_writesize} ; "  \
+               "while test ${i} -gt 0 ; do "                           \
+                       "echo ${update_nand_offset} ; "                 \
+                       "nand scrub -y ${update_nand_offset} "          \
+                               "${nand_erasesize} ; "                  \
+                       "nand write.raw ${loadaddr} "                   \
+                               "${update_nand_offset} 0x1 ; "  \
+                       "setexpr i ${i} - 1 ; "                         \
+                       "setexpr update_nand_offset "                   \
+                               "${update_nand_offset} + "              \
+                               "${update_nand_step} ; "                \
+               "done ; "                                               \
+               "setenv i ; "                                           \
+               "setenv update_nand_offset ; "                          \
+               "setenv update_nand_step\0"                             \
        "update_nand_full="                 /* Update FCB, DBBT and FW */ \
                "if tftp ${update_nand_full_filename} ; then " \
                "run update_nand_get_fcb_size ; " \
-               "nand scrub -y 0x0 ${filesize} ; " \
-               "nand write.raw ${loadaddr} 0x0 ${fcb_sz} ; " \
+               "run update_nand_write_fcb ; "                          \
                "setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \
                "setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \
                "nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \
-- 
1.7.10.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to