socrates: Update NAND driver to new API.
[platform/kernel/u-boot.git] / include / ppc405.h
1 /*----------------------------------------------------------------------------+
2 |
3 |       This source code has been made available to you by IBM on an AS-IS
4 |       basis.  Anyone receiving this source is licensed under IBM
5 |       copyrights to use it in any way he or she deems fit, including
6 |       copying it, modifying it, compiling it, and redistributing it either
7 |       with or without modifications.  No license under IBM patents or
8 |       patent applications is to be implied by the copyright license.
9 |
10 |       Any user of this software should understand that IBM cannot provide
11 |       technical support for this software and will not be responsible for
12 |       any consequences resulting from the use of this software.
13 |
14 |       Any person who transfers this source code or any derivative work
15 |       must include the IBM copyright notice, this paragraph, and the
16 |       preceding two paragraphs in the transferred software.
17 |
18 |       COPYRIGHT   I B M   CORPORATION 1999
19 |       LICENSED MATERIAL  -  PROGRAM PROPERTY OF I B M
20 +----------------------------------------------------------------------------*/
21
22 #ifndef __PPC405_H__
23 #define __PPC405_H__
24
25 /* Define bits and masks for real-mode storage attribute control registers */
26 #define PPC_128MB_SACR_BIT(addr)        ((addr) >> 27)
27 #define PPC_128MB_SACR_VALUE(addr)      PPC_REG_VAL(PPC_128MB_SACR_BIT(addr),1)
28
29 #ifndef CONFIG_IOP480
30 #define CFG_DCACHE_SIZE         (16 << 10)      /* For AMCC 405 CPUs    */
31 #else
32 #define CFG_DCACHE_SIZE         (2 << 10)       /* For PLX IOP480 (403) */
33 #endif
34
35 /*--------------------------------------------------------------------- */
36 /* Special Purpose Registers                                            */
37 /*--------------------------------------------------------------------- */
38         #define  srr2  0x3de      /* save/restore register 2 */
39         #define  srr3  0x3df      /* save/restore register 3 */
40
41         /*
42          * 405 does not really have CSRR0/1 but SRR2/3 are used during critical
43          * exception for the exact same purposes - let's alias them and have a
44          * common handling in crit_return() and CRIT_EXCEPTION
45          */
46         #define  csrr0 srr2
47         #define  csrr1 srr3
48
49         #define  dbsr  0x3f0      /* debug status register */
50         #define  dbcr0 0x3f2      /* debug control register 0 */
51         #define  dbcr1 0x3bd      /* debug control register 1 */
52         #define  iac1  0x3f4      /* instruction address comparator 1 */
53         #define  iac2  0x3f5      /* instruction address comparator 2 */
54         #define  iac3  0x3b4      /* instruction address comparator 3 */
55         #define  iac4  0x3b5      /* instruction address comparator 4 */
56         #define  dac1  0x3f6      /* data address comparator 1 */
57         #define  dac2  0x3f7      /* data address comparator 2 */
58         #define  dccr  0x3fa      /* data cache control register */
59         #define  iccr  0x3fb      /* instruction cache control register */
60         #define  esr   0x3d4      /* execption syndrome register */
61         #define  dear  0x3d5      /* data exeption address register */
62         #define  evpr  0x3d6      /* exeption vector prefix register */
63         #define  tsr   0x3d8      /* timer status register */
64         #define  tcr   0x3da      /* timer control register */
65         #define  pit   0x3db      /* programmable interval timer */
66         #define  sgr   0x3b9      /* storage guarded reg      */
67         #define  dcwr  0x3ba      /* data cache write-thru reg*/
68         #define  sler  0x3bb      /* storage little-endian reg */
69         #define  cdbcr 0x3d7      /* cache debug cntrl reg    */
70         #define  icdbdr 0x3d3     /* instr cache dbug data reg*/
71         #define  ccr0  0x3b3      /* core configuration register */
72         #define  dvc1  0x3b6      /* data value compare register 1 */
73         #define  dvc2  0x3b7      /* data value compare register 2 */
74         #define  pid   0x3b1      /* process ID */
75         #define  su0r  0x3bc      /* storage user-defined register 0 */
76         #define  zpr   0x3b0      /* zone protection regsiter */
77
78         #define  tbl   0x11c      /* time base lower - privileged write */
79         #define  tbu   0x11d      /* time base upper - privileged write */
80
81         #define  sprg4r 0x104     /* Special purpose general 4 - read only */
82         #define  sprg5r 0x105     /* Special purpose general 5 - read only */
83         #define  sprg6r 0x106     /* Special purpose general 6 - read only */
84         #define  sprg7r 0x107     /* Special purpose general 7 - read only */
85         #define  sprg4w 0x114     /* Special purpose general 4 - write only */
86         #define  sprg5w 0x115     /* Special purpose general 5 - write only */
87         #define  sprg6w 0x116     /* Special purpose general 6 - write only */
88         #define  sprg7w 0x117     /* Special purpose general 7 - write only */
89
90 /******************************************************************************
91  * Special for PPC405GP
92  ******************************************************************************/
93
94 /******************************************************************************
95  * DMA
96  ******************************************************************************/
97 #define DMA_DCR_BASE 0x100
98 #define dmacr0  (DMA_DCR_BASE+0x00)  /* DMA channel control register 0       */
99 #define dmact0  (DMA_DCR_BASE+0x01)  /* DMA count register 0                 */
100 #define dmada0  (DMA_DCR_BASE+0x02)  /* DMA destination address register 0   */
101 #define dmasa0  (DMA_DCR_BASE+0x03)  /* DMA source address register 0        */
102 #define dmasb0  (DMA_DCR_BASE+0x04)  /* DMA scatter/gather descriptor addr 0 */
103 #define dmacr1  (DMA_DCR_BASE+0x08)  /* DMA channel control register 1       */
104 #define dmact1  (DMA_DCR_BASE+0x09)  /* DMA count register 1                 */
105 #define dmada1  (DMA_DCR_BASE+0x0a)  /* DMA destination address register 1   */
106 #define dmasa1  (DMA_DCR_BASE+0x0b)  /* DMA source address register 1        */
107 #define dmasb1  (DMA_DCR_BASE+0x0c)  /* DMA scatter/gather descriptor addr 1 */
108 #define dmacr2  (DMA_DCR_BASE+0x10)  /* DMA channel control register 2       */
109 #define dmact2  (DMA_DCR_BASE+0x11)  /* DMA count register 2                 */
110 #define dmada2  (DMA_DCR_BASE+0x12)  /* DMA destination address register 2   */
111 #define dmasa2  (DMA_DCR_BASE+0x13)  /* DMA source address register 2        */
112 #define dmasb2  (DMA_DCR_BASE+0x14)  /* DMA scatter/gather descriptor addr 2 */
113 #define dmacr3  (DMA_DCR_BASE+0x18)  /* DMA channel control register 3       */
114 #define dmact3  (DMA_DCR_BASE+0x19)  /* DMA count register 3                 */
115 #define dmada3  (DMA_DCR_BASE+0x1a)  /* DMA destination address register 3   */
116 #define dmasa3  (DMA_DCR_BASE+0x1b)  /* DMA source address register 3        */
117 #define dmasb3  (DMA_DCR_BASE+0x1c)  /* DMA scatter/gather descriptor addr 3 */
118 #define dmasr   (DMA_DCR_BASE+0x20)  /* DMA status register                  */
119 #define dmasgc  (DMA_DCR_BASE+0x23)  /* DMA scatter/gather command register  */
120 #define dmaadr  (DMA_DCR_BASE+0x24)  /* DMA address decode register          */
121
122 /******************************************************************************
123  * Universal interrupt controller
124  ******************************************************************************/
125 #define UIC_SR  0x0                     /* UIC status                      */
126 #define UIC_ER  0x2                     /* UIC enable                      */
127 #define UIC_CR  0x3                     /* UIC critical                    */
128 #define UIC_PR  0x4                     /* UIC polarity                    */
129 #define UIC_TR  0x5                     /* UIC triggering                  */
130 #define UIC_MSR 0x6                     /* UIC masked status               */
131 #define UIC_VR  0x7                     /* UIC vector                      */
132 #define UIC_VCR 0x8                     /* UIC vector configuration        */
133
134 #define UIC_DCR_BASE 0xc0
135 #define UIC0_DCR_BASE UIC_DCR_BASE
136 #define uicsr        (UIC_DCR_BASE+0x0)  /* UIC status                       */
137 #define uicsrs       (UIC_DCR_BASE+0x1)  /* UIC status set                   */
138 #define uicer        (UIC_DCR_BASE+0x2)  /* UIC enable                       */
139 #define uiccr        (UIC_DCR_BASE+0x3)  /* UIC critical                     */
140 #define uicpr        (UIC_DCR_BASE+0x4)  /* UIC polarity                     */
141 #define uictr        (UIC_DCR_BASE+0x5)  /* UIC triggering                   */
142 #define uicmsr       (UIC_DCR_BASE+0x6)  /* UIC masked status                */
143 #define uicvr        (UIC_DCR_BASE+0x7)  /* UIC vector                       */
144 #define uicvcr       (UIC_DCR_BASE+0x8)  /* UIC vector configuration         */
145
146 #if defined(CONFIG_405EX)
147 #define uic0sr        uicsr             /* UIC status            */
148 #define uic0srs       uicsrs            /* UIC status set        */
149 #define uic0er        uicer             /* UIC enable            */
150 #define uic0cr        uiccr             /* UIC critical          */
151 #define uic0pr        uicpr             /* UIC polarity          */
152 #define uic0tr        uictr             /* UIC triggering        */
153 #define uic0msr       uicmsr            /* UIC masked status     */
154 #define uic0vr        uicvr             /* UIC vector            */
155 #define uic0vcr       uicvcr            /* UIC vector configuration*/
156
157 #define UIC_DCR_BASE1 0xd0
158 #define UIC1_DCR_BASE 0xd0
159 #define uic1sr        (UIC_DCR_BASE1+0x0)  /* UIC status            */
160 #define uic1srs       (UIC_DCR_BASE1+0x1)  /* UIC status set        */
161 #define uic1er        (UIC_DCR_BASE1+0x2)  /* UIC enable            */
162 #define uic1cr        (UIC_DCR_BASE1+0x3)  /* UIC critical          */
163 #define uic1pr        (UIC_DCR_BASE1+0x4)  /* UIC polarity          */
164 #define uic1tr        (UIC_DCR_BASE1+0x5)  /* UIC triggering        */
165 #define uic1msr       (UIC_DCR_BASE1+0x6)  /* UIC masked status     */
166 #define uic1vr        (UIC_DCR_BASE1+0x7)  /* UIC vector            */
167 #define uic1vcr       (UIC_DCR_BASE1+0x8)  /* UIC vector configuration*/
168
169 #define UIC_DCR_BASE2 0xe0
170 #define UIC2_DCR_BASE 0xe0
171 #define uic2sr        (UIC_DCR_BASE2+0x0)  /* UIC status            */
172 #define uic2srs       (UIC_DCR_BASE2+0x1)  /* UIC status set        */
173 #define uic2er        (UIC_DCR_BASE2+0x2)  /* UIC enable            */
174 #define uic2cr        (UIC_DCR_BASE2+0x3)  /* UIC critical          */
175 #define uic2pr        (UIC_DCR_BASE2+0x4)  /* UIC polarity          */
176 #define uic2tr        (UIC_DCR_BASE2+0x5)  /* UIC triggering        */
177 #define uic2msr       (UIC_DCR_BASE2+0x6)  /* UIC masked status     */
178 #define uic2vr        (UIC_DCR_BASE2+0x7)  /* UIC vector            */
179 #define uic2vcr       (UIC_DCR_BASE2+0x8)  /* UIC vector configuration*/
180 #endif
181
182 /*-----------------------------------------------------------------------------+
183 |  Universal interrupt controller interrupts
184 +-----------------------------------------------------------------------------*/
185 #if defined(CONFIG_405EZ)
186 #define UIC_DMA0        0x80000000      /* DMA chan. 0                  */
187 #define UIC_DMA1        0x40000000      /* DMA chan. 1                  */
188 #define UIC_DMA2        0x20000000      /* DMA chan. 2                  */
189 #define UIC_DMA3        0x10000000      /* DMA chan. 3                  */
190 #define UIC_1588        0x08000000      /* IEEE 1588 network synchronization */
191 #define UIC_UART0       0x04000000      /* UART 0                       */
192 #define UIC_UART1       0x02000000      /* UART 1                       */
193 #define UIC_CAN0        0x01000000      /* CAN 0                        */
194 #define UIC_CAN1        0x00800000      /* CAN 1                        */
195 #define UIC_SPI         0x00400000      /* SPI                          */
196 #define UIC_IIC         0x00200000      /* IIC                          */
197 #define UIC_CHT0        0x00100000      /* Chameleon timer high pri interrupt */
198 #define UIC_CHT1        0x00080000      /* Chameleon timer high pri interrupt */
199 #define UIC_USBH1       0x00040000      /* USB Host 1                   */
200 #define UIC_USBH2       0x00020000      /* USB Host 2                   */
201 #define UIC_USBDEV      0x00010000      /* USB Device                   */
202 #define UIC_ENET        0x00008000      /* Ethernet interrupt status    */
203 #define UIC_ENET1       0x00008000      /* dummy define                 */
204 #define UIC_EMAC_WAKE   0x00004000      /* EMAC wake up                 */
205
206 #define UIC_MADMAL      0x00002000      /* Logical OR of following MadMAL int */
207 #define UIC_MAL_SERR    0x00002000      /*   MAL SERR                   */
208 #define UIC_MAL_TXDE    0x00002000      /*   MAL TXDE                   */
209 #define UIC_MAL_RXDE    0x00002000      /*   MAL RXDE                   */
210
211 #define UIC_MAL_TXEOB   0x00001000      /* MAL TXEOB                    */
212 #define UIC_MAL_TXEOB1  0x00000800      /* MAL TXEOB1                   */
213 #define UIC_MAL_RXEOB   0x00000400      /* MAL RXEOB                    */
214 #define UIC_NAND        0x00000200      /* NAND Flash controller        */
215 #define UIC_ADC         0x00000100      /* ADC                          */
216 #define UIC_DAC         0x00000080      /* DAC                          */
217 #define UIC_OPB2PLB     0x00000040      /* OPB to PLB bridge interrupt  */
218 #define UIC_RESERVED0   0x00000020      /* Reserved                     */
219 #define UIC_EXT0        0x00000010      /* External  interrupt 0        */
220 #define UIC_EXT1        0x00000008      /* External  interrupt 1        */
221 #define UIC_EXT2        0x00000004      /* External  interrupt 2        */
222 #define UIC_EXT3        0x00000002      /* External  interrupt 3        */
223 #define UIC_EXT4        0x00000001      /* External  interrupt 4        */
224
225 #elif defined(CONFIG_405EX)
226
227 /* UIC 0 */
228 #define UIC_U0                  0x80000000      /* */
229 #define UIC_U1                  0x40000000      /* */
230 #define UIC_IIC0                0x20000000      /* */
231 #define UIC_PKA                 0x10000000      /* */
232 #define UIC_TRNG                0x08000000      /* */
233 #define UIC_EBM                 0x04000000      /* */
234 #define UIC_BGI                 0x02000000      /* */
235 #define UIC_IIC1                0x01000000      /* */
236 #define UIC_SPI                 0x00800000      /* */
237 #define UIC_EIRQ0               0x00400000      /**/
238 #define UIC_MTE                 0x00200000      /*MAL Tx EOB */
239 #define UIC_MRE                 0x00100000      /*MAL Rx EOB */
240 #define UIC_DMA0                0x00080000      /* */
241 #define UIC_DMA1                0x00040000      /* */
242 #define UIC_DMA2                0x00020000      /* */
243 #define UIC_DMA3                0x00010000      /* */
244 #define UIC_PCIE0AL             0x00008000      /* */
245 #define UIC_PCIE0VPD            0x00004000      /* */
246 #define UIC_RPCIE0HRST          0x00002000      /* */
247 #define UIC_FPCIE0HRST          0x00001000      /* */
248 #define UIC_PCIE0TCR            0x00000800      /* */
249 #define UIC_PCIEMSI0            0x00000400      /* */
250 #define UIC_PCIEMSI1            0x00000200      /* */
251 #define UIC_SECURITY            0x00000100      /* */
252 #define UIC_ENET                0x00000080      /* */
253 #define UIC_ENET1               0x00000040      /* */
254 #define UIC_PCIEMSI2            0x00000020      /* */
255 #define UIC_EIRQ4               0x00000010      /**/
256 #define UICB0_UIC2NCI           0x00000008      /* */
257 #define UICB0_UIC2CI            0x00000004      /* */
258 #define UICB0_UIC1NCI           0x00000002      /* */
259 #define UICB0_UIC1CI            0x00000001      /* */
260
261 #define UICB0_ALL               (UICB0_UIC1CI | UICB0_UIC1NCI | \
262                                  UICB0_UIC1CI | UICB0_UIC2NCI)
263
264 #define UIC_MAL_TXEOB           UIC_MTE/* MAL TXEOB                          */
265 #define UIC_MAL_RXEOB           UIC_MRE/* MAL RXEOB                          */
266 /* UIC 1 */
267 #define UIC_MS                  0x80000000      /* MAL SERR */
268 #define UIC_MTDE                0x40000000      /* MAL TXDE */
269 #define UIC_MRDE                0x20000000      /* MAL RXDE */
270 #define UIC_PCIE0BMVC0          0x10000000      /* */
271 #define UIC_PCIE0DCRERR         0x08000000      /* */
272 #define UIC_EBC                 0x04000000      /* */
273 #define UIC_NDFC                0x02000000      /* */
274 #define UIC_PCEI1DCRERR         0x01000000      /* */
275 #define UIC_GPTCMPT8            0x00800000      /* */
276 #define UIC_GPTCMPT9            0x00400000      /* */
277 #define UIC_PCIE1AL             0x00200000      /* */
278 #define UIC_PCIE1VPD            0x00100000      /* */
279 #define UIC_RPCE1HRST           0x00080000      /* */
280 #define UIC_FPCE1HRST           0x00040000      /* */
281 #define UIC_PCIE1TCR            0x00020000      /* */
282 #define UIC_PCIE1VC0            0x00010000      /* */
283 #define UIC_GPTCMPT3            0x00008000      /* */
284 #define UIC_GPTCMPT4            0x00004000      /* */
285 #define UIC_EIRQ7               0x00002000      /* */
286 #define UIC_EIRQ8               0x00001000      /* */
287 #define UIC_EIRQ9               0x00000800      /* */
288 #define UIC_GPTCMP5             0x00000400      /* */
289 #define UIC_GPTCMP6             0x00000200      /* */
290 #define UIC_GPTCMP7             0x00000100      /* */
291 #define UIC_SROM                0x00000080      /* SERIAL ROM*/
292 #define UIC_GPTDECPULS          0x00000040      /* GPT Decrement pulse*/
293 #define UIC_EIRQ2               0x00000020      /* */
294 #define UIC_EIRQ5               0x00000010      /* */
295 #define UIC_EIRQ6               0x00000008      /* */
296 #define UIC_EMAC0WAKE           0x00000004      /* */
297 #define UIC_EIRQ1               0x00000002      /* */
298 #define UIC_EMAC1WAKE           0x00000001      /* */
299 #define UIC_MAL_SERR            UIC_MS          /* MAL SERR     */
300 #define UIC_MAL_TXDE            UIC_MTDE                /* MAL TXDE     */
301 #define UIC_MAL_RXDE            UIC_MRDE                /* MAL RXDE     */
302 /* UIC 2 */
303 #define UIC_PCIE0INTA           0x80000000      /* PCIE0 INTA*/
304 #define UIC_PCIE0INTB           0x40000000      /* PCIE0 INTB*/
305 #define UIC_PCIE0INTC           0x20000000      /* PCIE0 INTC*/
306 #define UIC_PCIE0INTD           0x10000000      /* PCIE0 INTD*/
307 #define UIC_EIRQ3               0x08000000      /* External IRQ 3*/
308 #define UIC_DDRMCUE             0x04000000      /* */
309 #define UIC_DDRMCCE             0x02000000      /* */
310 #define UIC_MALINTCOATX0        0x01000000      /* Interrupt coalecence TX0*/
311 #define UIC_MALINTCOATX1        0x00800000      /* Interrupt coalecence TX1*/
312 #define UIC_MALINTCOARX0        0x00400000      /* Interrupt coalecence RX0*/
313 #define UIC_MALINTCOARX1        0x00200000      /* Interrupt coalecence RX1*/
314 #define UIC_PCIE1INTA           0x00100000      /* PCIE0 INTA*/
315 #define UIC_PCIE1INTB           0x00080000      /* PCIE0 INTB*/
316 #define UIC_PCIE1INTC           0x00040000      /* PCIE0 INTC*/
317 #define UIC_PCIE1INTD           0x00020000      /* PCIE0 INTD*/
318 #define UIC_RPCIEMSI2           0x00010000      /* MSI level 2 Note this looks same as uic0-26*/
319 #define UIC_PCIEMSI3            0x00008000      /* MSI level 2*/
320 #define UIC_PCIEMSI4            0x00004000      /* MSI level 2*/
321 #define UIC_PCIEMSI5            0x00002000      /* MSI level 2*/
322 #define UIC_PCIEMSI6            0x00001000      /* MSI level 2*/
323 #define UIC_PCIEMSI7            0x00000800      /* MSI level 2*/
324 #define UIC_PCIEMSI8            0x00000400      /* MSI level 2*/
325 #define UIC_PCIEMSI9            0x00000200      /* MSI level 2*/
326 #define UIC_PCIEMSI10           0x00000100      /* MSI level 2*/
327 #define UIC_PCIEMSI11           0x00000080      /* MSI level 2*/
328 #define UIC_PCIEMSI12           0x00000040      /* MSI level 2*/
329 #define UIC_PCIEMSI13           0x00000020      /* MSI level 2*/
330 #define UIC_PCIEMSI14           0x00000010      /* MSI level 2*/
331 #define UIC_PCIEMSI15           0x00000008      /* MSI level 2*/
332 #define UIC_PLB4XAHB            0x00000004      /* PLBxAHB bridge*/
333 #define UIC_USBWAKE             0x00000002      /* USB wakup*/
334 #define UIC_USBOTG              0x00000001      /*  USB OTG*/
335 #define UIC_ETH0        UIC_ENET
336 #define UIC_ETH1        UIC_ENET1
337
338 #else   /* !defined(CONFIG_405EZ) */
339
340 #define UIC_UART0     0x80000000      /* UART 0                             */
341 #define UIC_UART1     0x40000000      /* UART 1                             */
342 #define UIC_IIC       0x20000000      /* IIC                                */
343 #define UIC_EXT_MAST  0x10000000      /* External Master                    */
344 #define UIC_PCI       0x08000000      /* PCI write to command reg           */
345 #define UIC_DMA0      0x04000000      /* DMA chan. 0                        */
346 #define UIC_DMA1      0x02000000      /* DMA chan. 1                        */
347 #define UIC_DMA2      0x01000000      /* DMA chan. 2                        */
348 #define UIC_DMA3      0x00800000      /* DMA chan. 3                        */
349 #define UIC_EMAC_WAKE 0x00400000      /* EMAC wake up                       */
350 #define UIC_MAL_SERR  0x00200000      /* MAL SERR                           */
351 #define UIC_MAL_TXEOB 0x00100000      /* MAL TXEOB                          */
352 #define UIC_MAL_RXEOB 0x00080000      /* MAL RXEOB                          */
353 #define UIC_MAL_TXDE  0x00040000      /* MAL TXDE                           */
354 #define UIC_MAL_RXDE  0x00020000      /* MAL RXDE                           */
355 #define UIC_ENET      0x00010000      /* Ethernet0                          */
356 #define UIC_ENET1     0x00004000      /* Ethernet1 on 405EP                 */
357 #define UIC_ECC_CE    0x00004000      /* ECC Correctable Error on 405GP     */
358 #define UIC_EXT_PCI_SERR 0x00008000   /* External PCI SERR#                 */
359 #define UIC_PCI_PM    0x00002000      /* PCI Power Management               */
360 #define UIC_EXT0      0x00000040      /* External  interrupt 0              */
361 #define UIC_EXT1      0x00000020      /* External  interrupt 1              */
362 #define UIC_EXT2      0x00000010      /* External  interrupt 2              */
363 #define UIC_EXT3      0x00000008      /* External  interrupt 3              */
364 #define UIC_EXT4      0x00000004      /* External  interrupt 4              */
365 #define UIC_EXT5      0x00000002      /* External  interrupt 5              */
366 #define UIC_EXT6      0x00000001      /* External  interrupt 6              */
367 #endif  /* defined(CONFIG_405EZ) */
368
369 /******************************************************************************
370  * External Bus Controller (EBC)
371  *****************************************************************************/
372
373 /* Bank Configuration Register */
374 #define EBC_BXCR_BAS_MASK       PPC_REG_VAL(11, 0xFFF)
375 #define EBC_BXCR_BAS_ENCODE(n)  (((static_cast(unsigned long, n)) & \
376                                   EBC_BXCR_BAS_MASK) << 0)
377 #define EBC_BXCR_BS_MASK        PPC_REG_VAL(14, 0x7)
378 #define EBC_BXCR_BS_1MB         PPC_REG_VAL(14, 0x0)
379 #define EBC_BXCR_BS_2MB         PPC_REG_VAL(14, 0x1)
380 #define EBC_BXCR_BS_4MB         PPC_REG_VAL(14, 0x2)
381 #define EBC_BXCR_BS_8MB         PPC_REG_VAL(14, 0x3)
382 #define EBC_BXCR_BS_16MB        PPC_REG_VAL(14, 0x4)
383 #define EBC_BXCR_BS_32MB        PPC_REG_VAL(14, 0x5)
384 #define EBC_BXCR_BS_64MB        PPC_REG_VAL(14, 0x6)
385 #define EBC_BXCR_BS_128MB       PPC_REG_VAL(14, 0x7)
386 #define EBC_BXCR_BU_MASK        PPC_REG_VAL(16, 0x3)
387 #define EBC_BXCR_BU_NONE        PPC_REG_VAL(16, 0x0)
388 #define EBC_BXCR_BU_R           PPC_REG_VAL(16, 0x1)
389 #define EBC_BXCR_BU_W           PPC_REG_VAL(16, 0x2)
390 #define EBC_BXCR_BU_RW          PPC_REG_VAL(16, 0x3)
391 #define EBC_BXCR_BW_MASK        PPC_REG_VAL(18, 0x3)
392 #define EBC_BXCR_BW_8BIT        PPC_REG_VAL(18, 0x0)
393 #define EBC_BXCR_BW_16BIT       PPC_REG_VAL(18, 0x1)
394 #define EBC_BXCR_BW_32BIT       PPC_REG_VAL(18, 0x3)
395
396 /* Bank Access Parameter Register */
397 #define EBC_BXAP_BME_ENABLED    PPC_REG_VAL(0, 0x1)
398 #define EBC_BXAP_BME_DISABLED   PPC_REG_VAL(0, 0x0)
399 #define EBC_BXAP_TWT_ENCODE(n)  PPC_REG_VAL(8, \
400                                             (static_cast(unsigned long, n)) \
401                                             & 0xFF)
402 #define EBC_BXAP_FWT_ENCODE(n)  PPC_REG_VAL(5, \
403                                             (static_cast(unsigned long, n)) \
404                                             & 0x1F)
405 #define EBC_BXAP_BWT_ENCODE(n)  PPC_REG_VAL(8, \
406                                             (static_cast(unsigned long, n)) \
407                                             & 0x7)
408 #define EBC_BXAP_BCE_DISABLE    PPC_REG_VAL(9, 0x0)
409 #define EBC_BXAP_BCE_ENABLE     PPC_REG_VAL(9, 0x1)
410 #define EBC_BXAP_BCT_MASK       PPC_REG_VAL(11, 0x3)
411 #define EBC_BXAP_BCT_2TRANS     PPC_REG_VAL(11, 0x0)
412 #define EBC_BXAP_BCT_4TRANS     PPC_REG_VAL(11, 0x1)
413 #define EBC_BXAP_BCT_8TRANS     PPC_REG_VAL(11, 0x2)
414 #define EBC_BXAP_BCT_16TRANS    PPC_REG_VAL(11, 0x3)
415 #define EBC_BXAP_CSN_ENCODE(n)  PPC_REG_VAL(13, \
416                                             (static_cast(unsigned long, n)) \
417                                             & 0x3)
418 #define EBC_BXAP_OEN_ENCODE(n)  PPC_REG_VAL(15, \
419                                             (static_cast(unsigned long, n)) \
420                                             & 0x3)
421 #define EBC_BXAP_WBN_ENCODE(n)  PPC_REG_VAL(17, \
422                                             (static_cast(unsigned long, n)) \
423                                             & 0x3)
424 #define EBC_BXAP_WBF_ENCODE(n)  PPC_REG_VAL(19, \
425                                             (static_cast(unsigned long, n)) \
426                                             & 0x3)
427 #define EBC_BXAP_TH_ENCODE(n)   PPC_REG_VAL(22, \
428                                             (static_cast(unsigned long, n)) \
429                                             & 0x7)
430 #define EBC_BXAP_RE_ENABLED     PPC_REG_VAL(23, 0x1)
431 #define EBC_BXAP_RE_DISABLED    PPC_REG_VAL(23, 0x0)
432 #define EBC_BXAP_SOR_DELAYED    PPC_REG_VAL(24, 0x0)
433 #define EBC_BXAP_SOR_NONDELAYED PPC_REG_VAL(24, 0x1)
434 #define EBC_BXAP_BEM_WRITEONLY  PPC_REG_VAL(25, 0x0)
435 #define EBC_BXAP_BEM_RW         PPC_REG_VAL(25, 0x1)
436 #define EBC_BXAP_PEN_DISABLED   PPC_REG_VAL(26, 0x0)
437 #define EBC_BXAP_PEN_ENABLED    PPC_REG_VAL(26, 0x1)
438
439 /* Configuration Register */
440 #define EBC_CFG_LE_MASK         PPC_REG_VAL(0, 0x1)
441 #define EBC_CFG_LE_UNLOCK       PPC_REG_VAL(0, 0x0)
442 #define EBC_CFG_LE_LOCK         PPC_REG_VAL(0, 0x1)
443 #define EBC_CFG_PTD_MASK        PPC_REG_VAL(1, 0x1)
444 #define EBC_CFG_PTD_ENABLE      PPC_REG_VAL(1, 0x0)
445 #define EBC_CFG_PTD_DISABLE     PPC_REG_VAL(1, 0x1)
446 #define EBC_CFG_RTC_MASK        PPC_REG_VAL(4, 0x7)
447 #define EBC_CFG_RTC_16PERCLK    PPC_REG_VAL(4, 0x0)
448 #define EBC_CFG_RTC_32PERCLK    PPC_REG_VAL(4, 0x1)
449 #define EBC_CFG_RTC_64PERCLK    PPC_REG_VAL(4, 0x2)
450 #define EBC_CFG_RTC_128PERCLK   PPC_REG_VAL(4, 0x3)
451 #define EBC_CFG_RTC_256PERCLK   PPC_REG_VAL(4, 0x4)
452 #define EBC_CFG_RTC_512PERCLK   PPC_REG_VAL(4, 0x5)
453 #define EBC_CFG_RTC_1024PERCLK  PPC_REG_VAL(4, 0x6)
454 #define EBC_CFG_RTC_2048PERCLK  PPC_REG_VAL(4, 0x7)
455 #define EBC_CFG_ATC_MASK        PPC_REG_VAL(5, 0x1)
456 #define EBC_CFG_ATC_HI          PPC_REG_VAL(5, 0x0)
457 #define EBC_CFG_ATC_PREVIOUS    PPC_REG_VAL(5, 0x1)
458 #define EBC_CFG_DTC_MASK        PPC_REG_VAL(6, 0x1)
459 #define EBC_CFG_DTC_HI          PPC_REG_VAL(6, 0x0)
460 #define EBC_CFG_DTC_PREVIOUS    PPC_REG_VAL(6, 0x1)
461 #define EBC_CFG_CTC_MASK        PPC_REG_VAL(7, 0x1)
462 #define EBC_CFG_CTC_HI          PPC_REG_VAL(7, 0x0)
463 #define EBC_CFG_CTC_PREVIOUS    PPC_REG_VAL(7, 0x1)
464 #define EBC_CFG_OEO_MASK        PPC_REG_VAL(8, 0x1)
465 #define EBC_CFG_OEO_DISABLE     PPC_REG_VAL(8, 0x0)
466 #define EBC_CFG_OEO_ENABLE      PPC_REG_VAL(8, 0x1)
467 #define EBC_CFG_EMC_MASK        PPC_REG_VAL(9, 0x1)
468 #define EBC_CFG_EMC_NONDEFAULT  PPC_REG_VAL(9, 0x0)
469 #define EBC_CFG_EMC_DEFAULT     PPC_REG_VAL(9, 0x1)
470 #define EBC_CFG_PME_MASK        PPC_REG_VAL(14, 0x1)
471 #define EBC_CFG_PME_DISABLE     PPC_REG_VAL(14, 0x0)
472 #define EBC_CFG_PME_ENABLE      PPC_REG_VAL(14, 0x1)
473 #define EBC_CFG_PMT_MASK        PPC_REG_VAL(19, 0x1F)
474 #define EBC_CFG_PMT_ENCODE(n)   PPC_REG_VAL(19, \
475                                             (static_cast(unsigned long, n)) \
476                                             & 0x1F)
477 #define EBC_CFG_PR_MASK         PPC_REG_VAL(21, 0x3)
478 #define EBC_CFG_PR_16           PPC_REG_VAL(21, 0x0)
479 #define EBC_CFG_PR_32           PPC_REG_VAL(21, 0x1)
480 #define EBC_CFG_PR_64           PPC_REG_VAL(21, 0x2)
481 #define EBC_CFG_PR_128          PPC_REG_VAL(21, 0x3)
482
483 #ifndef CONFIG_405EP
484 /******************************************************************************
485  * Decompression Controller
486  ******************************************************************************/
487 #define DECOMP_DCR_BASE 0x14
488 #define kiar  (DECOMP_DCR_BASE+0x0)  /* Decompression controller addr reg    */
489 #define kidr  (DECOMP_DCR_BASE+0x1)  /* Decompression controller data reg    */
490   /* values for kiar register - indirect addressing of these regs */
491   #define kitor0      0x00    /* index table origin register 0        */
492   #define kitor1      0x01    /* index table origin register 1        */
493   #define kitor2      0x02    /* index table origin register 2        */
494   #define kitor3      0x03    /* index table origin register 3        */
495   #define kaddr0      0x04    /* address decode definition regsiter 0 */
496   #define kaddr1      0x05    /* address decode definition regsiter 1 */
497   #define kconf       0x40    /* decompression core config register   */
498   #define kid         0x41    /* decompression core ID     register   */
499   #define kver        0x42    /* decompression core version # reg     */
500   #define kpear       0x50    /* bus error addr reg (PLB addr)        */
501   #define kbear       0x51    /* bus error addr reg (DCP to EBIU addr)*/
502   #define kesr0       0x52    /* bus error status reg 0  (R/clear)    */
503   #define kesr0s      0x53    /* bus error status reg 0  (set)        */
504   /* There are 0x400 of the following registers, from krom0 to krom3ff*/
505   /* Only the first one is given here.                                */
506   #define krom0      0x400    /* SRAM/ROM read/write                  */
507 #endif
508
509 /******************************************************************************
510  * Power Management
511  ******************************************************************************/
512 #ifdef CONFIG_405EX
513 #define POWERMAN_DCR_BASE 0xb0
514 #else
515 #define POWERMAN_DCR_BASE 0xb8
516 #endif
517 #define cpmsr (POWERMAN_DCR_BASE+0x0) /* Power management status             */
518 #define cpmer (POWERMAN_DCR_BASE+0x1) /* Power management enable             */
519 #define cpmfr (POWERMAN_DCR_BASE+0x2) /* Power management force              */
520
521 /******************************************************************************
522  * Extrnal Bus Controller
523  ******************************************************************************/
524   /* values for ebccfga register - indirect addressing of these regs */
525   #define pb0cr       0x00    /* periph bank 0 config reg            */
526   #define pb1cr       0x01    /* periph bank 1 config reg            */
527   #define pb2cr       0x02    /* periph bank 2 config reg            */
528   #define pb3cr       0x03    /* periph bank 3 config reg            */
529   #define pb4cr       0x04    /* periph bank 4 config reg            */
530 #ifndef CONFIG_405EP
531   #define pb5cr       0x05    /* periph bank 5 config reg            */
532   #define pb6cr       0x06    /* periph bank 6 config reg            */
533   #define pb7cr       0x07    /* periph bank 7 config reg            */
534 #endif
535   #define pb0ap       0x10    /* periph bank 0 access parameters     */
536   #define pb1ap       0x11    /* periph bank 1 access parameters     */
537   #define pb2ap       0x12    /* periph bank 2 access parameters     */
538   #define pb3ap       0x13    /* periph bank 3 access parameters     */
539   #define pb4ap       0x14    /* periph bank 4 access parameters     */
540 #ifndef CONFIG_405EP
541   #define pb5ap       0x15    /* periph bank 5 access parameters     */
542   #define pb6ap       0x16    /* periph bank 6 access parameters     */
543   #define pb7ap       0x17    /* periph bank 7 access parameters     */
544 #endif
545   #define pbear       0x20    /* periph bus error addr reg           */
546   #define pbesr0      0x21    /* periph bus error status reg 0       */
547   #define pbesr1      0x22    /* periph bus error status reg 1       */
548   #define epcr        0x23    /* external periph control reg         */
549 #define EBC0_CFG        0x23    /* external bus configuration reg       */
550
551 #ifdef CONFIG_405EP
552 /******************************************************************************
553  * Control
554  ******************************************************************************/
555 #define CNTRL_DCR_BASE 0x0f0
556 #define cpc0_pllmr0   (CNTRL_DCR_BASE+0x0)  /* PLL mode  register 0                */
557 #define cpc0_boot     (CNTRL_DCR_BASE+0x1)  /* Clock status register               */
558 #define cpc0_epctl    (CNTRL_DCR_BASE+0x3)  /* EMAC to PHY control register        */
559 #define cpc0_pllmr1   (CNTRL_DCR_BASE+0x4)  /* PLL mode  register 1                */
560 #define cpc0_ucr      (CNTRL_DCR_BASE+0x5)  /* UART control register               */
561 #define cpc0_pci      (CNTRL_DCR_BASE+0x9)  /* PCI control register                */
562
563 #define CPC0_PLLMR0  (CNTRL_DCR_BASE+0x0)  /* PLL mode 0 register          */
564 #define CPC0_BOOT    (CNTRL_DCR_BASE+0x1)  /* Chip Clock Status register   */
565 #define CPC0_CR1     (CNTRL_DCR_BASE+0x2)  /* Chip Control 1 register      */
566 #define CPC0_EPRCSR  (CNTRL_DCR_BASE+0x3)  /* EMAC PHY Rcv Clk Src register*/
567 #define CPC0_PLLMR1  (CNTRL_DCR_BASE+0x4)  /* PLL mode 1 register          */
568 #define CPC0_UCR     (CNTRL_DCR_BASE+0x5)  /* UART Control register        */
569 #define CPC0_SRR     (CNTRL_DCR_BASE+0x6)  /* Soft Reset register          */
570 #define CPC0_JTAGID  (CNTRL_DCR_BASE+0x7)  /* JTAG ID register             */
571 #define CPC0_SPARE   (CNTRL_DCR_BASE+0x8)  /* Spare DCR                    */
572 #define CPC0_PCI     (CNTRL_DCR_BASE+0x9)  /* PCI Control register         */
573
574 /* Bit definitions */
575 #define PLLMR0_CPU_DIV_MASK      0x00300000     /* CPU clock divider */
576 #define PLLMR0_CPU_DIV_BYPASS    0x00000000
577 #define PLLMR0_CPU_DIV_2         0x00100000
578 #define PLLMR0_CPU_DIV_3         0x00200000
579 #define PLLMR0_CPU_DIV_4         0x00300000
580
581 #define PLLMR0_CPU_TO_PLB_MASK   0x00030000     /* CPU:PLB Frequency Divisor */
582 #define PLLMR0_CPU_PLB_DIV_1     0x00000000
583 #define PLLMR0_CPU_PLB_DIV_2     0x00010000
584 #define PLLMR0_CPU_PLB_DIV_3     0x00020000
585 #define PLLMR0_CPU_PLB_DIV_4     0x00030000
586
587 #define PLLMR0_OPB_TO_PLB_MASK   0x00003000     /* OPB:PLB Frequency Divisor */
588 #define PLLMR0_OPB_PLB_DIV_1     0x00000000
589 #define PLLMR0_OPB_PLB_DIV_2     0x00001000
590 #define PLLMR0_OPB_PLB_DIV_3     0x00002000
591 #define PLLMR0_OPB_PLB_DIV_4     0x00003000
592
593 #define PLLMR0_EXB_TO_PLB_MASK   0x00000300     /* External Bus:PLB Divisor  */
594 #define PLLMR0_EXB_PLB_DIV_2     0x00000000
595 #define PLLMR0_EXB_PLB_DIV_3     0x00000100
596 #define PLLMR0_EXB_PLB_DIV_4     0x00000200
597 #define PLLMR0_EXB_PLB_DIV_5     0x00000300
598
599 #define PLLMR0_MAL_TO_PLB_MASK   0x00000030     /* MAL:PLB Divisor  */
600 #define PLLMR0_MAL_PLB_DIV_1     0x00000000
601 #define PLLMR0_MAL_PLB_DIV_2     0x00000010
602 #define PLLMR0_MAL_PLB_DIV_3     0x00000020
603 #define PLLMR0_MAL_PLB_DIV_4     0x00000030
604
605 #define PLLMR0_PCI_TO_PLB_MASK   0x00000003     /* PCI:PLB Frequency Divisor */
606 #define PLLMR0_PCI_PLB_DIV_1     0x00000000
607 #define PLLMR0_PCI_PLB_DIV_2     0x00000001
608 #define PLLMR0_PCI_PLB_DIV_3     0x00000002
609 #define PLLMR0_PCI_PLB_DIV_4     0x00000003
610
611 #define PLLMR1_SSCS_MASK         0x80000000     /* Select system clock source */
612 #define PLLMR1_PLLR_MASK         0x40000000     /* PLL reset */
613 #define PLLMR1_FBMUL_MASK        0x00F00000     /* PLL feedback multiplier value */
614 #define PLLMR1_FBMUL_DIV_16      0x00000000
615 #define PLLMR1_FBMUL_DIV_1       0x00100000
616 #define PLLMR1_FBMUL_DIV_2       0x00200000
617 #define PLLMR1_FBMUL_DIV_3       0x00300000
618 #define PLLMR1_FBMUL_DIV_4       0x00400000
619 #define PLLMR1_FBMUL_DIV_5       0x00500000
620 #define PLLMR1_FBMUL_DIV_6       0x00600000
621 #define PLLMR1_FBMUL_DIV_7       0x00700000
622 #define PLLMR1_FBMUL_DIV_8       0x00800000
623 #define PLLMR1_FBMUL_DIV_9       0x00900000
624 #define PLLMR1_FBMUL_DIV_10      0x00A00000
625 #define PLLMR1_FBMUL_DIV_11      0x00B00000
626 #define PLLMR1_FBMUL_DIV_12      0x00C00000
627 #define PLLMR1_FBMUL_DIV_13      0x00D00000
628 #define PLLMR1_FBMUL_DIV_14      0x00E00000
629 #define PLLMR1_FBMUL_DIV_15      0x00F00000
630
631 #define PLLMR1_FWDVA_MASK        0x00070000     /* PLL forward divider A value */
632 #define PLLMR1_FWDVA_DIV_8       0x00000000
633 #define PLLMR1_FWDVA_DIV_7       0x00010000
634 #define PLLMR1_FWDVA_DIV_6       0x00020000
635 #define PLLMR1_FWDVA_DIV_5       0x00030000
636 #define PLLMR1_FWDVA_DIV_4       0x00040000
637 #define PLLMR1_FWDVA_DIV_3       0x00050000
638 #define PLLMR1_FWDVA_DIV_2       0x00060000
639 #define PLLMR1_FWDVA_DIV_1       0x00070000
640 #define PLLMR1_FWDVB_MASK        0x00007000     /* PLL forward divider B value */
641 #define PLLMR1_TUNING_MASK       0x000003FF     /* PLL tune bits */
642
643 /* Defines for CPC0_EPRCSR register */
644 #define CPC0_EPRCSR_E0NFE          0x80000000
645 #define CPC0_EPRCSR_E1NFE          0x40000000
646 #define CPC0_EPRCSR_E1RPP          0x00000080
647 #define CPC0_EPRCSR_E0RPP          0x00000040
648 #define CPC0_EPRCSR_E1ERP          0x00000020
649 #define CPC0_EPRCSR_E0ERP          0x00000010
650 #define CPC0_EPRCSR_E1PCI          0x00000002
651 #define CPC0_EPRCSR_E0PCI          0x00000001
652
653 /* Defines for CPC0_PCI Register */
654 #define CPC0_PCI_SPE                       0x00000010 /* PCIINT/WE select       */
655 #define CPC0_PCI_HOST_CFG_EN               0x00000008 /* PCI host config Enable */
656 #define CPC0_PCI_ARBIT_EN                  0x00000001 /* PCI Internal Arb Enabled*/
657
658 /* Defines for CPC0_BOOR Register */
659 #define CPC0_BOOT_SEP                      0x00000002 /* serial EEPROM present  */
660
661 /* Defines for CPC0_PLLMR1 Register fields */
662 #define PLL_ACTIVE                 0x80000000
663 #define CPC0_PLLMR1_SSCS           0x80000000
664 #define PLL_RESET                  0x40000000
665 #define CPC0_PLLMR1_PLLR           0x40000000
666     /* Feedback multiplier */
667 #define PLL_FBKDIV                 0x00F00000
668 #define CPC0_PLLMR1_FBDV           0x00F00000
669 #define PLL_FBKDIV_16              0x00000000
670 #define PLL_FBKDIV_1               0x00100000
671 #define PLL_FBKDIV_2               0x00200000
672 #define PLL_FBKDIV_3               0x00300000
673 #define PLL_FBKDIV_4               0x00400000
674 #define PLL_FBKDIV_5               0x00500000
675 #define PLL_FBKDIV_6               0x00600000
676 #define PLL_FBKDIV_7               0x00700000
677 #define PLL_FBKDIV_8               0x00800000
678 #define PLL_FBKDIV_9               0x00900000
679 #define PLL_FBKDIV_10              0x00A00000
680 #define PLL_FBKDIV_11              0x00B00000
681 #define PLL_FBKDIV_12              0x00C00000
682 #define PLL_FBKDIV_13              0x00D00000
683 #define PLL_FBKDIV_14              0x00E00000
684 #define PLL_FBKDIV_15              0x00F00000
685     /* Forward A divisor */
686 #define PLL_FWDDIVA                0x00070000
687 #define CPC0_PLLMR1_FWDVA          0x00070000
688 #define PLL_FWDDIVA_8              0x00000000
689 #define PLL_FWDDIVA_7              0x00010000
690 #define PLL_FWDDIVA_6              0x00020000
691 #define PLL_FWDDIVA_5              0x00030000
692 #define PLL_FWDDIVA_4              0x00040000
693 #define PLL_FWDDIVA_3              0x00050000
694 #define PLL_FWDDIVA_2              0x00060000
695 #define PLL_FWDDIVA_1              0x00070000
696     /* Forward B divisor */
697 #define PLL_FWDDIVB                0x00007000
698 #define CPC0_PLLMR1_FWDVB          0x00007000
699 #define PLL_FWDDIVB_8              0x00000000
700 #define PLL_FWDDIVB_7              0x00001000
701 #define PLL_FWDDIVB_6              0x00002000
702 #define PLL_FWDDIVB_5              0x00003000
703 #define PLL_FWDDIVB_4              0x00004000
704 #define PLL_FWDDIVB_3              0x00005000
705 #define PLL_FWDDIVB_2              0x00006000
706 #define PLL_FWDDIVB_1              0x00007000
707     /* PLL tune bits */
708 #define PLL_TUNE_MASK            0x000003FF
709 #define PLL_TUNE_2_M_3           0x00000133     /*  2 <= M <= 3               */
710 #define PLL_TUNE_4_M_6           0x00000134     /*  3 <  M <= 6               */
711 #define PLL_TUNE_7_M_10          0x00000138     /*  6 <  M <= 10              */
712 #define PLL_TUNE_11_M_14         0x0000013C     /* 10 <  M <= 14              */
713 #define PLL_TUNE_15_M_40         0x0000023E     /* 14 <  M <= 40              */
714 #define PLL_TUNE_VCO_LOW         0x00000000     /* 500MHz <= VCO <=  800MHz   */
715 #define PLL_TUNE_VCO_HI          0x00000080     /* 800MHz <  VCO <= 1000MHz   */
716
717 /* Defines for CPC0_PLLMR0 Register fields */
718     /* CPU divisor */
719 #define PLL_CPUDIV                 0x00300000
720 #define CPC0_PLLMR0_CCDV           0x00300000
721 #define PLL_CPUDIV_1               0x00000000
722 #define PLL_CPUDIV_2               0x00100000
723 #define PLL_CPUDIV_3               0x00200000
724 #define PLL_CPUDIV_4               0x00300000
725     /* PLB divisor */
726 #define PLL_PLBDIV                 0x00030000
727 #define CPC0_PLLMR0_CBDV           0x00030000
728 #define PLL_PLBDIV_1               0x00000000
729 #define PLL_PLBDIV_2               0x00010000
730 #define PLL_PLBDIV_3               0x00020000
731 #define PLL_PLBDIV_4               0x00030000
732     /* OPB divisor */
733 #define PLL_OPBDIV                 0x00003000
734 #define CPC0_PLLMR0_OPDV           0x00003000
735 #define PLL_OPBDIV_1               0x00000000
736 #define PLL_OPBDIV_2               0x00001000
737 #define PLL_OPBDIV_3               0x00002000
738 #define PLL_OPBDIV_4               0x00003000
739     /* EBC divisor */
740 #define PLL_EXTBUSDIV              0x00000300
741 #define CPC0_PLLMR0_EPDV           0x00000300
742 #define PLL_EXTBUSDIV_2            0x00000000
743 #define PLL_EXTBUSDIV_3            0x00000100
744 #define PLL_EXTBUSDIV_4            0x00000200
745 #define PLL_EXTBUSDIV_5            0x00000300
746     /* MAL divisor */
747 #define PLL_MALDIV                 0x00000030
748 #define CPC0_PLLMR0_MPDV           0x00000030
749 #define PLL_MALDIV_1               0x00000000
750 #define PLL_MALDIV_2               0x00000010
751 #define PLL_MALDIV_3               0x00000020
752 #define PLL_MALDIV_4               0x00000030
753     /* PCI divisor */
754 #define PLL_PCIDIV                 0x00000003
755 #define CPC0_PLLMR0_PPFD           0x00000003
756 #define PLL_PCIDIV_1               0x00000000
757 #define PLL_PCIDIV_2               0x00000001
758 #define PLL_PCIDIV_3               0x00000002
759 #define PLL_PCIDIV_4               0x00000003
760
761 /*
762  *-------------------------------------------------------------------------------
763  * PLL settings for 266MHz CPU, 133MHz PLB/SDRAM, 66MHz EBC, 33MHz PCI,
764  * assuming a 33.3MHz input clock to the 405EP.
765  *-------------------------------------------------------------------------------
766  */
767 #define PLLMR0_266_133_66  (PLL_CPUDIV_1 | PLL_PLBDIV_2 |  \
768                             PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |  \
769                             PLL_MALDIV_1 | PLL_PCIDIV_4)
770 #define PLLMR1_266_133_66  (PLL_FBKDIV_8  |  \
771                             PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |  \
772                             PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
773
774 #define PLLMR0_133_66_66_33  (PLL_CPUDIV_1 | PLL_PLBDIV_1 |  \
775                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 |  \
776                               PLL_MALDIV_1 | PLL_PCIDIV_4)
777 #define PLLMR1_133_66_66_33  (PLL_FBKDIV_4  |  \
778                               PLL_FWDDIVA_6 | PLL_FWDDIVB_6 |  \
779                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
780 #define PLLMR0_200_100_50_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 |  \
781                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_3 |  \
782                               PLL_MALDIV_1 | PLL_PCIDIV_4)
783 #define PLLMR1_200_100_50_33 (PLL_FBKDIV_6  |  \
784                               PLL_FWDDIVA_4 | PLL_FWDDIVB_4 |  \
785                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
786 #define PLLMR0_266_133_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 |  \
787                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 |  \
788                               PLL_MALDIV_1 | PLL_PCIDIV_4)
789 #define PLLMR1_266_133_66_33 (PLL_FBKDIV_8  |  \
790                               PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |  \
791                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
792 #define PLLMR0_266_66_33_33 (PLL_CPUDIV_1 | PLL_PLBDIV_4 |  \
793                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |  \
794                               PLL_MALDIV_1 | PLL_PCIDIV_2)
795 #define PLLMR1_266_66_33_33 (PLL_FBKDIV_8  |  \
796                               PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |  \
797                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
798 #define PLLMR0_333_111_55_37 (PLL_CPUDIV_1 | PLL_PLBDIV_3 |  \
799                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |  \
800                               PLL_MALDIV_1 | PLL_PCIDIV_3)
801 #define PLLMR1_333_111_55_37 (PLL_FBKDIV_10  |  \
802                               PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |  \
803                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
804 #define PLLMR0_333_111_55_111 (PLL_CPUDIV_1 | PLL_PLBDIV_3 |  \
805                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |  \
806                               PLL_MALDIV_1 | PLL_PCIDIV_1)
807 #define PLLMR1_333_111_55_111 (PLL_FBKDIV_10  |  \
808                               PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |  \
809                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
810
811 /*
812  * PLL Voltage Controlled Oscillator (VCO) definitions
813  * Maximum and minimum values (in MHz) for correct PLL operation.
814  */
815 #define VCO_MIN     500
816 #define VCO_MAX     1000
817 #elif defined(CONFIG_405EZ)
818 #define sdrnand0        0x4000
819 #define sdrultra0       0x4040
820 #define sdrultra1       0x4050
821 #define sdricintstat    0x4510
822
823 #define SDR_NAND0_NDEN          0x80000000
824 #define SDR_NAND0_NDBTEN        0x40000000
825 #define SDR_NAND0_NDBADR_MASK   0x30000000
826 #define SDR_NAND0_NDBPG_MASK    0x0f000000
827 #define SDR_NAND0_NDAREN        0x00800000
828 #define SDR_NAND0_NDRBEN        0x00400000
829
830 #define SDR_ULTRA0_NDGPIOBP     0x80000000
831 #define SDR_ULTRA0_CSN_MASK     0x78000000
832 #define SDR_ULTRA0_CSNSEL0      0x40000000
833 #define SDR_ULTRA0_CSNSEL1      0x20000000
834 #define SDR_ULTRA0_CSNSEL2      0x10000000
835 #define SDR_ULTRA0_CSNSEL3      0x08000000
836 #define SDR_ULTRA0_EBCRDYEN     0x04000000
837 #define SDR_ULTRA0_SPISSINEN    0x02000000
838 #define SDR_ULTRA0_NFSRSTEN     0x01000000
839
840 #define SDR_ULTRA1_LEDNENABLE   0x40000000
841
842 #define SDR_ICRX_STAT   0x80000000
843 #define SDR_ICTX0_STAT  0x40000000
844 #define SDR_ICTX1_STAT  0x20000000
845
846 #define SDR_PINSTP      0x40
847
848 /******************************************************************************
849  * Control
850  ******************************************************************************/
851 /* CPR Registers */
852 #define cprclkupd       0x020           /* CPR_CLKUPD */
853 #define cprpllc         0x040           /* CPR_PLLC */
854 #define cprplld         0x060           /* CPR_PLLD */
855 #define cprprimad       0x080           /* CPR_PRIMAD */
856 #define cprperd0        0x0e0           /* CPR_PERD0 */
857 #define cprperd1        0x0e1           /* CPR_PERD1 */
858 #define cprperc0        0x180           /* CPR_PERC0 */
859 #define cprmisc0        0x181           /* CPR_MISC0 */
860 #define cprmisc1        0x182           /* CPR_MISC1 */
861
862 #define CPR_CLKUPD_ENPLLCH_EN  0x40000000     /* Enable CPR PLL Changes */
863 #define CPR_CLKUPD_ENDVCH_EN   0x20000000     /* Enable CPR Sys. Div. Changes */
864 #define CPR_PERD0_SPIDV_MASK   0x000F0000     /* SPI Clock Divider */
865
866 #define PLLC_SRC_MASK          0x20000000     /* PLL feedback source */
867
868 #define PLLD_FBDV_MASK         0x1F000000     /* PLL feedback divider value */
869 #define PLLD_FWDVA_MASK        0x000F0000     /* PLL forward divider A value */
870 #define PLLD_FWDVB_MASK        0x00000700     /* PLL forward divider B value */
871
872 #define PRIMAD_CPUDV_MASK      0x0F000000     /* CPU Clock Divisor Mask */
873 #define PRIMAD_PLBDV_MASK      0x000F0000     /* PLB Clock Divisor Mask */
874 #define PRIMAD_OPBDV_MASK      0x00000F00     /* OPB Clock Divisor Mask */
875 #define PRIMAD_EBCDV_MASK      0x0000000F     /* EBC Clock Divisor Mask */
876
877 #define PERD0_PWMDV_MASK       0xFF000000     /* PWM Divider Mask */
878 #define PERD0_SPIDV_MASK       0x000F0000     /* SPI Divider Mask */
879 #define PERD0_U0DV_MASK        0x0000FF00     /* UART 0 Divider Mask */
880 #define PERD0_U1DV_MASK        0x000000FF     /* UART 1 Divider Mask */
881
882 #else /* #ifdef CONFIG_405EP */
883 /******************************************************************************
884  * Control
885  ******************************************************************************/
886 #define CNTRL_DCR_BASE 0x0b0
887 #define pllmd   (CNTRL_DCR_BASE+0x0)  /* PLL mode  register                  */
888 #define cntrl0  (CNTRL_DCR_BASE+0x1)  /* Control 0 register                  */
889 #define cntrl1  (CNTRL_DCR_BASE+0x2)  /* Control 1 register                  */
890 #define reset   (CNTRL_DCR_BASE+0x3)  /* reset register                      */
891 #define strap   (CNTRL_DCR_BASE+0x4)  /* strap register                      */
892
893 #define CPC0_CR0  (CNTRL_DCR_BASE+0x1)  /* chip control register 0           */
894 #define CPC0_CR1  (CNTRL_DCR_BASE+0x2)  /* chip control register 1           */
895 #define CPC0_PSR  (CNTRL_DCR_BASE+0x4)  /* chip pin strapping register       */
896
897 /* CPC0_ECR/CPC0_EIRR: PPC405GPr only */
898 #define CPC0_EIRR (CNTRL_DCR_BASE+0x6)  /* external interrupt routing register */
899 #define CPC0_ECR  (0xaa)                /* edge conditioner register */
900
901 #define ecr     (0xaa)                /* edge conditioner register (405gpr)  */
902
903 /* Bit definitions */
904 #define PLLMR_FWD_DIV_MASK      0xE0000000     /* Forward Divisor */
905 #define PLLMR_FWD_DIV_BYPASS    0xE0000000
906 #define PLLMR_FWD_DIV_3         0xA0000000
907 #define PLLMR_FWD_DIV_4         0x80000000
908 #define PLLMR_FWD_DIV_6         0x40000000
909
910 #define PLLMR_FB_DIV_MASK       0x1E000000     /* Feedback Divisor */
911 #define PLLMR_FB_DIV_1          0x02000000
912 #define PLLMR_FB_DIV_2          0x04000000
913 #define PLLMR_FB_DIV_3          0x06000000
914 #define PLLMR_FB_DIV_4          0x08000000
915
916 #define PLLMR_TUNING_MASK       0x01F80000
917
918 #define PLLMR_CPU_TO_PLB_MASK   0x00060000     /* CPU:PLB Frequency Divisor */
919 #define PLLMR_CPU_PLB_DIV_1     0x00000000
920 #define PLLMR_CPU_PLB_DIV_2     0x00020000
921 #define PLLMR_CPU_PLB_DIV_3     0x00040000
922 #define PLLMR_CPU_PLB_DIV_4     0x00060000
923
924 #define PLLMR_OPB_TO_PLB_MASK   0x00018000     /* OPB:PLB Frequency Divisor */
925 #define PLLMR_OPB_PLB_DIV_1     0x00000000
926 #define PLLMR_OPB_PLB_DIV_2     0x00008000
927 #define PLLMR_OPB_PLB_DIV_3     0x00010000
928 #define PLLMR_OPB_PLB_DIV_4     0x00018000
929
930 #define PLLMR_PCI_TO_PLB_MASK   0x00006000     /* PCI:PLB Frequency Divisor */
931 #define PLLMR_PCI_PLB_DIV_1     0x00000000
932 #define PLLMR_PCI_PLB_DIV_2     0x00002000
933 #define PLLMR_PCI_PLB_DIV_3     0x00004000
934 #define PLLMR_PCI_PLB_DIV_4     0x00006000
935
936 #define PLLMR_EXB_TO_PLB_MASK   0x00001800     /* External Bus:PLB Divisor  */
937 #define PLLMR_EXB_PLB_DIV_2     0x00000000
938 #define PLLMR_EXB_PLB_DIV_3     0x00000800
939 #define PLLMR_EXB_PLB_DIV_4     0x00001000
940 #define PLLMR_EXB_PLB_DIV_5     0x00001800
941
942 /* definitions for PPC405GPr (new mode strapping) */
943 #define PLLMR_FWDB_DIV_MASK     0x00000007     /* Forward Divisor B */
944
945 #define PSR_PLL_FWD_MASK        0xC0000000
946 #define PSR_PLL_FDBACK_MASK     0x30000000
947 #define PSR_PLL_TUNING_MASK     0x0E000000
948 #define PSR_PLB_CPU_MASK        0x01800000
949 #define PSR_OPB_PLB_MASK        0x00600000
950 #define PSR_PCI_PLB_MASK        0x00180000
951 #define PSR_EB_PLB_MASK         0x00060000
952 #define PSR_ROM_WIDTH_MASK      0x00018000
953 #define PSR_ROM_LOC             0x00004000
954 #define PSR_PCI_ASYNC_EN        0x00001000
955 #define PSR_PERCLK_SYNC_MODE_EN 0x00000800     /* PPC405GPr only */
956 #define PSR_PCI_ARBIT_EN        0x00000400
957 #define PSR_NEW_MODE_EN         0x00000020     /* PPC405GPr only */
958
959 #ifndef CONFIG_IOP480
960 /*
961  * PLL Voltage Controlled Oscillator (VCO) definitions
962  * Maximum and minimum values (in MHz) for correct PLL operation.
963  */
964 #define VCO_MIN     400
965 #define VCO_MAX     800
966 #endif /* #ifndef CONFIG_IOP480 */
967 #endif /* #ifdef CONFIG_405EP */
968
969 /******************************************************************************
970  * Memory Access Layer
971  ******************************************************************************/
972 #if defined(CONFIG_405EZ)
973 #define MAL_DCR_BASE    0x380
974 #define malmcr          (MAL_DCR_BASE+0x00)     /* MAL Config reg             */
975 #define malesr          (MAL_DCR_BASE+0x01)     /* Err Status reg (Read/Clear)*/
976 #define malier          (MAL_DCR_BASE+0x02)     /* Interrupt enable reg       */
977 #define maldbr          (MAL_DCR_BASE+0x03)     /* Mal Debug reg (Read only)  */
978 #define maltxcasr       (MAL_DCR_BASE+0x04)     /* TX Channel active reg (set)*/
979 #define maltxcarr       (MAL_DCR_BASE+0x05)     /* TX Channel active reg (Reset)     */
980 #define maltxeobisr     (MAL_DCR_BASE+0x06)     /* TX End of buffer int status reg   */
981 #define maltxdeir       (MAL_DCR_BASE+0x07)     /* TX Descr. Error Int reg    */
982 /*                                    0x08-0x0F    Reserved                   */
983 #define malrxcasr       (MAL_DCR_BASE+0x10)     /* RX Channel active reg (set)*/
984 #define malrxcarr       (MAL_DCR_BASE+0x11)     /* RX Channel active reg (Reset)     */
985 #define malrxeobisr     (MAL_DCR_BASE+0x12)     /* RX End of buffer int status reg   */
986 #define malrxdeir       (MAL_DCR_BASE+0x13)     /* RX Descr. Error Int reg  */
987 /*                                    0x14-0x1F    Reserved                 */
988 #define maltxctp0r      (MAL_DCR_BASE+0x20)  /* TX 0 Channel table ptr reg  */
989 #define maltxctp1r      (MAL_DCR_BASE+0x21)  /* TX 1 Channel table ptr reg  */
990 #define maltxctp2r      (MAL_DCR_BASE+0x22)  /* TX 2 Channel table ptr reg  */
991 #define maltxctp3r      (MAL_DCR_BASE+0x23)  /* TX 3 Channel table ptr reg  */
992 #define maltxctp4r      (MAL_DCR_BASE+0x24)  /* TX 4 Channel table ptr reg  */
993 #define maltxctp5r      (MAL_DCR_BASE+0x25)  /* TX 5 Channel table ptr reg  */
994 #define maltxctp6r      (MAL_DCR_BASE+0x26)  /* TX 6 Channel table ptr reg  */
995 #define maltxctp7r      (MAL_DCR_BASE+0x27)  /* TX 7 Channel table ptr reg  */
996 #define maltxctp8r      (MAL_DCR_BASE+0x28)  /* TX 8 Channel table ptr reg  */
997 #define maltxctp9r      (MAL_DCR_BASE+0x29)  /* TX 9 Channel table ptr reg  */
998 #define maltxctp10r     (MAL_DCR_BASE+0x2A)  /* TX 10 Channel table ptr reg */
999 #define maltxctp11r     (MAL_DCR_BASE+0x2B)  /* TX 11 Channel table ptr reg */
1000 #define maltxctp12r     (MAL_DCR_BASE+0x2C)  /* TX 12 Channel table ptr reg */
1001 #define maltxctp13r     (MAL_DCR_BASE+0x2D)  /* TX 13 Channel table ptr reg */
1002 #define maltxctp14r     (MAL_DCR_BASE+0x2E)  /* TX 14 Channel table ptr reg */
1003 #define maltxctp15r     (MAL_DCR_BASE+0x2F)  /* TX 15 Channel table ptr reg */
1004 #define maltxctp16r     (MAL_DCR_BASE+0x30)  /* TX 16 Channel table ptr reg */
1005 #define maltxctp17r     (MAL_DCR_BASE+0x31)  /* TX 17 Channel table ptr reg */
1006 #define maltxctp18r     (MAL_DCR_BASE+0x32)  /* TX 18 Channel table ptr reg */
1007 #define maltxctp19r     (MAL_DCR_BASE+0x33)  /* TX 19 Channel table ptr reg */
1008 #define maltxctp20r     (MAL_DCR_BASE+0x34)  /* TX 20 Channel table ptr reg */
1009 #define maltxctp21r     (MAL_DCR_BASE+0x35)  /* TX 21 Channel table ptr reg */
1010 #define maltxctp22r     (MAL_DCR_BASE+0x36)  /* TX 22 Channel table ptr reg */
1011 #define maltxctp23r     (MAL_DCR_BASE+0x37)  /* TX 23 Channel table ptr reg */
1012 #define maltxctp24r     (MAL_DCR_BASE+0x38)  /* TX 24 Channel table ptr reg */
1013 #define maltxctp25r     (MAL_DCR_BASE+0x39)  /* TX 25 Channel table ptr reg */
1014 #define maltxctp26r     (MAL_DCR_BASE+0x3A)  /* TX 26 Channel table ptr reg */
1015 #define maltxctp27r     (MAL_DCR_BASE+0x3B)  /* TX 27 Channel table ptr reg */
1016 #define maltxctp28r     (MAL_DCR_BASE+0x3C)  /* TX 28 Channel table ptr reg */
1017 #define maltxctp29r     (MAL_DCR_BASE+0x3D)  /* TX 29 Channel table ptr reg */
1018 #define maltxctp30r     (MAL_DCR_BASE+0x3E)  /* TX 30 Channel table ptr reg */
1019 #define maltxctp31r     (MAL_DCR_BASE+0x3F)  /* TX 31 Channel table ptr reg */
1020 #define malrxctp0r      (MAL_DCR_BASE+0x40)  /* RX 0 Channel table ptr reg  */
1021 #define malrxctp1r      (MAL_DCR_BASE+0x41)  /* RX 1 Channel table ptr reg  */
1022 #define malrxctp2r      (MAL_DCR_BASE+0x42)  /* RX 2 Channel table ptr reg  */
1023 #define malrxctp3r      (MAL_DCR_BASE+0x43)  /* RX 3 Channel table ptr reg  */
1024 #define malrxctp4r      (MAL_DCR_BASE+0x44)  /* RX 4 Channel table ptr reg  */
1025 #define malrxctp5r      (MAL_DCR_BASE+0x45)  /* RX 5 Channel table ptr reg  */
1026 #define malrxctp6r      (MAL_DCR_BASE+0x46)  /* RX 6 Channel table ptr reg  */
1027 #define malrxctp7r      (MAL_DCR_BASE+0x47)  /* RX 7 Channel table ptr reg  */
1028 #define malrxctp8r      (MAL_DCR_BASE+0x48)  /* RX 8 Channel table ptr reg  */
1029 #define malrxctp9r      (MAL_DCR_BASE+0x49)  /* RX 9 Channel table ptr reg  */
1030 #define malrxctp10r     (MAL_DCR_BASE+0x4A)  /* RX 10 Channel table ptr reg */
1031 #define malrxctp11r     (MAL_DCR_BASE+0x4B)  /* RX 11 Channel table ptr reg */
1032 #define malrxctp12r     (MAL_DCR_BASE+0x4C)  /* RX 12 Channel table ptr reg */
1033 #define malrxctp13r     (MAL_DCR_BASE+0x4D)  /* RX 13 Channel table ptr reg */
1034 #define malrxctp14r     (MAL_DCR_BASE+0x4E)  /* RX 14 Channel table ptr reg */
1035 #define malrxctp15r     (MAL_DCR_BASE+0x4F)  /* RX 15 Channel table ptr reg */
1036 #define malrxctp16r     (MAL_DCR_BASE+0x50)  /* RX 16 Channel table ptr reg */
1037 #define malrxctp17r     (MAL_DCR_BASE+0x51)  /* RX 17 Channel table ptr reg */
1038 #define malrxctp18r     (MAL_DCR_BASE+0x52)  /* RX 18 Channel table ptr reg */
1039 #define malrxctp19r     (MAL_DCR_BASE+0x53)  /* RX 19 Channel table ptr reg */
1040 #define malrxctp20r     (MAL_DCR_BASE+0x54)  /* RX 20 Channel table ptr reg */
1041 #define malrxctp21r     (MAL_DCR_BASE+0x55)  /* RX 21 Channel table ptr reg */
1042 #define malrxctp22r     (MAL_DCR_BASE+0x56)  /* RX 22 Channel table ptr reg */
1043 #define malrxctp23r     (MAL_DCR_BASE+0x57)  /* RX 23 Channel table ptr reg */
1044 #define malrxctp24r     (MAL_DCR_BASE+0x58)  /* RX 24 Channel table ptr reg */
1045 #define malrxctp25r     (MAL_DCR_BASE+0x59)  /* RX 25 Channel table ptr reg */
1046 #define malrxctp26r     (MAL_DCR_BASE+0x5A)  /* RX 26 Channel table ptr reg */
1047 #define malrxctp27r     (MAL_DCR_BASE+0x5B)  /* RX 27 Channel table ptr reg */
1048 #define malrxctp28r     (MAL_DCR_BASE+0x5C)  /* RX 28 Channel table ptr reg */
1049 #define malrxctp29r     (MAL_DCR_BASE+0x5D)  /* RX 29 Channel table ptr reg */
1050 #define malrxctp30r     (MAL_DCR_BASE+0x5E)  /* RX 30 Channel table ptr reg */
1051 #define malrxctp31r     (MAL_DCR_BASE+0x5F)  /* RX 31 Channel table ptr reg */
1052 #define malrcbs0        (MAL_DCR_BASE+0x60)  /* RX 0 Channel buffer size reg */
1053 #define malrcbs1        (MAL_DCR_BASE+0x61)  /* RX 1 Channel buffer size reg */
1054 #define malrcbs2        (MAL_DCR_BASE+0x62)  /* RX 2 Channel buffer size reg */
1055 #define malrcbs3        (MAL_DCR_BASE+0x63)  /* RX 3 Channel buffer size reg */
1056 #define malrcbs4        (MAL_DCR_BASE+0x64)  /* RX 4 Channel buffer size reg */
1057 #define malrcbs5        (MAL_DCR_BASE+0x65)  /* RX 5 Channel buffer size reg */
1058 #define malrcbs6        (MAL_DCR_BASE+0x66)  /* RX 6 Channel buffer size reg */
1059 #define malrcbs7        (MAL_DCR_BASE+0x67)  /* RX 7 Channel buffer size reg */
1060 #define malrcbs8        (MAL_DCR_BASE+0x68)  /* RX 8 Channel buffer size reg */
1061 #define malrcbs9        (MAL_DCR_BASE+0x69)  /* RX 9 Channel buffer size reg */
1062 #define malrcbs10       (MAL_DCR_BASE+0x6A)  /* RX 10 Channel buffer size reg */
1063 #define malrcbs11       (MAL_DCR_BASE+0x6B)  /* RX 11 Channel buffer size reg */
1064 #define malrcbs12       (MAL_DCR_BASE+0x6C)  /* RX 12 Channel buffer size reg */
1065 #define malrcbs13       (MAL_DCR_BASE+0x6D)  /* RX 13 Channel buffer size reg */
1066 #define malrcbs14       (MAL_DCR_BASE+0x6E)  /* RX 14 Channel buffer size reg */
1067 #define malrcbs15       (MAL_DCR_BASE+0x6F)  /* RX 15 Channel buffer size reg */
1068 #define malrcbs16       (MAL_DCR_BASE+0x70)  /* RX 16 Channel buffer size reg */
1069 #define malrcbs17       (MAL_DCR_BASE+0x71)  /* RX 17 Channel buffer size reg */
1070 #define malrcbs18       (MAL_DCR_BASE+0x72)  /* RX 18 Channel buffer size reg */
1071 #define malrcbs19       (MAL_DCR_BASE+0x73)  /* RX 19 Channel buffer size reg */
1072 #define malrcbs20       (MAL_DCR_BASE+0x74)  /* RX 20 Channel buffer size reg */
1073 #define malrcbs21       (MAL_DCR_BASE+0x75)  /* RX 21 Channel buffer size reg */
1074 #define malrcbs22       (MAL_DCR_BASE+0x76)  /* RX 22 Channel buffer size reg */
1075 #define malrcbs23       (MAL_DCR_BASE+0x77)  /* RX 23 Channel buffer size reg */
1076 #define malrcbs24       (MAL_DCR_BASE+0x78)  /* RX 24 Channel buffer size reg */
1077 #define malrcbs25       (MAL_DCR_BASE+0x79)  /* RX 25 Channel buffer size reg */
1078 #define malrcbs26       (MAL_DCR_BASE+0x7A)  /* RX 26 Channel buffer size reg */
1079 #define malrcbs27       (MAL_DCR_BASE+0x7B)  /* RX 27 Channel buffer size reg */
1080 #define malrcbs28       (MAL_DCR_BASE+0x7C)  /* RX 28 Channel buffer size reg */
1081 #define malrcbs29       (MAL_DCR_BASE+0x7D)  /* RX 29 Channel buffer size reg */
1082 #define malrcbs30       (MAL_DCR_BASE+0x7E)  /* RX 30 Channel buffer size reg */
1083 #define malrcbs31       (MAL_DCR_BASE+0x7F)  /* RX 31 Channel buffer size reg */
1084
1085 #else /* !defined(CONFIG_405EZ) */
1086
1087 #define MAL_DCR_BASE 0x180
1088 #define malmcr  (MAL_DCR_BASE+0x00)  /* MAL Config reg                       */
1089 #define malesr  (MAL_DCR_BASE+0x01)  /* Error Status reg (Read/Clear)        */
1090 #define malier  (MAL_DCR_BASE+0x02)  /* Interrupt enable reg                 */
1091 #define maldbr  (MAL_DCR_BASE+0x03)  /* Mal Debug reg (Read only)            */
1092 #define maltxcasr  (MAL_DCR_BASE+0x04)  /* TX Channel active reg (set)       */
1093 #define maltxcarr  (MAL_DCR_BASE+0x05)  /* TX Channel active reg (Reset)     */
1094 #define maltxeobisr (MAL_DCR_BASE+0x06) /* TX End of buffer int status reg   */
1095 #define maltxdeir  (MAL_DCR_BASE+0x07)  /* TX Descr. Error Int reg           */
1096 #define malrxcasr  (MAL_DCR_BASE+0x10)  /* RX Channel active reg (set)       */
1097 #define malrxcarr  (MAL_DCR_BASE+0x11)  /* RX Channel active reg (Reset)     */
1098 #define malrxeobisr (MAL_DCR_BASE+0x12) /* RX End of buffer int status reg   */
1099 #define malrxdeir  (MAL_DCR_BASE+0x13)  /* RX Descr. Error Int reg           */
1100 #define maltxctp0r (MAL_DCR_BASE+0x20)  /* TX 0 Channel table pointer reg    */
1101 #define maltxctp1r (MAL_DCR_BASE+0x21)  /* TX 1 Channel table pointer reg    */
1102 #define maltxctp2r (MAL_DCR_BASE+0x22)  /* TX 2 Channel table pointer reg    */
1103 #define malrxctp0r (MAL_DCR_BASE+0x40)  /* RX 0 Channel table pointer reg    */
1104 #define malrxctp1r (MAL_DCR_BASE+0x41)  /* RX 1 Channel table pointer reg    */
1105 #define malrcbs0   (MAL_DCR_BASE+0x60)  /* RX 0 Channel buffer size reg      */
1106 #define malrcbs1   (MAL_DCR_BASE+0x61)  /* RX 1 Channel buffer size reg      */
1107 #endif /* defined(CONFIG_405EZ) */
1108
1109 /*-----------------------------------------------------------------------------
1110 | IIC Register Offsets
1111 '----------------------------------------------------------------------------*/
1112 #define    IICMDBUF         0x00
1113 #define    IICSDBUF         0x02
1114 #define    IICLMADR         0x04
1115 #define    IICHMADR         0x05
1116 #define    IICCNTL          0x06
1117 #define    IICMDCNTL        0x07
1118 #define    IICSTS           0x08
1119 #define    IICEXTSTS        0x09
1120 #define    IICLSADR         0x0A
1121 #define    IICHSADR         0x0B
1122 #define    IICCLKDIV        0x0C
1123 #define    IICINTRMSK       0x0D
1124 #define    IICXFRCNT        0x0E
1125 #define    IICXTCNTLSS      0x0F
1126 #define    IICDIRECTCNTL    0x10
1127
1128 /*-----------------------------------------------------------------------------
1129 | UART Register Offsets
1130 '----------------------------------------------------------------------------*/
1131 #define         DATA_REG        0x00
1132 #define         DL_LSB          0x00
1133 #define         DL_MSB          0x01
1134 #define         INT_ENABLE      0x01
1135 #define         FIFO_CONTROL    0x02
1136 #define         LINE_CONTROL    0x03
1137 #define         MODEM_CONTROL   0x04
1138 #define         LINE_STATUS     0x05
1139 #define         MODEM_STATUS    0x06
1140 #define         SCRATCH         0x07
1141
1142 /******************************************************************************
1143  * On Chip Memory
1144  ******************************************************************************/
1145 #if defined(CONFIG_405EZ)
1146 #define OCM_DCR_BASE 0x020
1147 #define ocmplb3cr1      (OCM_DCR_BASE+0x00)  /* OCM PLB3 Bank 1 Config Reg    */
1148 #define ocmplb3cr2      (OCM_DCR_BASE+0x01)  /* OCM PLB3 Bank 2 Config Reg    */
1149 #define ocmplb3bear     (OCM_DCR_BASE+0x02)  /* OCM PLB3 Bus Error Add Reg    */
1150 #define ocmplb3besr0    (OCM_DCR_BASE+0x03)  /* OCM PLB3 Bus Error Stat Reg 0 */
1151 #define ocmplb3besr1    (OCM_DCR_BASE+0x04)  /* OCM PLB3 Bus Error Stat Reg 1 */
1152 #define ocmcid          (OCM_DCR_BASE+0x05)  /* OCM Core ID                   */
1153 #define ocmrevid        (OCM_DCR_BASE+0x06)  /* OCM Revision ID               */
1154 #define ocmplb3dpc      (OCM_DCR_BASE+0x07)  /* OCM PLB3 Data Parity Check    */
1155 #define ocmdscr1        (OCM_DCR_BASE+0x08)  /* OCM D-side Bank 1 Config Reg  */
1156 #define ocmdscr2        (OCM_DCR_BASE+0x09)  /* OCM D-side Bank 2 Config Reg  */
1157 #define ocmiscr1        (OCM_DCR_BASE+0x0A)  /* OCM I-side Bank 1 Config Reg  */
1158 #define ocmiscr2        (OCM_DCR_BASE+0x0B)  /* OCM I-side Bank 2 Config Reg  */
1159 #define ocmdsisdpc      (OCM_DCR_BASE+0x0C)  /* OCM D-side/I-side Data Par Chk*/
1160 #define ocmdsisbear     (OCM_DCR_BASE+0x0D)  /* OCM D-side/I-side Bus Err Addr*/
1161 #define ocmdsisbesr     (OCM_DCR_BASE+0x0E)  /* OCM D-side/I-side Bus Err Stat*/
1162 #else
1163 #define OCM_DCR_BASE 0x018
1164 #define ocmisarc   (OCM_DCR_BASE+0x00)  /* OCM I-side address compare reg    */
1165 #define ocmiscntl  (OCM_DCR_BASE+0x01)  /* OCM I-side control reg            */
1166 #define ocmdsarc   (OCM_DCR_BASE+0x02)  /* OCM D-side address compare reg    */
1167 #define ocmdscntl  (OCM_DCR_BASE+0x03)  /* OCM D-side control reg            */
1168 #endif /* CONFIG_405EZ */
1169
1170 /******************************************************************************
1171  * GPIO macro register defines
1172  ******************************************************************************/
1173 #if defined(CONFIG_405EZ)
1174 /* Only the 405EZ has 2 GPIOs */
1175 #define GPIO_BASE  0xEF600700
1176 #define GPIO0_OR                (GPIO_BASE+0x0)
1177 #define GPIO0_TCR               (GPIO_BASE+0x4)
1178 #define GPIO0_OSRL              (GPIO_BASE+0x8)
1179 #define GPIO0_OSRH              (GPIO_BASE+0xC)
1180 #define GPIO0_TSRL              (GPIO_BASE+0x10)
1181 #define GPIO0_TSRH              (GPIO_BASE+0x14)
1182 #define GPIO0_ODR               (GPIO_BASE+0x18)
1183 #define GPIO0_IR                (GPIO_BASE+0x1C)
1184 #define GPIO0_RR1               (GPIO_BASE+0x20)
1185 #define GPIO0_RR2               (GPIO_BASE+0x24)
1186 #define GPIO0_RR3               (GPIO_BASE+0x28)
1187 #define GPIO0_ISR1L             (GPIO_BASE+0x30)
1188 #define GPIO0_ISR1H             (GPIO_BASE+0x34)
1189 #define GPIO0_ISR2L             (GPIO_BASE+0x38)
1190 #define GPIO0_ISR2H             (GPIO_BASE+0x3C)
1191 #define GPIO0_ISR3L             (GPIO_BASE+0x40)
1192 #define GPIO0_ISR3H             (GPIO_BASE+0x44)
1193
1194 #define GPIO1_BASE  0xEF600800
1195 #define GPIO1_OR                (GPIO1_BASE+0x0)
1196 #define GPIO1_TCR               (GPIO1_BASE+0x4)
1197 #define GPIO1_OSRL              (GPIO1_BASE+0x8)
1198 #define GPIO1_OSRH              (GPIO1_BASE+0xC)
1199 #define GPIO1_TSRL              (GPIO1_BASE+0x10)
1200 #define GPIO1_TSRH              (GPIO1_BASE+0x14)
1201 #define GPIO1_ODR               (GPIO1_BASE+0x18)
1202 #define GPIO1_IR                (GPIO1_BASE+0x1C)
1203 #define GPIO1_RR1               (GPIO1_BASE+0x20)
1204 #define GPIO1_RR2               (GPIO1_BASE+0x24)
1205 #define GPIO1_RR3               (GPIO1_BASE+0x28)
1206 #define GPIO1_ISR1L             (GPIO1_BASE+0x30)
1207 #define GPIO1_ISR1H             (GPIO1_BASE+0x34)
1208 #define GPIO1_ISR2L             (GPIO1_BASE+0x38)
1209 #define GPIO1_ISR2H             (GPIO1_BASE+0x3C)
1210 #define GPIO1_ISR3L             (GPIO1_BASE+0x40)
1211 #define GPIO1_ISR3H             (GPIO1_BASE+0x44)
1212
1213 #elif defined(CONFIG_405EX)
1214 #define GPIO_BASE  0xEF600800
1215 #define GPIO0_OR               (GPIO_BASE+0x0)
1216 #define GPIO0_TCR              (GPIO_BASE+0x4)
1217 #define GPIO0_OSRL             (GPIO_BASE+0x8)
1218 #define GPIO0_OSRH             (GPIO_BASE+0xC)
1219 #define GPIO0_TSRL             (GPIO_BASE+0x10)
1220 #define GPIO0_TSRH             (GPIO_BASE+0x14)
1221 #define GPIO0_ODR              (GPIO_BASE+0x18)
1222 #define GPIO0_IR               (GPIO_BASE+0x1C)
1223 #define GPIO0_RR1              (GPIO_BASE+0x20)
1224 #define GPIO0_RR2              (GPIO_BASE+0x24)
1225 #define GPIO0_ISR1L            (GPIO_BASE+0x30)
1226 #define GPIO0_ISR1H            (GPIO_BASE+0x34)
1227 #define GPIO0_ISR2L            (GPIO_BASE+0x38)
1228 #define GPIO0_ISR2H            (GPIO_BASE+0x3C)
1229 #define GPIO0_ISR3L            (GPIO_BASE+0x40)
1230 #define GPIO0_ISR3H            (GPIO_BASE+0x44)
1231
1232 #else   /* !405EZ */
1233
1234 #define GPIO_BASE  0xEF600700
1235 #define GPIO0_OR               (GPIO_BASE+0x0)
1236 #define GPIO0_TCR              (GPIO_BASE+0x4)
1237 #define GPIO0_OSRH             (GPIO_BASE+0x8)
1238 #define GPIO0_OSRL             (GPIO_BASE+0xC)
1239 #define GPIO0_TSRH             (GPIO_BASE+0x10)
1240 #define GPIO0_TSRL             (GPIO_BASE+0x14)
1241 #define GPIO0_ODR              (GPIO_BASE+0x18)
1242 #define GPIO0_IR               (GPIO_BASE+0x1C)
1243 #define GPIO0_RR1              (GPIO_BASE+0x20)
1244 #define GPIO0_RR2              (GPIO_BASE+0x24)
1245 #define GPIO0_ISR1H            (GPIO_BASE+0x30)
1246 #define GPIO0_ISR1L            (GPIO_BASE+0x34)
1247 #define GPIO0_ISR2H            (GPIO_BASE+0x38)
1248 #define GPIO0_ISR2L            (GPIO_BASE+0x3C)
1249
1250 #endif /* CONFIG_405EZ */
1251
1252 #define GPIO0_BASE              GPIO_BASE
1253
1254 #if defined(CONFIG_405EX)
1255 #define SDR0_SRST               0x0200
1256
1257 #define sdr_uart0       0x0120  /* UART0 Config */
1258 #define sdr_uart1       0x0121  /* UART1 Config */
1259 #define sdr_mfr         0x4300  /* SDR0_MFR reg */
1260
1261 /* Defines for CPC0_EPRCSR register */
1262 #define CPC0_EPRCSR_E0NFE          0x80000000
1263 #define CPC0_EPRCSR_E1NFE          0x40000000
1264 #define CPC0_EPRCSR_E1RPP          0x00000080
1265 #define CPC0_EPRCSR_E0RPP          0x00000040
1266 #define CPC0_EPRCSR_E1ERP          0x00000020
1267 #define CPC0_EPRCSR_E0ERP          0x00000010
1268 #define CPC0_EPRCSR_E1PCI          0x00000002
1269 #define CPC0_EPRCSR_E0PCI          0x00000001
1270
1271 #define cpr0_clkupd     0x020
1272 #define cpr0_pllc       0x040
1273 #define cpr0_plld       0x060
1274 #define cpr0_cpud       0x080
1275 #define cpr0_plbd       0x0a0
1276 #define cpr0_opbd       0x0c0
1277 #define cpr0_perd       0x0e0
1278 #define cpr0_ahbd       0x100
1279 #define cpr0_icfg       0x140
1280
1281 #define SDR_PINSTP      0x0040
1282 #define sdr_sdcs        0x0060
1283
1284 #define SDR0_SDCS_SDD                   (0x80000000 >> 31)
1285
1286 /* CUST0 Customer Configuration Register0 */
1287 #define SDR0_CUST0                   0x4000
1288 #define   SDR0_CUST0_MUX_E_N_G_MASK   0xC0000000     /* Mux_Emac_NDFC_GPIO */
1289 #define   SDR0_CUST0_MUX_EMAC_SEL     0x40000000       /* Emac Selection */
1290 #define   SDR0_CUST0_MUX_NDFC_SEL     0x80000000       /* NDFC Selection */
1291 #define   SDR0_CUST0_MUX_GPIO_SEL     0xC0000000       /* GPIO Selection */
1292
1293 #define   SDR0_CUST0_NDFC_EN_MASK     0x20000000     /* NDFC Enable Mask */
1294 #define   SDR0_CUST0_NDFC_ENABLE      0x20000000       /* NDFC Enable */
1295 #define   SDR0_CUST0_NDFC_DISABLE     0x00000000       /* NDFC Disable */
1296
1297 #define   SDR0_CUST0_NDFC_BW_MASK     0x10000000     /* NDFC Boot Width */
1298 #define   SDR0_CUST0_NDFC_BW_16_BIT   0x10000000       /* NDFC Boot Width = 16 Bit */
1299 #define   SDR0_CUST0_NDFC_BW_8_BIT    0x00000000       /* NDFC Boot Width =  8 Bit */
1300
1301 #define   SDR0_CUST0_NDFC_BP_MASK     0x0F000000     /* NDFC Boot Page */
1302 #define   SDR0_CUST0_NDFC_BP_ENCODE(n) ((((unsigned long)(n))&0xF)<<24)
1303 #define   SDR0_CUST0_NDFC_BP_DECODE(n) ((((unsigned long)(n))>>24)&0x0F)
1304
1305 #define   SDR0_CUST0_NDFC_BAC_MASK    0x00C00000     /* NDFC Boot Address Cycle */
1306 #define   SDR0_CUST0_NDFC_BAC_ENCODE(n) ((((unsigned long)(n))&0x3)<<22)
1307 #define   SDR0_CUST0_NDFC_BAC_DECODE(n) ((((unsigned long)(n))>>22)&0x03)
1308
1309 #define   SDR0_CUST0_NDFC_ARE_MASK    0x00200000     /* NDFC Auto Read Enable */
1310 #define   SDR0_CUST0_NDFC_ARE_ENABLE  0x00200000       /* NDFC Auto Read Enable */
1311 #define   SDR0_CUST0_NDFC_ARE_DISABLE 0x00000000       /* NDFC Auto Read Disable */
1312
1313 #define   SDR0_CUST0_NRB_MASK         0x00100000     /* NDFC Ready / Busy */
1314 #define   SDR0_CUST0_NRB_BUSY         0x00100000       /* Busy */
1315 #define   SDR0_CUST0_NRB_READY        0x00000000       /* Ready */
1316
1317 #define   SDR0_CUST0_NDRSC_MASK       0x0000FFF0     /* NDFC Device Reset Count Mask */
1318 #define   SDR0_CUST0_NDRSC_ENCODE(n) ((((unsigned long)(n))&0xFFF)<<4)
1319 #define   SDR0_CUST0_NDRSC_DECODE(n) ((((unsigned long)(n))>>4)&0xFFF)
1320
1321 #define   SDR0_CUST0_CHIPSELGAT_MASK  0x0000000F     /* Chip Select Gating Mask */
1322 #define   SDR0_CUST0_CHIPSELGAT_DIS   0x00000000       /* Chip Select Gating Disable */
1323 #define   SDR0_CUST0_CHIPSELGAT_ENALL 0x0000000F       /* All Chip Select Gating Enable */
1324 #define   SDR0_CUST0_CHIPSELGAT_EN0   0x00000008       /* Chip Select0 Gating Enable */
1325 #define   SDR0_CUST0_CHIPSELGAT_EN1   0x00000004       /* Chip Select1 Gating Enable */
1326 #define   SDR0_CUST0_CHIPSELGAT_EN2   0x00000002       /* Chip Select2 Gating Enable */
1327 #define   SDR0_CUST0_CHIPSELGAT_EN3   0x00000001       /* Chip Select3 Gating Enable */
1328
1329 #define SDR0_PFC0               0x4100
1330 #define SDR0_PFC1               0x4101
1331 #define SDR0_PFC1_U1ME          0x02000000
1332 #define SDR0_PFC1_U0ME          0x00080000
1333 #define SDR0_PFC1_U0IM          0x00040000
1334 #define SDR0_PFC1_SIS           0x00020000
1335 #define SDR0_PFC1_DMAAEN        0x00010000
1336 #define SDR0_PFC1_DMADEN        0x00008000
1337 #define SDR0_PFC1_USBEN         0x00004000
1338 #define SDR0_PFC1_AHBSWAP       0x00000020
1339 #define SDR0_PFC1_USBBIGEN      0x00000010
1340 #define SDR0_PFC1_GPT_FREQ      0x0000000f
1341 #endif
1342
1343 /* General Purpose Timer (GPT) Register Offsets */
1344 #define GPT0_TBC                0x00000000
1345 #define GPT0_IM                 0x00000018
1346 #define GPT0_ISS                0x0000001C
1347 #define GPT0_ISC                0x00000020
1348 #define GPT0_IE                 0x00000024
1349 #define GPT0_COMP0              0x00000080
1350 #define GPT0_COMP1              0x00000084
1351 #define GPT0_COMP2              0x00000088
1352 #define GPT0_COMP3              0x0000008C
1353 #define GPT0_COMP4              0x00000090
1354 #define GPT0_COMP5              0x00000094
1355 #define GPT0_COMP6              0x00000098
1356 #define GPT0_MASK0              0x000000C0
1357 #define GPT0_MASK1              0x000000C4
1358 #define GPT0_MASK2              0x000000C8
1359 #define GPT0_MASK3              0x000000CC
1360 #define GPT0_MASK4              0x000000D0
1361 #define GPT0_MASK5              0x000000D4
1362 #define GPT0_MASK6              0x000000D8
1363 #define GPT0_DCT0               0x00000110
1364 #define GPT0_DCIS               0x0000011C
1365
1366 #endif  /* __PPC405_H__ */