Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/cpufreq
[linux-2.6] / include / asm-arm / arch-ixp4xx / ixp4xx-regs.h
1 /*
2  * include/asm-arm/arch-ixp4xx/ixp4xx-regs.h
3  *
4  * Register definitions for IXP4xx chipset. This file contains 
5  * register location and bit definitions only. Platform specific 
6  * definitions and helper function declarations are in platform.h 
7  * and machine-name.h.
8  *
9  * Copyright (C) 2002 Intel Corporation.
10  * Copyright (C) 2003-2004 MontaVista Software, Inc.
11  *
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License version 2 as
14  * published by the Free Software Foundation.
15  *
16  */
17
18 #ifndef __ASM_ARCH_HARDWARE_H__
19 #error "Do not include this directly, instead #include <asm/hardware.h>"
20 #endif
21
22 #ifndef _ASM_ARM_IXP4XX_H_
23 #define _ASM_ARM_IXP4XX_H_
24
25 /*
26  * IXP4xx Linux Memory Map:
27  *
28  * Phy          Size            Virt            Description
29  * =========================================================================
30  *
31  * 0x00000000   0x10000000(max) PAGE_OFFSET     System RAM
32  *
33  * 0x48000000   0x04000000      ioremap'd       PCI Memory Space
34  *
35  * 0x50000000   0x10000000      ioremap'd       EXP BUS
36  *
37  * 0x6000000    0x00004000      ioremap'd       QMgr
38  *
39  * 0xC0000000   0x00001000      0xffbff000      PCI CFG
40  *
41  * 0xC4000000   0x00001000      0xffbfe000      EXP CFG
42  *
43  * 0xC8000000   0x00013000      0xffbeb000      On-Chip Peripherals
44  */
45
46 /*
47  * Queue Manager
48  */
49 #define IXP4XX_QMGR_BASE_PHYS           (0x60000000)
50
51 /*
52  * Expansion BUS Configuration registers
53  */
54 #define IXP4XX_EXP_CFG_BASE_PHYS        (0xC4000000)
55 #define IXP4XX_EXP_CFG_BASE_VIRT        (0xFFBFE000)
56 #define IXP4XX_EXP_CFG_REGION_SIZE      (0x00001000)
57
58 /*
59  * PCI Config registers
60  */
61 #define IXP4XX_PCI_CFG_BASE_PHYS        (0xC0000000)
62 #define IXP4XX_PCI_CFG_BASE_VIRT        (0xFFBFF000)
63 #define IXP4XX_PCI_CFG_REGION_SIZE      (0x00001000)
64
65 /*
66  * Peripheral space
67  */
68 #define IXP4XX_PERIPHERAL_BASE_PHYS     (0xC8000000)
69 #define IXP4XX_PERIPHERAL_BASE_VIRT     (0xFFBEB000)
70 #define IXP4XX_PERIPHERAL_REGION_SIZE   (0x00013000)
71
72 /*
73  * Debug UART
74  *
75  * This is basically a remap of UART1 into a region that is section
76  * aligned so that it * can be used with the low-level debug code.
77  */
78 #define IXP4XX_DEBUG_UART_BASE_PHYS     (0xC8000000)
79 #define IXP4XX_DEBUG_UART_BASE_VIRT     (0xffb00000)
80 #define IXP4XX_DEBUG_UART_REGION_SIZE   (0x00001000)
81
82 #define IXP4XX_EXP_CS0_OFFSET   0x00
83 #define IXP4XX_EXP_CS1_OFFSET   0x04
84 #define IXP4XX_EXP_CS2_OFFSET   0x08
85 #define IXP4XX_EXP_CS3_OFFSET   0x0C
86 #define IXP4XX_EXP_CS4_OFFSET   0x10
87 #define IXP4XX_EXP_CS5_OFFSET   0x14
88 #define IXP4XX_EXP_CS6_OFFSET   0x18
89 #define IXP4XX_EXP_CS7_OFFSET   0x1C
90 #define IXP4XX_EXP_CFG0_OFFSET  0x20
91 #define IXP4XX_EXP_CFG1_OFFSET  0x24
92 #define IXP4XX_EXP_CFG2_OFFSET  0x28
93 #define IXP4XX_EXP_CFG3_OFFSET  0x2C
94
95 /*
96  * Expansion Bus Controller registers.
97  */
98 #define IXP4XX_EXP_REG(x) ((volatile u32 *)(IXP4XX_EXP_CFG_BASE_VIRT+(x)))
99
100 #define IXP4XX_EXP_CS0      IXP4XX_EXP_REG(IXP4XX_EXP_CS0_OFFSET)
101 #define IXP4XX_EXP_CS1      IXP4XX_EXP_REG(IXP4XX_EXP_CS1_OFFSET)
102 #define IXP4XX_EXP_CS2      IXP4XX_EXP_REG(IXP4XX_EXP_CS2_OFFSET) 
103 #define IXP4XX_EXP_CS3      IXP4XX_EXP_REG(IXP4XX_EXP_CS3_OFFSET)
104 #define IXP4XX_EXP_CS4      IXP4XX_EXP_REG(IXP4XX_EXP_CS4_OFFSET)
105 #define IXP4XX_EXP_CS5      IXP4XX_EXP_REG(IXP4XX_EXP_CS5_OFFSET)
106 #define IXP4XX_EXP_CS6      IXP4XX_EXP_REG(IXP4XX_EXP_CS6_OFFSET)     
107 #define IXP4XX_EXP_CS7      IXP4XX_EXP_REG(IXP4XX_EXP_CS7_OFFSET)
108
109 #define IXP4XX_EXP_CFG0     IXP4XX_EXP_REG(IXP4XX_EXP_CFG0_OFFSET) 
110 #define IXP4XX_EXP_CFG1     IXP4XX_EXP_REG(IXP4XX_EXP_CFG1_OFFSET) 
111 #define IXP4XX_EXP_CFG2     IXP4XX_EXP_REG(IXP4XX_EXP_CFG2_OFFSET) 
112 #define IXP4XX_EXP_CFG3     IXP4XX_EXP_REG(IXP4XX_EXP_CFG3_OFFSET)
113
114
115 /*
116  * Peripheral Space Register Region Base Addresses
117  */
118 #define IXP4XX_UART1_BASE_PHYS          (IXP4XX_PERIPHERAL_BASE_PHYS + 0x0000)
119 #define IXP4XX_UART2_BASE_PHYS          (IXP4XX_PERIPHERAL_BASE_PHYS + 0x1000)
120 #define IXP4XX_PMU_BASE_PHYS            (IXP4XX_PERIPHERAL_BASE_PHYS + 0x2000)
121 #define IXP4XX_INTC_BASE_PHYS           (IXP4XX_PERIPHERAL_BASE_PHYS + 0x3000)
122 #define IXP4XX_GPIO_BASE_PHYS           (IXP4XX_PERIPHERAL_BASE_PHYS + 0x4000)
123 #define IXP4XX_TIMER_BASE_PHYS          (IXP4XX_PERIPHERAL_BASE_PHYS + 0x5000)
124 #define IXP4XX_NPEA_BASE_PHYS           (IXP4XX_PERIPHERAL_BASE_PHYS + 0x6000)
125 #define IXP4XX_NPEB_BASE_PHYS           (IXP4XX_PERIPHERAL_BASE_PHYS + 0x7000)
126 #define IXP4XX_NPEC_BASE_PHYS           (IXP4XX_PERIPHERAL_BASE_PHYS + 0x8000)
127 #define IXP4XX_EthB_BASE_PHYS           (IXP4XX_PERIPHERAL_BASE_PHYS + 0x9000)
128 #define IXP4XX_EthC_BASE_PHYS           (IXP4XX_PERIPHERAL_BASE_PHYS + 0xA000)
129 #define IXP4XX_USB_BASE_PHYS            (IXP4XX_PERIPHERAL_BASE_PHYS + 0xB000)
130 /* ixp46X only */
131 #define IXP4XX_EthA_BASE_PHYS           (IXP4XX_PERIPHERAL_BASE_PHYS + 0xC000)
132 #define IXP4XX_EthB1_BASE_PHYS          (IXP4XX_PERIPHERAL_BASE_PHYS + 0xD000)
133 #define IXP4XX_EthB2_BASE_PHYS          (IXP4XX_PERIPHERAL_BASE_PHYS + 0xE000)
134 #define IXP4XX_EthB3_BASE_PHYS          (IXP4XX_PERIPHERAL_BASE_PHYS + 0xF000)
135 #define IXP4XX_TIMESYNC_BASE_PHYS       (IXP4XX_PERIPHERAL_BASE_PHYS + 0x10000)
136 #define IXP4XX_I2C_BASE_PHYS            (IXP4XX_PERIPHERAL_BASE_PHYS + 0x11000)
137 #define IXP4XX_SSP_BASE_PHYS            (IXP4XX_PERIPHERAL_BASE_PHYS + 0x12000)
138
139
140 #define IXP4XX_UART1_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0x0000)
141 #define IXP4XX_UART2_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0x1000)
142 #define IXP4XX_PMU_BASE_VIRT            (IXP4XX_PERIPHERAL_BASE_VIRT + 0x2000)
143 #define IXP4XX_INTC_BASE_VIRT           (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000)
144 #define IXP4XX_GPIO_BASE_VIRT           (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000)
145 #define IXP4XX_TIMER_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000)
146 #define IXP4XX_NPEA_BASE_VIRT           (IXP4XX_PERIPHERAL_BASE_PHYS + 0x6000)
147 #define IXP4XX_NPEB_BASE_VIRT           (IXP4XX_PERIPHERAL_BASE_PHYS + 0x7000)
148 #define IXP4XX_NPEC_BASE_VIRT           (IXP4XX_PERIPHERAL_BASE_PHYS + 0x8000)
149 #define IXP4XX_EthB_BASE_VIRT           (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000)
150 #define IXP4XX_EthC_BASE_VIRT           (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000)
151 #define IXP4XX_USB_BASE_VIRT            (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000)
152 /* ixp46X only */
153 #define IXP4XX_EthA_BASE_VIRT           (IXP4XX_PERIPHERAL_BASE_VIRT + 0xC000)
154 #define IXP4XX_EthB1_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0xD000)
155 #define IXP4XX_EthB2_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0xE000)
156 #define IXP4XX_EthB3_BASE_VIRT          (IXP4XX_PERIPHERAL_BASE_VIRT + 0xF000)
157 #define IXP4XX_TIMESYNC_BASE_VIRT       (IXP4XX_PERIPHERAL_BASE_VIRT + 0x10000)
158 #define IXP4XX_I2C_BASE_VIRT            (IXP4XX_PERIPHERAL_BASE_VIRT + 0x11000)
159 #define IXP4XX_SSP_BASE_VIRT            (IXP4XX_PERIPHERAL_BASE_VIRT + 0x12000)
160
161 /*
162  * Constants to make it easy to access  Interrupt Controller registers
163  */
164 #define IXP4XX_ICPR_OFFSET      0x00 /* Interrupt Status */
165 #define IXP4XX_ICMR_OFFSET      0x04 /* Interrupt Enable */
166 #define IXP4XX_ICLR_OFFSET      0x08 /* Interrupt IRQ/FIQ Select */
167 #define IXP4XX_ICIP_OFFSET      0x0C /* IRQ Status */
168 #define IXP4XX_ICFP_OFFSET      0x10 /* FIQ Status */
169 #define IXP4XX_ICHR_OFFSET      0x14 /* Interrupt Priority */
170 #define IXP4XX_ICIH_OFFSET      0x18 /* IRQ Highest Pri Int */
171 #define IXP4XX_ICFH_OFFSET      0x1C /* FIQ Highest Pri Int */
172
173 /*
174  * IXP465-only
175  */
176 #define IXP4XX_ICPR2_OFFSET     0x20 /* Interrupt Status 2 */
177 #define IXP4XX_ICMR2_OFFSET     0x24 /* Interrupt Enable 2 */
178 #define IXP4XX_ICLR2_OFFSET     0x28 /* Interrupt IRQ/FIQ Select 2 */
179 #define IXP4XX_ICIP2_OFFSET     0x2C /* IRQ Status */
180 #define IXP4XX_ICFP2_OFFSET     0x30 /* FIQ Status */
181 #define IXP4XX_ICEEN_OFFSET     0x34 /* Error High Pri Enable */
182
183
184 /*
185  * Interrupt Controller Register Definitions.
186  */
187
188 #define IXP4XX_INTC_REG(x) ((volatile u32 *)(IXP4XX_INTC_BASE_VIRT+(x)))
189
190 #define IXP4XX_ICPR     IXP4XX_INTC_REG(IXP4XX_ICPR_OFFSET)
191 #define IXP4XX_ICMR     IXP4XX_INTC_REG(IXP4XX_ICMR_OFFSET)
192 #define IXP4XX_ICLR     IXP4XX_INTC_REG(IXP4XX_ICLR_OFFSET)
193 #define IXP4XX_ICIP     IXP4XX_INTC_REG(IXP4XX_ICIP_OFFSET)
194 #define IXP4XX_ICFP     IXP4XX_INTC_REG(IXP4XX_ICFP_OFFSET)
195 #define IXP4XX_ICHR     IXP4XX_INTC_REG(IXP4XX_ICHR_OFFSET)
196 #define IXP4XX_ICIH     IXP4XX_INTC_REG(IXP4XX_ICIH_OFFSET) 
197 #define IXP4XX_ICFH     IXP4XX_INTC_REG(IXP4XX_ICFH_OFFSET)
198 #define IXP4XX_ICPR2    IXP4XX_INTC_REG(IXP4XX_ICPR2_OFFSET)
199 #define IXP4XX_ICMR2    IXP4XX_INTC_REG(IXP4XX_ICMR2_OFFSET)
200 #define IXP4XX_ICLR2    IXP4XX_INTC_REG(IXP4XX_ICLR2_OFFSET)
201 #define IXP4XX_ICIP2    IXP4XX_INTC_REG(IXP4XX_ICIP2_OFFSET)
202 #define IXP4XX_ICFP2    IXP4XX_INTC_REG(IXP4XX_ICFP2_OFFSET)
203 #define IXP4XX_ICEEN    IXP4XX_INTC_REG(IXP4XX_ICEEN_OFFSET)
204                                                                                 
205 /*
206  * Constants to make it easy to access GPIO registers
207  */
208 #define IXP4XX_GPIO_GPOUTR_OFFSET       0x00
209 #define IXP4XX_GPIO_GPOER_OFFSET        0x04
210 #define IXP4XX_GPIO_GPINR_OFFSET        0x08
211 #define IXP4XX_GPIO_GPISR_OFFSET        0x0C
212 #define IXP4XX_GPIO_GPIT1R_OFFSET       0x10
213 #define IXP4XX_GPIO_GPIT2R_OFFSET       0x14
214 #define IXP4XX_GPIO_GPCLKR_OFFSET       0x18
215 #define IXP4XX_GPIO_GPDBSELR_OFFSET     0x1C
216
217 /* 
218  * GPIO Register Definitions.
219  * [Only perform 32bit reads/writes]
220  */
221 #define IXP4XX_GPIO_REG(x) ((volatile u32 *)(IXP4XX_GPIO_BASE_VIRT+(x)))
222
223 #define IXP4XX_GPIO_GPOUTR      IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOUTR_OFFSET)
224 #define IXP4XX_GPIO_GPOER       IXP4XX_GPIO_REG(IXP4XX_GPIO_GPOER_OFFSET)
225 #define IXP4XX_GPIO_GPINR       IXP4XX_GPIO_REG(IXP4XX_GPIO_GPINR_OFFSET)
226 #define IXP4XX_GPIO_GPISR       IXP4XX_GPIO_REG(IXP4XX_GPIO_GPISR_OFFSET)
227 #define IXP4XX_GPIO_GPIT1R      IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT1R_OFFSET)
228 #define IXP4XX_GPIO_GPIT2R      IXP4XX_GPIO_REG(IXP4XX_GPIO_GPIT2R_OFFSET)
229 #define IXP4XX_GPIO_GPCLKR      IXP4XX_GPIO_REG(IXP4XX_GPIO_GPCLKR_OFFSET)
230 #define IXP4XX_GPIO_GPDBSELR    IXP4XX_GPIO_REG(IXP4XX_GPIO_GPDBSELR_OFFSET)
231
232 /*
233  * GPIO register bit definitions
234  */
235
236 /* Interrupt styles
237  */
238 #define IXP4XX_GPIO_STYLE_ACTIVE_HIGH   0x0
239 #define IXP4XX_GPIO_STYLE_ACTIVE_LOW    0x1
240 #define IXP4XX_GPIO_STYLE_RISING_EDGE   0x2
241 #define IXP4XX_GPIO_STYLE_FALLING_EDGE  0x3
242 #define IXP4XX_GPIO_STYLE_TRANSITIONAL  0x4
243
244 /* 
245  * Mask used to clear interrupt styles 
246  */
247 #define IXP4XX_GPIO_STYLE_CLEAR         0x7
248 #define IXP4XX_GPIO_STYLE_SIZE          3
249
250 /*
251  * Constants to make it easy to access Timer Control/Status registers
252  */
253 #define IXP4XX_OSTS_OFFSET      0x00  /* Continious TimeStamp */
254 #define IXP4XX_OST1_OFFSET      0x04  /* Timer 1 Timestamp */
255 #define IXP4XX_OSRT1_OFFSET     0x08  /* Timer 1 Reload */
256 #define IXP4XX_OST2_OFFSET      0x0C  /* Timer 2 Timestamp */
257 #define IXP4XX_OSRT2_OFFSET     0x10  /* Timer 2 Reload */
258 #define IXP4XX_OSWT_OFFSET      0x14  /* Watchdog Timer */
259 #define IXP4XX_OSWE_OFFSET      0x18  /* Watchdog Enable */
260 #define IXP4XX_OSWK_OFFSET      0x1C  /* Watchdog Key */
261 #define IXP4XX_OSST_OFFSET      0x20  /* Timer Status */
262
263 /*
264  * Operating System Timer Register Definitions.
265  */
266
267 #define IXP4XX_TIMER_REG(x) ((volatile u32 *)(IXP4XX_TIMER_BASE_VIRT+(x)))
268
269 #define IXP4XX_OSTS     IXP4XX_TIMER_REG(IXP4XX_OSTS_OFFSET)
270 #define IXP4XX_OST1     IXP4XX_TIMER_REG(IXP4XX_OST1_OFFSET)
271 #define IXP4XX_OSRT1    IXP4XX_TIMER_REG(IXP4XX_OSRT1_OFFSET)
272 #define IXP4XX_OST2     IXP4XX_TIMER_REG(IXP4XX_OST2_OFFSET)
273 #define IXP4XX_OSRT2    IXP4XX_TIMER_REG(IXP4XX_OSRT2_OFFSET)
274 #define IXP4XX_OSWT     IXP4XX_TIMER_REG(IXP4XX_OSWT_OFFSET)
275 #define IXP4XX_OSWE     IXP4XX_TIMER_REG(IXP4XX_OSWE_OFFSET)
276 #define IXP4XX_OSWK     IXP4XX_TIMER_REG(IXP4XX_OSWK_OFFSET)
277 #define IXP4XX_OSST     IXP4XX_TIMER_REG(IXP4XX_OSST_OFFSET)
278
279 /*
280  * Timer register values and bit definitions 
281  */
282 #define IXP4XX_OST_ENABLE               0x00000001
283 #define IXP4XX_OST_ONE_SHOT             0x00000002
284 /* Low order bits of reload value ignored */
285 #define IXP4XX_OST_RELOAD_MASK          0x00000003
286 #define IXP4XX_OST_DISABLED             0x00000000
287 #define IXP4XX_OSST_TIMER_1_PEND        0x00000001
288 #define IXP4XX_OSST_TIMER_2_PEND        0x00000002
289 #define IXP4XX_OSST_TIMER_TS_PEND       0x00000004
290 #define IXP4XX_OSST_TIMER_WDOG_PEND     0x00000008
291 #define IXP4XX_OSST_TIMER_WARM_RESET    0x00000010
292
293 #define IXP4XX_WDT_KEY                  0x0000482E
294
295 #define IXP4XX_WDT_RESET_ENABLE         0x00000001
296 #define IXP4XX_WDT_IRQ_ENABLE           0x00000002
297 #define IXP4XX_WDT_COUNT_ENABLE         0x00000004
298
299
300 /*
301  * Constants to make it easy to access PCI Control/Status registers
302  */
303 #define PCI_NP_AD_OFFSET            0x00
304 #define PCI_NP_CBE_OFFSET           0x04
305 #define PCI_NP_WDATA_OFFSET         0x08
306 #define PCI_NP_RDATA_OFFSET         0x0c
307 #define PCI_CRP_AD_CBE_OFFSET       0x10
308 #define PCI_CRP_WDATA_OFFSET        0x14
309 #define PCI_CRP_RDATA_OFFSET        0x18
310 #define PCI_CSR_OFFSET              0x1c
311 #define PCI_ISR_OFFSET              0x20
312 #define PCI_INTEN_OFFSET            0x24
313 #define PCI_DMACTRL_OFFSET          0x28
314 #define PCI_AHBMEMBASE_OFFSET       0x2c
315 #define PCI_AHBIOBASE_OFFSET        0x30
316 #define PCI_PCIMEMBASE_OFFSET       0x34
317 #define PCI_AHBDOORBELL_OFFSET      0x38
318 #define PCI_PCIDOORBELL_OFFSET      0x3C
319 #define PCI_ATPDMA0_AHBADDR_OFFSET  0x40
320 #define PCI_ATPDMA0_PCIADDR_OFFSET  0x44
321 #define PCI_ATPDMA0_LENADDR_OFFSET  0x48
322 #define PCI_ATPDMA1_AHBADDR_OFFSET  0x4C
323 #define PCI_ATPDMA1_PCIADDR_OFFSET  0x50
324 #define PCI_ATPDMA1_LENADDR_OFFSET      0x54
325
326 /*
327  * PCI Control/Status Registers
328  */
329 #define IXP4XX_PCI_CSR(x) ((volatile u32 *)(IXP4XX_PCI_CFG_BASE_VIRT+(x)))
330
331 #define PCI_NP_AD               IXP4XX_PCI_CSR(PCI_NP_AD_OFFSET)
332 #define PCI_NP_CBE              IXP4XX_PCI_CSR(PCI_NP_CBE_OFFSET)
333 #define PCI_NP_WDATA            IXP4XX_PCI_CSR(PCI_NP_WDATA_OFFSET)
334 #define PCI_NP_RDATA            IXP4XX_PCI_CSR(PCI_NP_RDATA_OFFSET)
335 #define PCI_CRP_AD_CBE          IXP4XX_PCI_CSR(PCI_CRP_AD_CBE_OFFSET)
336 #define PCI_CRP_WDATA           IXP4XX_PCI_CSR(PCI_CRP_WDATA_OFFSET)
337 #define PCI_CRP_RDATA           IXP4XX_PCI_CSR(PCI_CRP_RDATA_OFFSET)
338 #define PCI_CSR                 IXP4XX_PCI_CSR(PCI_CSR_OFFSET) 
339 #define PCI_ISR                 IXP4XX_PCI_CSR(PCI_ISR_OFFSET)
340 #define PCI_INTEN               IXP4XX_PCI_CSR(PCI_INTEN_OFFSET)
341 #define PCI_DMACTRL             IXP4XX_PCI_CSR(PCI_DMACTRL_OFFSET)
342 #define PCI_AHBMEMBASE          IXP4XX_PCI_CSR(PCI_AHBMEMBASE_OFFSET)
343 #define PCI_AHBIOBASE           IXP4XX_PCI_CSR(PCI_AHBIOBASE_OFFSET)
344 #define PCI_PCIMEMBASE          IXP4XX_PCI_CSR(PCI_PCIMEMBASE_OFFSET)
345 #define PCI_AHBDOORBELL         IXP4XX_PCI_CSR(PCI_AHBDOORBELL_OFFSET)
346 #define PCI_PCIDOORBELL         IXP4XX_PCI_CSR(PCI_PCIDOORBELL_OFFSET)
347 #define PCI_ATPDMA0_AHBADDR     IXP4XX_PCI_CSR(PCI_ATPDMA0_AHBADDR_OFFSET)
348 #define PCI_ATPDMA0_PCIADDR     IXP4XX_PCI_CSR(PCI_ATPDMA0_PCIADDR_OFFSET)
349 #define PCI_ATPDMA0_LENADDR     IXP4XX_PCI_CSR(PCI_ATPDMA0_LENADDR_OFFSET)
350 #define PCI_ATPDMA1_AHBADDR     IXP4XX_PCI_CSR(PCI_ATPDMA1_AHBADDR_OFFSET)
351 #define PCI_ATPDMA1_PCIADDR     IXP4XX_PCI_CSR(PCI_ATPDMA1_PCIADDR_OFFSET)
352 #define PCI_ATPDMA1_LENADDR     IXP4XX_PCI_CSR(PCI_ATPDMA1_LENADDR_OFFSET)
353
354 /*
355  * PCI register values and bit definitions 
356  */
357
358 /* CSR bit definitions */
359 #define PCI_CSR_HOST            0x00000001
360 #define PCI_CSR_ARBEN           0x00000002
361 #define PCI_CSR_ADS             0x00000004
362 #define PCI_CSR_PDS             0x00000008
363 #define PCI_CSR_ABE             0x00000010
364 #define PCI_CSR_DBT             0x00000020
365 #define PCI_CSR_ASE             0x00000100
366 #define PCI_CSR_IC              0x00008000
367
368 /* ISR (Interrupt status) Register bit definitions */
369 #define PCI_ISR_PSE             0x00000001
370 #define PCI_ISR_PFE             0x00000002
371 #define PCI_ISR_PPE             0x00000004
372 #define PCI_ISR_AHBE            0x00000008
373 #define PCI_ISR_APDC            0x00000010
374 #define PCI_ISR_PADC            0x00000020
375 #define PCI_ISR_ADB             0x00000040
376 #define PCI_ISR_PDB             0x00000080
377
378 /* INTEN (Interrupt Enable) Register bit definitions */
379 #define PCI_INTEN_PSE           0x00000001
380 #define PCI_INTEN_PFE           0x00000002
381 #define PCI_INTEN_PPE           0x00000004
382 #define PCI_INTEN_AHBE          0x00000008
383 #define PCI_INTEN_APDC          0x00000010
384 #define PCI_INTEN_PADC          0x00000020
385 #define PCI_INTEN_ADB           0x00000040
386 #define PCI_INTEN_PDB           0x00000080
387
388 /*
389  * Shift value for byte enable on NP cmd/byte enable register
390  */
391 #define IXP4XX_PCI_NP_CBE_BESL          4
392
393 /*
394  * PCI commands supported by NP access unit
395  */
396 #define NP_CMD_IOREAD                   0x2
397 #define NP_CMD_IOWRITE                  0x3
398 #define NP_CMD_CONFIGREAD               0xa
399 #define NP_CMD_CONFIGWRITE              0xb
400 #define NP_CMD_MEMREAD                  0x6
401 #define NP_CMD_MEMWRITE                 0x7
402
403 /*
404  * Constants for CRP access into local config space
405  */
406 #define CRP_AD_CBE_BESL         20
407 #define CRP_AD_CBE_WRITE        0x00010000
408
409
410 /*
411  * USB Device Controller
412  *
413  * These are used by the USB gadget driver, so they don't follow the
414  * IXP4XX_ naming convetions.
415  *
416  */
417 # define IXP4XX_USB_REG(x)       (*((volatile u32 *)(x)))
418
419 /* UDC Undocumented - Reserved1 */
420 #define UDC_RES1        IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0004)  
421 /* UDC Undocumented - Reserved2 */
422 #define UDC_RES2        IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0008)  
423 /* UDC Undocumented - Reserved3 */
424 #define UDC_RES3        IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x000C)  
425 /* UDC Control Register */
426 #define UDCCR           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0000)  
427 /* UDC Endpoint 0 Control/Status Register */
428 #define UDCCS0          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0010)  
429 /* UDC Endpoint 1 (IN) Control/Status Register */
430 #define UDCCS1          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0014)  
431 /* UDC Endpoint 2 (OUT) Control/Status Register */
432 #define UDCCS2          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0018)  
433 /* UDC Endpoint 3 (IN) Control/Status Register */
434 #define UDCCS3          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x001C)  
435 /* UDC Endpoint 4 (OUT) Control/Status Register */
436 #define UDCCS4          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0020)  
437 /* UDC Endpoint 5 (Interrupt) Control/Status Register */
438 #define UDCCS5          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0024)  
439 /* UDC Endpoint 6 (IN) Control/Status Register */
440 #define UDCCS6          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0028)  
441 /* UDC Endpoint 7 (OUT) Control/Status Register */
442 #define UDCCS7          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x002C)  
443 /* UDC Endpoint 8 (IN) Control/Status Register */
444 #define UDCCS8          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0030)  
445 /* UDC Endpoint 9 (OUT) Control/Status Register */
446 #define UDCCS9          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0034)  
447 /* UDC Endpoint 10 (Interrupt) Control/Status Register */
448 #define UDCCS10         IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0038)  
449 /* UDC Endpoint 11 (IN) Control/Status Register */
450 #define UDCCS11         IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x003C)  
451 /* UDC Endpoint 12 (OUT) Control/Status Register */
452 #define UDCCS12         IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0040)  
453 /* UDC Endpoint 13 (IN) Control/Status Register */
454 #define UDCCS13         IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0044)  
455 /* UDC Endpoint 14 (OUT) Control/Status Register */
456 #define UDCCS14         IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0048)  
457 /* UDC Endpoint 15 (Interrupt) Control/Status Register */
458 #define UDCCS15         IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x004C)  
459 /* UDC Frame Number Register High */
460 #define UFNRH           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0060)  
461 /* UDC Frame Number Register Low */
462 #define UFNRL           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0064)  
463 /* UDC Byte Count Reg 2 */
464 #define UBCR2           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0068)  
465 /* UDC Byte Count Reg 4 */
466 #define UBCR4           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x006c)  
467 /* UDC Byte Count Reg 7 */
468 #define UBCR7           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0070)  
469 /* UDC Byte Count Reg 9 */
470 #define UBCR9           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0074)  
471 /* UDC Byte Count Reg 12 */
472 #define UBCR12          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0078)  
473 /* UDC Byte Count Reg 14 */
474 #define UBCR14          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x007c)  
475 /* UDC Endpoint 0 Data Register */
476 #define UDDR0           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0080)  
477 /* UDC Endpoint 1 Data Register */
478 #define UDDR1           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0100)  
479 /* UDC Endpoint 2 Data Register */
480 #define UDDR2           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0180)  
481 /* UDC Endpoint 3 Data Register */
482 #define UDDR3           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0200)  
483 /* UDC Endpoint 4 Data Register */
484 #define UDDR4           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0400)  
485 /* UDC Endpoint 5 Data Register */
486 #define UDDR5           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00A0)  
487 /* UDC Endpoint 6 Data Register */
488 #define UDDR6           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0600)  
489 /* UDC Endpoint 7 Data Register */
490 #define UDDR7           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0680)  
491 /* UDC Endpoint 8 Data Register */
492 #define UDDR8           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0700)  
493 /* UDC Endpoint 9 Data Register */
494 #define UDDR9           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0900)  
495 /* UDC Endpoint 10 Data Register */
496 #define UDDR10          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00C0)  
497 /* UDC Endpoint 11 Data Register */
498 #define UDDR11          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0B00)  
499 /* UDC Endpoint 12 Data Register */
500 #define UDDR12          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0B80)  
501 /* UDC Endpoint 13 Data Register */
502 #define UDDR13          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0C00)  
503 /* UDC Endpoint 14 Data Register */
504 #define UDDR14          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0E00)  
505 /* UDC Endpoint 15 Data Register */
506 #define UDDR15          IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x00E0)  
507 /* UDC Interrupt Control Register 0 */
508 #define UICR0           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0050)  
509 /* UDC Interrupt Control Register 1 */
510 #define UICR1           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0054)  
511 /* UDC Status Interrupt Register 0 */
512 #define USIR0           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x0058)  
513 /* UDC Status Interrupt Register 1 */
514 #define USIR1           IXP4XX_USB_REG(IXP4XX_USB_BASE_VIRT+0x005C)  
515
516 #define UDCCR_UDE       (1 << 0)        /* UDC enable */
517 #define UDCCR_UDA       (1 << 1)        /* UDC active */
518 #define UDCCR_RSM       (1 << 2)        /* Device resume */
519 #define UDCCR_RESIR     (1 << 3)        /* Resume interrupt request */
520 #define UDCCR_SUSIR     (1 << 4)        /* Suspend interrupt request */
521 #define UDCCR_SRM       (1 << 5)        /* Suspend/resume interrupt mask */
522 #define UDCCR_RSTIR     (1 << 6)        /* Reset interrupt request */
523 #define UDCCR_REM       (1 << 7)        /* Reset interrupt mask */
524
525 #define UDCCS0_OPR      (1 << 0)        /* OUT packet ready */
526 #define UDCCS0_IPR      (1 << 1)        /* IN packet ready */
527 #define UDCCS0_FTF      (1 << 2)        /* Flush Tx FIFO */
528 #define UDCCS0_DRWF     (1 << 3)        /* Device remote wakeup feature */
529 #define UDCCS0_SST      (1 << 4)        /* Sent stall */
530 #define UDCCS0_FST      (1 << 5)        /* Force stall */
531 #define UDCCS0_RNE      (1 << 6)        /* Receive FIFO no empty */
532 #define UDCCS0_SA       (1 << 7)        /* Setup active */
533
534 #define UDCCS_BI_TFS    (1 << 0)        /* Transmit FIFO service */
535 #define UDCCS_BI_TPC    (1 << 1)        /* Transmit packet complete */
536 #define UDCCS_BI_FTF    (1 << 2)        /* Flush Tx FIFO */
537 #define UDCCS_BI_TUR    (1 << 3)        /* Transmit FIFO underrun */
538 #define UDCCS_BI_SST    (1 << 4)        /* Sent stall */
539 #define UDCCS_BI_FST    (1 << 5)        /* Force stall */
540 #define UDCCS_BI_TSP    (1 << 7)        /* Transmit short packet */
541
542 #define UDCCS_BO_RFS    (1 << 0)        /* Receive FIFO service */
543 #define UDCCS_BO_RPC    (1 << 1)        /* Receive packet complete */
544 #define UDCCS_BO_DME    (1 << 3)        /* DMA enable */
545 #define UDCCS_BO_SST    (1 << 4)        /* Sent stall */
546 #define UDCCS_BO_FST    (1 << 5)        /* Force stall */
547 #define UDCCS_BO_RNE    (1 << 6)        /* Receive FIFO not empty */
548 #define UDCCS_BO_RSP    (1 << 7)        /* Receive short packet */
549
550 #define UDCCS_II_TFS    (1 << 0)        /* Transmit FIFO service */
551 #define UDCCS_II_TPC    (1 << 1)        /* Transmit packet complete */
552 #define UDCCS_II_FTF    (1 << 2)        /* Flush Tx FIFO */
553 #define UDCCS_II_TUR    (1 << 3)        /* Transmit FIFO underrun */
554 #define UDCCS_II_TSP    (1 << 7)        /* Transmit short packet */
555
556 #define UDCCS_IO_RFS    (1 << 0)        /* Receive FIFO service */
557 #define UDCCS_IO_RPC    (1 << 1)        /* Receive packet complete */
558 #define UDCCS_IO_ROF    (1 << 3)        /* Receive overflow */
559 #define UDCCS_IO_DME    (1 << 3)        /* DMA enable */
560 #define UDCCS_IO_RNE    (1 << 6)        /* Receive FIFO not empty */
561 #define UDCCS_IO_RSP    (1 << 7)        /* Receive short packet */
562
563 #define UDCCS_INT_TFS   (1 << 0)        /* Transmit FIFO service */
564 #define UDCCS_INT_TPC   (1 << 1)        /* Transmit packet complete */
565 #define UDCCS_INT_FTF   (1 << 2)        /* Flush Tx FIFO */
566 #define UDCCS_INT_TUR   (1 << 3)        /* Transmit FIFO underrun */
567 #define UDCCS_INT_SST   (1 << 4)        /* Sent stall */
568 #define UDCCS_INT_FST   (1 << 5)        /* Force stall */
569 #define UDCCS_INT_TSP   (1 << 7)        /* Transmit short packet */
570
571 #define UICR0_IM0       (1 << 0)        /* Interrupt mask ep 0 */
572 #define UICR0_IM1       (1 << 1)        /* Interrupt mask ep 1 */
573 #define UICR0_IM2       (1 << 2)        /* Interrupt mask ep 2 */
574 #define UICR0_IM3       (1 << 3)        /* Interrupt mask ep 3 */
575 #define UICR0_IM4       (1 << 4)        /* Interrupt mask ep 4 */
576 #define UICR0_IM5       (1 << 5)        /* Interrupt mask ep 5 */
577 #define UICR0_IM6       (1 << 6)        /* Interrupt mask ep 6 */
578 #define UICR0_IM7       (1 << 7)        /* Interrupt mask ep 7 */
579
580 #define UICR1_IM8       (1 << 0)        /* Interrupt mask ep 8 */
581 #define UICR1_IM9       (1 << 1)        /* Interrupt mask ep 9 */
582 #define UICR1_IM10      (1 << 2)        /* Interrupt mask ep 10 */
583 #define UICR1_IM11      (1 << 3)        /* Interrupt mask ep 11 */
584 #define UICR1_IM12      (1 << 4)        /* Interrupt mask ep 12 */
585 #define UICR1_IM13      (1 << 5)        /* Interrupt mask ep 13 */
586 #define UICR1_IM14      (1 << 6)        /* Interrupt mask ep 14 */
587 #define UICR1_IM15      (1 << 7)        /* Interrupt mask ep 15 */
588
589 #define USIR0_IR0       (1 << 0)        /* Interrup request ep 0 */
590 #define USIR0_IR1       (1 << 1)        /* Interrup request ep 1 */
591 #define USIR0_IR2       (1 << 2)        /* Interrup request ep 2 */
592 #define USIR0_IR3       (1 << 3)        /* Interrup request ep 3 */
593 #define USIR0_IR4       (1 << 4)        /* Interrup request ep 4 */
594 #define USIR0_IR5       (1 << 5)        /* Interrup request ep 5 */
595 #define USIR0_IR6       (1 << 6)        /* Interrup request ep 6 */
596 #define USIR0_IR7       (1 << 7)        /* Interrup request ep 7 */
597
598 #define USIR1_IR8       (1 << 0)        /* Interrup request ep 8 */
599 #define USIR1_IR9       (1 << 1)        /* Interrup request ep 9 */
600 #define USIR1_IR10      (1 << 2)        /* Interrup request ep 10 */
601 #define USIR1_IR11      (1 << 3)        /* Interrup request ep 11 */
602 #define USIR1_IR12      (1 << 4)        /* Interrup request ep 12 */
603 #define USIR1_IR13      (1 << 5)        /* Interrup request ep 13 */
604 #define USIR1_IR14      (1 << 6)        /* Interrup request ep 14 */
605 #define USIR1_IR15      (1 << 7)        /* Interrup request ep 15 */
606
607 #define DCMD_LENGTH     0x01fff         /* length mask (max = 8K - 1) */
608
609 #ifndef __ASSEMBLY__
610 static inline int cpu_is_ixp46x(void)
611 {
612 #ifdef CONFIG_CPU_IXP46X
613         unsigned int processor_id;
614
615         asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :);
616
617         if ((processor_id & 0xffffff00) == 0x69054200)
618                 return 1;
619 #endif
620         return 0;
621 }
622 #endif
623
624 #endif