diff options
Diffstat (limited to 'arch/xtensa/variants')
-rw-r--r-- | arch/xtensa/variants/s6000/Makefile | 1 | ||||
-rw-r--r-- | arch/xtensa/variants/s6000/delay.c | 27 | ||||
-rw-r--r-- | arch/xtensa/variants/s6000/gpio.c | 3 | ||||
-rw-r--r-- | arch/xtensa/variants/s6000/include/variant/gpio.h | 6 |
4 files changed, 35 insertions, 2 deletions
diff --git a/arch/xtensa/variants/s6000/Makefile b/arch/xtensa/variants/s6000/Makefile index 03b3975468bd..d83f3805130c 100644 --- a/arch/xtensa/variants/s6000/Makefile +++ b/arch/xtensa/variants/s6000/Makefile | |||
@@ -1,3 +1,4 @@ | |||
1 | # s6000 Makefile | 1 | # s6000 Makefile |
2 | 2 | ||
3 | obj-y += irq.o gpio.o | 3 | obj-y += irq.o gpio.o |
4 | obj-$(CONFIG_XTENSA_CALIBRATE_CCOUNT) += delay.o | ||
diff --git a/arch/xtensa/variants/s6000/delay.c b/arch/xtensa/variants/s6000/delay.c new file mode 100644 index 000000000000..54b2b573f166 --- /dev/null +++ b/arch/xtensa/variants/s6000/delay.c | |||
@@ -0,0 +1,27 @@ | |||
1 | #include <asm/delay.h> | ||
2 | #include <asm/timex.h> | ||
3 | #include <asm/io.h> | ||
4 | #include <variant/hardware.h> | ||
5 | |||
6 | #define LOOPS 10 | ||
7 | void platform_calibrate_ccount(void) | ||
8 | { | ||
9 | u32 uninitialized_var(a); | ||
10 | u32 uninitialized_var(u); | ||
11 | u32 b; | ||
12 | u32 tstamp = S6_REG_GREG1 + S6_GREG1_GLOBAL_TIMER; | ||
13 | int i = LOOPS+1; | ||
14 | do { | ||
15 | u32 t = u; | ||
16 | asm volatile( | ||
17 | "1: l32i %0, %2, 0 ;" | ||
18 | " beq %0, %1, 1b ;" | ||
19 | : "=&a"(u) : "a"(t), "a"(tstamp)); | ||
20 | b = xtensa_get_ccount(); | ||
21 | if (i == LOOPS) | ||
22 | a = b; | ||
23 | } while (--i >= 0); | ||
24 | b -= a; | ||
25 | nsec_per_ccount = (LOOPS * 10000) / b; | ||
26 | ccount_per_jiffy = b * (100000UL / (LOOPS * HZ)); | ||
27 | } | ||
diff --git a/arch/xtensa/variants/s6000/gpio.c b/arch/xtensa/variants/s6000/gpio.c index 33a8d952934c..79317fdcf14c 100644 --- a/arch/xtensa/variants/s6000/gpio.c +++ b/arch/xtensa/variants/s6000/gpio.c | |||
@@ -64,8 +64,7 @@ static struct gpio_chip gpiochip = { | |||
64 | .exported = 0, /* no exporting to userspace */ | 64 | .exported = 0, /* no exporting to userspace */ |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static int gpio_init(void) | 67 | int s6_gpio_init(void) |
68 | { | 68 | { |
69 | return gpiochip_add(&gpiochip); | 69 | return gpiochip_add(&gpiochip); |
70 | } | 70 | } |
71 | device_initcall(gpio_init); | ||
diff --git a/arch/xtensa/variants/s6000/include/variant/gpio.h b/arch/xtensa/variants/s6000/include/variant/gpio.h new file mode 100644 index 000000000000..8327f62167eb --- /dev/null +++ b/arch/xtensa/variants/s6000/include/variant/gpio.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef _XTENSA_VARIANT_S6000_GPIO_H | ||
2 | #define _XTENSA_VARIANT_S6000_GPIO_H | ||
3 | |||
4 | extern int s6_gpio_init(void); | ||
5 | |||
6 | #endif /* _XTENSA_VARIANT_S6000_GPIO_H */ | ||