Re: [PATCH] ARC: Fix __udelay parentheses

2013-08-28 Thread Vineet Gupta
On 08/29/2013 12:07 PM, Joe Perches wrote: >> On the topic of multiply vs. divide (which probably is not relevant to topic >> at >> hand though), since ARCompact doesn't have native divide, we end up >> emulating it >> using libgcc routines. That makes it slightly non-deterministic (not a big >>

Re: [PATCH] ARC: Fix __udelay parentheses

2013-08-28 Thread Joe Perches
On Thu, 2013-08-29 at 06:24 +, Vineet Gupta wrote: > On 08/29/2013 11:31 AM, Joe Perches wrote: > > I think the whole thing is odd and it should simply be > > > > loops = loops_per_jiffy * usecs_to_jiffies(usecs) [] > On the topic of multiply vs. divide (which probably is not relevant to to

Re: [PATCH] ARC: Fix __udelay parentheses

2013-08-28 Thread Vineet Gupta
On 08/29/2013 11:31 AM, Joe Perches wrote: > On Thu, 2013-08-29 at 05:55 +, Vineet Gupta wrote: > >> The intent of writing orig code was to generate only 1 MPYHU insn (32*32 = >> high-part-64) for the whole math, at any optimization level whatsoever. If >> the >> first MPY is overflowing, u r

Re: [PATCH] ARC: Fix __udelay parentheses

2013-08-28 Thread Joe Perches
On Thu, 2013-08-29 at 05:55 +, Vineet Gupta wrote: > The intent of writing orig code was to generate only 1 MPYHU insn (32*32 = > high-part-64) for the whole math, at any optimization level whatsoever. If the > first MPY is overflowing, u r likely spinning for > 10,000 usec (10ms) which > is

Re: [PATCH] ARC: Fix __udelay parentheses

2013-08-28 Thread Vineet Gupta
On 08/29/2013 12:00 AM, Mischa Jonker wrote: > Make sure that usecs is casted to long long, to ensure that the > (usecs * 4295 * HZ) multiplication is 64 bit. > > Initially, the (usecs * 4295 * HZ) part was done as a 32 bit > multiplication, with the result casted to 64 bit. This led to some bits >

Re: [PATCH] ARC: Fix __udelay parentheses

2013-08-28 Thread Joe Perches
On Wed, 2013-08-28 at 19:12 +, Mischa Jonker wrote: > Hello Joe, > > > I don't see the loops_per_jiffy initial shift << 32. > > loops_per_jiffy * HZ = loops_per_second > loops_per_jiffy * HZ = 1,000,000 * loops_per_us > loops_per_jiffy * HZ * 4295 = 4,295,000 * loops_per_us > > loops_per_jif

RE: [PATCH] ARC: Fix __udelay parentheses

2013-08-28 Thread Mischa Jonker
Hello Joe, > I don't see the loops_per_jiffy initial shift << 32. loops_per_jiffy * HZ = loops_per_second loops_per_jiffy * HZ = 1,000,000 * loops_per_us loops_per_jiffy * HZ * 4295 = 4,295,000 * loops_per_us loops_per_jiffy * HZ * 4294.967296 = 2^32 * loops_per_us > > > > - loops = ((lon

Re: [PATCH] ARC: Fix __udelay parentheses

2013-08-28 Thread Joe Perches
On Wed, 2013-08-28 at 18:53 +, Mischa Jonker wrote: > > > Make sure that usecs is casted to long long, to ensure that the (usecs > > > * 4295 * HZ) multiplication is 64 bit. > > > > > > Initially, the (usecs * 4295 * HZ) part was done as a 32 bit > > > multiplication, with the result casted to

RE: [PATCH] ARC: Fix __udelay parentheses

2013-08-28 Thread Mischa Jonker
> > Make sure that usecs is casted to long long, to ensure that the (usecs > > * 4295 * HZ) multiplication is 64 bit. > > > > Initially, the (usecs * 4295 * HZ) part was done as a 32 bit > > multiplication, with the result casted to 64 bit. This led to some > > bits falling off. > > > > Signed-off-

Re: [PATCH] ARC: Fix __udelay parentheses

2013-08-28 Thread Joe Perches
On Wed, 2013-08-28 at 20:29 +0200, Mischa Jonker wrote: > Make sure that usecs is casted to long long, to ensure that the > (usecs * 4295 * HZ) multiplication is 64 bit. > > Initially, the (usecs * 4295 * HZ) part was done as a 32 bit > multiplication, with the result casted to 64 bit. This led to

[PATCH] ARC: Fix __udelay parentheses

2013-08-28 Thread Mischa Jonker
Make sure that usecs is casted to long long, to ensure that the (usecs * 4295 * HZ) multiplication is 64 bit. Initially, the (usecs * 4295 * HZ) part was done as a 32 bit multiplication, with the result casted to 64 bit. This led to some bits falling off. Signed-off-by: Mischa Jonker --- arch/a