Disintegrate asm/system.h for AVR32
authorDavid Howells <dhowells@redhat.com>
Wed, 28 Mar 2012 17:30:01 +0000 (18:30 +0100)
committerDavid Howells <dhowells@redhat.com>
Wed, 28 Mar 2012 17:30:01 +0000 (18:30 +0100)
Disintegrate asm/system.h for AVR32.  This has not been compiled at all.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Haavard Skinnemoen <hskinnemoen@gmail.com>

arch/avr32/include/asm/atomic.h
arch/avr32/include/asm/barrier.h [new file with mode: 0644]
arch/avr32/include/asm/bitops.h
arch/avr32/include/asm/bug.h
arch/avr32/include/asm/cmpxchg.h [new file with mode: 0644]
arch/avr32/include/asm/exec.h [new file with mode: 0644]
arch/avr32/include/asm/special_insns.h [new file with mode: 0644]
arch/avr32/include/asm/switch_to.h [new file with mode: 0644]
arch/avr32/include/asm/system.h
arch/avr32/mach-at32ap/cpufreq.c
arch/avr32/oprofile/op_model_avr32.c

index e0ac2631c87e3166d52c13d879c622f0bab75c4e..61407279208ab43b8af98f410ce3e56a88ce198e 100644 (file)
@@ -15,7 +15,7 @@
 #define __ASM_AVR32_ATOMIC_H
 
 #include <linux/types.h>
-#include <asm/system.h>
+#include <asm/cmpxchg.h>
 
 #define ATOMIC_INIT(i)  { (i) }
 
diff --git a/arch/avr32/include/asm/barrier.h b/arch/avr32/include/asm/barrier.h
new file mode 100644 (file)
index 0000000..808001c
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_AVR32_BARRIER_H
+#define __ASM_AVR32_BARRIER_H
+
+#define mb()                   asm volatile("" : : : "memory")
+#define rmb()                  mb()
+#define wmb()                  asm volatile("sync 0" : : : "memory")
+#define read_barrier_depends()  do { } while(0)
+#define set_mb(var, value)      do { var = value; mb(); } while(0)
+
+#ifdef CONFIG_SMP
+# error "The AVR32 port does not support SMP"
+#else
+# define smp_mb()              barrier()
+# define smp_rmb()             barrier()
+# define smp_wmb()             barrier()
+# define smp_read_barrier_depends() do { } while(0)
+#endif
+
+
+#endif /* __ASM_AVR32_BARRIER_H */
index b70c19bab63af141d8815e1ec76fb96f3b06b63b..ebe7ad3f490b3eb56668ffece9b3306c78a98964 100644 (file)
@@ -13,7 +13,6 @@
 #endif
 
 #include <asm/byteorder.h>
-#include <asm/system.h>
 
 /*
  * clear_bit() doesn't provide any barrier for the compiler
index 2aa373cc61b58e7f7c4807837a60a0c687269f27..85a92d099adbf4edb735d07b8755809c50dbe267 100644 (file)
@@ -70,4 +70,9 @@
 
 #include <asm-generic/bug.h>
 
+struct pt_regs;
+void die(const char *str, struct pt_regs *regs, long err);
+void _exception(long signr, struct pt_regs *regs, int code,
+               unsigned long addr);
+
 #endif /* __ASM_AVR32_BUG_H */
