Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 144922
b: refs/heads/master
c: b070a03
h: refs/heads/master
v: v3
  • Loading branch information
Oskar Schirmer authored and Chris Zankel committed May 12, 2009
1 parent 31ea24b commit ff539b4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d15f05eb8cc4ad59699c16b8ae834b85c6d39bfe
refs/heads/master: b070a03f6490b0ac8d95c51b55a64e433d9160ab
1 change: 1 addition & 0 deletions trunk/arch/xtensa/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ config XTENSA_VARIANT_S6000
bool "s6000 - Stretch software configurable processor"
select VARIANT_IRQ_SWITCH
select ARCH_REQUIRE_GPIOLIB
select XTENSA_CALIBRATE_CCOUNT
endchoice

config XTENSA_UNALIGNED_USER
Expand Down
1 change: 1 addition & 0 deletions trunk/arch/xtensa/variants/s6000/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# s6000 Makefile

obj-y += irq.o gpio.o
obj-$(CONFIG_XTENSA_CALIBRATE_CCOUNT) += delay.o
27 changes: 27 additions & 0 deletions trunk/arch/xtensa/variants/s6000/delay.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <asm/delay.h>
#include <asm/timex.h>
#include <asm/io.h>
#include <variant/hardware.h>

#define LOOPS 10
void platform_calibrate_ccount(void)
{
u32 uninitialized_var(a);
u32 uninitialized_var(u);
u32 b;
u32 tstamp = S6_REG_GREG1 + S6_GREG1_GLOBAL_TIMER;
int i = LOOPS+1;
do {
u32 t = u;
asm volatile(
"1: l32i %0, %2, 0 ;"
" beq %0, %1, 1b ;"
: "=&a"(u) : "a"(t), "a"(tstamp));
b = xtensa_get_ccount();
if (i == LOOPS)
a = b;
} while (--i >= 0);
b -= a;
nsec_per_ccount = (LOOPS * 10000) / b;
ccount_per_jiffy = b * (100000UL / (LOOPS * HZ));
}

0 comments on commit ff539b4

Please sign in to comment.