aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-16 14:49:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-16 14:49:58 -0400
commit8d6cea5111f2daea8acf79d7b4b384a14175ecc1 (patch)
treeef56294da7eefbe46654b030fa8be06830a9c4f0
parent6a454f71d795368c00d9c329b60cc4d58929e7bc (diff)
parent61cdd7a28f8b515140cb5d8aea518678f0fae024 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vapier/blackfin
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vapier/blackfin: (27 commits) Blackfin: hook up new rt_tgsigqueueinfo syscall Blackfin: improve CLKIN_HZ config default Blackfin: initial support for ftrace grapher Blackfin: initial support for ftrace Blackfin: enable support for LOCKDEP Blackfin: add preliminary support for STACKTRACE Blackfin: move custom sections into sections.h Blackfin: punt unused/wrong mutex-dec.h Blackfin: add support for irqflags Blackfin: add support for bzip2/lzma compressed kernel images Blackfin: convert Kconfig style to def_bool Blackfin: bf548-ezkit: update smsc911x resources Blackfin: update aedos-ipipe code to upstream 1.10-00 Blackfin: bf537-stamp: update ADP5520 resources Blackfin: bf518f-ezbrd: fix SPI CS for SPI flash Blackfin: define SPI IRQ in board resources Blackfin: do not configure the UART early if on wrong processor Blackfin: fix deadlock in SMP IPI handler Blackfin: fix flag storage for irq funcs Blackfin: push down exception oops checking ...
-rw-r--r--arch/blackfin/Kconfig60
-rw-r--r--arch/blackfin/Makefile7
-rw-r--r--arch/blackfin/boot/.gitignore3
-rw-r--r--arch/blackfin/boot/Makefile31
-rw-r--r--arch/blackfin/include/asm/atomic.h16
-rw-r--r--arch/blackfin/include/asm/bfin-global.h11
-rw-r--r--arch/blackfin/include/asm/bitops.h3
-rw-r--r--arch/blackfin/include/asm/bug.h57
-rw-r--r--arch/blackfin/include/asm/cache.h11
-rw-r--r--arch/blackfin/include/asm/cacheflush.h3
-rw-r--r--arch/blackfin/include/asm/cpu.h1
-rw-r--r--arch/blackfin/include/asm/ftrace.h14
-rw-r--r--arch/blackfin/include/asm/ipipe.h28
-rw-r--r--arch/blackfin/include/asm/irq.h271
-rw-r--r--arch/blackfin/include/asm/irqflags.h63
-rw-r--r--arch/blackfin/include/asm/mutex-dec.h112
-rw-r--r--arch/blackfin/include/asm/sections.h11
-rw-r--r--arch/blackfin/include/asm/system.h4
-rw-r--r--arch/blackfin/include/asm/unistd.h3
-rw-r--r--arch/blackfin/kernel/Makefile5
-rw-r--r--arch/blackfin/kernel/bfin_dma_5xx.c4
-rw-r--r--arch/blackfin/kernel/bfin_ksyms.c5
-rw-r--r--arch/blackfin/kernel/cplb-mpu/cplbmgr.c2
-rw-r--r--arch/blackfin/kernel/cplb-nompu/cplbmgr.c54
-rw-r--r--arch/blackfin/kernel/early_printk.c8
-rw-r--r--arch/blackfin/kernel/ftrace-entry.S140
-rw-r--r--arch/blackfin/kernel/ftrace.c42
-rw-r--r--arch/blackfin/kernel/ipipe.c42
-rw-r--r--arch/blackfin/kernel/setup.c16
-rw-r--r--arch/blackfin/kernel/stacktrace.c53
-rw-r--r--arch/blackfin/kernel/traps.c128
-rw-r--r--arch/blackfin/kernel/vmlinux.lds.S17
-rw-r--r--arch/blackfin/lib/checksum.c2
-rw-r--r--arch/blackfin/mach-bf518/boards/ezbrd.c12
-rw-r--r--arch/blackfin/mach-bf527/boards/cm_bf527.c5
-rw-r--r--arch/blackfin/mach-bf527/boards/ezbrd.c5
-rw-r--r--arch/blackfin/mach-bf527/boards/ezkit.c5
-rw-r--r--arch/blackfin/mach-bf533/boards/H8606.c5
-rw-r--r--arch/blackfin/mach-bf533/boards/blackstamp.c5
-rw-r--r--arch/blackfin/mach-bf533/boards/cm_bf533.c5
-rw-r--r--arch/blackfin/mach-bf533/boards/ezkit.c5
-rw-r--r--arch/blackfin/mach-bf533/boards/stamp.c5
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537.c7
-rw-r--r--arch/blackfin/mach-bf537/boards/minotaur.c5
-rw-r--r--arch/blackfin/mach-bf537/boards/pnav10.c7
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/tcm_bf537.c5
-rw-r--r--arch/blackfin/mach-bf538/boards/ezkit.c10
-rw-r--r--arch/blackfin/mach-bf548/boards/cm_bf548.c10
-rw-r--r--arch/blackfin/mach-bf548/boards/ezkit.c23
-rw-r--r--arch/blackfin/mach-bf561/boards/cm_bf561.c7
-rw-r--r--arch/blackfin/mach-bf561/boards/ezkit.c5
-rw-r--r--arch/blackfin/mach-common/cache-c.c14
-rw-r--r--arch/blackfin/mach-common/entry.S12
-rw-r--r--arch/blackfin/mach-common/smp.c24
-rw-r--r--drivers/spi/spi_bfin5xx.c4
56 files changed, 809 insertions, 605 deletions
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index a60cfe757914..8ea0d942cdea 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -6,59 +6,65 @@
6mainmenu "Blackfin Kernel Configuration" 6mainmenu "Blackfin Kernel Configuration"
7 7
8config MMU 8config MMU
9 bool 9 def_bool n
10 default n
11 10
12config FPU 11config FPU
13 bool 12 def_bool n
14 default n
15 13
16config RWSEM_GENERIC_SPINLOCK 14config RWSEM_GENERIC_SPINLOCK
17 bool 15 def_bool y
18 default y
19 16
20config RWSEM_XCHGADD_ALGORITHM 17config RWSEM_XCHGADD_ALGORITHM
21 bool 18 def_bool n
22 default n
23 19
24config BLACKFIN 20config BLACKFIN
25 bool 21 def_bool y
26 default y 22 select HAVE_FUNCTION_GRAPH_TRACER
23 select HAVE_FUNCTION_TRACER
27 select HAVE_IDE 24 select HAVE_IDE
25 select HAVE_KERNEL_GZIP
26 select HAVE_KERNEL_BZIP2
27 select HAVE_KERNEL_LZMA
28 select HAVE_OPROFILE 28 select HAVE_OPROFILE
29 select ARCH_WANT_OPTIONAL_GPIOLIB 29 select ARCH_WANT_OPTIONAL_GPIOLIB
30 30
31config GENERIC_BUG
32 def_bool y
33 depends on BUG
34
31config ZONE_DMA 35config ZONE_DMA
32 bool 36 def_bool y
33 default y
34 37
35config GENERIC_FIND_NEXT_BIT 38config GENERIC_FIND_NEXT_BIT
36 bool 39 def_bool y
37 default y
38 40
39config GENERIC_HWEIGHT 41config GENERIC_HWEIGHT
40 bool 42 def_bool y
41 default y
42 43
43config GENERIC_HARDIRQS 44config GENERIC_HARDIRQS
44 bool 45 def_bool y
45 default y
46 46
47config GENERIC_IRQ_PROBE 47config GENERIC_IRQ_PROBE
48 bool 48 def_bool y
49 default y
50 49
51config GENERIC_GPIO 50config GENERIC_GPIO
52 bool 51 def_bool y
53 default y
54 52
55config FORCE_MAX_ZONEORDER 53config FORCE_MAX_ZONEORDER
56 int 54 int
57 default "14" 55 default "14"
58 56
59config GENERIC_CALIBRATE_DELAY 57config GENERIC_CALIBRATE_DELAY
60 bool 58 def_bool y
61 default y 59
60config LOCKDEP_SUPPORT
61 def_bool y
62
63config STACKTRACE_SUPPORT
64 def_bool y
65
66config TRACE_IRQFLAGS_SUPPORT
67 def_bool y
62 68
63source "init/Kconfig" 69source "init/Kconfig"
64 70
@@ -408,12 +414,12 @@ comment "Clock/PLL Setup"
408 414
409config CLKIN_HZ 415config CLKIN_HZ
410 int "Frequency of the crystal on the board in Hz" 416 int "Frequency of the crystal on the board in Hz"
417 default "10000000" if BFIN532_IP0X
411 default "11059200" if BFIN533_STAMP 418 default "11059200" if BFIN533_STAMP
419 default "24576000" if PNAV10
420 default "25000000" # most people use this
412 default "27000000" if BFIN533_EZKIT 421 default "27000000" if BFIN533_EZKIT
413 default "25000000" if (BFIN537_STAMP || BFIN527_EZKIT || H8606_HVSISTEMAS || BLACKSTAMP || BFIN526_EZBRD || BFIN538_EZKIT || BFIN518F-EZBRD)
414 default "30000000" if BFIN561_EZKIT 422 default "30000000" if BFIN561_EZKIT
415 default "24576000" if PNAV10
416 default "10000000" if BFIN532_IP0X
417 help 423 help
418 The frequency of CLKIN crystal oscillator on the board in Hz. 424 The frequency of CLKIN crystal oscillator on the board in Hz.
419 Warning: This value should match the crystal on the board. Otherwise, 425 Warning: This value should match the crystal on the board. Otherwise,
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index d54c8283825c..6f9533c3d752 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -137,7 +137,7 @@ archclean:
137 137
138INSTALL_PATH ?= /tftpboot 138INSTALL_PATH ?= /tftpboot
139boot := arch/$(ARCH)/boot 139boot := arch/$(ARCH)/boot
140BOOT_TARGETS = vmImage 140BOOT_TARGETS = vmImage vmImage.bz2 vmImage.gz vmImage.lzma
141PHONY += $(BOOT_TARGETS) install 141PHONY += $(BOOT_TARGETS) install
142KBUILD_IMAGE := $(boot)/vmImage 142KBUILD_IMAGE := $(boot)/vmImage
143 143
@@ -150,7 +150,10 @@ install:
150 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install 150 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
151 151
152define archhelp 152define archhelp
153 echo '* vmImage - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage)' 153 echo '* vmImage - Alias to selected kernel format (vmImage.gz by default)'
154 echo ' vmImage.bz2 - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.bz2)'
155 echo '* vmImage.gz - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.gz)'
156 echo ' vmImage.lzma - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.lzma)'
154 echo ' install - Install kernel using' 157 echo ' install - Install kernel using'
155 echo ' (your) ~/bin/$(CROSS_COMPILE)installkernel or' 158 echo ' (your) ~/bin/$(CROSS_COMPILE)installkernel or'
156 echo ' (distribution) PATH: $(CROSS_COMPILE)installkernel or' 159 echo ' (distribution) PATH: $(CROSS_COMPILE)installkernel or'
diff --git a/arch/blackfin/boot/.gitignore b/arch/blackfin/boot/.gitignore
index 3ae03994b88d..229e50808677 100644
--- a/arch/blackfin/boot/.gitignore
+++ b/arch/blackfin/boot/.gitignore
@@ -1 +1,2 @@
1+vmImage 1vmImage*
2vmlinux*
diff --git a/arch/blackfin/boot/Makefile b/arch/blackfin/boot/Makefile
index e028d13481a9..3ab6f23561dd 100644
--- a/arch/blackfin/boot/Makefile
+++ b/arch/blackfin/boot/Makefile
@@ -8,24 +8,41 @@
8 8
9MKIMAGE := $(srctree)/scripts/mkuboot.sh 9MKIMAGE := $(srctree)/scripts/mkuboot.sh
10 10
11targets := vmImage 11targets := vmImage vmImage.bz2 vmImage.gz vmImage.lzma
12extra-y += vmlinux.bin vmlinux.gz 12extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma
13 13
14quiet_cmd_uimage = UIMAGE $@ 14quiet_cmd_uimage = UIMAGE $@
15 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(ARCH) -O linux -T kernel \ 15 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(ARCH) -O linux -T kernel \
16 -C gzip -n 'Linux-$(KERNELRELEASE)' -a $(CONFIG_BOOT_LOAD) \ 16 -C $(2) -n 'Linux-$(KERNELRELEASE)' -a $(CONFIG_BOOT_LOAD) \
17 -e $(shell $(NM) vmlinux | awk '$$NF == "__start" {print $$1}') \ 17 -e $(shell $(NM) vmlinux | awk '$$NF == "__start" {print $$1}') \
18 -d $< $@ 18 -d $< $@
19 19
20$(obj)/vmlinux.bin: vmlinux FORCE 20$(obj)/vmlinux.bin: vmlinux FORCE
21 $(call if_changed,objcopy) 21 $(call if_changed,objcopy)
22 22
23$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE 23$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
24 $(call if_changed,gzip) 24 $(call if_changed,gzip)
25 25
26$(obj)/vmImage: $(obj)/vmlinux.gz 26$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
27 $(call if_changed,uimage) 27 $(call if_changed,bzip2)
28 @$(kecho) 'Kernel: $@ is ready' 28
29$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
30 $(call if_changed,lzma)
31
32$(obj)/vmImage.bz2: $(obj)/vmlinux.bin.bz2
33 $(call if_changed,uimage,bzip2)
34
35$(obj)/vmImage.gz: $(obj)/vmlinux.bin.gz
36 $(call if_changed,uimage,gzip)
37
38$(obj)/vmImage.lzma: $(obj)/vmlinux.bin.lzma
39 $(call if_changed,uimage,lzma)
40
41suffix-$(CONFIG_KERNEL_GZIP) := gz
42suffix-$(CONFIG_KERNEL_BZIP2) := bz2
43suffix-$(CONFIG_KERNEL_LZMA) := lzma
44$(obj)/vmImage: $(obj)/vmImage.$(suffix-y)
45 @ln -sf $(notdir $<) $@
29 46
30install: 47install:
31 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" 48 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
diff --git a/arch/blackfin/include/asm/atomic.h b/arch/blackfin/include/asm/atomic.h
index 7bbf44e4ddf9..b1d92f13ef96 100644
--- a/arch/blackfin/include/asm/atomic.h
+++ b/arch/blackfin/include/asm/atomic.h
@@ -90,7 +90,7 @@ static inline int atomic_test_mask(int mask, atomic_t *v)
90 90
91static inline void atomic_add(int i, atomic_t *v) 91static inline void atomic_add(int i, atomic_t *v)
92{ 92{
93 long flags; 93 unsigned long flags;
94 94
95 local_irq_save_hw(flags); 95 local_irq_save_hw(flags);
96 v->counter += i; 96 v->counter += i;
@@ -99,7 +99,7 @@ static inline void atomic_add(int i, atomic_t *v)
99 99
100static inline void atomic_sub(int i, atomic_t *v) 100static inline void atomic_sub(int i, atomic_t *v)
101{ 101{
102 long flags; 102 unsigned long flags;
103 103
104 local_irq_save_hw(flags); 104 local_irq_save_hw(flags);
105 v->counter -= i; 105 v->counter -= i;
@@ -110,7 +110,7 @@ static inline void atomic_sub(int i, atomic_t *v)
110static inline int atomic_add_return(int i, atomic_t *v) 110static inline int atomic_add_return(int i, atomic_t *v)
111{ 111{
112 int __temp = 0; 112 int __temp = 0;
113 long flags; 113 unsigned long flags;
114 114
115 local_irq_save_hw(flags); 115 local_irq_save_hw(flags);
116 v->counter += i; 116 v->counter += i;
@@ -124,7 +124,7 @@ static inline int atomic_add_return(int i, atomic_t *v)
124static inline int atomic_sub_return(int i, atomic_t *v) 124static inline int atomic_sub_return(int i, atomic_t *v)
125{ 125{
126 int __temp = 0; 126 int __temp = 0;
127 long flags; 127 unsigned long flags;
128 128
129 local_irq_save_hw(flags); 129 local_irq_save_hw(flags);
130 v->counter -= i; 130 v->counter -= i;
@@ -136,7 +136,7 @@ static inline int atomic_sub_return(int i, atomic_t *v)
136 136
137static inline void atomic_inc(volatile atomic_t *v) 137static inline void atomic_inc(volatile atomic_t *v)
138{ 138{
139 long flags; 139 unsigned long flags;
140 140
141 local_irq_save_hw(flags); 141 local_irq_save_hw(flags);
142 v->counter++; 142 v->counter++;
@@ -145,7 +145,7 @@ static inline void atomic_inc(volatile atomic_t *v)
145 145
146static inline void atomic_dec(volatile atomic_t *v) 146static inline void atomic_dec(volatile atomic_t *v)
147{ 147{
148 long flags; 148 unsigned long flags;
149 149
150 local_irq_save_hw(flags); 150 local_irq_save_hw(flags);
151 v->counter--; 151 v->counter--;
@@ -154,7 +154,7 @@ static inline void atomic_dec(volatile atomic_t *v)
154 154
155static inline void atomic_clear_mask(unsigned int mask, atomic_t *v) 155static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
156{ 156{
157 long flags; 157 unsigned long flags;
158 158
159 local_irq_save_hw(flags); 159 local_irq_save_hw(flags);
160 v->counter &= ~mask; 160 v->counter &= ~mask;
@@ -163,7 +163,7 @@ static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
163 163
164static inline void atomic_set_mask(unsigned int mask, atomic_t *v) 164static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
165{ 165{
166 long flags; 166 unsigned long flags;
167 167
168 local_irq_save_hw(flags); 168 local_irq_save_hw(flags);
169 v->counter |= mask; 169 v->counter |= mask;
diff --git a/arch/blackfin/include/asm/bfin-global.h b/arch/blackfin/include/asm/bfin-global.h
index daffc0684e75..e39277ea43e8 100644
--- a/arch/blackfin/include/asm/bfin-global.h
+++ b/arch/blackfin/include/asm/bfin-global.h
@@ -31,7 +31,7 @@
31 31
32#ifndef __ASSEMBLY__ 32#ifndef __ASSEMBLY__
33 33
34#include <asm-generic/sections.h> 34#include <asm/sections.h>
35#include <asm/ptrace.h> 35#include <asm/ptrace.h>
36#include <asm/user.h> 36#include <asm/user.h>
37#include <linux/linkage.h> 37#include <linux/linkage.h>
@@ -99,15 +99,6 @@ extern const char bfin_board_name[];
99extern unsigned long bfin_sic_iwr[]; 99extern unsigned long bfin_sic_iwr[];
100extern unsigned vr_wakeup; 100extern unsigned vr_wakeup;
101extern u16 _bfin_swrst; /* shadow for Software Reset Register (SWRST) */ 101extern u16 _bfin_swrst; /* shadow for Software Reset Register (SWRST) */
102extern unsigned long _ramstart, _ramend, _rambase;
103extern unsigned long memory_start, memory_end, physical_mem_end;
104extern char _stext_l1[], _etext_l1[], _sdata_l1[], _edata_l1[], _sbss_l1[],
105 _ebss_l1[], _l1_lma_start[], _sdata_b_l1[], _sbss_b_l1[], _ebss_b_l1[],
106 _stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[], _sbss_l2[],
107 _ebss_l2[], _l2_lma_start[];
108
109/* only used when MTD_UCLINUX */
110extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size;
111 102
112#ifdef CONFIG_BFIN_ICACHE_LOCK 103#ifdef CONFIG_BFIN_ICACHE_LOCK
113extern void cache_grab_lock(int way); 104extern void cache_grab_lock(int way);
diff --git a/arch/blackfin/include/asm/bitops.h b/arch/blackfin/include/asm/bitops.h
index 21b036eadab1..75fee2f7d9f2 100644
--- a/arch/blackfin/include/asm/bitops.h
+++ b/arch/blackfin/include/asm/bitops.h
@@ -109,7 +109,8 @@ static inline void clear_bit(int nr, volatile unsigned long *addr)
109 109
110static inline void change_bit(int nr, volatile unsigned long *addr) 110static inline void change_bit(int nr, volatile unsigned long *addr)
111{ 111{
112 int mask, flags; 112 int mask;
113 unsigned long flags;
113 unsigned long *ADDR = (unsigned long *)addr; 114 unsigned long *ADDR = (unsigned long *)addr;
114 115
115 ADDR += nr >> 5; 116 ADDR += nr >> 5;
diff --git a/arch/blackfin/include/asm/bug.h b/arch/blackfin/include/asm/bug.h
index 6d3e11b1fc57..655e49540e41 100644
--- a/arch/blackfin/include/asm/bug.h
+++ b/arch/blackfin/include/asm/bug.h
@@ -2,13 +2,58 @@
2#define _BLACKFIN_BUG_H 2#define _BLACKFIN_BUG_H
3 3
4#ifdef CONFIG_BUG 4#ifdef CONFIG_BUG
5#define HAVE_ARCH_BUG
6 5
7#define BUG() do { \ 6#define BFIN_BUG_OPCODE 0xefcd
8 dump_bfin_trace_buffer(); \ 7
9 printk(KERN_EMERG "BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __func__); \ 8#ifdef CONFIG_DEBUG_BUGVERBOSE
10 panic("BUG!"); \ 9
11} while (0) 10#define _BUG_OR_WARN(flags) \
11 asm volatile( \
12 "1: .hword %0\n" \
13 " .section __bug_table,\"a\",@progbits\n" \
14 "2: .long 1b\n" \
15 " .long %1\n" \
16 " .short %2\n" \
17 " .short %3\n" \
18 " .org 2b + %4\n" \
19 " .previous" \
20 : \
21 : "i"(BFIN_BUG_OPCODE), "i"(__FILE__), \
22 "i"(__LINE__), "i"(flags), \
23 "i"(sizeof(struct bug_entry)))
24
25#else
26
27#define _BUG_OR_WARN(flags) \
28 asm volatile( \
29 "1: .hword %0\n" \
30 " .section __bug_table,\"a\",@progbits\n" \
31 "2: .long 1b\n" \
32 " .short %1\n" \
33 " .org 2b + %2\n" \
34 " .previous" \
35 : \
36 : "i"(BFIN_BUG_OPCODE), "i"(flags), \
37 "i"(sizeof(struct bug_entry)))
38
39#endif /* CONFIG_DEBUG_BUGVERBOSE */
40
41#define BUG() \
42 do { \
43 _BUG_OR_WARN(0); \
44 for (;;); \
45 } while (0)
46
47#define WARN_ON(condition) \
48 ({ \
49 int __ret_warn_on = !!(condition); \
50 if (unlikely(__ret_warn_on)) \
51 _BUG_OR_WARN(BUGFLAG_WARNING); \
52 unlikely(__ret_warn_on); \
53 })
54
55#define HAVE_ARCH_BUG
56#define HAVE_ARCH_WARN_ON
12 57
13#endif 58#endif
14 59
diff --git a/arch/blackfin/include/asm/cache.h b/arch/blackfin/include/asm/cache.h
index 86637814cf25..2ef669ed9222 100644
--- a/arch/blackfin/include/asm/cache.h
+++ b/arch/blackfin/include/asm/cache.h
@@ -34,9 +34,13 @@
34#define L1_CACHE_SHIFT_MAX 5 34#define L1_CACHE_SHIFT_MAX 5
35 35
36#if defined(CONFIG_SMP) && \ 36#if defined(CONFIG_SMP) && \
37 !defined(CONFIG_BFIN_CACHE_COHERENT) && \ 37 !defined(CONFIG_BFIN_CACHE_COHERENT)
38 defined(CONFIG_BFIN_DCACHE) 38# if defined(CONFIG_BFIN_ICACHE)
39#define __ARCH_SYNC_CORE_DCACHE 39# define __ARCH_SYNC_CORE_ICACHE
40# endif
41# if defined(CONFIG_BFIN_DCACHE)
42# define __ARCH_SYNC_CORE_DCACHE
43# endif
40#ifndef __ASSEMBLY__ 44#ifndef __ASSEMBLY__
41asmlinkage void __raw_smp_mark_barrier_asm(void); 45asmlinkage void __raw_smp_mark_barrier_asm(void);
42asmlinkage void __raw_smp_check_barrier_asm(void); 46asmlinkage void __raw_smp_check_barrier_asm(void);
@@ -51,6 +55,7 @@ static inline void smp_check_barrier(void)
51} 55}
52 56
53void resync_core_dcache(void); 57void resync_core_dcache(void);
58void resync_core_icache(void);
54#endif 59#endif
55#endif 60#endif
56 61
diff --git a/arch/blackfin/include/asm/cacheflush.h b/arch/blackfin/include/asm/cacheflush.h
index 94697f0f6f40..5c17dee53b5d 100644
--- a/arch/blackfin/include/asm/cacheflush.h
+++ b/arch/blackfin/include/asm/cacheflush.h
@@ -37,6 +37,7 @@ extern void blackfin_dcache_flush_range(unsigned long start_address, unsigned lo
37extern void blackfin_dcache_invalidate_range(unsigned long start_address, unsigned long end_address); 37extern void blackfin_dcache_invalidate_range(unsigned long start_address, unsigned long end_address);
38extern void blackfin_dflush_page(void *page); 38extern void blackfin_dflush_page(void *page);
39extern void blackfin_invalidate_entire_dcache(void); 39extern void blackfin_invalidate_entire_dcache(void);
40extern void blackfin_invalidate_entire_icache(void);
40 41
41#define flush_dcache_mmap_lock(mapping) do { } while (0) 42#define flush_dcache_mmap_lock(mapping) do { } while (0)
42#define flush_dcache_mmap_unlock(mapping) do { } while (0) 43#define flush_dcache_mmap_unlock(mapping) do { } while (0)
@@ -97,7 +98,7 @@ do { memcpy(dst, src, len); \
97extern unsigned long reserved_mem_dcache_on; 98extern unsigned long reserved_mem_dcache_on;
98extern unsigned long reserved_mem_icache_on; 99extern unsigned long reserved_mem_icache_on;
99 100
100static inline int bfin_addr_dcachable(unsigned long addr) 101static inline int bfin_addr_dcacheable(unsigned long addr)
101{ 102{
102#ifdef CONFIG_BFIN_DCACHE 103#ifdef CONFIG_BFIN_DCACHE
103 if (addr < (_ramend - DMA_UNCACHED_REGION)) 104 if (addr < (_ramend - DMA_UNCACHED_REGION))
diff --git a/arch/blackfin/include/asm/cpu.h b/arch/blackfin/include/asm/cpu.h
index c2594ef877f6..565b8136855e 100644
--- a/arch/blackfin/include/asm/cpu.h
+++ b/arch/blackfin/include/asm/cpu.h
@@ -34,6 +34,7 @@ struct blackfin_cpudata {
34 unsigned int dmemctl; 34 unsigned int dmemctl;
35 unsigned long loops_per_jiffy; 35 unsigned long loops_per_jiffy;
36 unsigned long dcache_invld_count; 36 unsigned long dcache_invld_count;
37 unsigned long icache_invld_count;
37}; 38};
38 39
39DECLARE_PER_CPU(struct blackfin_cpudata, cpu_data); 40DECLARE_PER_CPU(struct blackfin_cpudata, cpu_data);
diff --git a/arch/blackfin/include/asm/ftrace.h b/arch/blackfin/include/asm/ftrace.h
index 40a8c178f10d..8643680f0f78 100644
--- a/arch/blackfin/include/asm/ftrace.h
+++ b/arch/blackfin/include/asm/ftrace.h
@@ -1 +1,13 @@
1/* empty */ 1/*
2 * Blackfin ftrace code
3 *
4 * Copyright 2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
7
8#ifndef __ASM_BFIN_FTRACE_H__
9#define __ASM_BFIN_FTRACE_H__
10
11#define MCOUNT_INSN_SIZE 8 /* sizeof mcount call: LINK + CALL */
12
13#endif
diff --git a/arch/blackfin/include/asm/ipipe.h b/arch/blackfin/include/asm/ipipe.h
index 51d0bf5e2899..bbe1c3726b69 100644
--- a/arch/blackfin/include/asm/ipipe.h
+++ b/arch/blackfin/include/asm/ipipe.h
@@ -35,10 +35,10 @@
35#include <asm/atomic.h> 35#include <asm/atomic.h>
36#include <asm/traps.h> 36#include <asm/traps.h>
37 37
38#define IPIPE_ARCH_STRING "1.9-01" 38#define IPIPE_ARCH_STRING "1.10-00"
39#define IPIPE_MAJOR_NUMBER 1 39#define IPIPE_MAJOR_NUMBER 1
40#define IPIPE_MINOR_NUMBER 9 40#define IPIPE_MINOR_NUMBER 10
41#define IPIPE_PATCH_NUMBER 1 41#define IPIPE_PATCH_NUMBER 0
42 42
43#ifdef CONFIG_SMP 43#ifdef CONFIG_SMP
44#error "I-pipe/blackfin: SMP not implemented" 44#error "I-pipe/blackfin: SMP not implemented"
@@ -54,10 +54,11 @@ do { \
54 54
55#define task_hijacked(p) \ 55#define task_hijacked(p) \
56 ({ \ 56 ({ \
57 int __x__ = ipipe_current_domain != ipipe_root_domain; \ 57 int __x__ = __ipipe_root_domain_p; \
58 /* We would need to clear the SYNC flag for the root domain */ \ 58 __clear_bit(IPIPE_SYNC_FLAG, &ipipe_root_cpudom_var(status)); \
59 /* over the current processor in SMP mode. */ \ 59 if (__x__) \
60 local_irq_enable_hw(); __x__; \ 60 local_irq_enable_hw(); \
61 !__x__; \
61 }) 62 })
62 63
63struct ipipe_domain; 64struct ipipe_domain;
@@ -179,23 +180,24 @@ static inline unsigned long __ipipe_ffnz(unsigned long ul)
179 180
180#define __ipipe_run_isr(ipd, irq) \ 181#define __ipipe_run_isr(ipd, irq) \
181 do { \ 182 do { \
182 if (ipd == ipipe_root_domain) { \ 183 if (!__ipipe_pipeline_head_p(ipd)) \
183 local_irq_enable_hw(); \ 184 local_irq_enable_hw(); \
184 if (ipipe_virtual_irq_p(irq)) \ 185 if (ipd == ipipe_root_domain) { \
186 if (unlikely(ipipe_virtual_irq_p(irq))) { \
187 irq_enter(); \
185 ipd->irqs[irq].handler(irq, ipd->irqs[irq].cookie); \ 188 ipd->irqs[irq].handler(irq, ipd->irqs[irq].cookie); \
186 else \ 189 irq_exit(); \
190 } else \
187 ipd->irqs[irq].handler(irq, &__raw_get_cpu_var(__ipipe_tick_regs)); \ 191 ipd->irqs[irq].handler(irq, &__raw_get_cpu_var(__ipipe_tick_regs)); \
188 local_irq_disable_hw(); \
189 } else { \ 192 } else { \
190 __clear_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \ 193 __clear_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \
191 local_irq_enable_nohead(ipd); \
192 ipd->irqs[irq].handler(irq, ipd->irqs[irq].cookie); \ 194 ipd->irqs[irq].handler(irq, ipd->irqs[irq].cookie); \
193 /* Attempt to exit the outer interrupt level before \ 195 /* Attempt to exit the outer interrupt level before \
194 * starting the deferred IRQ processing. */ \ 196 * starting the deferred IRQ processing. */ \
195 local_irq_disable_nohead(ipd); \
196 __ipipe_run_irqtail(); \ 197 __ipipe_run_irqtail(); \
197 __set_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \ 198 __set_bit(IPIPE_SYNC_FLAG, &ipipe_cpudom_var(ipd, status)); \
198 } \ 199 } \
200 local_irq_disable_hw(); \
199 } while (0) 201 } while (0)
200 202
201#define __ipipe_syscall_watched_p(p, sc) \ 203#define __ipipe_syscall_watched_p(p, sc) \
diff --git a/arch/blackfin/include/asm/irq.h b/arch/blackfin/include/asm/irq.h
index 7645e85a5f6f..400bdd52ce87 100644
--- a/arch/blackfin/include/asm/irq.h
+++ b/arch/blackfin/include/asm/irq.h
@@ -17,270 +17,17 @@
17#ifndef _BFIN_IRQ_H_ 17#ifndef _BFIN_IRQ_H_
18#define _BFIN_IRQ_H_ 18#define _BFIN_IRQ_H_
19 19
20/* SYS_IRQS and NR_IRQS are defined in <mach-bf5xx/irq.h>*/ 20#include <linux/irqflags.h>
21#include <mach/irq.h>
22#include <asm/pda.h>
23#include <asm/processor.h>
24
25#ifdef CONFIG_SMP
26/* Forward decl needed due to cdef inter dependencies */
27static inline uint32_t __pure bfin_dspid(void);
28# define blackfin_core_id() (bfin_dspid() & 0xff)
29# define bfin_irq_flags cpu_pda[blackfin_core_id()].imask
30#else
31extern unsigned long bfin_irq_flags;
32#endif
33
34#ifdef CONFIG_IPIPE
35
36#include <linux/ipipe_trace.h>
37 21
38void __ipipe_unstall_root(void); 22/* SYS_IRQS and NR_IRQS are defined in <mach-bf5xx/irq.h> */
39 23#include <mach/irq.h>
40void __ipipe_restore_root(unsigned long flags);
41
42#ifdef CONFIG_DEBUG_HWERR
43# define __all_masked_irq_flags 0x3f
44# define __save_and_cli_hw(x) \
45 __asm__ __volatile__( \
46 "cli %0;" \
47 "sti %1;" \
48 : "=&d"(x) \
49 : "d" (0x3F) \
50 )
51#else
52# define __all_masked_irq_flags 0x1f
53# define __save_and_cli_hw(x) \
54 __asm__ __volatile__( \
55 "cli %0;" \
56 : "=&d"(x) \
57 )
58#endif
59
60#define irqs_enabled_from_flags_hw(x) ((x) != __all_masked_irq_flags)
61#define raw_irqs_disabled_flags(flags) (!irqs_enabled_from_flags_hw(flags))
62#define local_test_iflag_hw(x) irqs_enabled_from_flags_hw(x)
63
64#define local_save_flags(x) \
65 do { \
66 (x) = __ipipe_test_root() ? \
67 __all_masked_irq_flags : bfin_irq_flags; \
68 barrier(); \
69 } while (0)
70
71#define local_irq_save(x) \
72 do { \
73 (x) = __ipipe_test_and_stall_root() ? \
74 __all_masked_irq_flags : bfin_irq_flags; \
75 barrier(); \
76 } while (0)
77
78static inline void local_irq_restore(unsigned long x)
79{
80 barrier();
81 __ipipe_restore_root(x == __all_masked_irq_flags);
82}
83
84#define local_irq_disable() \
85 do { \
86 __ipipe_stall_root(); \
87 barrier(); \
88 } while (0)
89
90static inline void local_irq_enable(void)
91{
92 barrier();
93 __ipipe_unstall_root();
94}
95
96#define irqs_disabled() __ipipe_test_root()
97
98#define local_save_flags_hw(x) \
99 __asm__ __volatile__( \
100 "cli %0;" \
101 "sti %0;" \
102 : "=d"(x) \
103 )
104
105#define irqs_disabled_hw() \
106 ({ \
107 unsigned long flags; \
108 local_save_flags_hw(flags); \
109 !irqs_enabled_from_flags_hw(flags); \
110 })
111
112static inline unsigned long raw_mangle_irq_bits(int virt, unsigned long real)
113{
114 /* Merge virtual and real interrupt mask bits into a single
115 32bit word. */
116 return (real & ~(1 << 31)) | ((virt != 0) << 31);
117}
118
119static inline int raw_demangle_irq_bits(unsigned long *x)
120{
121 int virt = (*x & (1 << 31)) != 0;
122 *x &= ~(1L << 31);
123 return virt;
124}
125
126#ifdef CONFIG_IPIPE_TRACE_IRQSOFF
127
128#define local_irq_disable_hw() \
129 do { \
130 int _tmp_dummy; \
131 if (!irqs_disabled_hw()) \
132 ipipe_trace_begin(0x80000000); \
133 __asm__ __volatile__ ("cli %0;" : "=d" (_tmp_dummy) : ); \
134 } while (0)
135
136#define local_irq_enable_hw() \
137 do { \
138 if (irqs_disabled_hw()) \
139 ipipe_trace_end(0x80000000); \
140 __asm__ __volatile__ ("sti %0;" : : "d"(bfin_irq_flags)); \
141 } while (0)
142
143#define local_irq_save_hw(x) \
144 do { \
145 __save_and_cli_hw(x); \
146 if (local_test_iflag_hw(x)) \
147 ipipe_trace_begin(0x80000001); \
148 } while (0)
149
150#define local_irq_restore_hw(x) \
151 do { \
152 if (local_test_iflag_hw(x)) { \
153 ipipe_trace_end(0x80000001); \
154 local_irq_enable_hw_notrace(); \
155 } \
156 } while (0)
157
158#define local_irq_disable_hw_notrace() \
159 do { \
160 int _tmp_dummy; \
161 __asm__ __volatile__ ("cli %0;" : "=d" (_tmp_dummy) : ); \
162 } while (0)
163
164#define local_irq_enable_hw_notrace() \
165 __asm__ __volatile__( \
166 "sti %0;" \
167 : \
168 : "d"(bfin_irq_flags) \
169 )
170
171#define local_irq_save_hw_notrace(x) __save_and_cli_hw(x)
172
173#define local_irq_restore_hw_notrace(x) \
174 do { \
175 if (local_test_iflag_hw(x)) \
176 local_irq_enable_hw_notrace(); \
177 } while (0)
178
179#else /* CONFIG_IPIPE_TRACE_IRQSOFF */
180
181#define local_irq_enable_hw() \
182 __asm__ __volatile__( \
183 "sti %0;" \
184 : \
185 : "d"(bfin_irq_flags) \
186 )
187
188#define local_irq_disable_hw() \
189 do { \
190 int _tmp_dummy; \
191 __asm__ __volatile__ ( \
192 "cli %0;" \
193 : "=d" (_tmp_dummy)); \
194 } while (0)
195
196#define local_irq_restore_hw(x) \
197 do { \
198 if (irqs_enabled_from_flags_hw(x)) \
199 local_irq_enable_hw(); \
200 } while (0)
201
202#define local_irq_save_hw(x) __save_and_cli_hw(x)
203
204#define local_irq_disable_hw_notrace() local_irq_disable_hw()
205#define local_irq_enable_hw_notrace() local_irq_enable_hw()
206#define local_irq_save_hw_notrace(x) local_irq_save_hw(x)
207#define local_irq_restore_hw_notrace(x) local_irq_restore_hw(x)
208
209#endif /* CONFIG_IPIPE_TRACE_IRQSOFF */
210
211#else /* !CONFIG_IPIPE */
212
213/*
214 * Interrupt configuring macros.
215 */
216#define local_irq_disable() \
217 do { \
218 int __tmp_dummy; \
219 __asm__ __volatile__( \
220 "cli %0;" \
221 : "=d" (__tmp_dummy) \
222 ); \
223 } while (0)
224
225#define local_irq_enable() \
226 __asm__ __volatile__( \
227 "sti %0;" \
228 : \
229 : "d" (bfin_irq_flags) \
230 )
231
232#ifdef CONFIG_DEBUG_HWERR
233# define __save_and_cli(x) \
234 __asm__ __volatile__( \
235 "cli %0;" \
236 "sti %1;" \
237 : "=&d" (x) \
238 : "d" (0x3F) \
239 )
240#else
241# define __save_and_cli(x) \
242 __asm__ __volatile__( \
243 "cli %0;" \
244 : "=&d" (x) \
245 )
246#endif
247
248#define local_save_flags(x) \
249 __asm__ __volatile__( \
250 "cli %0;" \
251 "sti %0;" \
252 : "=d" (x) \
253 )
254
255#ifdef CONFIG_DEBUG_HWERR
256#define irqs_enabled_from_flags(x) (((x) & ~0x3f) != 0)
257#else
258#define irqs_enabled_from_flags(x) ((x) != 0x1f)
259#endif
260
261#define local_irq_restore(x) \
262 do { \
263 if (irqs_enabled_from_flags(x)) \
264 local_irq_enable(); \
265 } while (0)
266
267/* For spinlocks etc */
268#define local_irq_save(x) __save_and_cli(x)
269
270#define irqs_disabled() \
271({ \
272 unsigned long flags; \
273 local_save_flags(flags); \
274 !irqs_enabled_from_flags(flags); \
275})
276
277#define local_irq_save_hw(x) local_irq_save(x)
278#define local_irq_restore_hw(x) local_irq_restore(x)
279#define local_irq_enable_hw() local_irq_enable()
280#define local_irq_disable_hw() local_irq_disable()
281#define irqs_disabled_hw() irqs_disabled()
282 24
283#endif /* !CONFIG_IPIPE */ 25/* Xenomai IPIPE helpers */
26#define local_irq_restore_hw(x) local_irq_restore(x)
27#define local_irq_save_hw(x) local_irq_save(x)
28#define local_irq_enable_hw(x) local_irq_enable(x)
29#define local_irq_disable_hw(x) local_irq_disable(x)
30#define irqs_disabled_hw(x) irqs_disabled(x)
284 31
285#if ANOMALY_05000244 && defined(CONFIG_BFIN_ICACHE) 32#if ANOMALY_05000244 && defined(CONFIG_BFIN_ICACHE)
286# define NOP_PAD_ANOMALY_05000244 "nop; nop;" 33# define NOP_PAD_ANOMALY_05000244 "nop; nop;"
diff --git a/arch/blackfin/include/asm/irqflags.h b/arch/blackfin/include/asm/irqflags.h
new file mode 100644
index 000000000000..139cba4651b1
--- /dev/null
+++ b/arch/blackfin/include/asm/irqflags.h
@@ -0,0 +1,63 @@
1/*
2 * interface to Blackfin CEC
3 *
4 * Copyright 2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
7
8#ifndef __ASM_BFIN_IRQFLAGS_H__
9#define __ASM_BFIN_IRQFLAGS_H__
10
11#ifdef CONFIG_SMP
12# include <asm/pda.h>
13# include <asm/processor.h>
14/* Forward decl needed due to cdef inter dependencies */
15static inline uint32_t __pure bfin_dspid(void);
16# define blackfin_core_id() (bfin_dspid() & 0xff)
17# define bfin_irq_flags cpu_pda[blackfin_core_id()].imask
18#else
19extern unsigned long bfin_irq_flags;
20#endif
21
22static inline void bfin_sti(unsigned long flags)
23{
24 asm volatile("sti %0;" : : "d" (flags));
25}
26
27static inline unsigned long bfin_cli(void)
28{
29 unsigned long flags;
30 asm volatile("cli %0;" : "=d" (flags));
31 return flags;
32}
33
34static inline void raw_local_irq_disable(void)
35{
36 bfin_cli();
37}
38static inline void raw_local_irq_enable(void)
39{
40 bfin_sti(bfin_irq_flags);
41}
42
43#define raw_local_save_flags(flags) do { (flags) = bfin_read_IMASK(); } while (0)
44
45#define raw_irqs_disabled_flags(flags) (((flags) & ~0x3f) == 0)
46
47static inline void raw_local_irq_restore(unsigned long flags)
48{
49 if (!raw_irqs_disabled_flags(flags))
50 raw_local_irq_enable();
51}
52
53static inline unsigned long __raw_local_irq_save(void)
54{
55 unsigned long flags = bfin_cli();
56#ifdef CONFIG_DEBUG_HWERR
57 bfin_sti(0x3f);
58#endif
59 return flags;
60}
61#define raw_local_irq_save(flags) do { (flags) = __raw_local_irq_save(); } while (0)
62
63#endif
diff --git a/arch/blackfin/include/asm/mutex-dec.h b/arch/blackfin/include/asm/mutex-dec.h
deleted file mode 100644
index 0134151656af..000000000000
--- a/arch/blackfin/include/asm/mutex-dec.h
+++ /dev/null
@@ -1,112 +0,0 @@
1/*
2 * include/asm-generic/mutex-dec.h
3 *
4 * Generic implementation of the mutex fastpath, based on atomic
5 * decrement/increment.
6 */
7#ifndef _ASM_GENERIC_MUTEX_DEC_H
8#define _ASM_GENERIC_MUTEX_DEC_H
9
10/**
11 * __mutex_fastpath_lock - try to take the lock by moving the count
12 * from 1 to a 0 value
13 * @count: pointer of type atomic_t
14 * @fail_fn: function to call if the original value was not 1
15 *
16 * Change the count from 1 to a value lower than 1, and call <fail_fn> if
17 * it wasn't 1 originally. This function MUST leave the value lower than
18 * 1 even when the "1" assertion wasn't true.
19 */
20static inline void
21__mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
22{
23 if (unlikely(atomic_dec_return(count) < 0))
24 fail_fn(count);
25 else
26 smp_mb();
27}
28
29/**
30 * __mutex_fastpath_lock_retval - try to take the lock by moving the count
31 * from 1 to a 0 value
32 * @count: pointer of type atomic_t
33 * @fail_fn: function to call if the original value was not 1
34 *
35 * Change the count from 1 to a value lower than 1, and call <fail_fn> if
36 * it wasn't 1 originally. This function returns 0 if the fastpath succeeds,
37 * or anything the slow path function returns.
38 */
39static inline int
40__mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *))
41{
42 if (unlikely(atomic_dec_return(count) < 0))
43 return fail_fn(count);
44 else {
45 smp_mb();
46 return 0;
47 }
48}
49
50/**
51 * __mutex_fastpath_unlock - try to promote the count from 0 to 1
52 * @count: pointer of type atomic_t
53 * @fail_fn: function to call if the original value was not 0
54 *
55 * Try to promote the count from 0 to 1. If it wasn't 0, call <fail_fn>.
56 * In the failure case, this function is allowed to either set the value to
57 * 1, or to set it to a value lower than 1.
58 *
59 * If the implementation sets it to a value of lower than 1, then the
60 * __mutex_slowpath_needs_to_unlock() macro needs to return 1, it needs
61 * to return 0 otherwise.
62 */
63static inline void
64__mutex_fastpath_unlock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
65{
66 smp_mb();
67 if (unlikely(atomic_inc_return(count) <= 0))
68 fail_fn(count);
69}
70
71#define __mutex_slowpath_needs_to_unlock() 1
72
73/**
74 * __mutex_fastpath_trylock - try to acquire the mutex, without waiting
75 *
76 * @count: pointer of type atomic_t
77 * @fail_fn: fallback function
78 *
79 * Change the count from 1 to a value lower than 1, and return 0 (failure)
80 * if it wasn't 1 originally, or return 1 (success) otherwise. This function
81 * MUST leave the value lower than 1 even when the "1" assertion wasn't true.
82 * Additionally, if the value was < 0 originally, this function must not leave
83 * it to 0 on failure.
84 *
85 * If the architecture has no effective trylock variant, it should call the
86 * <fail_fn> spinlock-based trylock variant unconditionally.
87 */
88static inline int
89__mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
90{
91 /*
92 * We have two variants here. The cmpxchg based one is the best one
93 * because it never induce a false contention state. It is included
94 * here because architectures using the inc/dec algorithms over the
95 * xchg ones are much more likely to support cmpxchg natively.
96 *
97 * If not we fall back to the spinlock based variant - that is
98 * just as efficient (and simpler) as a 'destructive' probing of
99 * the mutex state would be.
100 */
101#ifdef __HAVE_ARCH_CMPXCHG
102 if (likely(atomic_cmpxchg(count, 1, 0) == 1)) {
103 smp_mb();
104 return 1;
105 }
106 return 0;
107#else
108 return fail_fn(count);
109#endif
110}
111
112#endif
diff --git a/arch/blackfin/include/asm/sections.h b/arch/blackfin/include/asm/sections.h
index 1443c3353a8c..e7fd0ecd73f7 100644
--- a/arch/blackfin/include/asm/sections.h
+++ b/arch/blackfin/include/asm/sections.h
@@ -4,4 +4,15 @@
4/* nothing to see, move along */ 4/* nothing to see, move along */
5#include <asm-generic/sections.h> 5#include <asm-generic/sections.h>
6 6
7/* only used when MTD_UCLINUX */
8extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size;
9
10extern unsigned long _ramstart, _ramend, _rambase;
11extern unsigned long memory_start, memory_end, physical_mem_end;
12
13extern char _stext_l1[], _etext_l1[], _sdata_l1[], _edata_l1[], _sbss_l1[],
14 _ebss_l1[], _l1_lma_start[], _sdata_b_l1[], _sbss_b_l1[], _ebss_b_l1[],
15 _stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[], _sbss_l2[],
16 _ebss_l2[], _l2_lma_start[];
17
7#endif 18#endif
diff --git a/arch/blackfin/include/asm/system.h b/arch/blackfin/include/asm/system.h
index a4c8254bec55..294dbda24164 100644
--- a/arch/blackfin/include/asm/system.h
+++ b/arch/blackfin/include/asm/system.h
@@ -35,10 +35,10 @@
35#define _BLACKFIN_SYSTEM_H 35#define _BLACKFIN_SYSTEM_H
36 36
37#include <linux/linkage.h> 37#include <linux/linkage.h>
38#include <linux/compiler.h> 38#include <linux/irqflags.h>
39#include <mach/anomaly.h> 39#include <mach/anomaly.h>
40#include <asm/cache.h>
40#include <asm/pda.h> 41#include <asm/pda.h>
41#include <asm/processor.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43 43
44/* 44/*
diff --git a/arch/blackfin/include/asm/unistd.h b/arch/blackfin/include/asm/unistd.h
index cf5066d3efd2..da35133c171d 100644
--- a/arch/blackfin/include/asm/unistd.h
+++ b/arch/blackfin/include/asm/unistd.h
@@ -380,8 +380,9 @@
380#define __NR_inotify_init1 365 380#define __NR_inotify_init1 365
381#define __NR_preadv 366 381#define __NR_preadv 366
382#define __NR_pwritev 367 382#define __NR_pwritev 367
383#define __NR_rt_tgsigqueueinfo 368
383 384
384#define __NR_syscall 368 385#define __NR_syscall 369
385#define NR_syscalls __NR_syscall 386#define NR_syscalls __NR_syscall
386 387
387/* Old optional stuff no one actually uses */ 388/* Old optional stuff no one actually uses */
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile
index fd4d4328a0f2..3731088e181b 100644
--- a/arch/blackfin/kernel/Makefile
+++ b/arch/blackfin/kernel/Makefile
@@ -15,6 +15,10 @@ else
15 obj-y += time.o 15 obj-y += time.o
16endif 16endif
17 17
18obj-$(CONFIG_FUNCTION_TRACER) += ftrace-entry.o
19obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
20CFLAGS_REMOVE_ftrace.o = -pg
21
18obj-$(CONFIG_IPIPE) += ipipe.o 22obj-$(CONFIG_IPIPE) += ipipe.o
19obj-$(CONFIG_IPIPE_TRACE_MCOUNT) += mcount.o 23obj-$(CONFIG_IPIPE_TRACE_MCOUNT) += mcount.o
20obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o 24obj-$(CONFIG_BFIN_GPTIMERS) += gptimers.o
@@ -23,6 +27,7 @@ obj-$(CONFIG_MODULES) += module.o
23obj-$(CONFIG_KGDB) += kgdb.o 27obj-$(CONFIG_KGDB) += kgdb.o
24obj-$(CONFIG_KGDB_TESTS) += kgdb_test.o 28obj-$(CONFIG_KGDB_TESTS) += kgdb_test.o
25obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 29obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
30obj-$(CONFIG_STACKTRACE) += stacktrace.o
26 31
27# the kgdb test puts code into L2 and without linker 32# the kgdb test puts code into L2 and without linker
28# relaxation, we need to force long calls to/from it 33# relaxation, we need to force long calls to/from it
diff --git a/arch/blackfin/kernel/bfin_dma_5xx.c b/arch/blackfin/kernel/bfin_dma_5xx.c
index 763ed84ba459..e0bf8cc06907 100644
--- a/arch/blackfin/kernel/bfin_dma_5xx.c
+++ b/arch/blackfin/kernel/bfin_dma_5xx.c
@@ -453,10 +453,10 @@ void *dma_memcpy(void *pdst, const void *psrc, size_t size)
453 unsigned long src = (unsigned long)psrc; 453 unsigned long src = (unsigned long)psrc;
454 size_t bulk, rest; 454 size_t bulk, rest;
455 455
456 if (bfin_addr_dcachable(src)) 456 if (bfin_addr_dcacheable(src))
457 blackfin_dcache_flush_range(src, src + size); 457 blackfin_dcache_flush_range(src, src + size);
458 458
459 if (bfin_addr_dcachable(dst)) 459 if (bfin_addr_dcacheable(dst))
460 blackfin_dcache_invalidate_range(dst, dst + size); 460 blackfin_dcache_invalidate_range(dst, dst + size);
461 461
462 bulk = size & ~0xffff; 462 bulk = size & ~0xffff;
diff --git a/arch/blackfin/kernel/bfin_ksyms.c b/arch/blackfin/kernel/bfin_ksyms.c
index 53e893ff708a..aa05e638fb7c 100644
--- a/arch/blackfin/kernel/bfin_ksyms.c
+++ b/arch/blackfin/kernel/bfin_ksyms.c
@@ -103,3 +103,8 @@ EXPORT_SYMBOL(__raw_smp_mark_barrier_asm);
103EXPORT_SYMBOL(__raw_smp_check_barrier_asm); 103EXPORT_SYMBOL(__raw_smp_check_barrier_asm);
104#endif 104#endif
105#endif 105#endif
106
107#ifdef CONFIG_FUNCTION_TRACER
108extern void _mcount(void);
109EXPORT_SYMBOL(_mcount);
110#endif
diff --git a/arch/blackfin/kernel/cplb-mpu/cplbmgr.c b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c
index 87463ce87f5a..784923e52a9a 100644
--- a/arch/blackfin/kernel/cplb-mpu/cplbmgr.c
+++ b/arch/blackfin/kernel/cplb-mpu/cplbmgr.c
@@ -151,7 +151,7 @@ static noinline int dcplb_miss(unsigned int cpu)
151 151
152 d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB; 152 d_data = CPLB_SUPV_WR | CPLB_VALID | CPLB_DIRTY | PAGE_SIZE_4KB;
153#ifdef CONFIG_BFIN_DCACHE 153#ifdef CONFIG_BFIN_DCACHE
154 if (bfin_addr_dcachable(addr)) { 154 if (bfin_addr_dcacheable(addr)) {
155 d_data |= CPLB_L1_CHBL | ANOMALY_05000158_WORKAROUND; 155 d_data |= CPLB_L1_CHBL | ANOMALY_05000158_WORKAROUND;
156#ifdef CONFIG_BFIN_WT 156#ifdef CONFIG_BFIN_WT
157 d_data |= CPLB_L1_AOW | CPLB_WT; 157 d_data |= CPLB_L1_AOW | CPLB_WT;
diff --git a/arch/blackfin/kernel/cplb-nompu/cplbmgr.c b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c
index 8cbb47c7b663..12b030842fdb 100644
--- a/arch/blackfin/kernel/cplb-nompu/cplbmgr.c
+++ b/arch/blackfin/kernel/cplb-nompu/cplbmgr.c
@@ -28,6 +28,7 @@
28#include <asm/cplbinit.h> 28#include <asm/cplbinit.h>
29#include <asm/cplb.h> 29#include <asm/cplb.h>
30#include <asm/mmu_context.h> 30#include <asm/mmu_context.h>
31#include <asm/traps.h>
31 32
32/* 33/*
33 * WARNING 34 * WARNING
@@ -100,28 +101,6 @@ static inline void write_icplb_data(int cpu, int idx, unsigned long data,
100#endif 101#endif
101} 102}
102 103
103/*
104 * Given the contents of the status register, return the index of the
105 * CPLB that caused the fault.
106 */
107static inline int faulting_cplb_index(int status)
108{
109 int signbits = __builtin_bfin_norm_fr1x32(status & 0xFFFF);
110 return 30 - signbits;
111}
112
113/*
114 * Given the contents of the status register and the DCPLB_DATA contents,
115 * return true if a write access should be permitted.
116 */
117static inline int write_permitted(int status, unsigned long data)
118{
119 if (status & FAULT_USERSUPV)
120 return !!(data & CPLB_SUPV_WR);
121 else
122 return !!(data & CPLB_USER_WR);
123}
124
125/* Counters to implement round-robin replacement. */ 104/* Counters to implement round-robin replacement. */
126static int icplb_rr_index[NR_CPUS] PDT_ATTR; 105static int icplb_rr_index[NR_CPUS] PDT_ATTR;
127static int dcplb_rr_index[NR_CPUS] PDT_ATTR; 106static int dcplb_rr_index[NR_CPUS] PDT_ATTR;
@@ -245,43 +224,16 @@ MGR_ATTR static int dcplb_miss(int cpu)
245 return CPLB_RELOADED; 224 return CPLB_RELOADED;
246} 225}
247 226
248MGR_ATTR static noinline int dcplb_protection_fault(int cpu)
249{
250 int status = bfin_read_DCPLB_STATUS();
251
252 nr_dcplb_prot[cpu]++;
253
254 if (likely(status & FAULT_RW)) {
255 int idx = faulting_cplb_index(status);
256 unsigned long regaddr = DCPLB_DATA0 + idx * 4;
257 unsigned long data = bfin_read32(regaddr);
258
259 /* Check if fault is to dirty a clean page */
260 if (!(data & CPLB_WT) && !(data & CPLB_DIRTY) &&
261 write_permitted(status, data)) {
262
263 dcplb_tbl[cpu][idx].data = data;
264 bfin_write32(regaddr, data);
265 return CPLB_RELOADED;
266 }
267 }
268
269 return CPLB_PROT_VIOL;
270}
271
272MGR_ATTR int cplb_hdr(int seqstat, struct pt_regs *regs) 227MGR_ATTR int cplb_hdr(int seqstat, struct pt_regs *regs)
273{ 228{
274 int cause = seqstat & 0x3f; 229 int cause = seqstat & 0x3f;
275 unsigned int cpu = smp_processor_id(); 230 unsigned int cpu = smp_processor_id();
276 switch (cause) { 231 switch (cause) {
277 case 0x2C: 232 case VEC_CPLB_I_M:
278 return icplb_miss(cpu); 233 return icplb_miss(cpu);
279 case 0x26: 234 case VEC_CPLB_M:
280 return dcplb_miss(cpu); 235 return dcplb_miss(cpu);
281 default: 236 default:
282 if (unlikely(cause == 0x23))
283 return dcplb_protection_fault(cpu);
284
285 return CPLB_UNKNOWN_ERR; 237 return CPLB_UNKNOWN_ERR;
286 } 238 }
287} 239}
diff --git a/arch/blackfin/kernel/early_printk.c b/arch/blackfin/kernel/early_printk.c
index 3302719173ca..2ab56811841c 100644
--- a/arch/blackfin/kernel/early_printk.c
+++ b/arch/blackfin/kernel/early_printk.c
@@ -202,11 +202,15 @@ asmlinkage void __init init_early_exception_vectors(void)
202asmlinkage void __init early_trap_c(struct pt_regs *fp, void *retaddr) 202asmlinkage void __init early_trap_c(struct pt_regs *fp, void *retaddr)
203{ 203{
204 /* This can happen before the uart is initialized, so initialize 204 /* This can happen before the uart is initialized, so initialize
205 * the UART now 205 * the UART now (but only if we are running on the processor we think
206 * we are compiled for - otherwise we write to MMRs that don't exist,
207 * and cause other problems. Nothing comes out the UART, but it does
208 * end up in the __buf_log.
206 */ 209 */
207 if (likely(early_console == NULL)) 210 if (likely(early_console == NULL) && CPUID == bfin_cpuid())
208 setup_early_printk(DEFAULT_EARLY_PORT); 211 setup_early_printk(DEFAULT_EARLY_PORT);
209 212
213 printk(KERN_EMERG "Early panic\n");
210 dump_bfin_mem(fp); 214 dump_bfin_mem(fp);
211 show_regs(fp); 215 show_regs(fp);
212 dump_bfin_trace_buffer(); 216 dump_bfin_trace_buffer();
diff --git a/arch/blackfin/kernel/ftrace-entry.S b/arch/blackfin/kernel/ftrace-entry.S
new file mode 100644
index 000000000000..6980b7a0615d
--- /dev/null
+++ b/arch/blackfin/kernel/ftrace-entry.S
@@ -0,0 +1,140 @@
1/*
2 * mcount and friends -- ftrace stuff
3 *
4 * Copyright (C) 2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
7
8#include <linux/linkage.h>
9#include <asm/ftrace.h>
10
11.text
12
13/* GCC will have called us before setting up the function prologue, so we
14 * can clobber the normal scratch registers, but we need to make sure to
15 * save/restore the registers used for argument passing (R0-R2) in case
16 * the profiled function is using them. With data registers, R3 is the
17 * only one we can blow away. With pointer registers, we have P0-P2.
18 *
19 * Upon entry, the RETS will point to the top of the current profiled
20 * function. And since GCC setup the frame for us, the previous function
21 * will be waiting there. mmmm pie.
22 */
23ENTRY(__mcount)
24 /* save third function arg early so we can do testing below */
25 [--sp] = r2;
26
27 /* load the function pointer to the tracer */
28 p0.l = _ftrace_trace_function;
29 p0.h = _ftrace_trace_function;
30 r3 = [p0];
31
32 /* optional micro optimization: don't call the stub tracer */
33 r2.l = _ftrace_stub;
34 r2.h = _ftrace_stub;
35 cc = r2 == r3;
36 if ! cc jump .Ldo_trace;
37
38#ifdef CONFIG_FUNCTION_GRAPH_TRACER
39 /* if the ftrace_graph_return function pointer is not set to
40 * the ftrace_stub entry, call prepare_ftrace_return().
41 */
42 p0.l = _ftrace_graph_return;
43 p0.h = _ftrace_graph_return;
44 r3 = [p0];
45 cc = r2 == r3;
46 if ! cc jump _ftrace_graph_caller;
47
48 /* similarly, if the ftrace_graph_entry function pointer is not
49 * set to the ftrace_graph_entry_stub entry, ...
50 */
51 p0.l = _ftrace_graph_entry;
52 p0.h = _ftrace_graph_entry;
53 r2.l = _ftrace_graph_entry_stub;
54 r2.h = _ftrace_graph_entry_stub;
55 r3 = [p0];
56 cc = r2 == r3;
57 if ! cc jump _ftrace_graph_caller;
58#endif
59
60 r2 = [sp++];
61 rts;
62
63.Ldo_trace:
64
65 /* save first/second function arg and the return register */
66 [--sp] = r0;
67 [--sp] = r1;
68 [--sp] = rets;
69
70 /* setup the tracer function */
71 p0 = r3;
72
73 /* tracer(ulong frompc, ulong selfpc):
74 * frompc: the pc that did the call to ...
75 * selfpc: ... this location
76 * the selfpc itself will need adjusting for the mcount call
77 */
78 r1 = rets;
79 r0 = [fp + 4];
80 r1 += -MCOUNT_INSN_SIZE;
81
82 /* call the tracer */
83 call (p0);
84
85 /* restore state and get out of dodge */
86.Lfinish_trace:
87 rets = [sp++];
88 r1 = [sp++];
89 r0 = [sp++];
90 r2 = [sp++];
91
92.globl _ftrace_stub
93_ftrace_stub:
94 rts;
95ENDPROC(__mcount)
96
97#ifdef CONFIG_FUNCTION_GRAPH_TRACER
98/* The prepare_ftrace_return() function is similar to the trace function
99 * except it takes a pointer to the location of the frompc. This is so
100 * the prepare_ftrace_return() can hijack it temporarily for probing
101 * purposes.
102 */
103ENTRY(_ftrace_graph_caller)
104 /* save first/second function arg and the return register */
105 [--sp] = r0;
106 [--sp] = r1;
107 [--sp] = rets;
108
109 r0 = fp;
110 r1 = rets;
111 r0 += 4;
112 r1 += -MCOUNT_INSN_SIZE;
113 call _prepare_ftrace_return;
114
115 jump .Lfinish_trace;
116ENDPROC(_ftrace_graph_caller)
117
118/* Undo the rewrite caused by ftrace_graph_caller(). The common function
119 * ftrace_return_to_handler() will return the original rets so we can
120 * restore it and be on our way.
121 */
122ENTRY(_return_to_handler)
123 /* make sure original return values are saved */
124 [--sp] = p0;
125 [--sp] = r0;
126 [--sp] = r1;
127
128 /* get original return address */
129 call _ftrace_return_to_handler;
130 rets = r0;
131
132 /* anomaly 05000371 - make sure we have at least three instructions
133 * between rets setting and the return
134 */
135 r1 = [sp++];
136 r0 = [sp++];
137 p0 = [sp++];
138 rts;
139ENDPROC(_return_to_handler)
140#endif
diff --git a/arch/blackfin/kernel/ftrace.c b/arch/blackfin/kernel/ftrace.c
new file mode 100644
index 000000000000..905bfc40a00b
--- /dev/null
+++ b/arch/blackfin/kernel/ftrace.c
@@ -0,0 +1,42 @@
1/*
2 * ftrace graph code
3 *
4 * Copyright (C) 2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
7
8#include <linux/ftrace.h>
9#include <linux/kernel.h>
10#include <linux/sched.h>
11#include <asm/atomic.h>
12
13#ifdef CONFIG_FUNCTION_GRAPH_TRACER
14
15/*
16 * Hook the return address and push it in the stack of return addrs
17 * in current thread info.
18 */
19void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
20{
21 struct ftrace_graph_ent trace;
22 unsigned long return_hooker = (unsigned long)&return_to_handler;
23
24 if (unlikely(atomic_read(&current->tracing_graph_pause)))
25 return;
26
27 if (ftrace_push_return_trace(*parent, self_addr, &trace.depth) == -EBUSY)
28 return;
29
30 trace.func = self_addr;
31
32 /* Only trace if the calling function expects to */
33 if (!ftrace_graph_entry(&trace)) {
34 current->curr_ret_stack--;
35 return;
36 }
37
38 /* all is well in the world ! hijack RETS ... */
39 *parent = return_hooker;
40}
41
42#endif
diff --git a/arch/blackfin/kernel/ipipe.c b/arch/blackfin/kernel/ipipe.c
index 5fc424803a17..d8cde1fc5cb9 100644
--- a/arch/blackfin/kernel/ipipe.c
+++ b/arch/blackfin/kernel/ipipe.c
@@ -99,7 +99,7 @@ void __ipipe_handle_irq(unsigned irq, struct pt_regs *regs)
99 * interrupt. 99 * interrupt.
100 */ 100 */
101 m_ack = (regs == NULL || irq == IRQ_SYSTMR || irq == IRQ_CORETMR); 101 m_ack = (regs == NULL || irq == IRQ_SYSTMR || irq == IRQ_CORETMR);
102 this_domain = ipipe_current_domain; 102 this_domain = __ipipe_current_domain;
103 103
104 if (unlikely(test_bit(IPIPE_STICKY_FLAG, &this_domain->irqs[irq].control))) 104 if (unlikely(test_bit(IPIPE_STICKY_FLAG, &this_domain->irqs[irq].control)))
105 head = &this_domain->p_link; 105 head = &this_domain->p_link;
@@ -212,7 +212,9 @@ void __ipipe_unstall_root_raw(void)
212 212
213int __ipipe_syscall_root(struct pt_regs *regs) 213int __ipipe_syscall_root(struct pt_regs *regs)
214{ 214{
215 struct ipipe_percpu_domain_data *p;
215 unsigned long flags; 216 unsigned long flags;
217 int ret;
216 218
217 /* 219 /*
218 * We need to run the IRQ tail hook whenever we don't 220 * We need to run the IRQ tail hook whenever we don't
@@ -231,29 +233,31 @@ int __ipipe_syscall_root(struct pt_regs *regs)
231 /* 233 /*
232 * This routine either returns: 234 * This routine either returns:
233 * 0 -- if the syscall is to be passed to Linux; 235 * 0 -- if the syscall is to be passed to Linux;
234 * 1 -- if the syscall should not be passed to Linux, and no 236 * >0 -- if the syscall should not be passed to Linux, and no
235 * tail work should be performed; 237 * tail work should be performed;
236 * -1 -- if the syscall should not be passed to Linux but the 238 * <0 -- if the syscall should not be passed to Linux but the
237 * tail work has to be performed (for handling signals etc). 239 * tail work has to be performed (for handling signals etc).
238 */ 240 */
239 241
240 if (__ipipe_event_monitored_p(IPIPE_EVENT_SYSCALL) && 242 if (!__ipipe_event_monitored_p(IPIPE_EVENT_SYSCALL))
241 __ipipe_dispatch_event(IPIPE_EVENT_SYSCALL, regs) > 0) { 243 return 0;
242 if (ipipe_root_domain_p && !in_atomic()) { 244
243 /* 245 ret = __ipipe_dispatch_event(IPIPE_EVENT_SYSCALL, regs);
244 * Sync pending VIRQs before _TIF_NEED_RESCHED 246
245 * is tested. 247 local_irq_save_hw(flags);
246 */ 248
247 local_irq_save_hw(flags); 249 if (!__ipipe_root_domain_p) {
248 if ((ipipe_root_cpudom_var(irqpend_himask) & IPIPE_IRQMASK_VIRT) != 0) 250 local_irq_restore_hw(flags);
249 __ipipe_sync_pipeline(IPIPE_IRQMASK_VIRT);
250 local_irq_restore_hw(flags);
251 return -1;
252 }
253 return 1; 251 return 1;
254 } 252 }
255 253
256 return 0; 254 p = ipipe_root_cpudom_ptr();
255 if ((p->irqpend_himask & IPIPE_IRQMASK_VIRT) != 0)
256 __ipipe_sync_pipeline(IPIPE_IRQMASK_VIRT);
257
258 local_irq_restore_hw(flags);
259
260 return -ret;
257} 261}
258 262
259unsigned long ipipe_critical_enter(void (*syncfn) (void)) 263unsigned long ipipe_critical_enter(void (*syncfn) (void))
@@ -329,9 +333,7 @@ asmlinkage void __ipipe_sync_root(void)
329 333
330void ___ipipe_sync_pipeline(unsigned long syncmask) 334void ___ipipe_sync_pipeline(unsigned long syncmask)
331{ 335{
332 struct ipipe_domain *ipd = ipipe_current_domain; 336 if (__ipipe_root_domain_p) {
333
334 if (ipd == ipipe_root_domain) {
335 if (test_bit(IPIPE_SYNCDEFER_FLAG, &ipipe_root_cpudom_var(status))) 337 if (test_bit(IPIPE_SYNCDEFER_FLAG, &ipipe_root_cpudom_var(status)))
336 return; 338 return;
337 } 339 }
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 80447f99c2b5..6454babdfaff 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -1098,7 +1098,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1098 CPUID, bfin_cpuid()); 1098 CPUID, bfin_cpuid());
1099 1099
1100 seq_printf(m, "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n" 1100 seq_printf(m, "model name\t: ADSP-%s %lu(MHz CCLK) %lu(MHz SCLK) (%s)\n"
1101 "stepping\t: %d\n", 1101 "stepping\t: %d ",
1102 cpu, cclk/1000000, sclk/1000000, 1102 cpu, cclk/1000000, sclk/1000000,
1103#ifdef CONFIG_MPU 1103#ifdef CONFIG_MPU
1104 "mpu on", 1104 "mpu on",
@@ -1107,7 +1107,16 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1107#endif 1107#endif
1108 revid); 1108 revid);
1109 1109
1110 seq_printf(m, "cpu MHz\t\t: %lu.%03lu/%lu.%03lu\n", 1110 if (bfin_revid() != bfin_compiled_revid()) {
1111 if (bfin_compiled_revid() == -1)
1112 seq_printf(m, "(Compiled for Rev none)");
1113 else if (bfin_compiled_revid() == 0xffff)
1114 seq_printf(m, "(Compiled for Rev any)");
1115 else
1116 seq_printf(m, "(Compiled for Rev %d)", bfin_compiled_revid());
1117 }
1118
1119 seq_printf(m, "\ncpu MHz\t\t: %lu.%03lu/%lu.%03lu\n",
1111 cclk/1000000, cclk%1000000, 1120 cclk/1000000, cclk%1000000,
1112 sclk/1000000, sclk%1000000); 1121 sclk/1000000, sclk%1000000);
1113 seq_printf(m, "bogomips\t: %lu.%02lu\n" 1122 seq_printf(m, "bogomips\t: %lu.%02lu\n"
@@ -1172,6 +1181,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1172#ifdef __ARCH_SYNC_CORE_DCACHE 1181#ifdef __ARCH_SYNC_CORE_DCACHE
1173 seq_printf(m, "SMP Dcache Flushes\t: %lu\n\n", cpudata->dcache_invld_count); 1182 seq_printf(m, "SMP Dcache Flushes\t: %lu\n\n", cpudata->dcache_invld_count);
1174#endif 1183#endif
1184#ifdef __ARCH_SYNC_CORE_ICACHE
1185 seq_printf(m, "SMP Icache Flushes\t: %lu\n\n", cpudata->icache_invld_count);
1186#endif
1175#ifdef CONFIG_BFIN_ICACHE_LOCK 1187#ifdef CONFIG_BFIN_ICACHE_LOCK
1176 switch ((cpudata->imemctl >> 3) & WAYALL_L) { 1188 switch ((cpudata->imemctl >> 3) & WAYALL_L) {
1177 case WAY0_L: 1189 case WAY0_L:
diff --git a/arch/blackfin/kernel/stacktrace.c b/arch/blackfin/kernel/stacktrace.c
new file mode 100644
index 000000000000..30301e1eace5
--- /dev/null
+++ b/arch/blackfin/kernel/stacktrace.c
@@ -0,0 +1,53 @@
1/*
2 * Blackfin stacktrace code (mostly copied from avr32)
3 *
4 * Copyright 2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later.
6 */
7
8#include <linux/sched.h>
9#include <linux/stacktrace.h>
10#include <linux/thread_info.h>
11#include <linux/module.h>
12
13register unsigned long current_frame_pointer asm("FP");
14
15struct stackframe {
16 unsigned long fp;
17 unsigned long rets;
18};
19
20/*
21 * Save stack-backtrace addresses into a stack_trace buffer.
22 */
23void save_stack_trace(struct stack_trace *trace)
24{
25 unsigned long low, high;
26 unsigned long fp;
27 struct stackframe *frame;
28 int skip = trace->skip;
29
30 low = (unsigned long)task_stack_page(current);
31 high = low + THREAD_SIZE;
32 fp = current_frame_pointer;
33
34 while (fp >= low && fp <= (high - sizeof(*frame))) {
35 frame = (struct stackframe *)fp;
36
37 if (skip) {
38 skip--;
39 } else {
40 trace->entries[trace->nr_entries++] = frame->rets;
41 if (trace->nr_entries >= trace->max_entries)
42 break;
43 }
44
45 /*
46 * The next frame must be at a higher address than the
47 * current frame.
48 */
49 low = fp + sizeof(*frame);
50 fp = frame->fp;
51 }
52}
53EXPORT_SYMBOL_GPL(save_stack_trace);
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index aa76dfb0226e..d279552fe9b0 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -27,6 +27,7 @@
27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 27 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */ 28 */
29 29
30#include <linux/bug.h>
30#include <linux/uaccess.h> 31#include <linux/uaccess.h>
31#include <linux/interrupt.h> 32#include <linux/interrupt.h>
32#include <linux/module.h> 33#include <linux/module.h>
@@ -238,6 +239,11 @@ asmlinkage void double_fault_c(struct pt_regs *fp)
238 239
239} 240}
240 241
242static int kernel_mode_regs(struct pt_regs *regs)
243{
244 return regs->ipend & 0xffc0;
245}
246
241asmlinkage void trap_c(struct pt_regs *fp) 247asmlinkage void trap_c(struct pt_regs *fp)
242{ 248{
243#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON 249#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
@@ -246,6 +252,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
246#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO 252#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
247 unsigned int cpu = smp_processor_id(); 253 unsigned int cpu = smp_processor_id();
248#endif 254#endif
255 const char *strerror = NULL;
249 int sig = 0; 256 int sig = 0;
250 siginfo_t info; 257 siginfo_t info;
251 unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE; 258 unsigned long trapnr = fp->seqstat & SEQSTAT_EXCAUSE;
@@ -259,27 +266,10 @@ asmlinkage void trap_c(struct pt_regs *fp)
259 * double faults if the stack has become corrupt 266 * double faults if the stack has become corrupt
260 */ 267 */
261 268
262 /* If the fault was caused by a kernel thread, or interrupt handler 269#ifndef CONFIG_KGDB
263 * we will kernel panic, so the system reboots. 270 /* IPEND is skipped if KGDB isn't enabled (see entry code) */
264 * If KGDB is enabled, don't set this for kernel breakpoints 271 fp->ipend = bfin_read_IPEND();
265 */
266
267 /* TODO: check to see if we are in some sort of deferred HWERR
268 * that we should be able to recover from, not kernel panic
269 */
270 if ((bfin_read_IPEND() & 0xFFC0) && (trapnr != VEC_STEP)
271#ifdef CONFIG_KGDB
272 && (trapnr != VEC_EXCPT02)
273#endif 272#endif
274 ){
275 console_verbose();
276 oops_in_progress = 1;
277 } else if (current) {
278 if (current->mm == NULL) {
279 console_verbose();
280 oops_in_progress = 1;
281 }
282 }
283 273
284 /* trap_c() will be called for exceptions. During exceptions 274 /* trap_c() will be called for exceptions. During exceptions
285 * processing, the pc value should be set with retx value. 275 * processing, the pc value should be set with retx value.
@@ -307,15 +297,15 @@ asmlinkage void trap_c(struct pt_regs *fp)
307 sig = SIGTRAP; 297 sig = SIGTRAP;
308 CHK_DEBUGGER_TRAP_MAYBE(); 298 CHK_DEBUGGER_TRAP_MAYBE();
309 /* Check if this is a breakpoint in kernel space */ 299 /* Check if this is a breakpoint in kernel space */
310 if (fp->ipend & 0xffc0) 300 if (kernel_mode_regs(fp))
311 return; 301 goto traps_done;
312 else 302 else
313 break; 303 break;
314 /* 0x03 - User Defined, userspace stack overflow */ 304 /* 0x03 - User Defined, userspace stack overflow */
315 case VEC_EXCPT03: 305 case VEC_EXCPT03:
316 info.si_code = SEGV_STACKFLOW; 306 info.si_code = SEGV_STACKFLOW;
317 sig = SIGSEGV; 307 sig = SIGSEGV;
318 verbose_printk(KERN_NOTICE EXC_0x03(KERN_NOTICE)); 308 strerror = KERN_NOTICE EXC_0x03(KERN_NOTICE);
319 CHK_DEBUGGER_TRAP_MAYBE(); 309 CHK_DEBUGGER_TRAP_MAYBE();
320 break; 310 break;
321 /* 0x02 - KGDB initial connection and break signal trap */ 311 /* 0x02 - KGDB initial connection and break signal trap */
@@ -324,7 +314,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
324 info.si_code = TRAP_ILLTRAP; 314 info.si_code = TRAP_ILLTRAP;
325 sig = SIGTRAP; 315 sig = SIGTRAP;
326 CHK_DEBUGGER_TRAP(); 316 CHK_DEBUGGER_TRAP();
327 return; 317 goto traps_done;
328#endif 318#endif
329 /* 0x04 - User Defined */ 319 /* 0x04 - User Defined */
330 /* 0x05 - User Defined */ 320 /* 0x05 - User Defined */
@@ -344,7 +334,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
344 case VEC_EXCPT04 ... VEC_EXCPT15: 334 case VEC_EXCPT04 ... VEC_EXCPT15:
345 info.si_code = ILL_ILLPARAOP; 335 info.si_code = ILL_ILLPARAOP;
346 sig = SIGILL; 336 sig = SIGILL;
347 verbose_printk(KERN_NOTICE EXC_0x04(KERN_NOTICE)); 337 strerror = KERN_NOTICE EXC_0x04(KERN_NOTICE);
348 CHK_DEBUGGER_TRAP_MAYBE(); 338 CHK_DEBUGGER_TRAP_MAYBE();
349 break; 339 break;
350 /* 0x10 HW Single step, handled here */ 340 /* 0x10 HW Single step, handled here */
@@ -353,15 +343,15 @@ asmlinkage void trap_c(struct pt_regs *fp)
353 sig = SIGTRAP; 343 sig = SIGTRAP;
354 CHK_DEBUGGER_TRAP_MAYBE(); 344 CHK_DEBUGGER_TRAP_MAYBE();
355 /* Check if this is a single step in kernel space */ 345 /* Check if this is a single step in kernel space */
356 if (fp->ipend & 0xffc0) 346 if (kernel_mode_regs(fp))
357 return; 347 goto traps_done;
358 else 348 else
359 break; 349 break;
360 /* 0x11 - Trace Buffer Full, handled here */ 350 /* 0x11 - Trace Buffer Full, handled here */
361 case VEC_OVFLOW: 351 case VEC_OVFLOW:
362 info.si_code = TRAP_TRACEFLOW; 352 info.si_code = TRAP_TRACEFLOW;
363 sig = SIGTRAP; 353 sig = SIGTRAP;
364 verbose_printk(KERN_NOTICE EXC_0x11(KERN_NOTICE)); 354 strerror = KERN_NOTICE EXC_0x11(KERN_NOTICE);
365 CHK_DEBUGGER_TRAP_MAYBE(); 355 CHK_DEBUGGER_TRAP_MAYBE();
366 break; 356 break;
367 /* 0x12 - Reserved, Caught by default */ 357 /* 0x12 - Reserved, Caught by default */
@@ -381,37 +371,54 @@ asmlinkage void trap_c(struct pt_regs *fp)
381 /* 0x20 - Reserved, Caught by default */ 371 /* 0x20 - Reserved, Caught by default */
382 /* 0x21 - Undefined Instruction, handled here */ 372 /* 0x21 - Undefined Instruction, handled here */
383 case VEC_UNDEF_I: 373 case VEC_UNDEF_I:
374#ifdef CONFIG_BUG
375 if (kernel_mode_regs(fp)) {
376 switch (report_bug(fp->pc, fp)) {
377 case BUG_TRAP_TYPE_NONE:
378 break;
379 case BUG_TRAP_TYPE_WARN:
380 dump_bfin_trace_buffer();
381 fp->pc += 2;
382 goto traps_done;
383 case BUG_TRAP_TYPE_BUG:
384 /* call to panic() will dump trace, and it is
385 * off at this point, so it won't be clobbered
386 */
387 panic("BUG()");
388 }
389 }
390#endif
384 info.si_code = ILL_ILLOPC; 391 info.si_code = ILL_ILLOPC;
385 sig = SIGILL; 392 sig = SIGILL;
386 verbose_printk(KERN_NOTICE EXC_0x21(KERN_NOTICE)); 393 strerror = KERN_NOTICE EXC_0x21(KERN_NOTICE);
387 CHK_DEBUGGER_TRAP_MAYBE(); 394 CHK_DEBUGGER_TRAP_MAYBE();
388 break; 395 break;
389 /* 0x22 - Illegal Instruction Combination, handled here */ 396 /* 0x22 - Illegal Instruction Combination, handled here */
390 case VEC_ILGAL_I: 397 case VEC_ILGAL_I:
391 info.si_code = ILL_ILLPARAOP; 398 info.si_code = ILL_ILLPARAOP;
392 sig = SIGILL; 399 sig = SIGILL;
393 verbose_printk(KERN_NOTICE EXC_0x22(KERN_NOTICE)); 400 strerror = KERN_NOTICE EXC_0x22(KERN_NOTICE);
394 CHK_DEBUGGER_TRAP_MAYBE(); 401 CHK_DEBUGGER_TRAP_MAYBE();
395 break; 402 break;
396 /* 0x23 - Data CPLB protection violation, handled here */ 403 /* 0x23 - Data CPLB protection violation, handled here */
397 case VEC_CPLB_VL: 404 case VEC_CPLB_VL:
398 info.si_code = ILL_CPLB_VI; 405 info.si_code = ILL_CPLB_VI;
399 sig = SIGBUS; 406 sig = SIGBUS;
400 verbose_printk(KERN_NOTICE EXC_0x23(KERN_NOTICE)); 407 strerror = KERN_NOTICE EXC_0x23(KERN_NOTICE);
401 CHK_DEBUGGER_TRAP_MAYBE(); 408 CHK_DEBUGGER_TRAP_MAYBE();
402 break; 409 break;
403 /* 0x24 - Data access misaligned, handled here */ 410 /* 0x24 - Data access misaligned, handled here */
404 case VEC_MISALI_D: 411 case VEC_MISALI_D:
405 info.si_code = BUS_ADRALN; 412 info.si_code = BUS_ADRALN;
406 sig = SIGBUS; 413 sig = SIGBUS;
407 verbose_printk(KERN_NOTICE EXC_0x24(KERN_NOTICE)); 414 strerror = KERN_NOTICE EXC_0x24(KERN_NOTICE);
408 CHK_DEBUGGER_TRAP_MAYBE(); 415 CHK_DEBUGGER_TRAP_MAYBE();
409 break; 416 break;
410 /* 0x25 - Unrecoverable Event, handled here */ 417 /* 0x25 - Unrecoverable Event, handled here */
411 case VEC_UNCOV: 418 case VEC_UNCOV:
412 info.si_code = ILL_ILLEXCPT; 419 info.si_code = ILL_ILLEXCPT;
413 sig = SIGILL; 420 sig = SIGILL;
414 verbose_printk(KERN_NOTICE EXC_0x25(KERN_NOTICE)); 421 strerror = KERN_NOTICE EXC_0x25(KERN_NOTICE);
415 CHK_DEBUGGER_TRAP_MAYBE(); 422 CHK_DEBUGGER_TRAP_MAYBE();
416 break; 423 break;
417 /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr, 424 /* 0x26 - Data CPLB Miss, normal case is handled in _cplb_hdr,
@@ -419,7 +426,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
419 case VEC_CPLB_M: 426 case VEC_CPLB_M:
420 info.si_code = BUS_ADRALN; 427 info.si_code = BUS_ADRALN;
421 sig = SIGBUS; 428 sig = SIGBUS;
422 verbose_printk(KERN_NOTICE EXC_0x26(KERN_NOTICE)); 429 strerror = KERN_NOTICE EXC_0x26(KERN_NOTICE);
423 break; 430 break;
424 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */ 431 /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero, handled here */
425 case VEC_CPLB_MHIT: 432 case VEC_CPLB_MHIT:
@@ -427,10 +434,10 @@ asmlinkage void trap_c(struct pt_regs *fp)
427 sig = SIGSEGV; 434 sig = SIGSEGV;
428#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO 435#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
429 if (cpu_pda[cpu].dcplb_fault_addr < FIXED_CODE_START) 436 if (cpu_pda[cpu].dcplb_fault_addr < FIXED_CODE_START)
430 verbose_printk(KERN_NOTICE "NULL pointer access\n"); 437 strerror = KERN_NOTICE "NULL pointer access\n";
431 else 438 else
432#endif 439#endif
433 verbose_printk(KERN_NOTICE EXC_0x27(KERN_NOTICE)); 440 strerror = KERN_NOTICE EXC_0x27(KERN_NOTICE);
434 CHK_DEBUGGER_TRAP_MAYBE(); 441 CHK_DEBUGGER_TRAP_MAYBE();
435 break; 442 break;
436 /* 0x28 - Emulation Watchpoint, handled here */ 443 /* 0x28 - Emulation Watchpoint, handled here */
@@ -440,8 +447,8 @@ asmlinkage void trap_c(struct pt_regs *fp)
440 pr_debug(EXC_0x28(KERN_DEBUG)); 447 pr_debug(EXC_0x28(KERN_DEBUG));
441 CHK_DEBUGGER_TRAP_MAYBE(); 448 CHK_DEBUGGER_TRAP_MAYBE();
442 /* Check if this is a watchpoint in kernel space */ 449 /* Check if this is a watchpoint in kernel space */
443 if (fp->ipend & 0xffc0) 450 if (kernel_mode_regs(fp))
444 return; 451 goto traps_done;
445 else 452 else
446 break; 453 break;
447#ifdef CONFIG_BF535 454#ifdef CONFIG_BF535
@@ -449,7 +456,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
449 case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */ 456 case VEC_ISTRU_VL: /* ADSP-BF535 only (MH) */
450 info.si_code = BUS_OPFETCH; 457 info.si_code = BUS_OPFETCH;
451 sig = SIGBUS; 458 sig = SIGBUS;
452 verbose_printk(KERN_NOTICE "BF535: VEC_ISTRU_VL\n"); 459 strerror = KERN_NOTICE "BF535: VEC_ISTRU_VL\n";
453 CHK_DEBUGGER_TRAP_MAYBE(); 460 CHK_DEBUGGER_TRAP_MAYBE();
454 break; 461 break;
455#else 462#else
@@ -459,21 +466,21 @@ asmlinkage void trap_c(struct pt_regs *fp)
459 case VEC_MISALI_I: 466 case VEC_MISALI_I:
460 info.si_code = BUS_ADRALN; 467 info.si_code = BUS_ADRALN;
461 sig = SIGBUS; 468 sig = SIGBUS;
462 verbose_printk(KERN_NOTICE EXC_0x2A(KERN_NOTICE)); 469 strerror = KERN_NOTICE EXC_0x2A(KERN_NOTICE);
463 CHK_DEBUGGER_TRAP_MAYBE(); 470 CHK_DEBUGGER_TRAP_MAYBE();
464 break; 471 break;
465 /* 0x2B - Instruction CPLB protection violation, handled here */ 472 /* 0x2B - Instruction CPLB protection violation, handled here */
466 case VEC_CPLB_I_VL: 473 case VEC_CPLB_I_VL:
467 info.si_code = ILL_CPLB_VI; 474 info.si_code = ILL_CPLB_VI;
468 sig = SIGBUS; 475 sig = SIGBUS;
469 verbose_printk(KERN_NOTICE EXC_0x2B(KERN_NOTICE)); 476 strerror = KERN_NOTICE EXC_0x2B(KERN_NOTICE);
470 CHK_DEBUGGER_TRAP_MAYBE(); 477 CHK_DEBUGGER_TRAP_MAYBE();
471 break; 478 break;
472 /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */ 479 /* 0x2C - Instruction CPLB miss, handled in _cplb_hdr */
473 case VEC_CPLB_I_M: 480 case VEC_CPLB_I_M:
474 info.si_code = ILL_CPLB_MISS; 481 info.si_code = ILL_CPLB_MISS;
475 sig = SIGBUS; 482 sig = SIGBUS;
476 verbose_printk(KERN_NOTICE EXC_0x2C(KERN_NOTICE)); 483 strerror = KERN_NOTICE EXC_0x2C(KERN_NOTICE);
477 break; 484 break;
478 /* 0x2D - Instruction CPLB Multiple Hits, handled here */ 485 /* 0x2D - Instruction CPLB Multiple Hits, handled here */
479 case VEC_CPLB_I_MHIT: 486 case VEC_CPLB_I_MHIT:
@@ -481,17 +488,17 @@ asmlinkage void trap_c(struct pt_regs *fp)
481 sig = SIGSEGV; 488 sig = SIGSEGV;
482#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO 489#ifdef CONFIG_DEBUG_HUNT_FOR_ZERO
483 if (cpu_pda[cpu].icplb_fault_addr < FIXED_CODE_START) 490 if (cpu_pda[cpu].icplb_fault_addr < FIXED_CODE_START)
484 verbose_printk(KERN_NOTICE "Jump to NULL address\n"); 491 strerror = KERN_NOTICE "Jump to NULL address\n";
485 else 492 else
486#endif 493#endif
487 verbose_printk(KERN_NOTICE EXC_0x2D(KERN_NOTICE)); 494 strerror = KERN_NOTICE EXC_0x2D(KERN_NOTICE);
488 CHK_DEBUGGER_TRAP_MAYBE(); 495 CHK_DEBUGGER_TRAP_MAYBE();
489 break; 496 break;
490 /* 0x2E - Illegal use of Supervisor Resource, handled here */ 497 /* 0x2E - Illegal use of Supervisor Resource, handled here */
491 case VEC_ILL_RES: 498 case VEC_ILL_RES:
492 info.si_code = ILL_PRVOPC; 499 info.si_code = ILL_PRVOPC;
493 sig = SIGILL; 500 sig = SIGILL;
494 verbose_printk(KERN_NOTICE EXC_0x2E(KERN_NOTICE)); 501 strerror = KERN_NOTICE EXC_0x2E(KERN_NOTICE);
495 CHK_DEBUGGER_TRAP_MAYBE(); 502 CHK_DEBUGGER_TRAP_MAYBE();
496 break; 503 break;
497 /* 0x2F - Reserved, Caught by default */ 504 /* 0x2F - Reserved, Caught by default */
@@ -519,17 +526,17 @@ asmlinkage void trap_c(struct pt_regs *fp)
519 case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR): 526 case (SEQSTAT_HWERRCAUSE_SYSTEM_MMR):
520 info.si_code = BUS_ADRALN; 527 info.si_code = BUS_ADRALN;
521 sig = SIGBUS; 528 sig = SIGBUS;
522 verbose_printk(KERN_NOTICE HWC_x2(KERN_NOTICE)); 529 strerror = KERN_NOTICE HWC_x2(KERN_NOTICE);
523 break; 530 break;
524 /* External Memory Addressing Error */ 531 /* External Memory Addressing Error */
525 case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR): 532 case (SEQSTAT_HWERRCAUSE_EXTERN_ADDR):
526 info.si_code = BUS_ADRERR; 533 info.si_code = BUS_ADRERR;
527 sig = SIGBUS; 534 sig = SIGBUS;
528 verbose_printk(KERN_NOTICE HWC_x3(KERN_NOTICE)); 535 strerror = KERN_NOTICE HWC_x3(KERN_NOTICE);
529 break; 536 break;
530 /* Performance Monitor Overflow */ 537 /* Performance Monitor Overflow */
531 case (SEQSTAT_HWERRCAUSE_PERF_FLOW): 538 case (SEQSTAT_HWERRCAUSE_PERF_FLOW):
532 verbose_printk(KERN_NOTICE HWC_x12(KERN_NOTICE)); 539 strerror = KERN_NOTICE HWC_x12(KERN_NOTICE);
533 break; 540 break;
534 /* RAISE 5 instruction */ 541 /* RAISE 5 instruction */
535 case (SEQSTAT_HWERRCAUSE_RAISE_5): 542 case (SEQSTAT_HWERRCAUSE_RAISE_5):
@@ -546,7 +553,6 @@ asmlinkage void trap_c(struct pt_regs *fp)
546 * if we get here we hit a reserved one, so panic 553 * if we get here we hit a reserved one, so panic
547 */ 554 */
548 default: 555 default:
549 oops_in_progress = 1;
550 info.si_code = ILL_ILLPARAOP; 556 info.si_code = ILL_ILLPARAOP;
551 sig = SIGILL; 557 sig = SIGILL;
552 verbose_printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n", 558 verbose_printk(KERN_EMERG "Caught Unhandled Exception, code = %08lx\n",
@@ -557,6 +563,16 @@ asmlinkage void trap_c(struct pt_regs *fp)
557 563
558 BUG_ON(sig == 0); 564 BUG_ON(sig == 0);
559 565
566 /* If the fault was caused by a kernel thread, or interrupt handler
567 * we will kernel panic, so the system reboots.
568 */
569 if (kernel_mode_regs(fp) || (current && !current->mm)) {
570 console_verbose();
571 oops_in_progress = 1;
572 if (strerror)
573 verbose_printk(strerror);
574 }
575
560 if (sig != SIGTRAP) { 576 if (sig != SIGTRAP) {
561 dump_bfin_process(fp); 577 dump_bfin_process(fp);
562 dump_bfin_mem(fp); 578 dump_bfin_mem(fp);
@@ -606,8 +622,8 @@ asmlinkage void trap_c(struct pt_regs *fp)
606 if (ANOMALY_05000461 && trapnr == VEC_HWERR && !access_ok(VERIFY_READ, fp->pc, 8)) 622 if (ANOMALY_05000461 && trapnr == VEC_HWERR && !access_ok(VERIFY_READ, fp->pc, 8))
607 fp->pc = SAFE_USER_INSTRUCTION; 623 fp->pc = SAFE_USER_INSTRUCTION;
608 624
625 traps_done:
609 trace_buffer_restore(j); 626 trace_buffer_restore(j);
610 return;
611} 627}
612 628
613/* Typical exception handling routines */ 629/* Typical exception handling routines */
@@ -792,6 +808,18 @@ void dump_bfin_trace_buffer(void)
792} 808}
793EXPORT_SYMBOL(dump_bfin_trace_buffer); 809EXPORT_SYMBOL(dump_bfin_trace_buffer);
794 810
811#ifdef CONFIG_BUG
812int is_valid_bugaddr(unsigned long addr)
813{
814 unsigned short opcode;
815
816 if (!get_instruction(&opcode, (unsigned short *)addr))
817 return 0;
818
819 return opcode == BFIN_BUG_OPCODE;
820}
821#endif
822
795/* 823/*
796 * Checks to see if the address pointed to is either a 824 * Checks to see if the address pointed to is either a
797 * 16-bit CALL instruction, or a 32-bit CALL instruction 825 * 16-bit CALL instruction, or a 32-bit CALL instruction
diff --git a/arch/blackfin/kernel/vmlinux.lds.S b/arch/blackfin/kernel/vmlinux.lds.S
index 8b67167cb4f4..6ac307ca0d80 100644
--- a/arch/blackfin/kernel/vmlinux.lds.S
+++ b/arch/blackfin/kernel/vmlinux.lds.S
@@ -54,6 +54,7 @@ SECTIONS
54 SCHED_TEXT 54 SCHED_TEXT
55#endif 55#endif
56 LOCK_TEXT 56 LOCK_TEXT
57 IRQENTRY_TEXT
57 KPROBES_TEXT 58 KPROBES_TEXT
58 *(.text.*) 59 *(.text.*)
59 *(.fixup) 60 *(.fixup)
@@ -166,6 +167,20 @@ SECTIONS
166 } 167 }
167 PERCPU(4) 168 PERCPU(4)
168 SECURITY_INIT 169 SECURITY_INIT
170
171 /* we have to discard exit text and such at runtime, not link time, to
172 * handle embedded cross-section references (alt instructions, bug
173 * table, eh_frame, etc...)
174 */
175 .exit.text :
176 {
177 EXIT_TEXT
178 }
179 .exit.data :
180 {
181 EXIT_DATA
182 }
183
169 .init.ramfs : 184 .init.ramfs :
170 { 185 {
171 . = ALIGN(4); 186 . = ALIGN(4);
@@ -264,8 +279,6 @@ SECTIONS
264 279
265 /DISCARD/ : 280 /DISCARD/ :
266 { 281 {
267 EXIT_TEXT
268 EXIT_DATA
269 *(.exitcall.exit) 282 *(.exitcall.exit)
270 } 283 }
271} 284}
diff --git a/arch/blackfin/lib/checksum.c b/arch/blackfin/lib/checksum.c
index 762a7f02970a..cd605e7d8518 100644
--- a/arch/blackfin/lib/checksum.c
+++ b/arch/blackfin/lib/checksum.c
@@ -116,6 +116,7 @@ __sum16 ip_compute_csum(const void *buff, int len)
116{ 116{
117 return (__force __sum16)~do_csum(buff, len); 117 return (__force __sum16)~do_csum(buff, len);
118} 118}
119EXPORT_SYMBOL(ip_compute_csum);
119 120
120/* 121/*
121 * copy from fs while checksumming, otherwise like csum_partial 122 * copy from fs while checksumming, otherwise like csum_partial
@@ -130,6 +131,7 @@ csum_partial_copy_from_user(const void __user *src, void *dst,
130 memcpy(dst, (__force void *)src, len); 131 memcpy(dst, (__force void *)src, len);
131 return csum_partial(dst, len, sum); 132 return csum_partial(dst, len, sum);
132} 133}
134EXPORT_SYMBOL(csum_partial_copy_from_user);
133 135
134/* 136/*
135 * copy from ds while checksumming, otherwise like csum_partial 137 * copy from ds while checksumming, otherwise like csum_partial
diff --git a/arch/blackfin/mach-bf518/boards/ezbrd.c b/arch/blackfin/mach-bf518/boards/ezbrd.c
index 62bba09bcce6..1382f0382359 100644
--- a/arch/blackfin/mach-bf518/boards/ezbrd.c
+++ b/arch/blackfin/mach-bf518/boards/ezbrd.c
@@ -246,7 +246,7 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
246 .modalias = "m25p80", /* Name of spi_driver for this device */ 246 .modalias = "m25p80", /* Name of spi_driver for this device */
247 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */ 247 .max_speed_hz = 25000000, /* max spi clock (SCK) speed in HZ */
248 .bus_num = 0, /* Framework bus number */ 248 .bus_num = 0, /* Framework bus number */
249 .chip_select = 1, /* Framework chip select. On STAMP537 it is SPISSEL1*/ 249 .chip_select = 2, /* On BF518F-EZBRD it's SPI0_SSEL2 */
250 .platform_data = &bfin_spi_flash_data, 250 .platform_data = &bfin_spi_flash_data,
251 .controller_data = &spi_flash_chip_info, 251 .controller_data = &spi_flash_chip_info,
252 .mode = SPI_MODE_3, 252 .mode = SPI_MODE_3,
@@ -369,6 +369,11 @@ static struct resource bfin_spi0_resource[] = {
369 [1] = { 369 [1] = {
370 .start = CH_SPI0, 370 .start = CH_SPI0,
371 .end = CH_SPI0, 371 .end = CH_SPI0,
372 .flags = IORESOURCE_DMA,
373 },
374 [2] = {
375 .start = IRQ_SPI0,
376 .end = IRQ_SPI0,
372 .flags = IORESOURCE_IRQ, 377 .flags = IORESOURCE_IRQ,
373 }, 378 },
374}; 379};
@@ -399,6 +404,11 @@ static struct resource bfin_spi1_resource[] = {
399 [1] = { 404 [1] = {
400 .start = CH_SPI1, 405 .start = CH_SPI1,
401 .end = CH_SPI1, 406 .end = CH_SPI1,
407 .flags = IORESOURCE_DMA,
408 },
409 [2] = {
410 .start = IRQ_SPI1,
411 .end = IRQ_SPI1,
402 .flags = IORESOURCE_IRQ, 412 .flags = IORESOURCE_IRQ,
403 }, 413 },
404}; 414};
diff --git a/arch/blackfin/mach-bf527/boards/cm_bf527.c b/arch/blackfin/mach-bf527/boards/cm_bf527.c
index 6d6f9effa0bb..1eaf27ff722e 100644
--- a/arch/blackfin/mach-bf527/boards/cm_bf527.c
+++ b/arch/blackfin/mach-bf527/boards/cm_bf527.c
@@ -664,6 +664,11 @@ static struct resource bfin_spi0_resource[] = {
664 [1] = { 664 [1] = {
665 .start = CH_SPI, 665 .start = CH_SPI,
666 .end = CH_SPI, 666 .end = CH_SPI,
667 .flags = IORESOURCE_DMA,
668 },
669 [2] = {
670 .start = IRQ_SPI,
671 .end = IRQ_SPI,
667 .flags = IORESOURCE_IRQ, 672 .flags = IORESOURCE_IRQ,
668 }, 673 },
669}; 674};
diff --git a/arch/blackfin/mach-bf527/boards/ezbrd.c b/arch/blackfin/mach-bf527/boards/ezbrd.c
index 1435c5d38cd5..9f9c0005dcf1 100644
--- a/arch/blackfin/mach-bf527/boards/ezbrd.c
+++ b/arch/blackfin/mach-bf527/boards/ezbrd.c
@@ -467,6 +467,11 @@ static struct resource bfin_spi0_resource[] = {
467 [1] = { 467 [1] = {
468 .start = CH_SPI, 468 .start = CH_SPI,
469 .end = CH_SPI, 469 .end = CH_SPI,
470 .flags = IORESOURCE_DMA,
471 },
472 [2] = {
473 .start = IRQ_SPI,
474 .end = IRQ_SPI,
470 .flags = IORESOURCE_IRQ, 475 .flags = IORESOURCE_IRQ,
471 }, 476 },
472}; 477};
diff --git a/arch/blackfin/mach-bf527/boards/ezkit.c b/arch/blackfin/mach-bf527/boards/ezkit.c
index 147edd1eb1ad..3e5b7db6b065 100644
--- a/arch/blackfin/mach-bf527/boards/ezkit.c
+++ b/arch/blackfin/mach-bf527/boards/ezkit.c
@@ -723,6 +723,11 @@ static struct resource bfin_spi0_resource[] = {
723 [1] = { 723 [1] = {
724 .start = CH_SPI, 724 .start = CH_SPI,
725 .end = CH_SPI, 725 .end = CH_SPI,
726 .flags = IORESOURCE_DMA,
727 },
728 [2] = {
729 .start = IRQ_SPI,
730 .end = IRQ_SPI,
726 .flags = IORESOURCE_IRQ, 731 .flags = IORESOURCE_IRQ,
727 }, 732 },
728}; 733};
diff --git a/arch/blackfin/mach-bf533/boards/H8606.c b/arch/blackfin/mach-bf533/boards/H8606.c
index 895f213ea454..38cf8ffd6d74 100644
--- a/arch/blackfin/mach-bf533/boards/H8606.c
+++ b/arch/blackfin/mach-bf533/boards/H8606.c
@@ -266,6 +266,11 @@ static struct resource bfin_spi0_resource[] = {
266 [1] = { 266 [1] = {
267 .start = CH_SPI, 267 .start = CH_SPI,
268 .end = CH_SPI, 268 .end = CH_SPI,
269 .flags = IORESOURCE_DMA,
270 },
271 [2] = {
272 .start = IRQ_SPI,
273 .end = IRQ_SPI,
269 .flags = IORESOURCE_IRQ, 274 .flags = IORESOURCE_IRQ,
270 } 275 }
271}; 276};
diff --git a/arch/blackfin/mach-bf533/boards/blackstamp.c b/arch/blackfin/mach-bf533/boards/blackstamp.c
index 0765872a8ada..9ecdc361fa6d 100644
--- a/arch/blackfin/mach-bf533/boards/blackstamp.c
+++ b/arch/blackfin/mach-bf533/boards/blackstamp.c
@@ -162,6 +162,11 @@ static struct resource bfin_spi0_resource[] = {
162 [1] = { 162 [1] = {
163 .start = CH_SPI, 163 .start = CH_SPI,
164 .end = CH_SPI, 164 .end = CH_SPI,
165 .flags = IORESOURCE_DMA,
166 },
167 [2] = {
168 .start = IRQ_SPI,
169 .end = IRQ_SPI,
165 .flags = IORESOURCE_IRQ, 170 .flags = IORESOURCE_IRQ,
166 } 171 }
167}; 172};
diff --git a/arch/blackfin/mach-bf533/boards/cm_bf533.c b/arch/blackfin/mach-bf533/boards/cm_bf533.c
index a727e538fa28..1443e92d8b62 100644
--- a/arch/blackfin/mach-bf533/boards/cm_bf533.c
+++ b/arch/blackfin/mach-bf533/boards/cm_bf533.c
@@ -160,6 +160,11 @@ static struct resource bfin_spi0_resource[] = {
160 [1] = { 160 [1] = {
161 .start = CH_SPI, 161 .start = CH_SPI,
162 .end = CH_SPI, 162 .end = CH_SPI,
163 .flags = IORESOURCE_DMA,
164 },
165 [2] = {
166 .start = IRQ_SPI,
167 .end = IRQ_SPI,
163 .flags = IORESOURCE_IRQ, 168 .flags = IORESOURCE_IRQ,
164 } 169 }
165}; 170};
diff --git a/arch/blackfin/mach-bf533/boards/ezkit.c b/arch/blackfin/mach-bf533/boards/ezkit.c
index 842f1c9c2393..89a5ec4ca048 100644
--- a/arch/blackfin/mach-bf533/boards/ezkit.c
+++ b/arch/blackfin/mach-bf533/boards/ezkit.c
@@ -196,6 +196,11 @@ static struct resource bfin_spi0_resource[] = {
196 [1] = { 196 [1] = {
197 .start = CH_SPI, 197 .start = CH_SPI,
198 .end = CH_SPI, 198 .end = CH_SPI,
199 .flags = IORESOURCE_DMA,
200 },
201 [2] = {
202 .start = IRQ_SPI,
203 .end = IRQ_SPI,
199 .flags = IORESOURCE_IRQ, 204 .flags = IORESOURCE_IRQ,
200 } 205 }
201}; 206};
diff --git a/arch/blackfin/mach-bf533/boards/stamp.c b/arch/blackfin/mach-bf533/boards/stamp.c
index e19c565ade16..a68ade8a3ca2 100644
--- a/arch/blackfin/mach-bf533/boards/stamp.c
+++ b/arch/blackfin/mach-bf533/boards/stamp.c
@@ -299,6 +299,11 @@ static struct resource bfin_spi0_resource[] = {
299 [1] = { 299 [1] = {
300 .start = CH_SPI, 300 .start = CH_SPI,
301 .end = CH_SPI, 301 .end = CH_SPI,
302 .flags = IORESOURCE_DMA,
303 },
304 [2] = {
305 .start = IRQ_SPI,
306 .end = IRQ_SPI,
302 .flags = IORESOURCE_IRQ, 307 .flags = IORESOURCE_IRQ,
303 } 308 }
304}; 309};
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537.c b/arch/blackfin/mach-bf537/boards/cm_bf537.c
index 4fee19673127..2a87d1cfcd06 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537.c
@@ -182,8 +182,13 @@ static struct resource bfin_spi0_resource[] = {
182 [1] = { 182 [1] = {
183 .start = CH_SPI, 183 .start = CH_SPI,
184 .end = CH_SPI, 184 .end = CH_SPI,
185 .flags = IORESOURCE_DMA,
186 },
187 [2] = {
188 .start = IRQ_SPI,
189 .end = IRQ_SPI,
185 .flags = IORESOURCE_IRQ, 190 .flags = IORESOURCE_IRQ,
186 } 191 },
187}; 192};
188 193
189/* SPI controller data */ 194/* SPI controller data */
diff --git a/arch/blackfin/mach-bf537/boards/minotaur.c b/arch/blackfin/mach-bf537/boards/minotaur.c
index 3c159819e555..399f81da7b93 100644
--- a/arch/blackfin/mach-bf537/boards/minotaur.c
+++ b/arch/blackfin/mach-bf537/boards/minotaur.c
@@ -184,6 +184,11 @@ static struct resource bfin_spi0_resource[] = {
184 [1] = { 184 [1] = {
185 .start = CH_SPI, 185 .start = CH_SPI,
186 .end = CH_SPI, 186 .end = CH_SPI,
187 .flags = IORESOURCE_DMA,
188 },
189 [2] = {
190 .start = IRQ_SPI,
191 .end = IRQ_SPI,
187 .flags = IORESOURCE_IRQ, 192 .flags = IORESOURCE_IRQ,
188 }, 193 },
189}; 194};
diff --git a/arch/blackfin/mach-bf537/boards/pnav10.c b/arch/blackfin/mach-bf537/boards/pnav10.c
index 26707ce39f29..838240f151f5 100644
--- a/arch/blackfin/mach-bf537/boards/pnav10.c
+++ b/arch/blackfin/mach-bf537/boards/pnav10.c
@@ -398,8 +398,13 @@ static struct resource bfin_spi0_resource[] = {
398 [1] = { 398 [1] = {
399 .start = CH_SPI, 399 .start = CH_SPI,
400 .end = CH_SPI, 400 .end = CH_SPI,
401 .flags = IORESOURCE_DMA,
402 },
403 [2] = {
404 .start = IRQ_SPI,
405 .end = IRQ_SPI,
401 .flags = IORESOURCE_IRQ, 406 .flags = IORESOURCE_IRQ,
402 } 407 },
403}; 408};
404 409
405/* SPI controller data */ 410/* SPI controller data */
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index dfb5036f8a6b..ff7228caa7da 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -1345,7 +1345,7 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
1345#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE) 1345#if defined(CONFIG_PMIC_ADP5520) || defined(CONFIG_PMIC_ADP5520_MODULE)
1346 { 1346 {
1347 I2C_BOARD_INFO("pmic-adp5520", 0x32), 1347 I2C_BOARD_INFO("pmic-adp5520", 0x32),
1348 .irq = IRQ_PF7, 1348 .irq = IRQ_PG0,
1349 .platform_data = (void *)&adp5520_pdev_data, 1349 .platform_data = (void *)&adp5520_pdev_data,
1350 }, 1350 },
1351#endif 1351#endif
diff --git a/arch/blackfin/mach-bf537/boards/tcm_bf537.c b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
index 280574591201..e523e6e610d0 100644
--- a/arch/blackfin/mach-bf537/boards/tcm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
@@ -182,6 +182,11 @@ static struct resource bfin_spi0_resource[] = {
182 [1] = { 182 [1] = {
183 .start = CH_SPI, 183 .start = CH_SPI,
184 .end = CH_SPI, 184 .end = CH_SPI,
185 .flags = IORESOURCE_DMA,
186 },
187 [2] = {
188 .start = IRQ_SPI,
189 .end = IRQ_SPI,
185 .flags = IORESOURCE_IRQ, 190 .flags = IORESOURCE_IRQ,
186 } 191 }
187}; 192};
diff --git a/arch/blackfin/mach-bf538/boards/ezkit.c b/arch/blackfin/mach-bf538/boards/ezkit.c
index e37cb9378884..57695b4c3c09 100644
--- a/arch/blackfin/mach-bf538/boards/ezkit.c
+++ b/arch/blackfin/mach-bf538/boards/ezkit.c
@@ -352,6 +352,11 @@ static struct resource bfin_spi0_resource[] = {
352 [1] = { 352 [1] = {
353 .start = CH_SPI0, 353 .start = CH_SPI0,
354 .end = CH_SPI0, 354 .end = CH_SPI0,
355 .flags = IORESOURCE_DMA,
356 },
357 [2] = {
358 .start = IRQ_SPI0,
359 .end = IRQ_SPI0,
355 .flags = IORESOURCE_IRQ, 360 .flags = IORESOURCE_IRQ,
356 } 361 }
357}; 362};
@@ -366,6 +371,11 @@ static struct resource bfin_spi1_resource[] = {
366 [1] = { 371 [1] = {
367 .start = CH_SPI1, 372 .start = CH_SPI1,
368 .end = CH_SPI1, 373 .end = CH_SPI1,
374 .flags = IORESOURCE_DMA,
375 },
376 [2] = {
377 .start = IRQ_SPI1,
378 .end = IRQ_SPI1,
369 .flags = IORESOURCE_IRQ, 379 .flags = IORESOURCE_IRQ,
370 } 380 }
371}; 381};
diff --git a/arch/blackfin/mach-bf548/boards/cm_bf548.c b/arch/blackfin/mach-bf548/boards/cm_bf548.c
index f53ad682530b..f5a3c30a41bd 100644
--- a/arch/blackfin/mach-bf548/boards/cm_bf548.c
+++ b/arch/blackfin/mach-bf548/boards/cm_bf548.c
@@ -612,6 +612,11 @@ static struct resource bfin_spi0_resource[] = {
612 [1] = { 612 [1] = {
613 .start = CH_SPI0, 613 .start = CH_SPI0,
614 .end = CH_SPI0, 614 .end = CH_SPI0,
615 .flags = IORESOURCE_DMA,
616 },
617 [2] = {
618 .start = IRQ_SPI0,
619 .end = IRQ_SPI0,
615 .flags = IORESOURCE_IRQ, 620 .flags = IORESOURCE_IRQ,
616 } 621 }
617}; 622};
@@ -626,6 +631,11 @@ static struct resource bfin_spi1_resource[] = {
626 [1] = { 631 [1] = {
627 .start = CH_SPI1, 632 .start = CH_SPI1,
628 .end = CH_SPI1, 633 .end = CH_SPI1,
634 .flags = IORESOURCE_DMA,
635 },
636 [2] = {
637 .start = IRQ_SPI1,
638 .end = IRQ_SPI1,
629 .flags = IORESOURCE_IRQ, 639 .flags = IORESOURCE_IRQ,
630 } 640 }
631}; 641};
diff --git a/arch/blackfin/mach-bf548/boards/ezkit.c b/arch/blackfin/mach-bf548/boards/ezkit.c
index add5a17452ce..805a57b5e650 100644
--- a/arch/blackfin/mach-bf548/boards/ezkit.c
+++ b/arch/blackfin/mach-bf548/boards/ezkit.c
@@ -396,6 +396,8 @@ static struct platform_device bfin_sir3_device = {
396#endif 396#endif
397 397
398#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 398#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
399#include <linux/smsc911x.h>
400
399static struct resource smsc911x_resources[] = { 401static struct resource smsc911x_resources[] = {
400 { 402 {
401 .name = "smsc911x-memory", 403 .name = "smsc911x-memory",
@@ -409,11 +411,22 @@ static struct resource smsc911x_resources[] = {
409 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, 411 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
410 }, 412 },
411}; 413};
414
415static struct smsc911x_platform_config smsc911x_config = {
416 .flags = SMSC911X_USE_32BIT,
417 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
418 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
419 .phy_interface = PHY_INTERFACE_MODE_MII,
420};
421
412static struct platform_device smsc911x_device = { 422static struct platform_device smsc911x_device = {
413 .name = "smsc911x", 423 .name = "smsc911x",
414 .id = 0, 424 .id = 0,
415 .num_resources = ARRAY_SIZE(smsc911x_resources), 425 .num_resources = ARRAY_SIZE(smsc911x_resources),
416 .resource = smsc911x_resources, 426 .resource = smsc911x_resources,
427 .dev = {
428 .platform_data = &smsc911x_config,
429 },
417}; 430};
418#endif 431#endif
419 432
@@ -741,6 +754,11 @@ static struct resource bfin_spi0_resource[] = {
741 [1] = { 754 [1] = {
742 .start = CH_SPI0, 755 .start = CH_SPI0,
743 .end = CH_SPI0, 756 .end = CH_SPI0,
757 .flags = IORESOURCE_DMA,
758 },
759 [2] = {
760 .start = IRQ_SPI0,
761 .end = IRQ_SPI0,
744 .flags = IORESOURCE_IRQ, 762 .flags = IORESOURCE_IRQ,
745 } 763 }
746}; 764};
@@ -755,6 +773,11 @@ static struct resource bfin_spi1_resource[] = {
755 [1] = { 773 [1] = {
756 .start = CH_SPI1, 774 .start = CH_SPI1,
757 .end = CH_SPI1, 775 .end = CH_SPI1,
776 .flags = IORESOURCE_DMA,
777 },
778 [2] = {
779 .start = IRQ_SPI1,
780 .end = IRQ_SPI1,
758 .flags = IORESOURCE_IRQ, 781 .flags = IORESOURCE_IRQ,
759 } 782 }
760}; 783};
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index 0dd9685e5d53..0c9d72c5f5ba 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -177,8 +177,13 @@ static struct resource bfin_spi0_resource[] = {
177 [1] = { 177 [1] = {
178 .start = CH_SPI, 178 .start = CH_SPI,
179 .end = CH_SPI, 179 .end = CH_SPI,
180 .flags = IORESOURCE_DMA,
181 },
182 [2] = {
183 .start = IRQ_SPI,
184 .end = IRQ_SPI,
180 .flags = IORESOURCE_IRQ, 185 .flags = IORESOURCE_IRQ,
181 } 186 },
182}; 187};
183 188
184/* SPI controller data */ 189/* SPI controller data */
diff --git a/arch/blackfin/mach-bf561/boards/ezkit.c b/arch/blackfin/mach-bf561/boards/ezkit.c
index 0e2178a1aec5..b5ef7ff7b7bd 100644
--- a/arch/blackfin/mach-bf561/boards/ezkit.c
+++ b/arch/blackfin/mach-bf561/boards/ezkit.c
@@ -304,6 +304,11 @@ static struct resource bfin_spi0_resource[] = {
304 [1] = { 304 [1] = {
305 .start = CH_SPI, 305 .start = CH_SPI,
306 .end = CH_SPI, 306 .end = CH_SPI,
307 .flags = IORESOURCE_DMA,
308 },
309 [2] = {
310 .start = IRQ_SPI,
311 .end = IRQ_SPI,
307 .flags = IORESOURCE_IRQ, 312 .flags = IORESOURCE_IRQ,
308 } 313 }
309}; 314};
diff --git a/arch/blackfin/mach-common/cache-c.c b/arch/blackfin/mach-common/cache-c.c
index e6ab1f815123..b59ce3cb3807 100644
--- a/arch/blackfin/mach-common/cache-c.c
+++ b/arch/blackfin/mach-common/cache-c.c
@@ -16,9 +16,21 @@
16void blackfin_invalidate_entire_dcache(void) 16void blackfin_invalidate_entire_dcache(void)
17{ 17{
18 u32 dmem = bfin_read_DMEM_CONTROL(); 18 u32 dmem = bfin_read_DMEM_CONTROL();
19 SSYNC();
20 bfin_write_DMEM_CONTROL(dmem & ~0xc); 19 bfin_write_DMEM_CONTROL(dmem & ~0xc);
21 SSYNC(); 20 SSYNC();
22 bfin_write_DMEM_CONTROL(dmem); 21 bfin_write_DMEM_CONTROL(dmem);
23 SSYNC(); 22 SSYNC();
24} 23}
24
25/* Invalidate the Entire Instruction cache by
26 * clearing IMC bit
27 */
28void blackfin_invalidate_entire_icache(void)
29{
30 u32 imem = bfin_read_IMEM_CONTROL();
31 bfin_write_IMEM_CONTROL(imem & ~0x4);
32 SSYNC();
33 bfin_write_IMEM_CONTROL(imem);
34 SSYNC();
35}
36
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index da0558ad1b1a..31fa313e81cf 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -42,6 +42,7 @@
42#include <asm/thread_info.h> /* TIF_NEED_RESCHED */ 42#include <asm/thread_info.h> /* TIF_NEED_RESCHED */
43#include <asm/asm-offsets.h> 43#include <asm/asm-offsets.h>
44#include <asm/trace.h> 44#include <asm/trace.h>
45#include <asm/traps.h>
45 46
46#include <asm/context.S> 47#include <asm/context.S>
47 48
@@ -84,13 +85,15 @@ ENTRY(_ex_workaround_261)
84 if !cc jump _bfin_return_from_exception; 85 if !cc jump _bfin_return_from_exception;
85 /* fall through */ 86 /* fall through */
86 R7 = P4; 87 R7 = P4;
87 R6 = 0x26; /* Data CPLB Miss */ 88 R6 = VEC_CPLB_M; /* Data CPLB Miss */
88 cc = R6 == R7; 89 cc = R6 == R7;
89 if cc jump _ex_dcplb_miss (BP); 90 if cc jump _ex_dcplb_miss (BP);
90 R6 = 0x23; /* Data CPLB Miss */ 91#ifdef CONFIG_MPU
92 R6 = VEC_CPLB_VL; /* Data CPLB Violation */
91 cc = R6 == R7; 93 cc = R6 == R7;
92 if cc jump _ex_dcplb_viol (BP); 94 if cc jump _ex_dcplb_viol (BP);
93 /* Handle 0x23 Data CPLB Protection Violation 95#endif
96 /* Handle Data CPLB Protection Violation
94 * and Data CPLB Multiple Hits - Linux Trap Zero 97 * and Data CPLB Multiple Hits - Linux Trap Zero
95 */ 98 */
96 jump _ex_trap_c; 99 jump _ex_trap_c;
@@ -270,7 +273,7 @@ ENTRY(_bfin_return_from_exception)
270 r6.l = lo(SEQSTAT_EXCAUSE); 273 r6.l = lo(SEQSTAT_EXCAUSE);
271 r6.h = hi(SEQSTAT_EXCAUSE); 274 r6.h = hi(SEQSTAT_EXCAUSE);
272 r7 = r7 & r6; 275 r7 = r7 & r6;
273 r6 = 0x25; 276 r6 = VEC_UNCOV;
274 CC = R7 == R6; 277 CC = R7 == R6;
275 if CC JUMP _double_fault; 278 if CC JUMP _double_fault;
276#endif 279#endif
@@ -1605,6 +1608,7 @@ ENTRY(_sys_call_table)
1605 .long _sys_inotify_init1 /* 365 */ 1608 .long _sys_inotify_init1 /* 365 */
1606 .long _sys_preadv 1609 .long _sys_preadv
1607 .long _sys_pwritev 1610 .long _sys_pwritev
1611 .long _sys_rt_tgsigqueueinfo
1608 1612
1609 .rept NR_syscalls-(.-_sys_call_table)/4 1613 .rept NR_syscalls-(.-_sys_call_table)/4
1610 .long _sys_ni_syscall 1614 .long _sys_ni_syscall
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index 3b8ebaee77f2..61840059dfac 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -144,7 +144,7 @@ static void ipi_call_function(unsigned int cpu, struct ipi_message *msg)
144 144
145static irqreturn_t ipi_handler(int irq, void *dev_instance) 145static irqreturn_t ipi_handler(int irq, void *dev_instance)
146{ 146{
147 struct ipi_message *msg, *mg; 147 struct ipi_message *msg;
148 struct ipi_message_queue *msg_queue; 148 struct ipi_message_queue *msg_queue;
149 unsigned int cpu = smp_processor_id(); 149 unsigned int cpu = smp_processor_id();
150 150
@@ -154,7 +154,8 @@ static irqreturn_t ipi_handler(int irq, void *dev_instance)
154 msg_queue->count++; 154 msg_queue->count++;
155 155
156 spin_lock(&msg_queue->lock); 156 spin_lock(&msg_queue->lock);
157 list_for_each_entry_safe(msg, mg, &msg_queue->head, list) { 157 while (!list_empty(&msg_queue->head)) {
158 msg = list_entry(msg_queue->head.next, typeof(*msg), list);
158 list_del(&msg->list); 159 list_del(&msg->list);
159 switch (msg->type) { 160 switch (msg->type) {
160 case BFIN_IPI_RESCHEDULE: 161 case BFIN_IPI_RESCHEDULE:
@@ -221,7 +222,7 @@ int smp_call_function(void (*func)(void *info), void *info, int wait)
221 for_each_cpu_mask(cpu, callmap) { 222 for_each_cpu_mask(cpu, callmap) {
222 msg_queue = &per_cpu(ipi_msg_queue, cpu); 223 msg_queue = &per_cpu(ipi_msg_queue, cpu);
223 spin_lock_irqsave(&msg_queue->lock, flags); 224 spin_lock_irqsave(&msg_queue->lock, flags);
224 list_add(&msg->list, &msg_queue->head); 225 list_add_tail(&msg->list, &msg_queue->head);
225 spin_unlock_irqrestore(&msg_queue->lock, flags); 226 spin_unlock_irqrestore(&msg_queue->lock, flags);
226 platform_send_ipi_cpu(cpu); 227 platform_send_ipi_cpu(cpu);
227 } 228 }
@@ -261,7 +262,7 @@ int smp_call_function_single(int cpuid, void (*func) (void *info), void *info,
261 262
262 msg_queue = &per_cpu(ipi_msg_queue, cpu); 263 msg_queue = &per_cpu(ipi_msg_queue, cpu);
263 spin_lock_irqsave(&msg_queue->lock, flags); 264 spin_lock_irqsave(&msg_queue->lock, flags);
264 list_add(&msg->list, &msg_queue->head); 265 list_add_tail(&msg->list, &msg_queue->head);
265 spin_unlock_irqrestore(&msg_queue->lock, flags); 266 spin_unlock_irqrestore(&msg_queue->lock, flags);
266 platform_send_ipi_cpu(cpu); 267 platform_send_ipi_cpu(cpu);
267 268
@@ -292,7 +293,7 @@ void smp_send_reschedule(int cpu)
292 293
293 msg_queue = &per_cpu(ipi_msg_queue, cpu); 294 msg_queue = &per_cpu(ipi_msg_queue, cpu);
294 spin_lock_irqsave(&msg_queue->lock, flags); 295 spin_lock_irqsave(&msg_queue->lock, flags);
295 list_add(&msg->list, &msg_queue->head); 296 list_add_tail(&msg->list, &msg_queue->head);
296 spin_unlock_irqrestore(&msg_queue->lock, flags); 297 spin_unlock_irqrestore(&msg_queue->lock, flags);
297 platform_send_ipi_cpu(cpu); 298 platform_send_ipi_cpu(cpu);
298 299
@@ -320,7 +321,7 @@ void smp_send_stop(void)
320 for_each_cpu_mask(cpu, callmap) { 321 for_each_cpu_mask(cpu, callmap) {
321 msg_queue = &per_cpu(ipi_msg_queue, cpu); 322 msg_queue = &per_cpu(ipi_msg_queue, cpu);
322 spin_lock_irqsave(&msg_queue->lock, flags); 323 spin_lock_irqsave(&msg_queue->lock, flags);
323 list_add(&msg->list, &msg_queue->head); 324 list_add_tail(&msg->list, &msg_queue->head);
324 spin_unlock_irqrestore(&msg_queue->lock, flags); 325 spin_unlock_irqrestore(&msg_queue->lock, flags);
325 platform_send_ipi_cpu(cpu); 326 platform_send_ipi_cpu(cpu);
326 } 327 }
@@ -468,6 +469,17 @@ void smp_icache_flush_range_others(unsigned long start, unsigned long end)
468} 469}
469EXPORT_SYMBOL_GPL(smp_icache_flush_range_others); 470EXPORT_SYMBOL_GPL(smp_icache_flush_range_others);
470 471
472#ifdef __ARCH_SYNC_CORE_ICACHE
473void resync_core_icache(void)
474{
475 unsigned int cpu = get_cpu();
476 blackfin_invalidate_entire_icache();
477 ++per_cpu(cpu_data, cpu).icache_invld_count;
478 put_cpu();
479}
480EXPORT_SYMBOL(resync_core_icache);
481#endif
482
471#ifdef __ARCH_SYNC_CORE_DCACHE 483#ifdef __ARCH_SYNC_CORE_DCACHE
472unsigned long barrier_mask __attribute__ ((__section__(".l2.bss"))); 484unsigned long barrier_mask __attribute__ ((__section__(".l2.bss")));
473 485
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index f014cc21e813..011c5bddba6a 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -803,7 +803,7 @@ static void bfin_spi_pump_transfers(unsigned long data)
803 drv_data->rx, drv_data->len_in_bytes); 803 drv_data->rx, drv_data->len_in_bytes);
804 804
805 /* invalidate caches, if needed */ 805 /* invalidate caches, if needed */
806 if (bfin_addr_dcachable((unsigned long) drv_data->rx)) 806 if (bfin_addr_dcacheable((unsigned long) drv_data->rx))
807 invalidate_dcache_range((unsigned long) drv_data->rx, 807 invalidate_dcache_range((unsigned long) drv_data->rx,
808 (unsigned long) (drv_data->rx + 808 (unsigned long) (drv_data->rx +
809 drv_data->len_in_bytes)); 809 drv_data->len_in_bytes));
@@ -816,7 +816,7 @@ static void bfin_spi_pump_transfers(unsigned long data)
816 dev_dbg(&drv_data->pdev->dev, "doing DMA out.\n"); 816 dev_dbg(&drv_data->pdev->dev, "doing DMA out.\n");
817 817
818 /* flush caches, if needed */ 818 /* flush caches, if needed */
819 if (bfin_addr_dcachable((unsigned long) drv_data->tx)) 819 if (bfin_addr_dcacheable((unsigned long) drv_data->tx))
820 flush_dcache_range((unsigned long) drv_data->tx, 820 flush_dcache_range((unsigned long) drv_data->tx,
821 (unsigned long) (drv_data->tx + 821 (unsigned long) (drv_data->tx +
822 drv_data->len_in_bytes)); 822 drv_data->len_in_bytes));