Commit 45d447406a19cbfd42720f066f156f4eb9d68801

Authored by Linus Torvalds

Merge git://git.kernel.org/pub/scm/linux/kernel/git/czankel/xtensa-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/czankel/xtensa-2.6:
  xtensa: Fix linker script to include .literal sections
  xtensa: update s6105_defconfig for ccount calibration
  xtensa: implement ccount calibration for s6000
  xtensa: fix wrong extern declaration renamed in code using it
  xtensa: register gpio chip before use
  xtensa: always use correct stack pointer for stack traces
  xtensa: Fix checksum header file
  xtensa: Fix architecture specific Kconfig

Showing 12 changed files Side-by-side Diff

... ... @@ -80,6 +80,7 @@
80 80 bool "s6000 - Stretch software configurable processor"
81 81 select VARIANT_IRQ_SWITCH
82 82 select ARCH_REQUIRE_GPIOLIB
  83 + select XTENSA_CALIBRATE_CCOUNT
83 84 endchoice
84 85  
85 86 config XTENSA_UNALIGNED_USER
... ... @@ -137,6 +138,8 @@
137 138  
138 139 source "drivers/pci/Kconfig"
139 140  
  141 +endmenu
  142 +
140 143 menu "Platform options"
141 144  
142 145 choice
... ... @@ -153,8 +156,6 @@
153 156  
154 157 config XTENSA_PLATFORM_XT2000
155 158 bool "XT2000"
156   - select XTENSA_CALIBRATE_CCOUNT
157   - select PCI
158 159 help
159 160 XT2000 is the name of Tensilica's feature-rich emulation platform.
160 161 This hardware is capable of running a full Linux distribution.
... ... @@ -191,8 +192,6 @@
191 192 memory size and the root device (e.g., mem=64M root=/dev/nfs).
192 193  
193 194 source "mm/Kconfig"
194   -
195   -endmenu
196 195  
197 196 config HOTPLUG
198 197 bool "Support for hot-pluggable devices"
arch/xtensa/configs/s6105_defconfig
... ... @@ -115,7 +115,7 @@
115 115 CONFIG_PREEMPT=y
116 116 # CONFIG_MATH_EMULATION is not set
117 117 # CONFIG_HIGHMEM is not set
118   -# CONFIG_XTENSA_CALIBRATE_CCOUNT is not set
  118 +CONFIG_XTENSA_CALIBRATE_CCOUNT=y
119 119 CONFIG_SERIAL_CONSOLE=y
120 120 # CONFIG_XTENSA_ISS_NETWORK is not set
121 121  
... ... @@ -131,7 +131,6 @@
131 131 # CONFIG_XTENSA_PLATFORM_ISS is not set
132 132 # CONFIG_XTENSA_PLATFORM_XT2000 is not set
133 133 CONFIG_XTENSA_PLATFORM_S6105=y
134   -CONFIG_XTENSA_CPU_CLOCK=300
135 134 CONFIG_GENERIC_CALIBRATE_DELAY=y
136 135 CONFIG_CMDLINE_BOOL=y
137 136 CONFIG_CMDLINE="console=ttyS1,38400 debug bootmem_debug loglevel=7"
arch/xtensa/include/asm/checksum.h
... ... @@ -113,7 +113,8 @@
113 113 are modified, we must also specify them as outputs, or gcc
114 114 will assume they contain their original values. */
115 115 : "=r" (sum), "=r" (iph), "=r" (ihl), "=&r" (tmp), "=&r" (endaddr)
116   - : "1" (iph), "2" (ihl));
  116 + : "1" (iph), "2" (ihl)
  117 + : "memory");
117 118  
118 119 return csum_fold(sum);
119 120 }
... ... @@ -227,7 +228,8 @@
227 228 "1:\t"
228 229 : "=r" (sum), "=&r" (__dummy)
229 230 : "r" (saddr), "r" (daddr),
230   - "r" (htonl(len)), "r" (htonl(proto)), "0" (sum));
  231 + "r" (htonl(len)), "r" (htonl(proto)), "0" (sum)
  232 + : "memory");
231 233  
232 234 return csum_fold(sum);
233 235 }
arch/xtensa/include/asm/timex.h
... ... @@ -39,9 +39,9 @@
39 39  
40 40 #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
41 41 extern unsigned long ccount_per_jiffy;
42   -extern unsigned long ccount_nsec;
  42 +extern unsigned long nsec_per_ccount;
43 43 #define CCOUNT_PER_JIFFY ccount_per_jiffy
44   -#define NSEC_PER_CCOUNT ccount_nsec
  44 +#define NSEC_PER_CCOUNT nsec_per_ccount
