aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-avr32/page.h
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2006-09-26 02:32:13 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 11:48:54 -0400
commit5f97f7f9400de47ae837170bb274e90ad3934386 (patch)
tree514451e6dc6b46253293a00035d375e77b1c65ed /include/asm-avr32/page.h
parent53e62d3aaa60590d4a69b4e07c29f448b5151047 (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/page.h')
-rw-r--r--include/asm-avr32/page.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/include/asm-avr32/page.h b/include/asm-avr32/page.h
new file mode 100644
index 000000000000..0f630b3e9932
--- /dev/null
+++ b/include/asm-avr32/page.h
@@ -0,0 +1,112 @@
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_PAGE_H
9#define __ASM_AVR32_PAGE_H
10
11#ifdef __KERNEL__
12
13/* PAGE_SHIFT determines the page size */
14#define PAGE_SHIFT 12
15#ifdef __ASSEMBLY__
16#define PAGE_SIZE (1 << PAGE_SHIFT)
17#else
18#define PAGE_SIZE (1UL << PAGE_SHIFT)
19#endif
20#define PAGE_MASK (~(PAGE_SIZE-1))
21#define PTE_MASK PAGE_MASK
22
23#ifndef __ASSEMBLY__
24
25#include <asm/addrspace.h>
26
27extern void clear_page(void *to);
28extern void copy_page(void *to, void *from);
29
30#define clear_user_page(page, vaddr, pg) clear_page(page)
31#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
32
33/*
34 * These are used to make use of C type-checking..
35 */
36typedef struct { unsigned long pte; } pte_t;
37typedef struct { unsigned long pgd; } pgd_t;
38typedef struct { unsigned long pgprot; } pgprot_t;
39
40#define pte_val(x) ((x).pte)
41#define pgd_val(x) ((x).pgd)
42#define pgprot_val(x) ((x).pgprot)
43
44#define __pte(x) ((pte_t) { (x) })
45#define __pgd(x) ((pgd_t) { (x) })
46#define __pgprot(x) ((pgprot_t) { (x) })
47
48/* FIXME: These should be removed soon */
49extern unsigned long memory_start, memory_end;
50
51/* Pure 2^n version of get_order */
52static inline int get_order(unsigned long size)
53{
54 unsigned lz;
55
56 size = (size - 1) >> PAGE_SHIFT;
57 asm("clz %0, %1" : "=r"(lz) : "r"(size));
58 return 32 - lz;
59}
60
61#endif /* !__ASSEMBLY__ */
62
63/* Align the pointer to the (next) page boundary */
64#define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)
65
66/*
67 * The hardware maps the virtual addresses 0x80000000 -> 0x9fffffff
68 * permanently to the physical addresses 0x00000000 -> 0x1fffffff when
69 * segmentation is enabled. We want to make use of this in order to
70 * minimize TLB pressure.
71 */
72#define PAGE_OFFSET (0x80000000UL)
73
74/*
75 * ALSA uses virt_to_page() on DMA pages, which I'm not entirely sure
76 * is a good idea. Anyway, we can't simply subtract PAGE_OFFSET here
77 * in that case, so we'll have to mask out the three most significant
78 * bits of the address instead...
79 *
80 * What's the difference between __pa() and virt_to_phys() anyway?
81 */
82#define __pa(x) PHYSADDR(x)
83#define __va(x) ((void *)(P1SEGADDR(x)))
84
85#define MAP_NR(addr) (((unsigned long)(addr) - PAGE_OFFSET) >> PAGE_SHIFT)
86
87#define phys_to_page(phys) (pfn_to_page(phys >> PAGE_SHIFT))
88#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
89
90#ifndef CONFIG_NEED_MULTIPLE_NODES
91
92#define PHYS_PFN_OFFSET (CONFIG_PHYS_OFFSET >> PAGE_SHIFT)
93
94#define pfn_to_page(pfn) (mem_map + ((pfn) - PHYS_PFN_OFFSET))
95#define page_to_pfn(page) ((unsigned long)((page) - mem_map) + PHYS_PFN_OFFSET)
96#define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
97#endif /* CONFIG_NEED_MULTIPLE_NODES */
98
99#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
100#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
101
102#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
103 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
104
105/*
106 * Memory above this physical address will be considered highmem.
107 */
108#define HIGHMEM_START 0x20000000UL
109
110#endif /* __KERNEL__ */
111
112#endif /* __ASM_AVR32_PAGE_H */