diff --git a/arch/avr32/include/asm/cmpxchg.h b/arch/avr32/include/asm/cmpxchg.h
new file mode 100644 (file)
index 0000000..962a6ae
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Atomic operations that C can't guarantee us.  Useful for
+ * resource counting etc.
+ *
+ * But use these as seldom as possible since they are slower than
+ * regular operations.
+ *
+ * Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_AVR32_CMPXCHG_H
+#define __ASM_AVR32_CMPXCHG_H
+
+#define xchg(ptr,x) \
+       ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
+
+extern void __xchg_called_with_bad_pointer(void);
+
+static inline unsigned long xchg_u32(u32 val, volatile u32 *m)
+{
+       u32 ret;
+
+       asm volatile("xchg %[ret], %[m], %[val]"
+                       : [ret] "=&r"(ret), "=m"(*m)
+                       : "m"(*m), [m] "r"(m), [val] "r"(val)
+                       : "memory");
+       return ret;
+}
+
+static inline unsigned long __xchg(unsigned long x,
+                                      volatile void *ptr,
+                                      int size)
+{
+       switch(size) {
+       case 4:
+               return xchg_u32(x, ptr);
+       default:
+               __xchg_called_with_bad_pointer();
+               return x;
+       }
+}
+
+static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
+                                         unsigned long new)
+{
+       __u32 ret;
+
+       asm volatile(
+               "1:     ssrf    5\n"
+               "       ld.w    %[ret], %[m]\n"
+               "       cp.w    %[ret], %[old]\n"
+               "       brne    2f\n"
+               "       stcond  %[m], %[new]\n"
+               "       brne    1b\n"
+               "2:\n"
+               : [ret] "=&r"(ret), [m] "=m"(*m)
+               : "m"(m), [old] "ir"(old), [new] "r"(new)
+               : "memory", "cc");
+       return ret;
+}
+
+extern unsigned long __cmpxchg_u64_unsupported_on_32bit_kernels(
+        volatile int * m, unsigned long old, unsigned long new);
+#define __cmpxchg_u64 __cmpxchg_u64_unsupported_on_32bit_kernels
+
+/* This function doesn't exist, so you'll get a linker error
+   if something tries to do an invalid cmpxchg().  */
+extern void __cmpxchg_called_with_bad_pointer(void);
+
+#define __HAVE_ARCH_CMPXCHG 1
+
+static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
+                                     unsigned long new, int size)
+{
+       switch (size) {
+       case 4:
+               return __cmpxchg_u32(ptr, old, new);
+       case 8:
+               return __cmpxchg_u64(ptr, old, new);
+       }
+
+       __cmpxchg_called_with_bad_pointer();
+       return old;
+}
+
+#define cmpxchg(ptr, old, new)                                 \
+       ((typeof(*(ptr)))__cmpxchg((ptr), (unsigned long)(old), \
+                                  (unsigned long)(new),        \
+                                  sizeof(*(ptr))))
+
+#include <asm-generic/cmpxchg-local.h>
+
+static inline unsigned long __cmpxchg_local(volatile void *ptr,
+                                     unsigned long old,
+                                     unsigned long new, int size)
+{
+       switch (size) {
+       case 4:
+               return __cmpxchg_u32(ptr, old, new);
+       default:
+               return __cmpxchg_local_generic(ptr, old, new, size);
+       }
+
+       return old;
+}
+
+#define cmpxchg_local(ptr, old, new)                                   \
+       ((typeof(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(old),   \
+                                  (unsigned long)(new),                \
+                                  sizeof(*(ptr))))
+
+#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
+
+#endif /* __ASM_AVR32_CMPXCHG_H */
diff --git a/arch/avr32/include/asm/exec.h b/arch/avr32/include/asm/exec.h
new file mode 100644 (file)
index 0000000..f467be8
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_AVR32_EXEC_H
+#define __ASM_AVR32_EXEC_H
+
+#define arch_align_stack(x)    (x)
+
+#endif /* __ASM_AVR32_EXEC_H */
diff --git a/arch/avr32/include/asm/special_insns.h b/arch/avr32/include/asm/special_insns.h
new file mode 100644 (file)
index 0000000..f922218
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_AVR32_SPECIAL_INSNS_H
+#define __ASM_AVR32_SPECIAL_INSNS_H
+
+#define nop() asm volatile("nop")
+
+#endif /* __ASM_AVR32_SPECIAL_INSNS_H */
diff --git a/arch/avr32/include/asm/switch_to.h b/arch/avr32/include/asm/switch_to.h
new file mode 100644 (file)
index 0000000..9a8e9d5
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __ASM_AVR32_SWITCH_TO_H
+#define __ASM_AVR32_SWITCH_TO_H
+
+/*
+ * Help PathFinder and other Nexus-compliant debuggers keep track of
+ * the current PID by emitting an Ownership Trace Message each time we
+ * switch task.
+ */
+#ifdef CONFIG_OWNERSHIP_TRACE
+#include <asm/ocd.h>
+#define finish_arch_switch(prev)                       \
+       do {                                            \
+               ocd_write(PID, prev->pid);              \
+               ocd_write(PID, current->pid);           \
+       } while(0)
+#endif
+
+/*
+ * switch_to(prev, next, last) should switch from task `prev' to task
+ * `next'. `prev' will never be the same as `next'.
+ *
+ * We just delegate everything to the __switch_to assembly function,
+ * which is implemented in arch/avr32/kernel/switch_to.S
+ *
+ * mb() tells GCC not to cache `current' across this call.
+ */
+struct cpu_context;
+struct task_struct;
+extern struct task_struct *__switch_to(struct task_struct *,
+                                      struct cpu_context *,
+                                      struct cpu_context *);
+#define switch_to(prev, next, last)                                    \
+       do {                                                            \
+               last = __switch_to(prev, &prev->thread.cpu_context + 1, \
+                                  &next->thread.cpu_context);          \
+       } while (0)
+
+
+#endif /* __ASM_AVR32_SWITCH_TO_H */
index 62d9ded016357bc6e6a6534d56cd154694b9692a..0d84f9e42fdec79dc4f1b52f82ac5b44d3643839 100644 (file)
@@ -1,178 +1,6 @@
-/*
- * Copyright (C) 2004-2006 Atmel Corporation
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __ASM_AVR32_SYSTEM_H
-#define __ASM_AVR32_SYSTEM_H
-
-#include <linux/compiler.h>
-#include <linux/linkage.h>
-#include <linux/types.h>
-
-#include <asm/ptrace.h>
-#include <asm/sysreg.h>
-
-#define xchg(ptr,x) \
-       ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
-
-#define nop() asm volatile("nop")
-
-#define mb()                   asm volatile("" : : : "memory")
-#define rmb()                  mb()
-#define wmb()                  asm volatile("sync 0" : : : "memory")
-#define read_barrier_depends()  do { } while(0)
-#define set_mb(var, value)      do { var = value; mb(); } while(0)
-
-/*
- * Help PathFinder and other Nexus-compliant debuggers keep track of
- * the current PID by emitting an Ownership Trace Message each time we
- * switch task.
- */
-#ifdef CONFIG_OWNERSHIP_TRACE
-#include <asm/ocd.h>
-#define finish_arch_switch(prev)                       \
-       do {                                            \
-               ocd_write(PID, prev->pid);              \
-               ocd_write(PID, current->pid);           \
-       } while(0)
-#endif
-
-/*
- * switch_to(prev, next, last) should switch from task `prev' to task
- * `next'. `prev' will never be the same as `next'.
- *
- * We just delegate everything to the __switch_to assembly function,
- * which is implemented in arch/avr32/kernel/switch_to.S
- *
- * mb() tells GCC not to cache `current' across this call.
- */
-struct cpu_context;
-struct task_struct;
-extern struct task_struct *__switch_to(struct task_struct *,
-                                      struct cpu_context *,
-                                      struct cpu_context *);
-#define switch_to(prev, next, last)                                    \
-       do {                                                            \
-               last = __switch_to(prev, &prev->thread.cpu_context + 1, \
-                                  &next->thread.cpu_context);          \
-       } while (0)
-
-#ifdef CONFIG_SMP
-# error "The AVR32 port does not support SMP"
-#else
-# define smp_mb()              barrier()
-# define smp_rmb()             barrier()
-# define smp_wmb()             barrier()
-# define smp_read_barrier_depends() do { } while(0)
-#endif
-
-#include <linux/irqflags.h>
-
-extern void __xchg_called_with_bad_pointer(void);
-
-static inline unsigned long xchg_u32(u32 val, volatile u32 *m)
-{
-       u32 ret;
-
-       asm volatile("xchg %[ret], %[m], %[val]"
-                       : [ret] "=&r"(ret), "=m"(*m)
-                       : "m"(*m), [m] "r"(m), [val] "r"(val)
-                       : "memory");
-       return ret;
-}
-
-static inline unsigned long __xchg(unsigned long x,
-                                      volatile void *ptr,
-                                      int size)
-{
-       switch(size) {
-       case 4:
-               return xchg_u32(x, ptr);
-       default:
-               __xchg_called_with_bad_pointer();
-               return x;
-       }
-}
-
-static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
-                                         unsigned long new)
-{
-       __u32 ret;
-
-       asm volatile(
-               "1:     ssrf    5\n"
-               "       ld.w    %[ret], %[m]\n"
-               "       cp.w    %[ret], %[old]\n"
-               "       brne    2f\n"
-               "       stcond  %[m], %[new]\n"
-               "       brne    1b\n"
-               "2:\n"
-               : [ret] "=&r"(ret), [m] "=m"(*m)
-               : "m"(m), [old] "ir"(old), [new] "r"(new)
-               : "memory", "cc");
-       return ret;
-}
-
-extern unsigned long __cmpxchg_u64_unsupported_on_32bit_kernels(
-        volatile int * m, unsigned long old, unsigned long new);
-#define __cmpxchg_u64 __cmpxchg_u64_unsupported_on_32bit_kernels
-
-/* This function doesn't exist, so you'll get a linker error
-   if something tries to do an invalid cmpxchg().  */
-extern void __cmpxchg_called_with_bad_pointer(void);
-
-#define __HAVE_ARCH_CMPXCHG 1
-
-static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
-                                     unsigned long new, int size)
-{
-       switch (size) {
-       case 4:
-               return __cmpxchg_u32(ptr, old, new);
-       case 8:
-               return __cmpxchg_u64(ptr, old, new);
-       }
-
-       __cmpxchg_called_with_bad_pointer();
-       return old;
-}
-
-#define cmpxchg(ptr, old, new)                                 \
-       ((typeof(*(ptr)))__cmpxchg((ptr), (unsigned long)(old), \
-                                  (unsigned long)(new),        \
-                                  sizeof(*(ptr))))
-
-#include <asm-generic/cmpxchg-local.h>
-
-static inline unsigned long __cmpxchg_local(volatile void *ptr,
-                                     unsigned long old,
-                                     unsigned long new, int size)
-{
-       switch (size) {
-       case 4:
-               return __cmpxchg_u32(ptr, old, new);
-       default:
-               return __cmpxchg_local_generic(ptr, old, new, size);
-       }
-
-       return old;
-}
-
-#define cmpxchg_local(ptr, old, new)                                   \
-       ((typeof(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(old),   \
-                                  (unsigned long)(new),                \
-                                  sizeof(*(ptr))))
-
-#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n))
-
-struct pt_regs;
-void die(const char *str, struct pt_regs *regs, long err);
-void _exception(long signr, struct pt_regs *regs, int code,
-               unsigned long addr);
-
-#define arch_align_stack(x)    (x)
-
-#endif /* __ASM_AVR32_SYSTEM_H */
+/* FILE TO BE DELETED. DO NOT ADD STUFF HERE! */
+#include <asm/barrier.h>
+#include <asm/cmpxchg.h>
+#include <asm/exec.h>
+#include <asm/special_insns.h>
+#include <asm/switch_to.h>
index 627743326253f553e2da7fc2d7f95f5c9d809c28..18b765629a0c8e95625976f91a84a0ac69659e03 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/export.h>
-#include <asm/system.h>
 
 static struct clk *cpuclk;
 
index a3e9b3c4845a50f0fc53bf164923a084650f5c17..f74b7809e089d0bb404f5ea9c0433dbad52212af 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/types.h>
 
 #include <asm/sysreg.h>
-#include <asm/system.h>
 
 #define AVR32_PERFCTR_IRQ_GROUP        0
 #define AVR32_PERFCTR_IRQ_LINE 1