diff options
author | Haavard Skinnemoen <hskinnemoen@atmel.com> | 2006-09-26 02:32:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 11:48:54 -0400 |
commit | 5f97f7f9400de47ae837170bb274e90ad3934386 (patch) | |
tree | 514451e6dc6b46253293a00035d375e77b1c65ed /include/asm-avr32/processor.h | |
parent | 53e62d3aaa60590d4a69b4e07c29f448b5151047 (diff) |
[PATCH] avr32 architecture
This adds support for the Atmel AVR32 architecture as well as the AT32AP7000
CPU and the AT32STK1000 development board.
AVR32 is a new high-performance 32-bit RISC microprocessor core, designed for
cost-sensitive embedded applications, with particular emphasis on low power
consumption and high code density. The AVR32 architecture is not binary
compatible with earlier 8-bit AVR architectures.
The AVR32 architecture, including the instruction set, is described by the
AVR32 Architecture Manual, available from
http://www.atmel.com/dyn/resources/prod_documents/doc32000.pdf
The Atmel AT32AP7000 is the first CPU implementing the AVR32 architecture. It
features a 7-stage pipeline, 16KB instruction and data caches and a full
Memory Management Unit. It also comes with a large set of integrated
peripherals, many of which are shared with the AT91 ARM-based controllers from
Atmel.
Full data sheet is available from
http://www.atmel.com/dyn/resources/prod_documents/doc32003.pdf
while the CPU core implementation including caches and MMU is documented by
the AVR32 AP Technical Reference, available from
http://www.atmel.com/dyn/resources/prod_documents/doc32001.pdf
Information about the AT32STK1000 development board can be found at
http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3918
including a BSP CD image with an earlier version of this patch, development
tools (binaries and source/patches) and a root filesystem image suitable for
booting from SD card.
Alternatively, there's a preliminary "getting started" guide available at
http://avr32linux.org/twiki/bin/view/Main/GettingStarted which provides links
to the sources and patches you will need in order to set up a cross-compiling
environment for avr32-linux.
This patch, as well as the other patches included with the BSP and the
toolchain patches, is actively supported by Atmel Corporation.
[dmccr@us.ibm.com: Fix more pxx_page macro locations]
[bunk@stusta.de: fix `make defconfig']
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Dave McCracken <dmccr@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-avr32/processor.h')
-rw-r--r-- | include/asm-avr32/processor.h | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/include/asm-avr32/processor.h b/include/asm-avr32/processor.h new file mode 100644 index 000000000000..f6913778a45f --- /dev/null +++ b/include/asm-avr32/processor.h | |||
@@ -0,0 +1,147 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004-2006 Atmel Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | */ | ||
8 | #ifndef __ASM_AVR32_PROCESSOR_H | ||
9 | #define __ASM_AVR32_PROCESSOR_H | ||
10 | |||
11 | #include <asm/page.h> | ||
12 | #include <asm/cache.h> | ||
13 | |||
14 | #define TASK_SIZE 0x80000000 | ||
15 | |||
16 | #ifndef __ASSEMBLY__ | ||
17 | |||
18 | static inline void *current_text_addr(void) | ||
19 | { | ||
20 | register void *pc asm("pc"); | ||
21 | return pc; | ||
22 | } | ||
23 | |||
24 | enum arch_type { | ||
25 | ARCH_AVR32A, | ||
26 | ARCH_AVR32B, | ||
27 | ARCH_MAX | ||
28 | }; | ||
29 | |||
30 | enum cpu_type { | ||
31 | CPU_MORGAN, | ||
32 | CPU_AT32AP, | ||
33 | CPU_MAX | ||
34 | }; | ||
35 | |||
36 | enum tlb_config { | ||
37 | TLB_NONE, | ||
38 | TLB_SPLIT, | ||
39 | TLB_UNIFIED, | ||
40 | TLB_INVALID | ||
41 | }; | ||
42 | |||
43 | struct avr32_cpuinfo { | ||
44 | struct clk *clk; | ||
45 | unsigned long loops_per_jiffy; | ||
46 | enum arch_type arch_type; | ||
47 | enum cpu_type cpu_type; | ||
48 | unsigned short arch_revision; | ||
49 | unsigned short cpu_revision; | ||
50 | enum tlb_config tlb_config; | ||
51 | |||
52 | struct cache_info icache; | ||
53 | struct cache_info dcache; | ||
54 | }; | ||
55 | |||
56 | extern struct avr32_cpuinfo boot_cpu_data; | ||
57 | |||
58 | #ifdef CONFIG_SMP | ||
59 | extern struct avr32_cpuinfo cpu_data[]; | ||
60 | #define current_cpu_data cpu_data[smp_processor_id()] | ||
61 | #else | ||
62 | #define cpu_data (&boot_cpu_data) | ||
63 | #define current_cpu_data boot_cpu_data | ||
64 | #endif | ||
65 | |||
66 | /* This decides where the kernel will search for a free chunk of vm | ||
67 | * space during mmap's | ||
68 | */ | ||
69 | #define TASK_UNMAPPED_BASE (PAGE_ALIGN(TASK_SIZE / 3)) | ||
70 | |||
71 | #define cpu_relax() barrier() | ||
72 | #define cpu_sync_pipeline() asm volatile("sub pc, -2" : : : "memory") | ||
73 | |||
74 | struct cpu_context { | ||
75 | unsigned long sr; | ||
76 | unsigned long pc; | ||
77 | unsigned long ksp; /* Kernel stack pointer */ | ||
78 | unsigned long r7; | ||
79 | unsigned long r6; | ||
80 | unsigned long r5; | ||
81 | unsigned long r4; | ||
82 | unsigned long r3; | ||
83 | unsigned long r2; | ||
84 | unsigned long r1; | ||
85 | unsigned long r0; | ||
86 | }; | ||
87 | |||
88 | /* This struct contains the CPU context as stored by switch_to() */ | ||
89 | struct thread_struct { | ||
90 | struct cpu_context cpu_context; | ||
91 | unsigned long single_step_addr; | ||
92 | u16 single_step_insn; | ||
93 | }; | ||
94 | |||
95 | #define INIT_THREAD { \ | ||
96 | .cpu_context = { \ | ||
97 | .ksp = sizeof(init_stack) + (long)&init_stack, \ | ||
98 | }, \ | ||
99 | } | ||
100 | |||
101 | /* | ||
102 | * Do necessary setup to start up a newly executed thread. | ||
103 | */ | ||
104 | #define start_thread(regs, new_pc, new_sp) \ | ||
105 | do { \ | ||
106 | set_fs(USER_DS); \ | ||
107 | memset(regs, 0, sizeof(*regs)); \ | ||
108 | regs->sr = MODE_USER; \ | ||
109 | regs->pc = new_pc & ~1; \ | ||
110 | regs->sp = new_sp; \ | ||
111 | } while(0) | ||
112 | |||
113 | struct task_struct; | ||
114 | |||
115 | /* Free all resources held by a thread */ | ||
116 | extern void release_thread(struct task_struct *); | ||
117 | |||
118 | /* Create a kernel thread without removing it from tasklists */ | ||
119 | extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags); | ||
120 | |||
121 | /* Prepare to copy thread state - unlazy all lazy status */ | ||
122 | #define prepare_to_copy(tsk) do { } while(0) | ||
123 | |||
124 | /* Return saved PC of a blocked thread */ | ||
125 | #define thread_saved_pc(tsk) ((tsk)->thread.cpu_context.pc) | ||
126 | |||
127 | struct pt_regs; | ||
128 | void show_trace(struct task_struct *task, unsigned long *stack, | ||
129 | struct pt_regs *regs); | ||
130 | |||
131 | extern unsigned long get_wchan(struct task_struct *p); | ||
132 | |||
133 | #define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc) | ||
134 | #define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp) | ||
135 | |||
136 | #define ARCH_HAS_PREFETCH | ||
137 | |||
138 | static inline void prefetch(const void *x) | ||
139 | { | ||
140 | const char *c = x; | ||
141 | asm volatile("pref %0" : : "r"(c)); | ||
142 | } | ||
143 | #define PREFETCH_STRIDE L1_CACHE_BYTES | ||
144 | |||
145 | #endif /* __ASSEMBLY__ */ | ||
146 | |||
147 | #endif /* __ASM_AVR32_PROCESSOR_H */ | ||