Re: [PATCH 06/27] score: create head files delay.h device.h div64.h dma-mapping.h dma.h

From: Arnd Bergmann
Date: Sat Jun 13 2009 - 18:32:50 EST


On Saturday 13 June 2009, liqin.chen@xxxxxxxxxxxxx wrote:
> Arnd Bergmann <arnd@xxxxxxxx> 写于 2009-06-10 01:18:20:
>
> > On Tuesday 09 June 2009, liqin.chen@xxxxxxxxxxxxx wrote:
> >
> > Having a working udelay() function is required for many
> > drivers that are sensitive to timing, you should probably
> > implement that at some point in the future.
>
> Add udelay() implement in code.

so you use

static inline void __delay(unsigned long loops)
{
__asm__ __volatile__ (
"1:\tsubi\t%0,1\n\t"
"cmpz.c\t%0\n\t"
"bne\t1b\n\t"
: "=r" (loops)
: "0" (loops));
}

static inline void __udelay(unsigned long usecs)
{
__delay(usecs);
}


This is much better than before, but is far from exact in the __udelay()
case. Please take a look at init/calibrate.c and how other architectures
use loops_per_jiffy if you don't have an exact time source you can use.

If you have a time source with microsecond resolution or better, just loop
until the amount of microseconds has expired.

Arnd <><
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/