rk27xx: avoid one multiply in udelay() as pointed by kugel
Change-Id: Ie33a393b0d4c4b45975ca53ced91dd9f03369db1
This commit is contained in:
parent
3c802a95ed
commit
490db740a1
1 changed files with 8 additions and 1 deletions
|
@ -177,9 +177,16 @@ int system_memory_guard(int newmode)
|
|||
/* usecs may be at most 2^32/200 (~21 seconds) for 200MHz max cpu freq */
|
||||
void udelay(unsigned usecs)
|
||||
{
|
||||
unsigned cycles_per_usec;
|
||||
unsigned delay;
|
||||
|
||||
delay = (usecs * (cpu_frequency/1000000)) / 5;
|
||||
if (cpu_frequency == CPUFREQ_MAX) {
|
||||
cycles_per_usec = (CPUFREQ_MAX + 999999) / 1000000;
|
||||
} else {
|
||||
cycles_per_usec = (CPUFREQ_NORMAL + 999999) / 1000000;
|
||||
}
|
||||
|
||||
delay = (usecs * cycles_per_usec) / 5;
|
||||
|
||||
asm volatile(
|
||||
"1: subs %0, %0, #1 \n" /* 1 cycle */
|
||||
|
|
Loading…
Reference in a new issue