aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32
diff options
context:
space:
mode:
Diffstat (limited to 'arch/avr32')
-rw-r--r--arch/avr32/Kconfig1
-rw-r--r--arch/avr32/include/asm/atomic.h60
-rw-r--r--arch/avr32/include/asm/delay.h27
-rw-r--r--arch/avr32/include/asm/ptrace.h2
-rw-r--r--arch/avr32/kernel/module.c20
-rw-r--r--arch/avr32/kernel/setup.c10
-rw-r--r--arch/avr32/kernel/syscall_table.S2
-rw-r--r--arch/avr32/mach-at32ap/extint.c2
-rw-r--r--arch/avr32/mach-at32ap/hsmc.c2
-rw-r--r--arch/avr32/mach-at32ap/intc.c2
-rw-r--r--arch/avr32/mach-at32ap/pio.c2
11 files changed, 37 insertions, 93 deletions
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index e9d689b7c83..197e96f7040 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -10,6 +10,7 @@ config AVR32
10 select GENERIC_IRQ_PROBE 10 select GENERIC_IRQ_PROBE
11 select HARDIRQS_SW_RESEND 11 select HARDIRQS_SW_RESEND
12 select GENERIC_IRQ_SHOW 12 select GENERIC_IRQ_SHOW
13 select ARCH_HAVE_NMI_SAFE_CMPXCHG
13 help 14 help
14 AVR32 is a high-performance 32-bit RISC microprocessor core, 15 AVR32 is a high-performance 32-bit RISC microprocessor core,
15 designed for cost-sensitive embedded applications, with particular 16 designed for cost-sensitive embedded applications, with particular
diff --git a/arch/avr32/include/asm/atomic.h b/arch/avr32/include/asm/atomic.h
index bbce6a1c6bb..e0ac2631c87 100644
--- a/arch/avr32/include/asm/atomic.h
+++ b/arch/avr32/include/asm/atomic.h
@@ -78,70 +78,63 @@ static inline int atomic_add_return(int i, atomic_t *v)
78/* 78/*
79 * atomic_sub_unless - sub unless the number is a given value 79 * atomic_sub_unless - sub unless the number is a given value
80 * @v: pointer of type atomic_t 80 * @v: pointer of type atomic_t
81 * @a: the amount to add to v... 81 * @a: the amount to subtract from v...
82 * @u: ...unless v is equal to u. 82 * @u: ...unless v is equal to u.
83 * 83 *
84 * If the atomic value v is not equal to u, this function subtracts a 84 * Atomically subtract @a from @v, so long as it was not @u.
85 * from v, and returns non zero. If v is equal to u then it returns 85 * Returns the old value of @v.
86 * zero. This is done as an atomic operation.
87*/ 86*/
88static inline int atomic_sub_unless(atomic_t *v, int a, int u) 87static inline void atomic_sub_unless(atomic_t *v, int a, int u)
89{ 88{
90 int tmp, result = 0; 89 int tmp;
91 90
92 asm volatile( 91 asm volatile(
93 "/* atomic_sub_unless */\n" 92 "/* atomic_sub_unless */\n"
94 "1: ssrf 5\n" 93 "1: ssrf 5\n"
95 " ld.w %0, %3\n" 94 " ld.w %0, %2\n"
96 " cp.w %0, %5\n" 95 " cp.w %0, %4\n"
97 " breq 1f\n" 96 " breq 1f\n"
98 " sub %0, %4\n" 97 " sub %0, %3\n"
99 " stcond %2, %0\n" 98 " stcond %1, %0\n"
100 " brne 1b\n" 99 " brne 1b\n"
101 " mov %1, 1\n"
102 "1:" 100 "1:"
103 : "=&r"(tmp), "=&r"(result), "=o"(v->counter) 101 : "=&r"(tmp), "=o"(v->counter)
104 : "m"(v->counter), "rKs21"(a), "rKs21"(u), "1"(result) 102 : "m"(v->counter), "rKs21"(a), "rKs21"(u)
105 : "cc", "memory"); 103 : "cc", "memory");
106
107 return result;
108} 104}
109 105
110/* 106/*
111 * atomic_add_unless - add unless the number is a given value 107 * __atomic_add_unless - add unless the number is a given value
112 * @v: pointer of type atomic_t 108 * @v: pointer of type atomic_t
113 * @a: the amount to add to v... 109 * @a: the amount to add to v...
114 * @u: ...unless v is equal to u. 110 * @u: ...unless v is equal to u.
115 * 111 *
116 * If the atomic value v is not equal to u, this function adds a to v, 112 * Atomically adds @a to @v, so long as it was not @u.
117 * and returns non zero. If v is equal to u then it returns zero. This 113 * Returns the old value of @v.
118 * is done as an atomic operation.
119*/ 114*/
120static inline int atomic_add_unless(atomic_t *v, int a, int u) 115static inline int __atomic_add_unless(atomic_t *v, int a, int u)
121{ 116{
122 int tmp, result; 117 int tmp, old = atomic_read(v);
123 118
124 if (__builtin_constant_p(a) && (a >= -1048575) && (a <= 1048576)) 119 if (__builtin_constant_p(a) && (a >= -1048575) && (a <= 1048576))
125 result = atomic_sub_unless(v, -a, u); 120 atomic_sub_unless(v, -a, u);
126 else { 121 else {
127 result = 0;
128 asm volatile( 122 asm volatile(
129 "/* atomic_add_unless */\n" 123 "/* __atomic_add_unless */\n"
130 "1: ssrf 5\n" 124 "1: ssrf 5\n"
131 " ld.w %0, %3\n" 125 " ld.w %0, %2\n"
132 " cp.w %0, %5\n" 126 " cp.w %0, %4\n"
133 " breq 1f\n" 127 " breq 1f\n"
134 " add %0, %4\n" 128 " add %0, %3\n"
135 " stcond %2, %0\n" 129 " stcond %1, %0\n"
136 " brne 1b\n" 130 " brne 1b\n"
137 " mov %1, 1\n"
138 "1:" 131 "1:"
139 : "=&r"(tmp), "=&r"(result), "=o"(v->counter) 132 : "=&r"(tmp), "=o"(v->counter)
140 : "m"(v->counter), "r"(a), "ir"(u), "1"(result) 133 : "m"(v->counter), "r"(a), "ir"(u)
141 : "cc", "memory"); 134 : "cc", "memory");
142 } 135 }
143 136
144 return result; 137 return old;
145} 138}
146 139
147/* 140/*
@@ -188,7 +181,6 @@ static inline int atomic_sub_if_positive(int i, atomic_t *v)
188#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0) 181#define atomic_dec_and_test(v) (atomic_sub_return(1, v) == 0)
189#define atomic_add_negative(i, v) (atomic_add_return(i, v) < 0) 182#define atomic_add_negative(i, v) (atomic_add_return(i, v) < 0)
190 183
191#define atomic_inc_not_zero(v) atomic_add_unless(v, 1, 0)
192#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v) 184#define atomic_dec_if_positive(v) atomic_sub_if_positive(1, v)
193 185
194#define smp_mb__before_atomic_dec() barrier() 186#define smp_mb__before_atomic_dec() barrier()
@@ -196,6 +188,4 @@ static inline int atomic_sub_if_positive(int i, atomic_t *v)
196#define smp_mb__before_atomic_inc() barrier() 188#define smp_mb__before_atomic_inc() barrier()
197#define smp_mb__after_atomic_inc() barrier() 189#define smp_mb__after_atomic_inc() barrier()
198 190
199#include <asm-generic/atomic-long.h>
200
201#endif /* __ASM_AVR32_ATOMIC_H */ 191#endif /* __ASM_AVR32_ATOMIC_H */
diff --git a/arch/avr32/include/asm/delay.h b/arch/avr32/include/asm/delay.h
index a0ed9a9839a..9670e127b7b 100644
--- a/arch/avr32/include/asm/delay.h
+++ b/arch/avr32/include/asm/delay.h
@@ -1,26 +1 @@
1#ifndef __ASM_AVR32_DELAY_H #include <asm-generic/delay.h>
2#define __ASM_AVR32_DELAY_H
3
4/*
5 * Copyright (C) 1993 Linus Torvalds
6 *
7 * Delay routines calling functions in arch/avr32/lib/delay.c
8 */
9
10extern void __bad_udelay(void);
11extern void __bad_ndelay(void);
12
13extern void __udelay(unsigned long usecs);
14extern void __ndelay(unsigned long nsecs);
15extern void __const_udelay(unsigned long xloops);
16extern void __delay(unsigned long loops);
17
18#define udelay(n) (__builtin_constant_p(n) ? \
19 ((n) > 20000 ? __bad_udelay() : __const_udelay((n) * 0x10c6ul)) : \
20 __udelay(n))
21
22#define ndelay(n) (__builtin_constant_p(n) ? \
23 ((n) > 20000 ? __bad_ndelay() : __const_udelay((n) * 5ul)) : \
24 __ndelay(n))
25
26#endif /* __ASM_AVR32_DELAY_H */
diff --git a/arch/avr32/include/asm/ptrace.h b/arch/avr32/include/asm/ptrace.h
index e53dd0d900f..c67a007f672 100644
--- a/arch/avr32/include/asm/ptrace.h
+++ b/arch/avr32/include/asm/ptrace.h
@@ -132,8 +132,6 @@ struct pt_regs {
132#define instruction_pointer(regs) ((regs)->pc) 132#define instruction_pointer(regs) ((regs)->pc)
133#define profile_pc(regs) instruction_pointer(regs) 133#define profile_pc(regs) instruction_pointer(regs)
134 134
135extern void show_regs (struct pt_regs *);
136
137static __inline__ int valid_user_regs(struct pt_regs *regs) 135static __inline__ int valid_user_regs(struct pt_regs *regs)
138{ 136{
139 /* 137 /*
diff --git a/arch/avr32/kernel/module.c b/arch/avr32/kernel/module.c
index a727f54d64d..596f7305d93 100644
--- a/arch/avr32/kernel/module.c
+++ b/arch/avr32/kernel/module.c
@@ -19,13 +19,6 @@
19#include <linux/moduleloader.h> 19#include <linux/moduleloader.h>
20#include <linux/vmalloc.h> 20#include <linux/vmalloc.h>
21 21
22void *module_alloc(unsigned long size)
23{
24 if (size == 0)
25 return NULL;
26 return vmalloc(size);
27}
28
29void module_free(struct module *mod, void *module_region) 22void module_free(struct module *mod, void *module_region)
30{ 23{
31 vfree(mod->arch.syminfo); 24 vfree(mod->arch.syminfo);
@@ -299,15 +292,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
299 return ret; 292 return ret;
300} 293}
301 294
302int apply_relocate(Elf32_Shdr *sechdrs, const char *strtab,
303 unsigned int symindex, unsigned int relindex,
304 struct module *module)
305{
306 printk(KERN_ERR "module %s: REL relocations are not supported\n",
307 module->name);
308 return -ENOEXEC;
309}
310
311int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs, 295int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
312 struct module *module) 296 struct module *module)
313{ 297{
@@ -316,7 +300,3 @@ int module_finalize(const Elf_Ehdr *hdr, const Elf_Shdr *sechdrs,
316 300
317 return 0; 301 return 0;
318} 302}
319
320void module_arch_cleanup(struct module *module)
321{
322}
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c
index bb0974cce4a..b4247f47806 100644
--- a/arch/avr32/kernel/setup.c
+++ b/arch/avr32/kernel/setup.c
@@ -444,7 +444,7 @@ static unsigned long __init
444find_bootmap_pfn(const struct resource *mem) 444find_bootmap_pfn(const struct resource *mem)
445{ 445{
446 unsigned long bootmap_pages, bootmap_len; 446 unsigned long bootmap_pages, bootmap_len;
447 unsigned long node_pages = PFN_UP(mem->end - mem->start + 1); 447 unsigned long node_pages = PFN_UP(resource_size(mem));
448 unsigned long bootmap_start; 448 unsigned long bootmap_start;
449 449
450 bootmap_pages = bootmem_bootmap_pages(node_pages); 450 bootmap_pages = bootmem_bootmap_pages(node_pages);
@@ -541,10 +541,10 @@ static void __init setup_bootmem(void)
541 */ 541 */
542 if (res->start >= PFN_PHYS(first_pfn) 542 if (res->start >= PFN_PHYS(first_pfn)
543 && res->end < PFN_PHYS(max_pfn)) 543 && res->end < PFN_PHYS(max_pfn))
544 reserve_bootmem_node( 544 reserve_bootmem_node(NODE_DATA(node),
545 NODE_DATA(node), res->start, 545 res->start,
546 res->end - res->start + 1, 546 resource_size(res),
547 BOOTMEM_DEFAULT); 547 BOOTMEM_DEFAULT);
548 } 548 }
549 549
550 node_set_online(node); 550 node_set_online(node);
diff --git a/arch/avr32/kernel/syscall_table.S b/arch/avr32/kernel/syscall_table.S
index c7fd394d28a..6eba53530d1 100644
--- a/arch/avr32/kernel/syscall_table.S
+++ b/arch/avr32/kernel/syscall_table.S
@@ -158,7 +158,7 @@ sys_call_table:
158 .long sys_sched_rr_get_interval 158 .long sys_sched_rr_get_interval
159 .long sys_nanosleep 159 .long sys_nanosleep
160 .long sys_poll 160 .long sys_poll
161 .long sys_nfsservctl /* 145 */ 161 .long sys_ni_syscall /* 145 was nfsservctl */
162 .long sys_setresgid 162 .long sys_setresgid
163 .long sys_getresgid 163 .long sys_getresgid
164 .long sys_prctl 164 .long sys_prctl
diff --git a/arch/avr32/mach-at32ap/extint.c b/arch/avr32/mach-at32ap/extint.c
index fbc2aeaebdd..cfb298d6630 100644
--- a/arch/avr32/mach-at32ap/extint.c
+++ b/arch/avr32/mach-at32ap/extint.c
@@ -204,7 +204,7 @@ static int __init eic_probe(struct platform_device *pdev)
204 } 204 }
205 205
206 eic->first_irq = EIM_IRQ_BASE + 32 * pdev->id; 206 eic->first_irq = EIM_IRQ_BASE + 32 * pdev->id;
207 eic->regs = ioremap(regs->start, regs->end - regs->start + 1); 207 eic->regs = ioremap(regs->start, resource_size(regs));
208 if (!eic->regs) { 208 if (!eic->regs) {
209 dev_dbg(&pdev->dev, "failed to map regs\n"); 209 dev_dbg(&pdev->dev, "failed to map regs\n");
210 goto err_ioremap; 210 goto err_ioremap;
diff --git a/arch/avr32/mach-at32ap/hsmc.c b/arch/avr32/mach-at32ap/hsmc.c
index f7672d3e86b..f66245e6e63 100644
--- a/arch/avr32/mach-at32ap/hsmc.c
+++ b/arch/avr32/mach-at32ap/hsmc.c
@@ -245,7 +245,7 @@ static int hsmc_probe(struct platform_device *pdev)
245 245
246 hsmc->pclk = pclk; 246 hsmc->pclk = pclk;
247 hsmc->mck = mck; 247 hsmc->mck = mck;
248 hsmc->regs = ioremap(regs->start, regs->end - regs->start + 1); 248 hsmc->regs = ioremap(regs->start, resource_size(regs));
249 if (!hsmc->regs) 249 if (!hsmc->regs)
250 goto out_disable_clocks; 250 goto out_disable_clocks;
251 251
diff --git a/arch/avr32/mach-at32ap/intc.c b/arch/avr32/mach-at32ap/intc.c
index c9ac2f8e8f6..258682bc127 100644
--- a/arch/avr32/mach-at32ap/intc.c
+++ b/arch/avr32/mach-at32ap/intc.c
@@ -107,7 +107,7 @@ void __init init_IRQ(void)
107 107
108 clk_enable(pclk); 108 clk_enable(pclk);
109 109
110 intc0.regs = ioremap(regs->start, regs->end - regs->start + 1); 110 intc0.regs = ioremap(regs->start, resource_size(regs));
111 if (!intc0.regs) { 111 if (!intc0.regs) {
112 printk(KERN_EMERG "intc: failed to map registers (0x%08lx)\n", 112 printk(KERN_EMERG "intc: failed to map registers (0x%08lx)\n",
113 (unsigned long)regs->start); 113 (unsigned long)regs->start);
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index 2e0aa853a4b..9b39dea6682 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -461,7 +461,7 @@ void __init at32_init_pio(struct platform_device *pdev)
461 clk_enable(pio->clk); 461 clk_enable(pio->clk);
462 462
463 pio->pdev = pdev; 463 pio->pdev = pdev;
464 pio->regs = ioremap(regs->start, regs->end - regs->start + 1); 464 pio->regs = ioremap(regs->start, resource_size(regs));
465 465
466 /* start with irqs disabled and acked */ 466 /* start with irqs disabled and acked */
467 pio_writel(pio, IDR, ~0UL); 467 pio_writel(pio, IDR, ~0UL);