From mboxrd@z Thu Jan 1 00:00:00 1970 From: Minkyu Kang Date: Wed, 17 Apr 2013 11:10:09 +0900 Subject: [U-Boot] [PATCH 1/2] exynos: Correct use of 64-bit division In-Reply-To: <1365863202-22713-1-git-send-email-sjg@chromium.org> References: <1365863202-22713-1-git-send-email-sjg@chromium.org> Message-ID: <516E0481.2010807@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 13/04/13 23:26, Simon Glass wrote: > The current code is causing errors like this on my toolchains: > > /usr/x86_64-pc-linux-gnu/armv7a-cros-linux-gnueabi/binutils-bin/2.22/ > ld.bfd.real: failed to merge target specific data of file /usr/lib/gcc/ > armv7a-cros-linux-gnueabi/4.7.x-google/libgcc.a(_divdi3.o) > > Use do_div() to avoid this. > > Signed-off-by: Simon Glass > --- > arch/arm/cpu/armv7/s5p-common/timer.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c > index 6a0fa58..4adfaae 100644 > --- a/arch/arm/cpu/armv7/s5p-common/timer.c > +++ b/arch/arm/cpu/armv7/s5p-common/timer.c > @@ -24,6 +24,7 @@ > */ > > #include > +#include > #include > #include > #include > @@ -76,6 +77,8 @@ int timer_init(void) > */ > unsigned long get_timer(unsigned long base) > { > + unsigned long long time_ms; > + > ulong now = timer_get_us_down(); > > /* > @@ -87,7 +90,9 @@ unsigned long get_timer(unsigned long base) > gd->arch.lastinc = now; > > /* Divide by 1000 to convert from us to ms */ > - return gd->arch.timer_reset_value / 1000 - base; > + time_ms = gd->arch.timer_reset_value; > + do_div(time_ms, 1000); > + return time_ms - base; > } > > unsigned long timer_get_us(void) > applied to u-boot-samsung Thanks, Minkyu Kang.