diff mbox

[U-Boot] mmc: Use lldiv() for 64-bit division in write_raw_image()

Message ID 1446006256-19153-1-git-send-email-siarhei.siamashka@gmail.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Siarhei Siamashka Oct. 28, 2015, 4:24 a.m. UTC
This fixes compilation problems when using a hardfloat toolchain on
ARM, which manifest themselves as "libgcc.a(_udivmoddi4.o) uses
VFP register arguments, u-boot does not".

These problems have been reported in the U-Boot mailing list:
    http://lists.denx.de/pipermail/u-boot/2015-October/230314.html
    http://lists.denx.de/pipermail/u-boot/2015-October/231908.html

Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
---

I have only tested that the compilation problem disappears for
me. It would be best if somebody could confirm whether the fix
is correct.

 common/fb_mmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Tom Rini Oct. 28, 2015, 8:55 p.m. UTC | #1
On Wed, Oct 28, 2015 at 06:24:16AM +0200, Siarhei Siamashka wrote:

> This fixes compilation problems when using a hardfloat toolchain on
> ARM, which manifest themselves as "libgcc.a(_udivmoddi4.o) uses
> VFP register arguments, u-boot does not".
> 
> These problems have been reported in the U-Boot mailing list:
>     http://lists.denx.de/pipermail/u-boot/2015-October/230314.html
>     http://lists.denx.de/pipermail/u-boot/2015-October/231908.html
> 
> Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>

We care about the result not the remainder here so lldiv is correct.

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini Nov. 13, 2015, 1:28 a.m. UTC | #2
On Wed, Oct 28, 2015 at 06:24:16AM +0200, Siarhei Siamashka wrote:

> This fixes compilation problems when using a hardfloat toolchain on
> ARM, which manifest themselves as "libgcc.a(_udivmoddi4.o) uses
> VFP register arguments, u-boot does not".
> 
> These problems have been reported in the U-Boot mailing list:
>     http://lists.denx.de/pipermail/u-boot/2015-October/230314.html
>     http://lists.denx.de/pipermail/u-boot/2015-October/231908.html
> 
> Signed-off-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/common/fb_mmc.c b/common/fb_mmc.c
index 0c48cf9..f424bb8 100644
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
@@ -11,6 +11,7 @@ 
 #include <aboot.h>
 #include <sparse_format.h>
 #include <mmc.h>
+#include <div64.h>
 
 #ifndef CONFIG_FASTBOOT_GPT_NAME
 #define CONFIG_FASTBOOT_GPT_NAME GPT_ENTRY_NAME
@@ -64,7 +65,7 @@  static void write_raw_image(block_dev_desc_t *dev_desc, disk_partition_t *info,
 
 	/* determine number of blocks to write */
 	blkcnt = ((download_bytes + (info->blksz - 1)) & ~(info->blksz - 1));
-	blkcnt = blkcnt / info->blksz;
+	blkcnt = lldiv(blkcnt, info->blksz);
 
 	if (blkcnt > info->size) {
 		error("too large for partition: '%s'\n", part_name);