diff mbox

[U-Boot] arm: zynq: correct the argument to lldiv

Message ID a5aae850-5768-481a-9a89-380e65bd661e@AM1EHSMHS015.ehs.local
State Accepted
Delegated to: Michal Simek
Headers show

Commit Message

Siva Durga Prasad Paladugu Feb. 17, 2014, 6:12 a.m. UTC
Typecast the argument with unsigned long
long for proper calculation of lldiv

Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
---
-Fixes the issue of rounding of the multiplication result to
 32-bit value
---
 arch/arm/cpu/armv7/zynq/timer.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Michal Simek Feb. 17, 2014, 6:50 a.m. UTC | #1
On 02/17/2014 07:12 AM, Siva Durga Prasad Paladugu wrote:
> Typecast the argument with unsigned long
> long for proper calculation of lldiv
> 
> Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
> ---
> -Fixes the issue of rounding of the multiplication result to
>  32-bit value

We found this in connection to eeprom write test.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>


Albert: This is the bug fixed I was talking you about on IRC.
Will add it to my zynq pull request if this is fine for others.

Thanks,
Michal
Albert ARIBAUD Feb. 17, 2014, 9:07 a.m. UTC | #2
Hi Michal,

On Mon, 17 Feb 2014 07:50:26 +0100, Michal Simek <monstr@monstr.eu>
wrote:

> On 02/17/2014 07:12 AM, Siva Durga Prasad Paladugu wrote:
> > Typecast the argument with unsigned long
> > long for proper calculation of lldiv
> > 
> > Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
> > ---
> > -Fixes the issue of rounding of the multiplication result to
> >  32-bit value
> 
> We found this in connection to eeprom write test.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> 
> Albert: This is the bug fixed I was talking you about on IRC.
> Will add it to my zynq pull request if this is fine for others.

Fine for me at least. As soon as my current PR to u-boot/master is
applied (cc: Tom), I'll resume applying patches, starting with your Zynq
PR, so if it was updated meanwhile, I'll apply the updated one.

> Thanks,
> Michal

Amicalement,
Michal Simek Feb. 17, 2014, 9:10 a.m. UTC | #3
On 02/17/2014 10:07 AM, Albert ARIBAUD wrote:
> Hi Michal,
> 
> On Mon, 17 Feb 2014 07:50:26 +0100, Michal Simek <monstr@monstr.eu>
> wrote:
> 
>> On 02/17/2014 07:12 AM, Siva Durga Prasad Paladugu wrote:
>>> Typecast the argument with unsigned long
>>> long for proper calculation of lldiv
>>>
>>> Signed-off-by: Siva Durga Prasad Paladugu <sivadur@xilinx.com>
>>> ---
>>> -Fixes the issue of rounding of the multiplication result to
>>>  32-bit value
>>
>> We found this in connection to eeprom write test.
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>
>> Albert: This is the bug fixed I was talking you about on IRC.
>> Will add it to my zynq pull request if this is fine for others.
> 
> Fine for me at least. As soon as my current PR to u-boot/master is
> applied (cc: Tom), I'll resume applying patches, starting with your Zynq
> PR, so if it was updated meanwhile, I'll apply the updated one.

I am keeping my eyes on it too.

Thanks,
Michal
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/zynq/timer.c b/arch/arm/cpu/armv7/zynq/timer.c
index 2be253c..09a5547 100644
--- a/arch/arm/cpu/armv7/zynq/timer.c
+++ b/arch/arm/cpu/armv7/zynq/timer.c
@@ -107,7 +107,8 @@  void __udelay(unsigned long usec)
 	if (usec == 0)
 		return;
 
-	countticks = lldiv(TIMER_TICK_HZ * usec, 1000000);
+	countticks = lldiv(((unsigned long long)TIMER_TICK_HZ * usec),
+			   1000000);
 
 	/* decrementing timer */
 	timeend = readl(&timer_base->counter) - countticks;