ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-arm / arch-pxa / hardware.h
1 /*
2  *  linux/include/asm-arm/arch-pxa/hardware.h
3  *
4  *  Author:     Nicolas Pitre
5  *  Created:    Jun 15, 2001
6  *  Copyright:  MontaVista Software Inc.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12
13 #ifndef __ASM_ARCH_HARDWARE_H
14 #define __ASM_ARCH_HARDWARE_H
15
16 #include <asm/mach-types.h>
17
18
19 /*
20  * These are statically mapped PCMCIA IO space for designs using it as a
21  * generic IO bus, typically with ISA parts, hardwired IDE interfaces, etc.
22  * The actual PCMCIA code is mapping required IO region at run time.
23  */
24 #define PCMCIA_IO_0_BASE        0xf6000000
25 #define PCMCIA_IO_1_BASE        0xf7000000
26
27
28 /*
29  * We requires absolute addresses.
30  */
31 #define PCIO_BASE               0
32
33 /*
34  * Workarounds for at least 2 errata so far require this.
35  * The mapping is set in mach-pxa/generic.c.
36  */
37 #define UNCACHED_PHYS_0         0xff000000
38 #define UNCACHED_ADDR           UNCACHED_PHYS_0
39
40 /*
41  * Intel PXA internal I/O mappings:
42  *
43  * 0x40000000 - 0x41ffffff <--> 0xf8000000 - 0xf9ffffff
44  * 0x44000000 - 0x45ffffff <--> 0xfa000000 - 0xfbffffff
45  * 0x48000000 - 0x49ffffff <--> 0xfc000000 - 0xfdffffff
46  */
47
48 #define io_p2v(x)       ( ((x) | 0xbe000000) ^ (~((x) >> 1) & 0x06000000) )
49 #define io_v2p( x )     ( ((x) & 0x41ffffff) ^ ( ((x) & 0x06000000) << 1) )
50
51 #ifndef __ASSEMBLY__
52
53 #if 0
54 # define __REG(x)       (*((volatile u32 *)io_p2v(x)))
55 #else
56 /*
57  * This __REG() version gives the same results as the one above,  except
58  * that we are fooling gcc somehow so it generates far better and smaller
59  * assembly code for access to contigous registers.  It's a shame that gcc
60  * doesn't guess this by itself.
61  */
62 #include <asm/types.h>
63 typedef struct { volatile u32 offset[4096]; } __regbase;
64 # define __REGP(x)      ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2]
65 # define __REG(x)       __REGP(io_p2v(x))
66 #endif
67
68 /* Let's kick gcc's ass again... */
69 # define __REG2(x,y)    \
70         ( __builtin_constant_p(y) ? (__REG((x) + (y))) \
71                                   : (*(volatile u32 *)((u32)&__REG(x) + (y))) )
72
73 # define __PREG(x)      (io_v2p((u32)&(x)))
74
75 #else
76
77 # define __REG(x)       io_p2v(x)
78 # define __PREG(x)      io_v2p(x)
79
80 #endif
81
82 #include "pxa-regs.h"
83
84 #ifndef __ASSEMBLY__
85
86 /*
87  * Handy routine to set GPIO alternate functions
88  */
89 extern void pxa_gpio_mode( int gpio_mode );
90
91 /*
92  * return current lclk frequency in units of 10kHz
93  */
94 extern unsigned int get_lclk_frequency_10khz(void);
95
96 #endif
97
98
99 /*
100  * Implementation specifics
101  */
102
103 #include "lubbock.h"
104 #include "idp.h"
105
106 #endif  /* _ASM_ARCH_HARDWARE_H */