wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 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. |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 7 | * |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 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. |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 11 | * |
| 12 | * Note: This file was taken from linux-2.4.19-rmk4-pxa1 |
| 13 | * |
| 14 | * - 2003/01/20 implementation specifics activated |
| 15 | * Robert Schwebel <r.schwebel@pengutronix.de> |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 16 | */ |
| 17 | |
| 18 | #ifndef __ASM_ARCH_HARDWARE_H |
| 19 | #define __ASM_ARCH_HARDWARE_H |
| 20 | |
| 21 | #include <linux/config.h> |
| 22 | #include <asm/mach-types.h> |
| 23 | |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 24 | |
| 25 | /* |
| 26 | * These are statically mapped PCMCIA IO space for designs using it as a |
| 27 | * generic IO bus, typically with ISA parts, hardwired IDE interfaces, etc. |
| 28 | * The actual PCMCIA code is mapping required IO region at run time. |
| 29 | */ |
| 30 | #define PCMCIA_IO_0_BASE 0xf6000000 |
| 31 | #define PCMCIA_IO_1_BASE 0xf7000000 |
| 32 | |
| 33 | |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 34 | /* |
| 35 | * We requires absolute addresses. |
| 36 | */ |
| 37 | #define PCIO_BASE 0 |
| 38 | |
| 39 | /* |
| 40 | * Workarounds for at least 2 errata so far require this. |
| 41 | * The mapping is set in mach-pxa/generic.c. |
| 42 | */ |
| 43 | #define UNCACHED_PHYS_0 0xff000000 |
| 44 | #define UNCACHED_ADDR UNCACHED_PHYS_0 |
| 45 | |
| 46 | /* |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 47 | * Intel PXA internal I/O mappings: |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 48 | * |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 49 | * 0x40000000 - 0x41ffffff <--> 0xf8000000 - 0xf9ffffff |
| 50 | * 0x44000000 - 0x45ffffff <--> 0xfa000000 - 0xfbffffff |
| 51 | * 0x48000000 - 0x49ffffff <--> 0xfc000000 - 0xfdffffff |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 52 | */ |
| 53 | |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 54 | /* FIXME: Only this does work for u-boot... find out why... [RS] */ |
| 55 | #define UBOOT_REG_FIX 1 |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 56 | |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 57 | #ifndef UBOOT_REG_FIX |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 58 | #ifndef __ASSEMBLY__ |
| 59 | |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 60 | #define io_p2v(x) ( ((x) | 0xbe000000) ^ (~((x) >> 1) & 0x06000000) ) |
| 61 | #define io_v2p( x ) ( ((x) & 0x41ffffff) ^ ( ((x) & 0x06000000) << 1) ) |
| 62 | |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 63 | /* |
| 64 | * This __REG() version gives the same results as the one above, except |
| 65 | * that we are fooling gcc somehow so it generates far better and smaller |
| 66 | * assembly code for access to contigous registers. It's a shame that gcc |
| 67 | * doesn't guess this by itself. |
| 68 | */ |
| 69 | #include <asm/types.h> |
| 70 | typedef struct { volatile u32 offset[4096]; } __regbase; |
| 71 | # define __REGP(x) ((__regbase *)((x)&~4095))->offset[((x)&4095)>>2] |
| 72 | # define __REG(x) __REGP(io_p2v(x)) |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 73 | #endif |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 74 | |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 75 | /* Let's kick gcc's ass again... */ |
| 76 | # define __REG2(x,y) \ |
| 77 | ( __builtin_constant_p(y) ? (__REG((x) + (y))) \ |
| 78 | : (*(volatile u32 *)((u32)&__REG(x) + (y))) ) |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 79 | |
| 80 | # define __PREG(x) (io_v2p((u32)&(x))) |
| 81 | |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 82 | #else |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 83 | |
| 84 | # define __REG(x) io_p2v(x) |
| 85 | # define __PREG(x) io_v2p(x) |
| 86 | |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 87 | # undef io_p2v |
| 88 | # undef __REG |
| 89 | # ifndef __ASSEMBLY__ |
| 90 | # define io_p2v(PhAdd) (PhAdd) |
| 91 | # define __REG(x) (*((volatile u32 *)io_p2v(x))) |
| 92 | # define __REG2(x,y) (*(volatile u32 *)((u32)&__REG(x) + (y))) |
| 93 | # else |
| 94 | # define __REG(x) (x) |
| 95 | # ifdef CONFIG_CPU_MONAHANS /* Hack to make this work with mona's pxa-regs.h */ |
| 96 | # define __REG_2(x) (x) |
| 97 | # define __REG_3(x) (x) |
| 98 | # endif |
| 99 | # endif |
| 100 | #endif /* UBOOT_REG_FIX */ |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 101 | |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 102 | #include "pxa-regs.h" |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 103 | |
| 104 | #ifndef __ASSEMBLY__ |
| 105 | |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 106 | /* |
| 107 | * GPIO edge detection for IRQs: |
| 108 | * IRQs are generated on Falling-Edge, Rising-Edge, or both. |
| 109 | * This must be called *before* the corresponding IRQ is registered. |
| 110 | * Use this instead of directly setting GRER/GFER. |
| 111 | */ |
| 112 | #define GPIO_FALLING_EDGE 1 |
| 113 | #define GPIO_RISING_EDGE 2 |
| 114 | #define GPIO_BOTH_EDGES 3 |
| 115 | extern void set_GPIO_IRQ_edge( int gpio_nr, int edge_mask ); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 116 | |
| 117 | /* |
| 118 | * Handy routine to set GPIO alternate functions |
| 119 | */ |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 120 | extern void set_GPIO_mode( int gpio_mode ); |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 121 | |
| 122 | /* |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 123 | * return current lclk frequency in units of 10kHz |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 124 | */ |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 125 | extern unsigned int get_lclk_frequency_10khz(void); |
| 126 | |
| 127 | #endif |
| 128 | |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 129 | |
| 130 | /* |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 131 | * Implementation specifics |
wdenk | 1cb8e98 | 2003-03-06 21:55:29 +0000 | [diff] [blame] | 132 | */ |
| 133 | |
| 134 | #ifdef CONFIG_ARCH_LUBBOCK |
| 135 | #include "lubbock.h" |
| 136 | #endif |
| 137 | |
| 138 | #ifdef CONFIG_ARCH_PXA_IDP |
| 139 | #include "idp.h" |
| 140 | #endif |
| 141 | |
| 142 | #ifdef CONFIG_ARCH_PXA_CERF |
| 143 | #include "cerf.h" |
| 144 | #endif |
| 145 | |
| 146 | #ifdef CONFIG_ARCH_CSB226 |
| 147 | #include "csb226.h" |
| 148 | #endif |
| 149 | |
| 150 | #ifdef CONFIG_ARCH_INNOKOM |
| 151 | #include "innokom.h" |
| 152 | #endif |
| 153 | |
wdenk | 6310eb9 | 2005-01-09 21:28:15 +0000 | [diff] [blame] | 154 | #ifdef CONFIG_ARCH_PLEB |
| 155 | #include "pleb.h" |
| 156 | #endif |
| 157 | |
Markus Klotzbücher | 9d803d8 | 2006-02-08 18:56:28 +0100 | [diff] [blame] | 158 | #endif /* _ASM_ARCH_HARDWARE_H */ |