45 45 #else
46 46 #define CCOUNT_PER_JIFFY (CONFIG_XTENSA_CPU_CLOCK*(1000000UL/HZ))
47 47 #define NSEC_PER_CCOUNT (1000UL / CONFIG_XTENSA_CPU_CLOCK)
arch/xtensa/kernel/Makefile
... ... @@ -4,14 +4,31 @@
4 4  
5 5 extra-y := head.o vmlinux.lds
6 6  
7   -
8 7 obj-y := align.o entry.o irq.o coprocessor.o process.o ptrace.o \
9 8 setup.o signal.o syscall.o time.o traps.o vectors.o platform.o \
10 9 pci-dma.o init_task.o io.o
11 10  
12   -## windowspill.o
13   -
14 11 obj-$(CONFIG_KGDB) += xtensa-stub.o
15 12 obj-$(CONFIG_PCI) += pci.o
16 13 obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o
  14 +
  15 +# In the Xtensa architecture, assembly generates literals which must always
  16 +# precede the L32R instruction with a relative offset less than 256 kB.
  17 +# Therefore, the .text and .literal section must be combined in parenthesis
  18 +# in the linker script, such as: *(.literal .text).
  19 +#
  20 +# We need to post-process the generated vmlinux.lds scripts to convert
  21 +# *(xxx.text) to *(xxx.literal xxx.text) for the following text sections:
  22 +# .text .ref.text .*init.text .*exit.text .text.*
  23 +#
  24 +# Replicate rules in scripts/Makefile.build
  25 +
  26 +sed-y = -e 's/(\(\.[a-z]*it\|\.ref\|\)\.text)/(\1.literal \1.text)/g' \
  27 + -e 's/(\(\.text\.[a-z]*\))/(\1.literal \1)/g'
  28 +
  29 +quiet_cmd__cpp_lds_S = LDS $@
  30 + cmd__cpp_lds_S = $(CPP) $(cpp_flags) -D__ASSEMBLY__ $< | sed $(sed-y) >$@
  31 +
  32 +$(obj)/vmlinux.lds: $(src)/vmlinux.lds.S FORCE
  33 + $(call if_changed_dep,_cpp_lds_S)
arch/xtensa/kernel/traps.c
... ... @@ -369,6 +369,18 @@
369 369 regs->syscall);
370 370 }
371 371  
  372 +static __always_inline unsigned long *stack_pointer(struct task_struct *task)
  373 +{
  374 + unsigned long *sp;
  375 +
  376 + if (!task || task == current)
  377 + __asm__ __volatile__ ("mov %0, a1\n" : "=a"(sp));
  378 + else
  379 + sp = (unsigned long *)task->thread.sp;
  380 +
  381 + return sp;
  382 +}
  383 +
372 384 void show_trace(struct task_struct *task, unsigned long *sp)
373 385 {
374 386 unsigned long a0, a1, pc;
... ... @@ -377,7 +389,7 @@
377 389 if (sp)
378 390 a1 = (unsigned long)sp;
379 391 else
380   - a1 = task->thread.sp;
  392 + a1 = (unsigned long)stack_pointer(task);
381 393  
382 394 sp_start = a1 & ~(THREAD_SIZE-1);
383 395 sp_end = sp_start + THREAD_SIZE;
... ... @@ -420,7 +432,7 @@
420 432 unsigned long *stack;
421 433  
422 434 if (!sp)
423   - sp = (unsigned long *)task->thread.sp;
  435 + sp = stack_pointer(task);
424 436 stack = sp;
425 437  
426 438 printk("\nStack: ");
arch/xtensa/kernel/vmlinux.lds.S
... ... @@ -87,7 +87,7 @@
87 87 {
88 88 /* The HEAD_TEXT section must be the first section! */
89 89 HEAD_TEXT
90   - *(.literal .text)
  90 + TEXT_TEXT
91 91 VMLINUX_SYMBOL(__sched_text_start) = .;
92 92 *(.sched.literal .sched.text)
93 93 VMLINUX_SYMBOL(__sched_text_end) = .;
... ... @@ -139,8 +139,6 @@
139 139 __init_begin = .;
140 140 .init.text : {
141 141 _sinittext = .;
142   - *(.init.literal) *(.cpuinit.literal)
143   - *(.devinit.literal) *(.meminit.literal)
144 142 INIT_TEXT
145 143 _einittext = .;
146 144 }
arch/xtensa/platforms/s6105/setup.c
... ... @@ -10,6 +10,8 @@
10 10 #include <asm/bootparam.h>
11 11  
12 12 #include <variant/hardware.h>
  13 +#include <variant/gpio.h>
  14 +
13 15 #include <platform/gpio.h>
14 16  
15 17 void platform_halt(void)
... ... @@ -47,6 +49,7 @@
47 49  
48 50 void __init platform_init(bp_tag_t *first)
49 51 {
  52 + s6_gpio_init();
50 53 gpio_request(GPIO_LED1_NGREEN, "led1_green");
51 54 gpio_request(GPIO_LED1_RED, "led1_red");
52 55 gpio_direction_output(GPIO_LED1_NGREEN, 1);
arch/xtensa/variants/s6000/Makefile
1 1 # s6000 Makefile
2 2  
3 3 obj-y += irq.o gpio.o
  4 +obj-$(CONFIG_XTENSA_CALIBRATE_CCOUNT) += delay.o
arch/xtensa/variants/s6000/delay.c
  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 +}
arch/xtensa/variants/s6000/gpio.c
... ... @@ -64,9 +64,8 @@
64 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 69 return gpiochip_add(&gpiochip);
70 70 }
71   -device_initcall(gpio_init);
arch/xtensa/variants/s6000/include/variant/gpio.h
  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 */