tqma6: fix rounding in env
authorMarkus Niebel <Markus.Niebel@tq-group.com>
Fri, 3 Feb 2017 15:14:02 +0000 (16:14 +0100)
committerStefano Babic <sbabic@denx.de>
Sun, 19 Feb 2017 16:16:51 +0000 (17:16 +0100)
need to add before div in mmc update scripts. Otherwise we could
write one block more ba acident

Signed-off-by: Markus Niebel <Markus.Niebel@tq-group.com>
include/configs/tqma6.h

index 311221d75bc37e9b63ad8f9f557806a62cf90567..9225bc1639f3c96bafa6c3326329c5c44113046a 100644 (file)
        "update_uboot=if tftp ${uboot}; then "                                 \
                "if itest ${filesize} > 0; then "                              \
                        "mmc dev ${mmcdev}; mmc rescan; "                      \
-                       "setexpr blkc ${filesize} / 0x200; "                   \
-                       "setexpr blkc ${blkc} + 1; "                           \
+                       "setexpr blkc ${filesize} + 0x1ff; "                   \
+                       "setexpr blkc ${blkc} / 0x200; "                       \
                        "if itest ${blkc} <= ${uboot_size}; then "             \
                                "mmc write ${loadaddr} ${uboot_start} "        \
                                        "${blkc}; "                            \
                "if tftp ${kernel}; then "                                     \
                        "if itest ${filesize} > 0; then "                      \
                                "mmc dev ${mmcdev}; mmc rescan; "              \
-                               "setexpr blkc ${filesize} / 0x200; "           \
-                               "setexpr blkc ${blkc} + 1; "                   \
+                               "setexpr blkc ${filesize} + 0x1ff; "           \
+                               "setexpr blkc ${blkc} / 0x200; "               \
                                "if itest ${blkc} <= ${kernel_size}; then "    \
                                        "mmc write ${loadaddr} "               \
                                                "${kernel_start} ${blkc}; "    \
        "update_fdt=if tftp ${fdt_file}; then "                                \
                "if itest ${filesize} > 0; then "                              \
                        "mmc dev ${mmcdev}; mmc rescan; "                      \
-                       "setexpr blkc ${filesize} / 0x200; "                   \
-                       "setexpr blkc ${blkc} + 1; "                           \
+                       "setexpr blkc ${filesize} + 0x1ff; "                   \
+                       "setexpr blkc ${blkc} / 0x200; "                       \
                        "if itest ${blkc} <= ${fdt_size}; then "               \
                                "mmc write ${loadaddr} ${fdt_start} ${blkc}; " \
                        "fi; "                                                 \