2 * linux/include/asm-arm/arch-pxa/hardware.h
4 * Author: Nicolas Pitre
5 * Created: Jun 15, 2001
6 * Copyright: MontaVista Software Inc.
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.
13 #ifndef __ASM_ARCH_HARDWARE_H
14 #define __ASM_ARCH_HARDWARE_H
16 #include <asm/mach-types.h>
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.
24 #define PCMCIA_IO_0_BASE 0xf6000000
25 #define PCMCIA_IO_1_BASE 0xf7000000
29 * We requires absolute addresses.
34 * Workarounds for at least 2 errata so far require this.
35 * The mapping is set in mach-pxa/generic.c.
37 #define UNCACHED_PHYS_0 0xff000000
38 #define UNCACHED_ADDR UNCACHED_PHYS_0
41 * Intel PXA internal I/O mappings:
43 * 0x40000000 - 0x41ffffff <--> 0xf8000000 - 0xf9ffffff
44 * 0x44000000 - 0x45ffffff <--> 0xfa000000 - 0xfbffffff
45 * 0x48000000 - 0x49ffffff <--> 0xfc000000 - 0xfdffffff
48 #define io_p2v(x) ( ((x) | 0xbe000000) ^ (~((x) >> 1) & 0x06000000) )
49 #define io_v2p( x ) ( ((x) & 0x41ffffff) ^ ( ((x) & 0x06000000) << 1) )
54 # define __REG(x) (*((volatile u32 *)io_p2v(x)))
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.
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))
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))) )
73 # define __PREG(x) (io_v2p((u32)&(x)))
77 # define __REG(x) io_p2v(x)
78 # define __PREG(x) io_v2p(x)
87 * Handy routine to set GPIO alternate functions
89 extern void pxa_gpio_mode( int gpio_mode );
92 * return current lclk frequency in units of 10kHz
94 extern unsigned int get_lclk_frequency_10khz(void);
100 * Implementation specifics
106 #endif /* _ASM_ARCH_HARDWARE_H */