e0d165e572516b57c8ab484040e7394822f2f70e
[platform/kernel/u-boot.git] / arch / powerpc / include / asm / ppc405.h
1 /*----------------------------------------------------------------------------+
2 |   This source code is dual-licensed.  You may use it under the terms of the
3 |   GNU General Public License version 2, or under the license below.
4 |
5 |       This source code has been made available to you by IBM on an AS-IS
6 |       basis.  Anyone receiving this source is licensed under IBM
7 |       copyrights to use it in any way he or she deems fit, including
8 |       copying it, modifying it, compiling it, and redistributing it either
9 |       with or without modifications.  No license under IBM patents or
10 |       patent applications is to be implied by the copyright license.
11 |
12 |       Any user of this software should understand that IBM cannot provide
13 |       technical support for this software and will not be responsible for
14 |       any consequences resulting from the use of this software.
15 |
16 |       Any person who transfers this source code or any derivative work
17 |       must include the IBM copyright notice, this paragraph, and the
18 |       preceding two paragraphs in the transferred software.
19 |
20 |       COPYRIGHT   I B M   CORPORATION 1999
21 |       LICENSED MATERIAL  -  PROGRAM PROPERTY OF I B M
22 +----------------------------------------------------------------------------*/
23
24 #ifndef __PPC405_H__
25 #define __PPC405_H__
26
27 /* Define bits and masks for real-mode storage attribute control registers */
28 #define PPC_128MB_SACR_BIT(addr)        ((addr) >> 27)
29 #define PPC_128MB_SACR_VALUE(addr)      PPC_REG_VAL(PPC_128MB_SACR_BIT(addr),1)
30
31 #ifndef CONFIG_IOP480
32 #define CONFIG_SYS_DCACHE_SIZE          (16 << 10)      /* For AMCC 405 CPUs */
33 #else
34 #define CONFIG_SYS_DCACHE_SIZE          (2 << 10)       /* For PLX IOP480(403)*/
35 #endif
36
37 /* DCR registers */
38 #define PLB0_ACR        0x0087
39
40 /******************************************************************************
41  * Special for PPC405GP
42  ******************************************************************************/
43
44 /******************************************************************************
45  * DMA
46  ******************************************************************************/
47 #define DMA_DCR_BASE 0x100
48 #define DMACR0  (DMA_DCR_BASE+0x00)  /* DMA channel control register 0       */
49 #define DMACT0  (DMA_DCR_BASE+0x01)  /* DMA count register 0                 */
50 #define DMADA0  (DMA_DCR_BASE+0x02)  /* DMA destination address register 0   */
51 #define DMASA0  (DMA_DCR_BASE+0x03)  /* DMA source address register 0        */
52 #define DMASB0  (DMA_DCR_BASE+0x04)  /* DMA scatter/gather descriptor addr 0 */
53 #define DMACR1  (DMA_DCR_BASE+0x08)  /* DMA channel control register 1       */
54 #define DMACT1  (DMA_DCR_BASE+0x09)  /* DMA count register 1                 */
55 #define DMADA1  (DMA_DCR_BASE+0x0a)  /* DMA destination address register 1   */
56 #define DMASA1  (DMA_DCR_BASE+0x0b)  /* DMA source address register 1        */
57 #define DMASB1  (DMA_DCR_BASE+0x0c)  /* DMA scatter/gather descriptor addr 1 */
58 #define DMACR2  (DMA_DCR_BASE+0x10)  /* DMA channel control register 2       */
59 #define DMACT2  (DMA_DCR_BASE+0x11)  /* DMA count register 2                 */
60 #define DMADA2  (DMA_DCR_BASE+0x12)  /* DMA destination address register 2   */
61 #define DMASA2  (DMA_DCR_BASE+0x13)  /* DMA source address register 2        */
62 #define DMASB2  (DMA_DCR_BASE+0x14)  /* DMA scatter/gather descriptor addr 2 */
63 #define DMACR3  (DMA_DCR_BASE+0x18)  /* DMA channel control register 3       */
64 #define DMACT3  (DMA_DCR_BASE+0x19)  /* DMA count register 3                 */
65 #define DMADA3  (DMA_DCR_BASE+0x1a)  /* DMA destination address register 3   */
66 #define DMASA3  (DMA_DCR_BASE+0x1b)  /* DMA source address register 3        */
67 #define DMASB3  (DMA_DCR_BASE+0x1c)  /* DMA scatter/gather descriptor addr 3 */
68 #define DMASR   (DMA_DCR_BASE+0x20)  /* DMA status register                  */
69 #define DMASGC  (DMA_DCR_BASE+0x23)  /* DMA scatter/gather command register  */
70 #define DMAADR  (DMA_DCR_BASE+0x24)  /* DMA address decode register          */
71
72 #ifndef CONFIG_405EP
73 /******************************************************************************
74  * Decompression Controller
75  ******************************************************************************/
76 #define DECOMP_DCR_BASE 0x14
77 #define KIAR  (DECOMP_DCR_BASE+0x0)     /* Decompression controller addr reg */
78 #define KIDR  (DECOMP_DCR_BASE+0x1)     /* Decompression controller data reg */
79 /* values for kiar register - indirect addressing of these regs */
80 #define KCONF   0x40                    /* decompression core config register */
81 #endif
82
83 /******************************************************************************
84  * Power Management
85  ******************************************************************************/
86 #ifdef CONFIG_405EX
87 #define POWERMAN_DCR_BASE 0xb0
88 #else
89 #define POWERMAN_DCR_BASE 0xb8
90 #endif
91 #define CPMSR   (POWERMAN_DCR_BASE+0x0) /* Power management status */
92 #define CPMER   (POWERMAN_DCR_BASE+0x1) /* Power management enable */
93 #define CPMFR   (POWERMAN_DCR_BASE+0x2) /* Power management force */
94
95 /******************************************************************************
96  * Extrnal Bus Controller
97  ******************************************************************************/
98   /* values for EBC0_CFGADDR register - indirect addressing of these regs */
99   #define PB0CR         0x00    /* periph bank 0 config reg */
100   #define PB1CR         0x01    /* periph bank 1 config reg */
101   #define PB2CR         0x02    /* periph bank 2 config reg */
102   #define PB3CR         0x03    /* periph bank 3 config reg */
103   #define PB4CR         0x04    /* periph bank 4 config reg */
104 #ifndef CONFIG_405EP
105   #define PB5CR         0x05    /* periph bank 5 config reg */
106   #define PB6CR         0x06    /* periph bank 6 config reg */
107   #define PB7CR         0x07    /* periph bank 7 config reg */
108 #endif
109   #define PB0AP         0x10    /* periph bank 0 access parameters */
110   #define PB1AP         0x11    /* periph bank 1 access parameters */
111   #define PB2AP         0x12    /* periph bank 2 access parameters */
112   #define PB3AP         0x13    /* periph bank 3 access parameters */
113   #define PB4AP         0x14    /* periph bank 4 access parameters */
114 #ifndef CONFIG_405EP
115   #define PB5AP         0x15    /* periph bank 5 access parameters */
116   #define PB6AP         0x16    /* periph bank 6 access parameters */
117   #define PB7AP         0x17    /* periph bank 7 access parameters */
118 #endif
119   #define PBEAR         0x20    /* periph bus error addr reg */
120   #define PBESR0        0x21    /* periph bus error status reg 0 */
121   #define PBESR1        0x22    /* periph bus error status reg 1 */
122 #define EBC0_CFG        0x23    /* external bus configuration reg */
123
124 #ifdef CONFIG_405EP
125 /******************************************************************************
126  * Control
127  ******************************************************************************/
128 #define CNTRL_DCR_BASE 0x0f0
129 #define CPC0_PLLMR0   (CNTRL_DCR_BASE+0x0)  /* PLL mode  register 0     */
130 #define CPC0_BOOT     (CNTRL_DCR_BASE+0x1)  /* Clock status register    */
131 #define CPC0_EPCTL    (CNTRL_DCR_BASE+0x3)  /* EMAC to PHY control register */
132 #define CPC0_PLLMR1   (CNTRL_DCR_BASE+0x4)  /* PLL mode  register 1     */
133 #define CPC0_UCR      (CNTRL_DCR_BASE+0x5)  /* UART control register    */
134 #define CPC0_PCI      (CNTRL_DCR_BASE+0x9)  /* PCI control register     */
135
136 #define CPC0_PLLMR0  (CNTRL_DCR_BASE+0x0)  /* PLL mode 0 register */
137 #define CPC0_BOOT    (CNTRL_DCR_BASE+0x1)  /* Chip Clock Status register */
138 #define CPC0_CR1     (CNTRL_DCR_BASE+0x2)  /* Chip Control 1 register */
139 #define CPC0_EPRCSR  (CNTRL_DCR_BASE+0x3)  /* EMAC PHY Rcv Clk Src register */
140 #define CPC0_PLLMR1  (CNTRL_DCR_BASE+0x4)  /* PLL mode 1 register */
141 #define CPC0_UCR     (CNTRL_DCR_BASE+0x5)  /* UART Control register */
142 #define CPC0_SRR     (CNTRL_DCR_BASE+0x6)  /* Soft Reset register */
143 #define CPC0_JTAGID  (CNTRL_DCR_BASE+0x7)  /* JTAG ID register */
144 #define CPC0_SPARE   (CNTRL_DCR_BASE+0x8)  /* Spare DCR */
145 #define CPC0_PCI     (CNTRL_DCR_BASE+0x9)  /* PCI Control register */
146
147 /* Bit definitions */
148 #define PLLMR0_CPU_DIV_MASK      0x00300000     /* CPU clock divider */
149 #define PLLMR0_CPU_DIV_BYPASS    0x00000000
150 #define PLLMR0_CPU_DIV_2         0x00100000
151 #define PLLMR0_CPU_DIV_3         0x00200000
152 #define PLLMR0_CPU_DIV_4         0x00300000
153
154 #define PLLMR0_CPU_TO_PLB_MASK   0x00030000     /* CPU:PLB Frequency Divisor */
155 #define PLLMR0_CPU_PLB_DIV_1     0x00000000
156 #define PLLMR0_CPU_PLB_DIV_2     0x00010000
157 #define PLLMR0_CPU_PLB_DIV_3     0x00020000
158 #define PLLMR0_CPU_PLB_DIV_4     0x00030000
159
160 #define PLLMR0_OPB_TO_PLB_MASK   0x00003000     /* OPB:PLB Frequency Divisor */
161 #define PLLMR0_OPB_PLB_DIV_1     0x00000000
162 #define PLLMR0_OPB_PLB_DIV_2     0x00001000
163 #define PLLMR0_OPB_PLB_DIV_3     0x00002000
164 #define PLLMR0_OPB_PLB_DIV_4     0x00003000
165
166 #define PLLMR0_EXB_TO_PLB_MASK   0x00000300     /* External Bus:PLB Divisor */
167 #define PLLMR0_EXB_PLB_DIV_2     0x00000000
168 #define PLLMR0_EXB_PLB_DIV_3     0x00000100
169 #define PLLMR0_EXB_PLB_DIV_4     0x00000200
170 #define PLLMR0_EXB_PLB_DIV_5     0x00000300
171
172 #define PLLMR0_MAL_TO_PLB_MASK   0x00000030     /* MAL:PLB Divisor */
173 #define PLLMR0_MAL_PLB_DIV_1     0x00000000
174 #define PLLMR0_MAL_PLB_DIV_2     0x00000010
175 #define PLLMR0_MAL_PLB_DIV_3     0x00000020
176 #define PLLMR0_MAL_PLB_DIV_4     0x00000030
177
178 #define PLLMR0_PCI_TO_PLB_MASK   0x00000003     /* PCI:PLB Frequency Divisor */
179 #define PLLMR0_PCI_PLB_DIV_1     0x00000000
180 #define PLLMR0_PCI_PLB_DIV_2     0x00000001
181 #define PLLMR0_PCI_PLB_DIV_3     0x00000002
182 #define PLLMR0_PCI_PLB_DIV_4     0x00000003
183
184 #define PLLMR1_SSCS_MASK         0x80000000     /* Select system clock source */
185 #define PLLMR1_PLLR_MASK         0x40000000     /* PLL reset */
186 #define PLLMR1_FBMUL_MASK        0x00F00000 /* PLL feedback multiplier value */
187 #define PLLMR1_FBMUL_DIV_16      0x00000000
188 #define PLLMR1_FBMUL_DIV_1       0x00100000
189 #define PLLMR1_FBMUL_DIV_2       0x00200000
190 #define PLLMR1_FBMUL_DIV_3       0x00300000
191 #define PLLMR1_FBMUL_DIV_4       0x00400000
192 #define PLLMR1_FBMUL_DIV_5       0x00500000
193 #define PLLMR1_FBMUL_DIV_6       0x00600000
194 #define PLLMR1_FBMUL_DIV_7       0x00700000
195 #define PLLMR1_FBMUL_DIV_8       0x00800000
196 #define PLLMR1_FBMUL_DIV_9       0x00900000
197 #define PLLMR1_FBMUL_DIV_10      0x00A00000
198 #define PLLMR1_FBMUL_DIV_11      0x00B00000
199 #define PLLMR1_FBMUL_DIV_12      0x00C00000
200 #define PLLMR1_FBMUL_DIV_13      0x00D00000
201 #define PLLMR1_FBMUL_DIV_14      0x00E00000
202 #define PLLMR1_FBMUL_DIV_15      0x00F00000
203
204 #define PLLMR1_FWDVA_MASK        0x00070000 /* PLL forward divider A value */
205 #define PLLMR1_FWDVA_DIV_8       0x00000000
206 #define PLLMR1_FWDVA_DIV_7       0x00010000
207 #define PLLMR1_FWDVA_DIV_6       0x00020000
208 #define PLLMR1_FWDVA_DIV_5       0x00030000
209 #define PLLMR1_FWDVA_DIV_4       0x00040000
210 #define PLLMR1_FWDVA_DIV_3       0x00050000
211 #define PLLMR1_FWDVA_DIV_2       0x00060000
212 #define PLLMR1_FWDVA_DIV_1       0x00070000
213 #define PLLMR1_FWDVB_MASK        0x00007000 /* PLL forward divider B value */
214 #define PLLMR1_TUNING_MASK       0x000003FF /* PLL tune bits */
215
216 /* Defines for CPC0_EPRCSR register */
217 #define CPC0_EPRCSR_E0NFE       0x80000000
218 #define CPC0_EPRCSR_E1NFE       0x40000000
219 #define CPC0_EPRCSR_E1RPP       0x00000080
220 #define CPC0_EPRCSR_E0RPP       0x00000040
221 #define CPC0_EPRCSR_E1ERP       0x00000020
222 #define CPC0_EPRCSR_E0ERP       0x00000010
223 #define CPC0_EPRCSR_E1PCI       0x00000002
224 #define CPC0_EPRCSR_E0PCI       0x00000001
225
226 /* Defines for CPC0_PCI Register */
227 #define CPC0_PCI_SPE            0x00000010 /* PCIINT/WE select   */
228 #define CPC0_PCI_HOST_CFG_EN    0x00000008 /* PCI host config Enable */
229 #define CPC0_PCI_ARBIT_EN       0x00000001 /* PCI Internal Arb Enabled */
230
231 /* Defines for CPC0_BOOR Register */
232 #define CPC0_BOOT_SEP           0x00000002 /* serial EEPROM present */
233
234 /* Defines for CPC0_PLLMR1 Register fields */
235 #define PLL_ACTIVE              0x80000000
236 #define CPC0_PLLMR1_SSCS        0x80000000
237 #define PLL_RESET               0x40000000
238 #define CPC0_PLLMR1_PLLR        0x40000000
239         /* Feedback multiplier */
240 #define PLL_FBKDIV              0x00F00000
241 #define CPC0_PLLMR1_FBDV        0x00F00000
242 #define PLL_FBKDIV_16           0x00000000
243 #define PLL_FBKDIV_1            0x00100000
244 #define PLL_FBKDIV_2            0x00200000
245 #define PLL_FBKDIV_3            0x00300000
246 #define PLL_FBKDIV_4            0x00400000
247 #define PLL_FBKDIV_5            0x00500000
248 #define PLL_FBKDIV_6            0x00600000
249 #define PLL_FBKDIV_7            0x00700000
250 #define PLL_FBKDIV_8            0x00800000
251 #define PLL_FBKDIV_9            0x00900000
252 #define PLL_FBKDIV_10           0x00A00000
253 #define PLL_FBKDIV_11           0x00B00000
254 #define PLL_FBKDIV_12           0x00C00000
255 #define PLL_FBKDIV_13           0x00D00000
256 #define PLL_FBKDIV_14           0x00E00000
257 #define PLL_FBKDIV_15           0x00F00000
258         /* Forward A divisor */
259 #define PLL_FWDDIVA             0x00070000
260 #define CPC0_PLLMR1_FWDVA       0x00070000
261 #define PLL_FWDDIVA_8           0x00000000
262 #define PLL_FWDDIVA_7           0x00010000
263 #define PLL_FWDDIVA_6           0x00020000
264 #define PLL_FWDDIVA_5           0x00030000
265 #define PLL_FWDDIVA_4           0x00040000
266 #define PLL_FWDDIVA_3           0x00050000
267 #define PLL_FWDDIVA_2           0x00060000
268 #define PLL_FWDDIVA_1           0x00070000
269         /* Forward B divisor */
270 #define PLL_FWDDIVB             0x00007000
271 #define CPC0_PLLMR1_FWDVB       0x00007000
272 #define PLL_FWDDIVB_8           0x00000000
273 #define PLL_FWDDIVB_7           0x00001000
274 #define PLL_FWDDIVB_6           0x00002000
275 #define PLL_FWDDIVB_5           0x00003000
276 #define PLL_FWDDIVB_4           0x00004000
277 #define PLL_FWDDIVB_3           0x00005000
278 #define PLL_FWDDIVB_2           0x00006000
279 #define PLL_FWDDIVB_1           0x00007000
280         /* PLL tune bits */
281 #define PLL_TUNE_MASK            0x000003FF
282 #define PLL_TUNE_2_M_3           0x00000133     /*  2 <= M <= 3 */
283 #define PLL_TUNE_4_M_6           0x00000134     /*  3 <  M <= 6 */
284 #define PLL_TUNE_7_M_10          0x00000138     /*  6 <  M <= 10 */
285 #define PLL_TUNE_11_M_14         0x0000013C     /* 10 <  M <= 14 */
286 #define PLL_TUNE_15_M_40         0x0000023E     /* 14 <  M <= 40 */
287 #define PLL_TUNE_VCO_LOW         0x00000000     /* 500MHz <= VCO <=  800MHz */
288 #define PLL_TUNE_VCO_HI          0x00000080     /* 800MHz <  VCO <= 1000MHz */
289
290 /* Defines for CPC0_PLLMR0 Register fields */
291         /* CPU divisor */
292 #define PLL_CPUDIV              0x00300000
293 #define CPC0_PLLMR0_CCDV        0x00300000
294 #define PLL_CPUDIV_1            0x00000000
295 #define PLL_CPUDIV_2            0x00100000
296 #define PLL_CPUDIV_3            0x00200000
297 #define PLL_CPUDIV_4            0x00300000
298         /* PLB divisor */
299 #define PLL_PLBDIV              0x00030000
300 #define CPC0_PLLMR0_CBDV        0x00030000
301 #define PLL_PLBDIV_1            0x00000000
302 #define PLL_PLBDIV_2            0x00010000
303 #define PLL_PLBDIV_3            0x00020000
304 #define PLL_PLBDIV_4            0x00030000
305         /* OPB divisor */
306 #define PLL_OPBDIV              0x00003000
307 #define CPC0_PLLMR0_OPDV        0x00003000
308 #define PLL_OPBDIV_1            0x00000000
309 #define PLL_OPBDIV_2            0x00001000
310 #define PLL_OPBDIV_3            0x00002000
311 #define PLL_OPBDIV_4            0x00003000
312         /* EBC divisor */
313 #define PLL_EXTBUSDIV           0x00000300
314 #define CPC0_PLLMR0_EPDV        0x00000300
315 #define PLL_EXTBUSDIV_2         0x00000000
316 #define PLL_EXTBUSDIV_3         0x00000100
317 #define PLL_EXTBUSDIV_4         0x00000200
318 #define PLL_EXTBUSDIV_5         0x00000300
319         /* MAL divisor */
320 #define PLL_MALDIV              0x00000030
321 #define CPC0_PLLMR0_MPDV        0x00000030
322 #define PLL_MALDIV_1            0x00000000
323 #define PLL_MALDIV_2            0x00000010
324 #define PLL_MALDIV_3            0x00000020
325 #define PLL_MALDIV_4            0x00000030
326         /* PCI divisor */
327 #define PLL_PCIDIV              0x00000003
328 #define CPC0_PLLMR0_PPFD        0x00000003
329 #define PLL_PCIDIV_1            0x00000000
330 #define PLL_PCIDIV_2            0x00000001
331 #define PLL_PCIDIV_3            0x00000002
332 #define PLL_PCIDIV_4            0x00000003
333
334 /*
335  *------------------------------------------------------------------------------
336  * PLL settings for 266MHz CPU, 133MHz PLB/SDRAM, 66MHz EBC, 33MHz PCI,
337  * assuming a 33.3MHz input clock to the 405EP.
338  *------------------------------------------------------------------------------
339  */
340 #define PLLMR0_266_133_66  (PLL_CPUDIV_1 | PLL_PLBDIV_2 |  \
341                             PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |  \
342                             PLL_MALDIV_1 | PLL_PCIDIV_4)
343 #define PLLMR1_266_133_66  (PLL_FBKDIV_8  |  \
344                             PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |  \
345                             PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
346
347 #define PLLMR0_133_66_66_33  (PLL_CPUDIV_1 | PLL_PLBDIV_1 |  \
348                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 |  \
349                               PLL_MALDIV_1 | PLL_PCIDIV_4)
350 #define PLLMR1_133_66_66_33  (PLL_FBKDIV_4  |  \
351                               PLL_FWDDIVA_6 | PLL_FWDDIVB_6 |  \
352                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
353 #define PLLMR0_200_100_50_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 |  \
354                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_3 |  \
355                               PLL_MALDIV_1 | PLL_PCIDIV_4)
356 #define PLLMR1_200_100_50_33 (PLL_FBKDIV_6  |  \
357                               PLL_FWDDIVA_4 | PLL_FWDDIVB_4 |  \
358                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
359 #define PLLMR0_266_133_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 |  \
360                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 |  \
361                               PLL_MALDIV_1 | PLL_PCIDIV_4)
362 #define PLLMR1_266_133_66_33 (PLL_FBKDIV_8  |  \
363                               PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |  \
364                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
365 #define PLLMR0_266_66_33_33 (PLL_CPUDIV_1 | PLL_PLBDIV_4 |  \
366                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |  \
367                               PLL_MALDIV_1 | PLL_PCIDIV_2)
368 #define PLLMR1_266_66_33_33 (PLL_FBKDIV_8  |  \
369                               PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |  \
370                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
371 #define PLLMR0_333_111_55_37 (PLL_CPUDIV_1 | PLL_PLBDIV_3 |  \
372                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |  \
373                               PLL_MALDIV_1 | PLL_PCIDIV_3)
374 #define PLLMR1_333_111_55_37 (PLL_FBKDIV_10  |  \
375                               PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |  \
376                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
377 #define PLLMR0_333_111_55_111 (PLL_CPUDIV_1 | PLL_PLBDIV_3 |  \
378                               PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 |  \
379                               PLL_MALDIV_1 | PLL_PCIDIV_1)
380 #define PLLMR1_333_111_55_111 (PLL_FBKDIV_10  |  \
381                               PLL_FWDDIVA_3 | PLL_FWDDIVB_3 |  \
382                               PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
383
384 /*
385  * PLL Voltage Controlled Oscillator (VCO) definitions
386  * Maximum and minimum values (in MHz) for correct PLL operation.
387  */
388 #define VCO_MIN     500
389 #define VCO_MAX     1000
390 #elif defined(CONFIG_405EZ)
391 #define SDR0_NAND0      0x4000
392 #define SDR0_ULTRA0     0x4040
393 #define SDR0_ULTRA1     0x4050
394 #define SDR0_ICINTSTAT  0x4510
395
396 #define SDR_NAND0_NDEN          0x80000000
397 #define SDR_NAND0_NDBTEN        0x40000000
398 #define SDR_NAND0_NDBADR_MASK   0x30000000
399 #define SDR_NAND0_NDBPG_MASK    0x0f000000
400 #define SDR_NAND0_NDAREN        0x00800000
401 #define SDR_NAND0_NDRBEN        0x00400000
402
403 #define SDR_ULTRA0_NDGPIOBP     0x80000000
404 #define SDR_ULTRA0_CSN_MASK     0x78000000
405 #define SDR_ULTRA0_CSNSEL0      0x40000000
406 #define SDR_ULTRA0_CSNSEL1      0x20000000
407 #define SDR_ULTRA0_CSNSEL2      0x10000000
408 #define SDR_ULTRA0_CSNSEL3      0x08000000
409 #define SDR_ULTRA0_EBCRDYEN     0x04000000
410 #define SDR_ULTRA0_SPISSINEN    0x02000000
411 #define SDR_ULTRA0_NFSRSTEN     0x01000000
412
413 #define SDR_ULTRA1_LEDNENABLE   0x40000000
414
415 #define SDR_ICRX_STAT   0x80000000
416 #define SDR_ICTX0_STAT  0x40000000
417 #define SDR_ICTX1_STAT  0x20000000
418
419 #define SDR0_PINSTP     0x40
420
421 /******************************************************************************
422  * Control
423  ******************************************************************************/
424 /* CPR Registers */
425 #define CPR0_CLKUP      0x020           /* CPR_CLKUPD */
426 #define CPR0_PLLC               0x040           /* CPR_PLLC */
427 #define CPR0_PLLD               0x060           /* CPR_PLLD */
428 #define CPC0_PRIMAD     0x080           /* CPR_PRIMAD */
429 #define CPC0_PERD0      0x0e0           /* CPR_PERD0 */
430 #define CPC0_PERD1      0x0e1           /* CPR_PERD1 */
431 #define CPC0_PERC0      0x180           /* CPR_PERC0 */
432
433 #define CPR_CLKUPD_ENPLLCH_EN  0x40000000 /* Enable CPR PLL Changes */
434 #define CPR_CLKUPD_ENDVCH_EN   0x20000000 /* Enable CPR Sys. Div. Changes */
435 #define CPR_PERD0_SPIDV_MASK   0x000F0000 /* SPI Clock Divider */
436
437 #define PLLC_SRC_MASK          0x20000000 /* PLL feedback source */
438
439 #define PLLD_FBDV_MASK         0x1F000000 /* PLL feedback divider value */
440 #define PLLD_FWDVA_MASK        0x000F0000 /* PLL forward divider A value */
441 #define PLLD_FWDVB_MASK        0x00000700 /* PLL forward divider B value */
442
443 #define PRIMAD_CPUDV_MASK      0x0F000000 /* CPU Clock Divisor Mask */
444 #define PRIMAD_PLBDV_MASK      0x000F0000 /* PLB Clock Divisor Mask */
445 #define PRIMAD_OPBDV_MASK      0x00000F00 /* OPB Clock Divisor Mask */
446 #define PRIMAD_EBCDV_MASK      0x0000000F /* EBC Clock Divisor Mask */
447
448 #define PERD0_PWMDV_MASK       0xFF000000 /* PWM Divider Mask */
449 #define PERD0_SPIDV_MASK       0x000F0000 /* SPI Divider Mask */
450 #define PERD0_U0DV_MASK        0x0000FF00 /* UART 0 Divider Mask */
451 #define PERD0_U1DV_MASK        0x000000FF /* UART 1 Divider Mask */
452
453 #else /* #ifdef CONFIG_405EP */
454 /******************************************************************************
455  * Control
456  ******************************************************************************/
457 #define CNTRL_DCR_BASE 0x0b0
458 #define CPC0_PLLMR      (CNTRL_DCR_BASE + 0x0)  /* PLL mode  register */
459 #define CPC0_CR0        (CNTRL_DCR_BASE + 0x1)  /* chip control register 0 */
460 #define CPC0_CR1        (CNTRL_DCR_BASE + 0x2)  /* chip control register 1 */
461 #define CPC0_PSR        (CNTRL_DCR_BASE + 0x4)  /* chip pin strapping reg */
462
463 /* CPC0_ECR/CPC0_EIRR: PPC405GPr only */
464 #define CPC0_EIRR       (CNTRL_DCR_BASE + 0x6)  /* ext interrupt routing reg */
465 #define CPC0_ECR        0xaa                    /* edge conditioner register */
466
467 /* Bit definitions */
468 #define PLLMR_FWD_DIV_MASK      0xE0000000      /* Forward Divisor */
469 #define PLLMR_FWD_DIV_BYPASS    0xE0000000
470 #define PLLMR_FWD_DIV_3         0xA0000000
471 #define PLLMR_FWD_DIV_4         0x80000000
472 #define PLLMR_FWD_DIV_6         0x40000000
473
474 #define PLLMR_FB_DIV_MASK       0x1E000000      /* Feedback Divisor */
475 #define PLLMR_FB_DIV_1          0x02000000
476 #define PLLMR_FB_DIV_2          0x04000000
477 #define PLLMR_FB_DIV_3          0x06000000
478 #define PLLMR_FB_DIV_4          0x08000000
479
480 #define PLLMR_TUNING_MASK       0x01F80000
481
482 #define PLLMR_CPU_TO_PLB_MASK   0x00060000      /* CPU:PLB Frequency Divisor */
483 #define PLLMR_CPU_PLB_DIV_1     0x00000000
484 #define PLLMR_CPU_PLB_DIV_2     0x00020000
485 #define PLLMR_CPU_PLB_DIV_3     0x00040000
486 #define PLLMR_CPU_PLB_DIV_4     0x00060000
487
488 #define PLLMR_OPB_TO_PLB_MASK   0x00018000      /* OPB:PLB Frequency Divisor */
489 #define PLLMR_OPB_PLB_DIV_1     0x00000000
490 #define PLLMR_OPB_PLB_DIV_2     0x00008000
491 #define PLLMR_OPB_PLB_DIV_3     0x00010000
492 #define PLLMR_OPB_PLB_DIV_4     0x00018000
493
494 #define PLLMR_PCI_TO_PLB_MASK   0x00006000      /* PCI:PLB Frequency Divisor */
495 #define PLLMR_PCI_PLB_DIV_1     0x00000000
496 #define PLLMR_PCI_PLB_DIV_2     0x00002000
497 #define PLLMR_PCI_PLB_DIV_3     0x00004000
498 #define PLLMR_PCI_PLB_DIV_4     0x00006000
499
500 #define PLLMR_EXB_TO_PLB_MASK   0x00001800      /* External Bus:PLB Divisor */
501 #define PLLMR_EXB_PLB_DIV_2     0x00000000
502 #define PLLMR_EXB_PLB_DIV_3     0x00000800
503 #define PLLMR_EXB_PLB_DIV_4     0x00001000
504 #define PLLMR_EXB_PLB_DIV_5     0x00001800
505
506 /* definitions for PPC405GPr (new mode strapping) */
507 #define PLLMR_FWDB_DIV_MASK     0x00000007      /* Forward Divisor B */
508
509 #define PSR_PLL_FWD_MASK        0xC0000000
510 #define PSR_PLL_FDBACK_MASK     0x30000000
511 #define PSR_PLL_TUNING_MASK     0x0E000000
512 #define PSR_PLB_CPU_MASK        0x01800000
513 #define PSR_OPB_PLB_MASK        0x00600000
514 #define PSR_PCI_PLB_MASK        0x00180000
515 #define PSR_EB_PLB_MASK         0x00060000
516 #define PSR_ROM_WIDTH_MASK      0x00018000
517 #define PSR_ROM_LOC             0x00004000
518 #define PSR_PCI_ASYNC_EN        0x00001000
519 #define PSR_PERCLK_SYNC_MODE_EN 0x00000800      /* PPC405GPr only */
520 #define PSR_PCI_ARBIT_EN        0x00000400
521 #define PSR_NEW_MODE_EN         0x00000020      /* PPC405GPr only */
522
523 #ifndef CONFIG_IOP480
524 /*
525  * PLL Voltage Controlled Oscillator (VCO) definitions
526  * Maximum and minimum values (in MHz) for correct PLL operation.
527 */
528 #define VCO_MIN     400
529 #define VCO_MAX     800
530 #endif /* #ifndef CONFIG_IOP480 */
531 #endif /* #ifdef CONFIG_405EP */
532
533 #if 0
534 /******************************************************************************
535  * Memory Access Layer
536  ******************************************************************************/
537 #define MAL0_CFG        (MAL_DCR_BASE + 0x00) /* MAL Config reg */
538 #define MAL0_ESR        (MAL_DCR_BASE + 0x01) /* Err Status (Read/Clear) */
539 #define MAL0_IER        (MAL_DCR_BASE + 0x02) /* Interrupt enable */
540 #define MAL0_TXCASR     (MAL_DCR_BASE + 0x04) /* TX Channel active (set) */
541 #define MAL0_TXCARR     (MAL_DCR_BASE + 0x05) /* TX Channel active (reset) */
542 #define MAL0_TXEOBISR   (MAL_DCR_BASE + 0x06) /* TX End of buffer int status */
543 #define MAL0_TXDEIR     (MAL_DCR_BASE + 0x07) /* TX Descr. Error Int reg */
544 #define MAL0_RXCASR     (MAL_DCR_BASE + 0x10) /* RX Channel active (set) */
545 #define MAL0_RXCARR     (MAL_DCR_BASE + 0x11) /* RX Channel active (reset) */
546 #define MAL0_RXEOBISR   (MAL_DCR_BASE + 0x12) /* RX End of buffer int status */
547 #define MAL0_RXDEIR     (MAL_DCR_BASE + 0x13) /* RX Descr. Error Int reg */
548 #define MAL0_TXCTP0R    (MAL_DCR_BASE + 0x20) /* TX 0 Channel table ptr */
549 #define MAL0_TXCTP1R    (MAL_DCR_BASE + 0x21) /* TX 1 Channel table ptr */
550 #define MAL0_TXCTP2R    (MAL_DCR_BASE + 0x22) /* TX 2 Channel table ptr */
551 #define MAL0_TXCTP3R    (MAL_DCR_BASE + 0x23) /* TX 3 Channel table ptr */
552 #define MAL0_RXCTP0R    (MAL_DCR_BASE + 0x40) /* RX 0 Channel table ptr */
553 #define MAL0_RXCTP1R    (MAL_DCR_BASE + 0x41) /* RX 1 Channel table ptr */
554 #define MAL0_RXCTP2R    (MAL_DCR_BASE + 0x42) /* RX 2 Channel table ptr */
555 #define MAL0_RXCTP3R    (MAL_DCR_BASE + 0x43) /* RX 3 Channel table ptr */
556 #define MAL0_RXCTP8R    (MAL_DCR_BASE + 0x48) /* RX 8 Channel table ptr */
557 #define MAL0_RXCTP16R   (MAL_DCR_BASE + 0x50) /* RX 16 Channel table ptr */
558 #define MAL0_RXCTP24R   (MAL_DCR_BASE + 0x58) /* RX 24 Channel table ptr */
559 #define MAL0_RCBS0      (MAL_DCR_BASE + 0x60) /* RX 0 Channel buffer size */
560 #define MAL0_RCBS1      (MAL_DCR_BASE + 0x61) /* RX 1 Channel buffer size */
561 #define MAL0_RCBS2      (MAL_DCR_BASE + 0x62) /* RX 2 Channel buffer size */
562 #define MAL0_RCBS3      (MAL_DCR_BASE + 0x63) /* RX 3 Channel buffer size */
563 #define MAL0_RCBS8      (MAL_DCR_BASE + 0x68) /* RX 8 Channel buffer size */
564 #define MAL0_RCBS16     (MAL_DCR_BASE + 0x70) /* RX 16 Channel buffer size */
565 #define MAL0_RCBS24     (MAL_DCR_BASE + 0x78) /* RX 24 Channel buffer size */
566 #endif
567
568 /*-----------------------------------------------------------------------------
569 | UART Register Offsets
570 '----------------------------------------------------------------------------*/
571 #define         DATA_REG        0x00
572 #define         DL_LSB          0x00
573 #define         DL_MSB          0x01
574 #define         INT_ENABLE      0x01
575 #define         FIFO_CONTROL    0x02
576 #define         LINE_CONTROL    0x03
577 #define         MODEM_CONTROL   0x04
578 #define         LINE_STATUS     0x05
579 #define         MODEM_STATUS    0x06
580 #define         SCRATCH         0x07
581
582 /******************************************************************************
583  * On Chip Memory
584  ******************************************************************************/
585 #if defined(CONFIG_405EZ)
586 #define OCM_DCR_BASE 0x020
587 #define OCM0_PLBCR1     (OCM_DCR_BASE + 0x00)   /* OCM PLB3 Bank 1 Config */
588 #define OCM0_PLBCR2     (OCM_DCR_BASE + 0x01)   /* OCM PLB3 Bank 2 Config */
589 #define OCM0_PLBBEAR    (OCM_DCR_BASE + 0x02)   /* OCM PLB3 Bus Error Add */
590 #define OCM0_DSRC1      (OCM_DCR_BASE + 0x08)   /* OCM D-side Bank 1 Config */
591 #define OCM0_DSRC2      (OCM_DCR_BASE + 0x09)   /* OCM D-side Bank 2 Config */
592 #define OCM0_ISRC1      (OCM_DCR_BASE + 0x0A)   /* OCM I-side Bank 1Config */
593 #define OCM0_ISRC2      (OCM_DCR_BASE + 0x0B)   /* OCM I-side Bank 2 Config */
594 #define OCM0_DISDPC     (OCM_DCR_BASE + 0x0C)   /* OCM D-/I-side Data Par Chk */
595 #else
596 #define OCM_DCR_BASE 0x018
597 #define OCM0_ISCNTL     (OCM_DCR_BASE+0x01)     /* OCM I-side control reg */
598 #define OCM0_DSARC      (OCM_DCR_BASE+0x02)     /* OCM D-side address compare */
599 #define OCM0_DSCNTL     (OCM_DCR_BASE+0x03)     /* OCM D-side control */
600 #endif /* CONFIG_405EZ */
601
602 /******************************************************************************
603  * GPIO macro register defines
604  ******************************************************************************/
605 #if defined(CONFIG_405EZ)
606 /* Only the 405EZ has 2 GPIOs */
607 #define GPIO_BASE  0xEF600700
608 #define GPIO0_OR                (GPIO_BASE+0x0)
609 #define GPIO0_TCR               (GPIO_BASE+0x4)
610 #define GPIO0_OSRL              (GPIO_BASE+0x8)
611 #define GPIO0_OSRH              (GPIO_BASE+0xC)
612 #define GPIO0_TSRL              (GPIO_BASE+0x10)
613 #define GPIO0_TSRH              (GPIO_BASE+0x14)
614 #define GPIO0_ODR               (GPIO_BASE+0x18)
615 #define GPIO0_IR                (GPIO_BASE+0x1C)
616 #define GPIO0_RR1               (GPIO_BASE+0x20)
617 #define GPIO0_RR2               (GPIO_BASE+0x24)
618 #define GPIO0_RR3               (GPIO_BASE+0x28)
619 #define GPIO0_ISR1L             (GPIO_BASE+0x30)
620 #define GPIO0_ISR1H             (GPIO_BASE+0x34)
621 #define GPIO0_ISR2L             (GPIO_BASE+0x38)
622 #define GPIO0_ISR2H             (GPIO_BASE+0x3C)
623 #define GPIO0_ISR3L             (GPIO_BASE+0x40)
624 #define GPIO0_ISR3H             (GPIO_BASE+0x44)
625
626 #define GPIO1_BASE  0xEF600800
627 #define GPIO1_OR                (GPIO1_BASE+0x0)
628 #define GPIO1_TCR               (GPIO1_BASE+0x4)
629 #define GPIO1_OSRL              (GPIO1_BASE+0x8)
630 #define GPIO1_OSRH              (GPIO1_BASE+0xC)
631 #define GPIO1_TSRL              (GPIO1_BASE+0x10)
632 #define GPIO1_TSRH              (GPIO1_BASE+0x14)
633 #define GPIO1_ODR               (GPIO1_BASE+0x18)
634 #define GPIO1_IR                (GPIO1_BASE+0x1C)
635 #define GPIO1_RR1               (GPIO1_BASE+0x20)
636 #define GPIO1_RR2               (GPIO1_BASE+0x24)
637 #define GPIO1_RR3               (GPIO1_BASE+0x28)
638 #define GPIO1_ISR1L             (GPIO1_BASE+0x30)
639 #define GPIO1_ISR1H             (GPIO1_BASE+0x34)
640 #define GPIO1_ISR2L             (GPIO1_BASE+0x38)
641 #define GPIO1_ISR2H             (GPIO1_BASE+0x3C)
642 #define GPIO1_ISR3L             (GPIO1_BASE+0x40)
643 #define GPIO1_ISR3H             (GPIO1_BASE+0x44)
644
645 #elif defined(CONFIG_405EX)
646 #define GPIO_BASE  0xEF600800
647 #define GPIO0_OR               (GPIO_BASE+0x0)
648 #define GPIO0_TCR              (GPIO_BASE+0x4)
649 #define GPIO0_OSRL             (GPIO_BASE+0x8)
650 #define GPIO0_OSRH             (GPIO_BASE+0xC)
651 #define GPIO0_TSRL             (GPIO_BASE+0x10)
652 #define GPIO0_TSRH             (GPIO_BASE+0x14)
653 #define GPIO0_ODR              (GPIO_BASE+0x18)
654 #define GPIO0_IR               (GPIO_BASE+0x1C)
655 #define GPIO0_RR1              (GPIO_BASE+0x20)
656 #define GPIO0_RR2              (GPIO_BASE+0x24)
657 #define GPIO0_ISR1L            (GPIO_BASE+0x30)
658 #define GPIO0_ISR1H            (GPIO_BASE+0x34)
659 #define GPIO0_ISR2L            (GPIO_BASE+0x38)
660 #define GPIO0_ISR2H            (GPIO_BASE+0x3C)
661 #define GPIO0_ISR3L            (GPIO_BASE+0x40)
662 #define GPIO0_ISR3H            (GPIO_BASE+0x44)
663
664 #else   /* !405EZ */
665
666 #define GPIO_BASE  0xEF600700
667 #define GPIO0_OR               (GPIO_BASE+0x0)
668 #define GPIO0_TCR              (GPIO_BASE+0x4)
669 #define GPIO0_OSRH             (GPIO_BASE+0x8)
670 #define GPIO0_OSRL             (GPIO_BASE+0xC)
671 #define GPIO0_TSRH             (GPIO_BASE+0x10)
672 #define GPIO0_TSRL             (GPIO_BASE+0x14)
673 #define GPIO0_ODR              (GPIO_BASE+0x18)
674 #define GPIO0_IR               (GPIO_BASE+0x1C)
675 #define GPIO0_RR1              (GPIO_BASE+0x20)
676 #define GPIO0_RR2              (GPIO_BASE+0x24)
677 #define GPIO0_ISR1H            (GPIO_BASE+0x30)
678 #define GPIO0_ISR1L            (GPIO_BASE+0x34)
679 #define GPIO0_ISR2H            (GPIO_BASE+0x38)
680 #define GPIO0_ISR2L            (GPIO_BASE+0x3C)
681
682 #endif /* CONFIG_405EZ */
683
684 #define GPIO0_BASE              GPIO_BASE
685
686 #if defined(CONFIG_405EX)
687 #define SDR0_SRST               0x0200
688
689 /*
690  * Software Reset Register
691  */
692 #define SDR0_SRST_BGO           PPC_REG_VAL(0, 1)
693 #define SDR0_SRST_PLB4          PPC_REG_VAL(1, 1)
694 #define SDR0_SRST_EBC           PPC_REG_VAL(2, 1)
695 #define SDR0_SRST_OPB           PPC_REG_VAL(3, 1)
696 #define SDR0_SRST_UART0         PPC_REG_VAL(4, 1)
697 #define SDR0_SRST_UART1         PPC_REG_VAL(5, 1)
698 #define SDR0_SRST_IIC0          PPC_REG_VAL(6, 1)
699 #define SDR0_SRST_BGI           PPC_REG_VAL(7, 1)
700 #define SDR0_SRST_GPIO          PPC_REG_VAL(8, 1)
701 #define SDR0_SRST_GPT           PPC_REG_VAL(9, 1)
702 #define SDR0_SRST_DMC           PPC_REG_VAL(10, 1)
703 #define SDR0_SRST_RGMII         PPC_REG_VAL(11, 1)
704 #define SDR0_SRST_EMAC0         PPC_REG_VAL(12, 1)
705 #define SDR0_SRST_EMAC1         PPC_REG_VAL(13, 1)
706 #define SDR0_SRST_CPM           PPC_REG_VAL(14, 1)
707 #define SDR0_SRST_EPLL          PPC_REG_VAL(15, 1)
708 #define SDR0_SRST_UIC           PPC_REG_VAL(16, 1)
709 #define SDR0_SRST_UPRST         PPC_REG_VAL(17, 1)
710 #define SDR0_SRST_IIC1          PPC_REG_VAL(18, 1)
711 #define SDR0_SRST_SCP           PPC_REG_VAL(19, 1)
712 #define SDR0_SRST_UHRST         PPC_REG_VAL(20, 1)
713 #define SDR0_SRST_DMA           PPC_REG_VAL(21, 1)
714 #define SDR0_SRST_DMAC          PPC_REG_VAL(22, 1)
715 #define SDR0_SRST_MAL           PPC_REG_VAL(23, 1)
716 #define SDR0_SRST_EBM           PPC_REG_VAL(24, 1)
717 #define SDR0_SRST_GPTR          PPC_REG_VAL(25, 1)
718 #define SDR0_SRST_PE0           PPC_REG_VAL(26, 1)
719 #define SDR0_SRST_PE1           PPC_REG_VAL(27, 1)
720 #define SDR0_SRST_CRYP          PPC_REG_VAL(28, 1)
721 #define SDR0_SRST_PKP           PPC_REG_VAL(29, 1)
722 #define SDR0_SRST_AHB           PPC_REG_VAL(30, 1)
723 #define SDR0_SRST_NDFC          PPC_REG_VAL(31, 1)
724
725 #define SDR0_UART0              0x0120  /* UART0 Config */
726 #define SDR0_UART1              0x0121  /* UART1 Config */
727 #define SDR0_MFR                0x4300  /* SDR0_MFR reg */
728
729 /* Defines for CPC0_EPRCSR register */
730 #define CPC0_EPRCSR_E0NFE       0x80000000
731 #define CPC0_EPRCSR_E1NFE       0x40000000
732 #define CPC0_EPRCSR_E1RPP       0x00000080
733 #define CPC0_EPRCSR_E0RPP       0x00000040
734 #define CPC0_EPRCSR_E1ERP       0x00000020
735 #define CPC0_EPRCSR_E0ERP       0x00000010
736 #define CPC0_EPRCSR_E1PCI       0x00000002
737 #define CPC0_EPRCSR_E0PCI       0x00000001
738
739 #define CPR0_CLKUPD     0x020
740 #define CPR0_PLLC       0x040
741 #define CPR0_PLLD       0x060
742 #define CPR0_CPUD       0x080
743 #define CPR0_PLBD       0x0a0
744 #define CPR0_OPBD0      0x0c0
745 #define CPR0_PERD       0x0e0
746
747 #define SDR0_PINSTP     0x0040
748 #define SDR0_SDCS0      0x0060
749
750 #define SDR0_SDCS_SDD                   (0x80000000 >> 31)
751
752 /* CUST0 Customer Configuration Register0 */
753 #define SDR0_CUST0                   0x4000
754 #define SDR0_CUST0_MUX_E_N_G_MASK       0xC0000000 /* Mux_Emac_NDFC_GPIO */
755 #define SDR0_CUST0_MUX_EMAC_SEL         0x40000000 /* Emac Selection */
756 #define SDR0_CUST0_MUX_NDFC_SEL         0x80000000 /* NDFC Selection */
757 #define SDR0_CUST0_MUX_GPIO_SEL         0xC0000000 /* GPIO Selection */
758
759 #define SDR0_CUST0_NDFC_EN_MASK         0x20000000 /* NDFC Enable Mask */
760 #define SDR0_CUST0_NDFC_ENABLE          0x20000000 /* NDFC Enable */
761 #define SDR0_CUST0_NDFC_DISABLE         0x00000000 /* NDFC Disable */
762
763 #define SDR0_CUST0_NDFC_BW_MASK         0x10000000 /* NDFC Boot Width */
764 #define SDR0_CUST0_NDFC_BW_16_BIT       0x10000000 /* NDFC Boot Width= 16 Bit */
765 #define SDR0_CUST0_NDFC_BW_8_BIT        0x00000000 /* NDFC Boot Width=  8 Bit */
766
767 #define SDR0_CUST0_NDFC_BP_MASK         0x0F000000 /* NDFC Boot Page */
768 #define SDR0_CUST0_NDFC_BP_ENCODE(n)    ((((unsigned long)(n))&0xF)<<24)
769 #define SDR0_CUST0_NDFC_BP_DECODE(n)    ((((unsigned long)(n))>>24)&0x0F)
770
771 #define SDR0_CUST0_NDFC_BAC_MASK        0x00C00000 /* NDFC Boot Address Cycle */
772 #define SDR0_CUST0_NDFC_BAC_ENCODE(n)   ((((unsigned long)(n))&0x3)<<22)
773 #define SDR0_CUST0_NDFC_BAC_DECODE(n)   ((((unsigned long)(n))>>22)&0x03)
774
775 #define SDR0_CUST0_NDFC_ARE_MASK        0x00200000 /* NDFC Auto Read Enable */
776 #define SDR0_CUST0_NDFC_ARE_ENABLE      0x00200000 /* NDFC Auto Read Enable */
777 #define SDR0_CUST0_NDFC_ARE_DISABLE     0x00000000 /* NDFC Auto Read Disable */
778
779 #define SDR0_CUST0_NRB_MASK             0x00100000 /* NDFC Ready / Busy */
780 #define SDR0_CUST0_NRB_BUSY             0x00100000 /* Busy */
781 #define SDR0_CUST0_NRB_READY            0x00000000 /* Ready */
782
783 #define SDR0_CUST0_NDRSC_MASK   0x0000FFF0 /* NDFC Device Reset Count Mask */
784 #define SDR0_CUST0_NDRSC_ENCODE(n)      ((((unsigned long)(n))&0xFFF)<<4)
785 #define SDR0_CUST0_NDRSC_DECODE(n)      ((((unsigned long)(n))>>4)&0xFFF)
786
787 #define SDR0_CUST0_CHIPSELGAT_MASK      0x0000000F /* Chip Sel Gating Mask */
788 #define SDR0_CUST0_CHIPSELGAT_DIS       0x00000000 /* Chip Sel Gating Disable */
789 #define SDR0_CUST0_CHIPSELGAT_ENALL  0x0000000F /* All Chip Sel Gating Enable */
790 #define SDR0_CUST0_CHIPSELGAT_EN0       0x00000008 /* Chip Sel0 Gating Enable */
791 #define SDR0_CUST0_CHIPSELGAT_EN1       0x00000004 /* Chip Sel1 Gating Enable */
792 #define SDR0_CUST0_CHIPSELGAT_EN2       0x00000002 /* Chip Sel2 Gating Enable */
793 #define SDR0_CUST0_CHIPSELGAT_EN3       0x00000001 /* Chip Sel3 Gating Enable */
794
795 #define SDR0_PFC0               0x4100
796 #define SDR0_PFC1               0x4101
797 #define SDR0_PFC1_U1ME          0x02000000
798 #define SDR0_PFC1_U0ME          0x00080000
799 #define SDR0_PFC1_U0IM          0x00040000
800 #define SDR0_PFC1_SIS           0x00020000
801 #define SDR0_PFC1_DMAAEN        0x00010000
802 #define SDR0_PFC1_DMADEN        0x00008000
803 #define SDR0_PFC1_USBEN         0x00004000
804 #define SDR0_PFC1_AHBSWAP       0x00000020
805 #define SDR0_PFC1_USBBIGEN      0x00000010
806 #define SDR0_PFC1_GPT_FREQ      0x0000000f
807 #endif
808
809 #endif  /* __PPC405_H__ */