blob: 0c7bf3e6def81bcc10e0e328c877529e1ebcd78e [file] [log] [blame]
wdenk0442ed82002-11-03 10:24:00 +00001/*----------------------------------------------------------------------------+
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/*--------------------------------------------------------------------- */
26/* Special Purpose Registers */
27/*--------------------------------------------------------------------- */
wdenk8bde7f72003-06-27 21:31:46 +000028 #define srr2 0x3de /* save/restore register 2 */
29 #define srr3 0x3df /* save/restore register 3 */
Grzegorz Bernackiefa35cf2007-06-15 11:19:28 +020030
31 /*
32 * 405 does not really have CSRR0/1 but SRR2/3 are used during critical
33 * exception for the exact same purposes - let's alias them and have a
34 * common handling in crit_return() and CRIT_EXCEPTION
35 */
36 #define csrr0 srr2
37 #define csrr1 srr3
38
wdenk0442ed82002-11-03 10:24:00 +000039 #define dbsr 0x3f0 /* debug status register */
40 #define dbcr0 0x3f2 /* debug control register 0 */
41 #define dbcr1 0x3bd /* debug control register 1 */
42 #define iac1 0x3f4 /* instruction address comparator 1 */
43 #define iac2 0x3f5 /* instruction address comparator 2 */
44 #define iac3 0x3b4 /* instruction address comparator 3 */
45 #define iac4 0x3b5 /* instruction address comparator 4 */
46 #define dac1 0x3f6 /* data address comparator 1 */
47 #define dac2 0x3f7 /* data address comparator 2 */
48 #define dccr 0x3fa /* data cache control register */
49 #define iccr 0x3fb /* instruction cache control register */
50 #define esr 0x3d4 /* execption syndrome register */
51 #define dear 0x3d5 /* data exeption address register */
52 #define evpr 0x3d6 /* exeption vector prefix register */
53 #define tsr 0x3d8 /* timer status register */
54 #define tcr 0x3da /* timer control register */
55 #define pit 0x3db /* programmable interval timer */
wdenk8bde7f72003-06-27 21:31:46 +000056 #define sgr 0x3b9 /* storage guarded reg */
57 #define dcwr 0x3ba /* data cache write-thru reg*/
58 #define sler 0x3bb /* storage little-endian reg */
wdenk0442ed82002-11-03 10:24:00 +000059 #define cdbcr 0x3d7 /* cache debug cntrl reg */
60 #define icdbdr 0x3d3 /* instr cache dbug data reg*/
61 #define ccr0 0x3b3 /* core configuration register */
62 #define dvc1 0x3b6 /* data value compare register 1 */
63 #define dvc2 0x3b7 /* data value compare register 2 */
64 #define pid 0x3b1 /* process ID */
65 #define su0r 0x3bc /* storage user-defined register 0 */
66 #define zpr 0x3b0 /* zone protection regsiter */
67
wdenk8bde7f72003-06-27 21:31:46 +000068 #define tbl 0x11c /* time base lower - privileged write */
69 #define tbu 0x11d /* time base upper - privileged write */
wdenk0442ed82002-11-03 10:24:00 +000070
71 #define sprg4r 0x104 /* Special purpose general 4 - read only */
72 #define sprg5r 0x105 /* Special purpose general 5 - read only */
73 #define sprg6r 0x106 /* Special purpose general 6 - read only */
74 #define sprg7r 0x107 /* Special purpose general 7 - read only */
75 #define sprg4w 0x114 /* Special purpose general 4 - write only */
76 #define sprg5w 0x115 /* Special purpose general 5 - write only */
77 #define sprg6w 0x116 /* Special purpose general 6 - write only */
78 #define sprg7w 0x117 /* Special purpose general 7 - write only */
79
80/******************************************************************************
81 * Special for PPC405GP
82 ******************************************************************************/
83
84/******************************************************************************
85 * DMA
86 ******************************************************************************/
87#define DMA_DCR_BASE 0x100
88#define dmacr0 (DMA_DCR_BASE+0x00) /* DMA channel control register 0 */
89#define dmact0 (DMA_DCR_BASE+0x01) /* DMA count register 0 */
90#define dmada0 (DMA_DCR_BASE+0x02) /* DMA destination address register 0 */
91#define dmasa0 (DMA_DCR_BASE+0x03) /* DMA source address register 0 */
92#define dmasb0 (DMA_DCR_BASE+0x04) /* DMA scatter/gather descriptor addr 0 */
93#define dmacr1 (DMA_DCR_BASE+0x08) /* DMA channel control register 1 */
94#define dmact1 (DMA_DCR_BASE+0x09) /* DMA count register 1 */
95#define dmada1 (DMA_DCR_BASE+0x0a) /* DMA destination address register 1 */
96#define dmasa1 (DMA_DCR_BASE+0x0b) /* DMA source address register 1 */
97#define dmasb1 (DMA_DCR_BASE+0x0c) /* DMA scatter/gather descriptor addr 1 */
98#define dmacr2 (DMA_DCR_BASE+0x10) /* DMA channel control register 2 */
99#define dmact2 (DMA_DCR_BASE+0x11) /* DMA count register 2 */
100#define dmada2 (DMA_DCR_BASE+0x12) /* DMA destination address register 2 */
101#define dmasa2 (DMA_DCR_BASE+0x13) /* DMA source address register 2 */
102#define dmasb2 (DMA_DCR_BASE+0x14) /* DMA scatter/gather descriptor addr 2 */
103#define dmacr3 (DMA_DCR_BASE+0x18) /* DMA channel control register 3 */
104#define dmact3 (DMA_DCR_BASE+0x19) /* DMA count register 3 */
105#define dmada3 (DMA_DCR_BASE+0x1a) /* DMA destination address register 3 */
106#define dmasa3 (DMA_DCR_BASE+0x1b) /* DMA source address register 3 */
107#define dmasb3 (DMA_DCR_BASE+0x1c) /* DMA scatter/gather descriptor addr 3 */
108#define dmasr (DMA_DCR_BASE+0x20) /* DMA status register */
109#define dmasgc (DMA_DCR_BASE+0x23) /* DMA scatter/gather command register */
110#define dmaadr (DMA_DCR_BASE+0x24) /* DMA address decode register */
111
112/******************************************************************************
113 * Universal interrupt controller
114 ******************************************************************************/
115#define UIC_DCR_BASE 0xc0
116#define uicsr (UIC_DCR_BASE+0x0) /* UIC status */
117#define uicsrs (UIC_DCR_BASE+0x1) /* UIC status set */
118#define uicer (UIC_DCR_BASE+0x2) /* UIC enable */
119#define uiccr (UIC_DCR_BASE+0x3) /* UIC critical */
120#define uicpr (UIC_DCR_BASE+0x4) /* UIC polarity */
121#define uictr (UIC_DCR_BASE+0x5) /* UIC triggering */
122#define uicmsr (UIC_DCR_BASE+0x6) /* UIC masked status */
123#define uicvr (UIC_DCR_BASE+0x7) /* UIC vector */
124#define uicvcr (UIC_DCR_BASE+0x8) /* UIC vector configuration */
125
126/*-----------------------------------------------------------------------------+
127| Universal interrupt controller interrupts
128+-----------------------------------------------------------------------------*/
Stefan Roesee01bd212007-03-21 13:38:59 +0100129#if defined(CONFIG_405EZ)
130#define UIC_DMA0 0x80000000 /* DMA chan. 0 */
131#define UIC_DMA1 0x40000000 /* DMA chan. 1 */
132#define UIC_DMA2 0x20000000 /* DMA chan. 2 */
133#define UIC_DMA3 0x10000000 /* DMA chan. 3 */
134#define UIC_1588 0x08000000 /* IEEE 1588 network synchronization */
135#define UIC_UART0 0x04000000 /* UART 0 */
136#define UIC_UART1 0x02000000 /* UART 1 */
137#define UIC_CAN0 0x01000000 /* CAN 0 */
138#define UIC_CAN1 0x00800000 /* CAN 1 */
139#define UIC_SPI 0x00400000 /* SPI */
140#define UIC_IIC 0x00200000 /* IIC */
141#define UIC_CHT0 0x00100000 /* Chameleon timer high pri interrupt */
142#define UIC_CHT1 0x00080000 /* Chameleon timer high pri interrupt */
143#define UIC_USBH1 0x00040000 /* USB Host 1 */
144#define UIC_USBH2 0x00020000 /* USB Host 2 */
145#define UIC_USBDEV 0x00010000 /* USB Device */
Wolfgang Denk1636d1c2007-06-22 23:59:00 +0200146#define UIC_ENET 0x00008000 /* Ethernet interrupt status */
147#define UIC_ENET1 0x00008000 /* dummy define */
Stefan Roesee01bd212007-03-21 13:38:59 +0100148#define UIC_EMAC_WAKE 0x00004000 /* EMAC wake up */
149
150#define UIC_MADMAL 0x00002000 /* Logical OR of following MadMAL int */
Wolfgang Denk1636d1c2007-06-22 23:59:00 +0200151#define UIC_MAL_SERR 0x00002000 /* MAL SERR */
Stefan Roesee01bd212007-03-21 13:38:59 +0100152#define UIC_MAL_TXDE 0x00002000 /* MAL TXDE */
153#define UIC_MAL_RXDE 0x00002000 /* MAL RXDE */
154
155#define UIC_MAL_TXEOB 0x00001000 /* MAL TXEOB */
156#define UIC_MAL_TXEOB1 0x00000800 /* MAL TXEOB1 */
157#define UIC_MAL_RXEOB 0x00000400 /* MAL RXEOB */
158#define UIC_NAND 0x00000200 /* NAND Flash controller */
159#define UIC_ADC 0x00000100 /* ADC */
160#define UIC_DAC 0x00000080 /* DAC */
161#define UIC_OPB2PLB 0x00000040 /* OPB to PLB bridge interrupt */
162#define UIC_RESERVED0 0x00000020 /* Reserved */
163#define UIC_EXT0 0x00000010 /* External interrupt 0 */
164#define UIC_EXT1 0x00000008 /* External interrupt 1 */
165#define UIC_EXT2 0x00000004 /* External interrupt 2 */
166#define UIC_EXT3 0x00000002 /* External interrupt 3 */
167#define UIC_EXT4 0x00000001 /* External interrupt 4 */
168
169#else /* !defined(CONFIG_405EZ) */
170
wdenk0442ed82002-11-03 10:24:00 +0000171#define UIC_UART0 0x80000000 /* UART 0 */
172#define UIC_UART1 0x40000000 /* UART 1 */
173#define UIC_IIC 0x20000000 /* IIC */
174#define UIC_EXT_MAST 0x10000000 /* External Master */
175#define UIC_PCI 0x08000000 /* PCI write to command reg */
176#define UIC_DMA0 0x04000000 /* DMA chan. 0 */
177#define UIC_DMA1 0x02000000 /* DMA chan. 1 */
178#define UIC_DMA2 0x01000000 /* DMA chan. 2 */
179#define UIC_DMA3 0x00800000 /* DMA chan. 3 */
180#define UIC_EMAC_WAKE 0x00400000 /* EMAC wake up */
181#define UIC_MAL_SERR 0x00200000 /* MAL SERR */
182#define UIC_MAL_TXEOB 0x00100000 /* MAL TXEOB */
183#define UIC_MAL_RXEOB 0x00080000 /* MAL RXEOB */
184#define UIC_MAL_TXDE 0x00040000 /* MAL TXDE */
185#define UIC_MAL_RXDE 0x00020000 /* MAL RXDE */
wdenkcea655a2004-06-06 23:53:59 +0000186#define UIC_ENET 0x00010000 /* Ethernet0 */
187#define UIC_ENET1 0x00004000 /* Ethernet1 on 405EP */
188#define UIC_ECC_CE 0x00004000 /* ECC Correctable Error on 405GP */
wdenk0442ed82002-11-03 10:24:00 +0000189#define UIC_EXT_PCI_SERR 0x00008000 /* External PCI SERR# */
wdenk0442ed82002-11-03 10:24:00 +0000190#define UIC_PCI_PM 0x00002000 /* PCI Power Management */
191#define UIC_EXT0 0x00000040 /* External interrupt 0 */
192#define UIC_EXT1 0x00000020 /* External interrupt 1 */
193#define UIC_EXT2 0x00000010 /* External interrupt 2 */
194#define UIC_EXT3 0x00000008 /* External interrupt 3 */
195#define UIC_EXT4 0x00000004 /* External interrupt 4 */
196#define UIC_EXT5 0x00000002 /* External interrupt 5 */
197#define UIC_EXT6 0x00000001 /* External interrupt 6 */
Stefan Roesee01bd212007-03-21 13:38:59 +0100198#endif /* defined(CONFIG_405EZ) */
wdenk0442ed82002-11-03 10:24:00 +0000199
200/******************************************************************************
201 * SDRAM Controller
202 ******************************************************************************/
203#define SDRAM_DCR_BASE 0x10
204#define memcfga (SDRAM_DCR_BASE+0x0) /* Memory configuration address reg */
205#define memcfgd (SDRAM_DCR_BASE+0x1) /* Memory configuration data reg */
206 /* values for memcfga register - indirect addressing of these regs */
stroeseb867d702003-05-23 11:18:02 +0000207#ifndef CONFIG_405EP
wdenk0442ed82002-11-03 10:24:00 +0000208 #define mem_besra 0x00 /* bus error syndrome reg a */
209 #define mem_besrsa 0x04 /* bus error syndrome reg set a */
210 #define mem_besrb 0x08 /* bus error syndrome reg b */
211 #define mem_besrsb 0x0c /* bus error syndrome reg set b */
212 #define mem_bear 0x10 /* bus error address reg */
stroeseb867d702003-05-23 11:18:02 +0000213#endif
wdenk0442ed82002-11-03 10:24:00 +0000214 #define mem_mcopt1 0x20 /* memory controller options 1 */
Heiko Schocherca43ba12007-01-11 15:44:44 +0100215 #define mem_status 0x24 /* memory status */
wdenk0442ed82002-11-03 10:24:00 +0000216 #define mem_rtr 0x30 /* refresh timer reg */
217 #define mem_pmit 0x34 /* power management idle timer */
218 #define mem_mb0cf 0x40 /* memory bank 0 configuration */
219 #define mem_mb1cf 0x44 /* memory bank 1 configuration */
stroesee075fbe2003-12-09 14:59:11 +0000220#ifndef CONFIG_405EP
wdenk0442ed82002-11-03 10:24:00 +0000221 #define mem_mb2cf 0x48 /* memory bank 2 configuration */
222 #define mem_mb3cf 0x4c /* memory bank 3 configuration */
stroesee075fbe2003-12-09 14:59:11 +0000223#endif
wdenk0442ed82002-11-03 10:24:00 +0000224 #define mem_sdtr1 0x80 /* timing reg 1 */
stroeseb867d702003-05-23 11:18:02 +0000225#ifndef CONFIG_405EP
wdenk0442ed82002-11-03 10:24:00 +0000226 #define mem_ecccf 0x94 /* ECC configuration */
227 #define mem_eccerr 0x98 /* ECC error status */
stroeseb867d702003-05-23 11:18:02 +0000228#endif
wdenk0442ed82002-11-03 10:24:00 +0000229
stroesee075fbe2003-12-09 14:59:11 +0000230#ifndef CONFIG_405EP
wdenk0442ed82002-11-03 10:24:00 +0000231/******************************************************************************
232 * Decompression Controller
233 ******************************************************************************/
234#define DECOMP_DCR_BASE 0x14
235#define kiar (DECOMP_DCR_BASE+0x0) /* Decompression controller addr reg */
236#define kidr (DECOMP_DCR_BASE+0x1) /* Decompression controller data reg */
237 /* values for kiar register - indirect addressing of these regs */
238 #define kitor0 0x00 /* index table origin register 0 */
239 #define kitor1 0x01 /* index table origin register 1 */
240 #define kitor2 0x02 /* index table origin register 2 */
241 #define kitor3 0x03 /* index table origin register 3 */
242 #define kaddr0 0x04 /* address decode definition regsiter 0 */
243 #define kaddr1 0x05 /* address decode definition regsiter 1 */
244 #define kconf 0x40 /* decompression core config register */
245 #define kid 0x41 /* decompression core ID register */
246 #define kver 0x42 /* decompression core version # reg */
247 #define kpear 0x50 /* bus error addr reg (PLB addr) */
248 #define kbear 0x51 /* bus error addr reg (DCP to EBIU addr)*/
249 #define kesr0 0x52 /* bus error status reg 0 (R/clear) */
250 #define kesr0s 0x53 /* bus error status reg 0 (set) */
251 /* There are 0x400 of the following registers, from krom0 to krom3ff*/
252 /* Only the first one is given here. */
253 #define krom0 0x400 /* SRAM/ROM read/write */
stroesee075fbe2003-12-09 14:59:11 +0000254#endif
wdenk0442ed82002-11-03 10:24:00 +0000255
256/******************************************************************************
257 * Power Management
258 ******************************************************************************/
259#define POWERMAN_DCR_BASE 0xb8
260#define cpmsr (POWERMAN_DCR_BASE+0x0) /* Power management status */
261#define cpmer (POWERMAN_DCR_BASE+0x1) /* Power management enable */
262#define cpmfr (POWERMAN_DCR_BASE+0x2) /* Power management force */
263
264/******************************************************************************
265 * Extrnal Bus Controller
266 ******************************************************************************/
267#define EBC_DCR_BASE 0x12
268#define ebccfga (EBC_DCR_BASE+0x0) /* External bus controller addr reg */
269#define ebccfgd (EBC_DCR_BASE+0x1) /* External bus controller data reg */
270 /* values for ebccfga register - indirect addressing of these regs */
271 #define pb0cr 0x00 /* periph bank 0 config reg */
272 #define pb1cr 0x01 /* periph bank 1 config reg */
273 #define pb2cr 0x02 /* periph bank 2 config reg */
274 #define pb3cr 0x03 /* periph bank 3 config reg */
275 #define pb4cr 0x04 /* periph bank 4 config reg */
stroesee075fbe2003-12-09 14:59:11 +0000276#ifndef CONFIG_405EP
wdenk0442ed82002-11-03 10:24:00 +0000277 #define pb5cr 0x05 /* periph bank 5 config reg */
278 #define pb6cr 0x06 /* periph bank 6 config reg */
279 #define pb7cr 0x07 /* periph bank 7 config reg */
stroesee075fbe2003-12-09 14:59:11 +0000280#endif
wdenk0442ed82002-11-03 10:24:00 +0000281 #define pb0ap 0x10 /* periph bank 0 access parameters */
282 #define pb1ap 0x11 /* periph bank 1 access parameters */
283 #define pb2ap 0x12 /* periph bank 2 access parameters */
284 #define pb3ap 0x13 /* periph bank 3 access parameters */
285 #define pb4ap 0x14 /* periph bank 4 access parameters */
stroesee075fbe2003-12-09 14:59:11 +0000286#ifndef CONFIG_405EP
wdenk0442ed82002-11-03 10:24:00 +0000287 #define pb5ap 0x15 /* periph bank 5 access parameters */
288 #define pb6ap 0x16 /* periph bank 6 access parameters */
289 #define pb7ap 0x17 /* periph bank 7 access parameters */
stroesee075fbe2003-12-09 14:59:11 +0000290#endif
wdenk0442ed82002-11-03 10:24:00 +0000291 #define pbear 0x20 /* periph bus error addr reg */
292 #define pbesr0 0x21 /* periph bus error status reg 0 */
293 #define pbesr1 0x22 /* periph bus error status reg 1 */
294 #define epcr 0x23 /* external periph control reg */
Stefan Roese4745aca2007-02-20 10:57:08 +0100295#define EBC0_CFG 0x23 /* external bus configuration reg */
wdenk0442ed82002-11-03 10:24:00 +0000296
stroeseb867d702003-05-23 11:18:02 +0000297#ifdef CONFIG_405EP
298/******************************************************************************
299 * Control
300 ******************************************************************************/
301#define CNTRL_DCR_BASE 0x0f0
302#define cpc0_pllmr0 (CNTRL_DCR_BASE+0x0) /* PLL mode register 0 */
303#define cpc0_boot (CNTRL_DCR_BASE+0x1) /* Clock status register */
304#define cpc0_epctl (CNTRL_DCR_BASE+0x3) /* EMAC to PHY control register */
305#define cpc0_pllmr1 (CNTRL_DCR_BASE+0x4) /* PLL mode register 1 */
306#define cpc0_ucr (CNTRL_DCR_BASE+0x5) /* UART control register */
307#define cpc0_pci (CNTRL_DCR_BASE+0x9) /* PCI control register */
308
309#define CPC0_PLLMR0 (CNTRL_DCR_BASE+0x0) /* PLL mode 0 register */
310#define CPC0_BOOT (CNTRL_DCR_BASE+0x1) /* Chip Clock Status register */
311#define CPC0_CR1 (CNTRL_DCR_BASE+0x2) /* Chip Control 1 register */
312#define CPC0_EPRCSR (CNTRL_DCR_BASE+0x3) /* EMAC PHY Rcv Clk Src register*/
313#define CPC0_PLLMR1 (CNTRL_DCR_BASE+0x4) /* PLL mode 1 register */
314#define CPC0_UCR (CNTRL_DCR_BASE+0x5) /* UART Control register */
315#define CPC0_SRR (CNTRL_DCR_BASE+0x6) /* Soft Reset register */
316#define CPC0_JTAGID (CNTRL_DCR_BASE+0x7) /* JTAG ID register */
317#define CPC0_SPARE (CNTRL_DCR_BASE+0x8) /* Spare DCR */
318#define CPC0_PCI (CNTRL_DCR_BASE+0x9) /* PCI Control register */
319
320/* Bit definitions */
321#define PLLMR0_CPU_DIV_MASK 0x00300000 /* CPU clock divider */
322#define PLLMR0_CPU_DIV_BYPASS 0x00000000
323#define PLLMR0_CPU_DIV_2 0x00100000
324#define PLLMR0_CPU_DIV_3 0x00200000
325#define PLLMR0_CPU_DIV_4 0x00300000
326
327#define PLLMR0_CPU_TO_PLB_MASK 0x00030000 /* CPU:PLB Frequency Divisor */
328#define PLLMR0_CPU_PLB_DIV_1 0x00000000
329#define PLLMR0_CPU_PLB_DIV_2 0x00010000
330#define PLLMR0_CPU_PLB_DIV_3 0x00020000
331#define PLLMR0_CPU_PLB_DIV_4 0x00030000
332
333#define PLLMR0_OPB_TO_PLB_MASK 0x00003000 /* OPB:PLB Frequency Divisor */
334#define PLLMR0_OPB_PLB_DIV_1 0x00000000
335#define PLLMR0_OPB_PLB_DIV_2 0x00001000
336#define PLLMR0_OPB_PLB_DIV_3 0x00002000
337#define PLLMR0_OPB_PLB_DIV_4 0x00003000
338
339#define PLLMR0_EXB_TO_PLB_MASK 0x00000300 /* External Bus:PLB Divisor */
340#define PLLMR0_EXB_PLB_DIV_2 0x00000000
341#define PLLMR0_EXB_PLB_DIV_3 0x00000100
342#define PLLMR0_EXB_PLB_DIV_4 0x00000200
343#define PLLMR0_EXB_PLB_DIV_5 0x00000300
344
345#define PLLMR0_MAL_TO_PLB_MASK 0x00000030 /* MAL:PLB Divisor */
346#define PLLMR0_MAL_PLB_DIV_1 0x00000000
347#define PLLMR0_MAL_PLB_DIV_2 0x00000010
348#define PLLMR0_MAL_PLB_DIV_3 0x00000020
349#define PLLMR0_MAL_PLB_DIV_4 0x00000030
350
351#define PLLMR0_PCI_TO_PLB_MASK 0x00000003 /* PCI:PLB Frequency Divisor */
352#define PLLMR0_PCI_PLB_DIV_1 0x00000000
353#define PLLMR0_PCI_PLB_DIV_2 0x00000001
354#define PLLMR0_PCI_PLB_DIV_3 0x00000002
355#define PLLMR0_PCI_PLB_DIV_4 0x00000003
356
357#define PLLMR1_SSCS_MASK 0x80000000 /* Select system clock source */
358#define PLLMR1_PLLR_MASK 0x40000000 /* PLL reset */
359#define PLLMR1_FBMUL_MASK 0x00F00000 /* PLL feedback multiplier value */
360#define PLLMR1_FBMUL_DIV_16 0x00000000
361#define PLLMR1_FBMUL_DIV_1 0x00100000
362#define PLLMR1_FBMUL_DIV_2 0x00200000
363#define PLLMR1_FBMUL_DIV_3 0x00300000
364#define PLLMR1_FBMUL_DIV_4 0x00400000
365#define PLLMR1_FBMUL_DIV_5 0x00500000
366#define PLLMR1_FBMUL_DIV_6 0x00600000
367#define PLLMR1_FBMUL_DIV_7 0x00700000
368#define PLLMR1_FBMUL_DIV_8 0x00800000
369#define PLLMR1_FBMUL_DIV_9 0x00900000
370#define PLLMR1_FBMUL_DIV_10 0x00A00000
371#define PLLMR1_FBMUL_DIV_11 0x00B00000
372#define PLLMR1_FBMUL_DIV_12 0x00C00000
373#define PLLMR1_FBMUL_DIV_13 0x00D00000
374#define PLLMR1_FBMUL_DIV_14 0x00E00000
375#define PLLMR1_FBMUL_DIV_15 0x00F00000
376
377#define PLLMR1_FWDVA_MASK 0x00070000 /* PLL forward divider A value */
378#define PLLMR1_FWDVA_DIV_8 0x00000000
379#define PLLMR1_FWDVA_DIV_7 0x00010000
380#define PLLMR1_FWDVA_DIV_6 0x00020000
381#define PLLMR1_FWDVA_DIV_5 0x00030000
382#define PLLMR1_FWDVA_DIV_4 0x00040000
383#define PLLMR1_FWDVA_DIV_3 0x00050000
384#define PLLMR1_FWDVA_DIV_2 0x00060000
385#define PLLMR1_FWDVA_DIV_1 0x00070000
386#define PLLMR1_FWDVB_MASK 0x00007000 /* PLL forward divider B value */
387#define PLLMR1_TUNING_MASK 0x000003FF /* PLL tune bits */
388
389/* Defines for CPC0_EPRCSR register */
390#define CPC0_EPRCSR_E0NFE 0x80000000
391#define CPC0_EPRCSR_E1NFE 0x40000000
392#define CPC0_EPRCSR_E1RPP 0x00000080
393#define CPC0_EPRCSR_E0RPP 0x00000040
394#define CPC0_EPRCSR_E1ERP 0x00000020
395#define CPC0_EPRCSR_E0ERP 0x00000010
396#define CPC0_EPRCSR_E1PCI 0x00000002
397#define CPC0_EPRCSR_E0PCI 0x00000001
398
399/* Defines for CPC0_PCI Register */
400#define CPC0_PCI_SPE 0x00000010 /* PCIINT/WE select */
401#define CPC0_PCI_HOST_CFG_EN 0x00000008 /* PCI host config Enable */
402#define CPC0_PCI_ARBIT_EN 0x00000001 /* PCI Internal Arb Enabled*/
403
404/* Defines for CPC0_BOOR Register */
405#define CPC0_BOOT_SEP 0x00000002 /* serial EEPROM present */
406
407/* Defines for CPC0_PLLMR1 Register fields */
408#define PLL_ACTIVE 0x80000000
409#define CPC0_PLLMR1_SSCS 0x80000000
410#define PLL_RESET 0x40000000
411#define CPC0_PLLMR1_PLLR 0x40000000
412 /* Feedback multiplier */
413#define PLL_FBKDIV 0x00F00000
414#define CPC0_PLLMR1_FBDV 0x00F00000
415#define PLL_FBKDIV_16 0x00000000
416#define PLL_FBKDIV_1 0x00100000
417#define PLL_FBKDIV_2 0x00200000
418#define PLL_FBKDIV_3 0x00300000
419#define PLL_FBKDIV_4 0x00400000
420#define PLL_FBKDIV_5 0x00500000
421#define PLL_FBKDIV_6 0x00600000
422#define PLL_FBKDIV_7 0x00700000
423#define PLL_FBKDIV_8 0x00800000
424#define PLL_FBKDIV_9 0x00900000
425#define PLL_FBKDIV_10 0x00A00000
426#define PLL_FBKDIV_11 0x00B00000
427#define PLL_FBKDIV_12 0x00C00000
428#define PLL_FBKDIV_13 0x00D00000
429#define PLL_FBKDIV_14 0x00E00000
430#define PLL_FBKDIV_15 0x00F00000
431 /* Forward A divisor */
432#define PLL_FWDDIVA 0x00070000
433#define CPC0_PLLMR1_FWDVA 0x00070000
434#define PLL_FWDDIVA_8 0x00000000
435#define PLL_FWDDIVA_7 0x00010000
436#define PLL_FWDDIVA_6 0x00020000
437#define PLL_FWDDIVA_5 0x00030000
438#define PLL_FWDDIVA_4 0x00040000
439#define PLL_FWDDIVA_3 0x00050000
440#define PLL_FWDDIVA_2 0x00060000
441#define PLL_FWDDIVA_1 0x00070000
442 /* Forward B divisor */
443#define PLL_FWDDIVB 0x00007000
444#define CPC0_PLLMR1_FWDVB 0x00007000
445#define PLL_FWDDIVB_8 0x00000000
446#define PLL_FWDDIVB_7 0x00001000
447#define PLL_FWDDIVB_6 0x00002000
448#define PLL_FWDDIVB_5 0x00003000
449#define PLL_FWDDIVB_4 0x00004000
450#define PLL_FWDDIVB_3 0x00005000
451#define PLL_FWDDIVB_2 0x00006000
452#define PLL_FWDDIVB_1 0x00007000
453 /* PLL tune bits */
454#define PLL_TUNE_MASK 0x000003FF
455#define PLL_TUNE_2_M_3 0x00000133 /* 2 <= M <= 3 */
456#define PLL_TUNE_4_M_6 0x00000134 /* 3 < M <= 6 */
457#define PLL_TUNE_7_M_10 0x00000138 /* 6 < M <= 10 */
458#define PLL_TUNE_11_M_14 0x0000013C /* 10 < M <= 14 */
459#define PLL_TUNE_15_M_40 0x0000023E /* 14 < M <= 40 */
460#define PLL_TUNE_VCO_LOW 0x00000000 /* 500MHz <= VCO <= 800MHz */
461#define PLL_TUNE_VCO_HI 0x00000080 /* 800MHz < VCO <= 1000MHz */
462
463/* Defines for CPC0_PLLMR0 Register fields */
464 /* CPU divisor */
465#define PLL_CPUDIV 0x00300000
466#define CPC0_PLLMR0_CCDV 0x00300000
467#define PLL_CPUDIV_1 0x00000000
468#define PLL_CPUDIV_2 0x00100000
469#define PLL_CPUDIV_3 0x00200000
470#define PLL_CPUDIV_4 0x00300000
471 /* PLB divisor */
472#define PLL_PLBDIV 0x00030000
473#define CPC0_PLLMR0_CBDV 0x00030000
474#define PLL_PLBDIV_1 0x00000000
475#define PLL_PLBDIV_2 0x00010000
476#define PLL_PLBDIV_3 0x00020000
477#define PLL_PLBDIV_4 0x00030000
478 /* OPB divisor */
479#define PLL_OPBDIV 0x00003000
480#define CPC0_PLLMR0_OPDV 0x00003000
481#define PLL_OPBDIV_1 0x00000000
482#define PLL_OPBDIV_2 0x00001000
483#define PLL_OPBDIV_3 0x00002000
484#define PLL_OPBDIV_4 0x00003000
485 /* EBC divisor */
486#define PLL_EXTBUSDIV 0x00000300
487#define CPC0_PLLMR0_EPDV 0x00000300
488#define PLL_EXTBUSDIV_2 0x00000000
489#define PLL_EXTBUSDIV_3 0x00000100
490#define PLL_EXTBUSDIV_4 0x00000200
491#define PLL_EXTBUSDIV_5 0x00000300
492 /* MAL divisor */
493#define PLL_MALDIV 0x00000030
494#define CPC0_PLLMR0_MPDV 0x00000030
495#define PLL_MALDIV_1 0x00000000
496#define PLL_MALDIV_2 0x00000010
497#define PLL_MALDIV_3 0x00000020
498#define PLL_MALDIV_4 0x00000030
499 /* PCI divisor */
500#define PLL_PCIDIV 0x00000003
501#define CPC0_PLLMR0_PPFD 0x00000003
502#define PLL_PCIDIV_1 0x00000000
503#define PLL_PCIDIV_2 0x00000001
504#define PLL_PCIDIV_3 0x00000002
505#define PLL_PCIDIV_4 0x00000003
506
507/*
508 *-------------------------------------------------------------------------------
509 * PLL settings for 266MHz CPU, 133MHz PLB/SDRAM, 66MHz EBC, 33MHz PCI,
510 * assuming a 33.3MHz input clock to the 405EP.
511 *-------------------------------------------------------------------------------
512 */
513#define PLLMR0_266_133_66 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
wdenk8bde7f72003-06-27 21:31:46 +0000514 PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
515 PLL_MALDIV_1 | PLL_PCIDIV_4)
stroeseb867d702003-05-23 11:18:02 +0000516#define PLLMR1_266_133_66 (PLL_FBKDIV_8 | \
wdenk8bde7f72003-06-27 21:31:46 +0000517 PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
518 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
stroeseb867d702003-05-23 11:18:02 +0000519
520#define PLLMR0_133_66_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_1 | \
wdenk8bde7f72003-06-27 21:31:46 +0000521 PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
522 PLL_MALDIV_1 | PLL_PCIDIV_4)
stroeseb867d702003-05-23 11:18:02 +0000523#define PLLMR1_133_66_66_33 (PLL_FBKDIV_4 | \
wdenk8bde7f72003-06-27 21:31:46 +0000524 PLL_FWDDIVA_6 | PLL_FWDDIVB_6 | \
525 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
stroeseb867d702003-05-23 11:18:02 +0000526#define PLLMR0_200_100_50_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
wdenk8bde7f72003-06-27 21:31:46 +0000527 PLL_OPBDIV_2 | PLL_EXTBUSDIV_3 | \
528 PLL_MALDIV_1 | PLL_PCIDIV_4)
stroeseb867d702003-05-23 11:18:02 +0000529#define PLLMR1_200_100_50_33 (PLL_FBKDIV_6 | \
wdenk8bde7f72003-06-27 21:31:46 +0000530 PLL_FWDDIVA_4 | PLL_FWDDIVB_4 | \
531 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
stroeseb867d702003-05-23 11:18:02 +0000532#define PLLMR0_266_133_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
wdenk8bde7f72003-06-27 21:31:46 +0000533 PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
534 PLL_MALDIV_1 | PLL_PCIDIV_4)
stroeseb867d702003-05-23 11:18:02 +0000535#define PLLMR1_266_133_66_33 (PLL_FBKDIV_8 | \
wdenk8bde7f72003-06-27 21:31:46 +0000536 PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
537 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
stroese44acc8d2004-12-16 18:03:44 +0000538#define PLLMR0_266_66_33_33 (PLL_CPUDIV_1 | PLL_PLBDIV_4 | \
wdenkefe2a4d2004-12-16 21:44:03 +0000539 PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
540 PLL_MALDIV_1 | PLL_PCIDIV_2)
stroese44acc8d2004-12-16 18:03:44 +0000541#define PLLMR1_266_66_33_33 (PLL_FBKDIV_8 | \
wdenkefe2a4d2004-12-16 21:44:03 +0000542 PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
543 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
Stefan Roese779e9752007-08-14 14:44:41 +0200544#define PLLMR0_333_111_55_37 (PLL_CPUDIV_1 | PLL_PLBDIV_3 | \
545 PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
546 PLL_MALDIV_1 | PLL_PCIDIV_3)
547#define PLLMR1_333_111_55_37 (PLL_FBKDIV_10 | \
548 PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
549 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
550#define PLLMR0_333_111_55_111 (PLL_CPUDIV_1 | PLL_PLBDIV_3 | \
551 PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
552 PLL_MALDIV_1 | PLL_PCIDIV_1)
553#define PLLMR1_333_111_55_111 (PLL_FBKDIV_10 | \
554 PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
555 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_HI)
stroeseb867d702003-05-23 11:18:02 +0000556
557/*
558 * PLL Voltage Controlled Oscillator (VCO) definitions
559 * Maximum and minimum values (in MHz) for correct PLL operation.
560 */
561#define VCO_MIN 500
562#define VCO_MAX 1000
Stefan Roesee01bd212007-03-21 13:38:59 +0100563#elif defined(CONFIG_405EZ)
564/******************************************************************************
565 * SDR Registers
566 ******************************************************************************/
567#define SDR_DCR_BASE 0x0E
568#define sdrcfga (SDR_DCR_BASE+0x0) /* ADDR */
569#define sdrcfgd (SDR_DCR_BASE+0x1) /* Data */
570
Stefan Roese9f0077a2007-05-22 12:48:09 +0200571#define mtsdr(reg, data) do { mtdcr(sdrcfga,reg);mtdcr(sdrcfgd,data); } while (0)
572#define mfsdr(reg, data) do { mtdcr(sdrcfga,reg);data = mfdcr(sdrcfgd); } while (0)
Stefan Roesee01bd212007-03-21 13:38:59 +0100573
574#define sdrnand0 0x4000
575#define sdrultra0 0x4040
576#define sdrultra1 0x4050
577#define sdricintstat 0x4510
578
579#define SDR_NAND0_NDEN 0x80000000
Stefan Roesec440bfe2007-06-06 11:42:13 +0200580#define SDR_NAND0_NDBTEN 0x40000000
581#define SDR_NAND0_NDBADR_MASK 0x30000000
582#define SDR_NAND0_NDBPG_MASK 0x0f000000
583#define SDR_NAND0_NDAREN 0x00800000
584#define SDR_NAND0_NDRBEN 0x00400000
Stefan Roesee01bd212007-03-21 13:38:59 +0100585
586#define SDR_ULTRA0_NDGPIOBP 0x80000000
587#define SDR_ULTRA0_CSN_MASK 0x78000000
588#define SDR_ULTRA0_CSNSEL0 0x40000000
589#define SDR_ULTRA0_CSNSEL1 0x20000000
590#define SDR_ULTRA0_CSNSEL2 0x10000000
591#define SDR_ULTRA0_CSNSEL3 0x08000000
Stefan Roesec440bfe2007-06-06 11:42:13 +0200592#define SDR_ULTRA0_EBCRDYEN 0x04000000
593#define SDR_ULTRA0_SPISSINEN 0x02000000
594#define SDR_ULTRA0_NFSRSTEN 0x01000000
Stefan Roesee01bd212007-03-21 13:38:59 +0100595
596#define SDR_ULTRA1_LEDNENABLE 0x40000000
597
598#define SDR_ICRX_STAT 0x80000000
599#define SDR_ICTX0_STAT 0x40000000
600#define SDR_ICTX1_STAT 0x20000000
601
Stefan Roese90e6f412007-04-18 12:05:59 +0200602#define SDR_PINSTP 0x40
603
Stefan Roesee01bd212007-03-21 13:38:59 +0100604/******************************************************************************
605 * Control
606 ******************************************************************************/
607#define CNTRL_DCR_BASE 0x0C
608#define cprcfga (CNTRL_DCR_BASE+0x0) /* CPR addr reg */
609#define cprcfgd (CNTRL_DCR_BASE+0x1) /* CPR data reg */
610
611/* CPR Registers */
612#define cprclkupd 0x020 /* CPR_CLKUPD */
613#define cprpllc 0x040 /* CPR_PLLC */
614#define cprplld 0x060 /* CPR_PLLD */
615#define cprprimad 0x080 /* CPR_PRIMAD */
616#define cprperd0 0x0e0 /* CPR_PERD0 */
617#define cprperd1 0x0e1 /* CPR_PERD1 */
618#define cprperc0 0x180 /* CPR_PERC0 */
619#define cprmisc0 0x181 /* CPR_MISC0 */
620#define cprmisc1 0x182 /* CPR_MISC1 */
621
622/*
623 * Macro for accessing the indirect CPR register
624 */
Stefan Roese9f0077a2007-05-22 12:48:09 +0200625#define mtcpr(reg, data) do { mtdcr(cprcfga,reg);mtdcr(cprcfgd,data); } while (0)
626#define mfcpr(reg, data) do { mtdcr(cprcfga,reg);data = mfdcr(cprcfgd); } while (0)
Stefan Roesee01bd212007-03-21 13:38:59 +0100627
628#define CPR_CLKUPD_ENPLLCH_EN 0x40000000 /* Enable CPR PLL Changes */
629#define CPR_CLKUPD_ENDVCH_EN 0x20000000 /* Enable CPR Sys. Div. Changes */
630#define CPR_PERD0_SPIDV_MASK 0x000F0000 /* SPI Clock Divider */
631
Stefan Roese273db7e2007-08-13 09:05:33 +0200632#define PLLC_SRC_MASK 0x20000000 /* PLL feedback source */
633
Stefan Roesee01bd212007-03-21 13:38:59 +0100634#define PLLD_FBDV_MASK 0x1F000000 /* PLL feedback divider value */
635#define PLLD_FWDVA_MASK 0x000F0000 /* PLL forward divider A value */
636#define PLLD_FWDVB_MASK 0x00000700 /* PLL forward divider B value */
637
638#define PRIMAD_CPUDV_MASK 0x0F000000 /* CPU Clock Divisor Mask */
639#define PRIMAD_PLBDV_MASK 0x000F0000 /* PLB Clock Divisor Mask */
640#define PRIMAD_OPBDV_MASK 0x00000F00 /* OPB Clock Divisor Mask */
641#define PRIMAD_EBCDV_MASK 0x0000000F /* EBC Clock Divisor Mask */
642
643#define PERD0_PWMDV_MASK 0xFF000000 /* PWM Divider Mask */
644#define PERD0_SPIDV_MASK 0x000F0000 /* SPI Divider Mask */
645#define PERD0_U0DV_MASK 0x0000FF00 /* UART 0 Divider Mask */
646#define PERD0_U1DV_MASK 0x000000FF /* UART 1 Divider Mask */
647
648#if 0 /* Deprecated */
649#define CNTRL_DCR_BASE 0x0f0
650#define cpc0_pllmr0 (CNTRL_DCR_BASE+0x0) /* PLL mode register 0 */
651#define cpc0_boot (CNTRL_DCR_BASE+0x1) /* Clock status register */
652#define cpc0_epctl (CNTRL_DCR_BASE+0x3) /* EMAC to PHY control register */
653#define cpc0_pllmr1 (CNTRL_DCR_BASE+0x4) /* PLL mode register 1 */
654#define cpc0_ucr (CNTRL_DCR_BASE+0x5) /* UART control register */
655#define cpc0_pci (CNTRL_DCR_BASE+0x9) /* PCI control register */
656
657#define CPC0_PLLMR0 (CNTRL_DCR_BASE+0x0) /* PLL mode 0 register */
658#define CPC0_BOOT (CNTRL_DCR_BASE+0x1) /* Chip Clock Status register */
659#define CPC0_CR1 (CNTRL_DCR_BASE+0x2) /* Chip Control 1 register */
660#define CPC0_EPRCSR (CNTRL_DCR_BASE+0x3) /* EMAC PHY Rcv Clk Src register*/
661#define CPC0_PLLMR1 (CNTRL_DCR_BASE+0x4) /* PLL mode 1 register */
662#define CPC0_UCR (CNTRL_DCR_BASE+0x5) /* UART Control register */
663#define CPC0_SRR (CNTRL_DCR_BASE+0x6) /* Soft Reset register */
664#define CPC0_JTAGID (CNTRL_DCR_BASE+0x7) /* JTAG ID register */
665#define CPC0_SPARE (CNTRL_DCR_BASE+0x8) /* Spare DCR */
666#define CPC0_PCI (CNTRL_DCR_BASE+0x9) /* PCI Control register */
667
668/* Bit definitions */
669#define PLLMR0_CPU_DIV_MASK 0x00300000 /* CPU clock divider */
670#define PLLMR0_CPU_DIV_BYPASS 0x00000000
671#define PLLMR0_CPU_DIV_2 0x00100000
672#define PLLMR0_CPU_DIV_3 0x00200000
673#define PLLMR0_CPU_DIV_4 0x00300000
674
675#define PLLMR0_CPU_TO_PLB_MASK 0x00030000 /* CPU:PLB Frequency Divisor */
676#define PLLMR0_CPU_PLB_DIV_1 0x00000000
677#define PLLMR0_CPU_PLB_DIV_2 0x00010000
678#define PLLMR0_CPU_PLB_DIV_3 0x00020000
679#define PLLMR0_CPU_PLB_DIV_4 0x00030000
680
681#define PLLMR0_OPB_TO_PLB_MASK 0x00003000 /* OPB:PLB Frequency Divisor */
682#define PLLMR0_OPB_PLB_DIV_1 0x00000000
683#define PLLMR0_OPB_PLB_DIV_2 0x00001000
684#define PLLMR0_OPB_PLB_DIV_3 0x00002000
685#define PLLMR0_OPB_PLB_DIV_4 0x00003000
686
687#define PLLMR0_EXB_TO_PLB_MASK 0x00000300 /* External Bus:PLB Divisor */
688#define PLLMR0_EXB_PLB_DIV_2 0x00000000
689#define PLLMR0_EXB_PLB_DIV_3 0x00000100
690#define PLLMR0_EXB_PLB_DIV_4 0x00000200
691#define PLLMR0_EXB_PLB_DIV_5 0x00000300
692
693#define PLLMR0_MAL_TO_PLB_MASK 0x00000030 /* MAL:PLB Divisor */
694#define PLLMR0_MAL_PLB_DIV_1 0x00000000
695#define PLLMR0_MAL_PLB_DIV_2 0x00000010
696#define PLLMR0_MAL_PLB_DIV_3 0x00000020
697#define PLLMR0_MAL_PLB_DIV_4 0x00000030
698
699#define PLLMR0_PCI_TO_PLB_MASK 0x00000003 /* PCI:PLB Frequency Divisor */
700#define PLLMR0_PCI_PLB_DIV_1 0x00000000
701#define PLLMR0_PCI_PLB_DIV_2 0x00000001
702#define PLLMR0_PCI_PLB_DIV_3 0x00000002
703#define PLLMR0_PCI_PLB_DIV_4 0x00000003
704
705#define PLLMR1_SSCS_MASK 0x80000000 /* Select system clock source */
706#define PLLMR1_PLLR_MASK 0x40000000 /* PLL reset */
707#define PLLMR1_FBMUL_MASK 0x00F00000 /* PLL feedback multiplier value */
708#define PLLMR1_FBMUL_DIV_16 0x00000000
709#define PLLMR1_FBMUL_DIV_1 0x00100000
710#define PLLMR1_FBMUL_DIV_2 0x00200000
711#define PLLMR1_FBMUL_DIV_3 0x00300000
712#define PLLMR1_FBMUL_DIV_4 0x00400000
713#define PLLMR1_FBMUL_DIV_5 0x00500000
714#define PLLMR1_FBMUL_DIV_6 0x00600000
715#define PLLMR1_FBMUL_DIV_7 0x00700000
716#define PLLMR1_FBMUL_DIV_8 0x00800000
717#define PLLMR1_FBMUL_DIV_9 0x00900000
718#define PLLMR1_FBMUL_DIV_10 0x00A00000
719#define PLLMR1_FBMUL_DIV_11 0x00B00000
720#define PLLMR1_FBMUL_DIV_12 0x00C00000
721#define PLLMR1_FBMUL_DIV_13 0x00D00000
722#define PLLMR1_FBMUL_DIV_14 0x00E00000
723#define PLLMR1_FBMUL_DIV_15 0x00F00000
724
725#define PLLMR1_FWDVA_MASK 0x00070000 /* PLL forward divider A value */
726#define PLLMR1_FWDVA_DIV_8 0x00000000
727#define PLLMR1_FWDVA_DIV_7 0x00010000
728#define PLLMR1_FWDVA_DIV_6 0x00020000
729#define PLLMR1_FWDVA_DIV_5 0x00030000
730#define PLLMR1_FWDVA_DIV_4 0x00040000
731#define PLLMR1_FWDVA_DIV_3 0x00050000
732#define PLLMR1_FWDVA_DIV_2 0x00060000
733#define PLLMR1_FWDVA_DIV_1 0x00070000
734#define PLLMR1_FWDVB_MASK 0x00007000 /* PLL forward divider B value */
735#define PLLMR1_TUNING_MASK 0x000003FF /* PLL tune bits */
736
737/* Defines for CPC0_EPRCSR register */
738#define CPC0_EPRCSR_E0NFE 0x80000000
739#define CPC0_EPRCSR_E1NFE 0x40000000
740#define CPC0_EPRCSR_E1RPP 0x00000080
741#define CPC0_EPRCSR_E0RPP 0x00000040
742#define CPC0_EPRCSR_E1ERP 0x00000020
743#define CPC0_EPRCSR_E0ERP 0x00000010
744#define CPC0_EPRCSR_E1PCI 0x00000002
745#define CPC0_EPRCSR_E0PCI 0x00000001
746
747/* Defines for CPC0_BOOR Register */
748#define CPC0_BOOT_SEP 0x00000002 /* serial EEPROM present */
749
750/* Defines for CPC0_PLLMR1 Register fields */
751#define PLL_ACTIVE 0x80000000
752#define CPC0_PLLMR1_SSCS 0x80000000
753#define PLL_RESET 0x40000000
754#define CPC0_PLLMR1_PLLR 0x40000000
755 /* Feedback multiplier */
756#define PLL_FBKDIV 0x00F00000
757#define CPC0_PLLMR1_FBDV 0x00F00000
758#define PLL_FBKDIV_16 0x00000000
759#define PLL_FBKDIV_1 0x00100000
760#define PLL_FBKDIV_2 0x00200000
761#define PLL_FBKDIV_3 0x00300000
762#define PLL_FBKDIV_4 0x00400000
763#define PLL_FBKDIV_5 0x00500000
764#define PLL_FBKDIV_6 0x00600000
765#define PLL_FBKDIV_7 0x00700000
766#define PLL_FBKDIV_8 0x00800000
767#define PLL_FBKDIV_9 0x00900000
768#define PLL_FBKDIV_10 0x00A00000
769#define PLL_FBKDIV_11 0x00B00000
770#define PLL_FBKDIV_12 0x00C00000
771#define PLL_FBKDIV_13 0x00D00000
772#define PLL_FBKDIV_14 0x00E00000
773#define PLL_FBKDIV_15 0x00F00000
774 /* Forward A divisor */
775#define PLL_FWDDIVA 0x00070000
776#define CPC0_PLLMR1_FWDVA 0x00070000
777#define PLL_FWDDIVA_8 0x00000000
778#define PLL_FWDDIVA_7 0x00010000
779#define PLL_FWDDIVA_6 0x00020000
780#define PLL_FWDDIVA_5 0x00030000
781#define PLL_FWDDIVA_4 0x00040000
782#define PLL_FWDDIVA_3 0x00050000
783#define PLL_FWDDIVA_2 0x00060000
784#define PLL_FWDDIVA_1 0x00070000
785 /* Forward B divisor */
786#define PLL_FWDDIVB 0x00007000
787#define CPC0_PLLMR1_FWDVB 0x00007000
788#define PLL_FWDDIVB_8 0x00000000
789#define PLL_FWDDIVB_7 0x00001000
790#define PLL_FWDDIVB_6 0x00002000
791#define PLL_FWDDIVB_5 0x00003000
792#define PLL_FWDDIVB_4 0x00004000
793#define PLL_FWDDIVB_3 0x00005000
794#define PLL_FWDDIVB_2 0x00006000
795#define PLL_FWDDIVB_1 0x00007000
796 /* PLL tune bits */
797#define PLL_TUNE_MASK 0x000003FF
798#define PLL_TUNE_2_M_3 0x00000133 /* 2 <= M <= 3 */
799#define PLL_TUNE_4_M_6 0x00000134 /* 3 < M <= 6 */
800#define PLL_TUNE_7_M_10 0x00000138 /* 6 < M <= 10 */
801#define PLL_TUNE_11_M_14 0x0000013C /* 10 < M <= 14 */
802#define PLL_TUNE_15_M_40 0x0000023E /* 14 < M <= 40 */
803#define PLL_TUNE_VCO_LOW 0x00000000 /* 500MHz <= VCO <= 800MHz */
804#define PLL_TUNE_VCO_HI 0x00000080 /* 800MHz < VCO <= 1000MHz */
805
806/* Defines for CPC0_PLLMR0 Register fields */
807 /* CPU divisor */
808#define PLL_CPUDIV 0x00300000
809#define CPC0_PLLMR0_CCDV 0x00300000
810#define PLL_CPUDIV_1 0x00000000
811#define PLL_CPUDIV_2 0x00100000
812#define PLL_CPUDIV_3 0x00200000
813#define PLL_CPUDIV_4 0x00300000
814 /* PLB divisor */
815#define PLL_PLBDIV 0x00030000
816#define CPC0_PLLMR0_CBDV 0x00030000
817#define PLL_PLBDIV_1 0x00000000
818#define PLL_PLBDIV_2 0x00010000
819#define PLL_PLBDIV_3 0x00020000
820#define PLL_PLBDIV_4 0x00030000
821 /* OPB divisor */
822#define PLL_OPBDIV 0x00003000
823#define CPC0_PLLMR0_OPDV 0x00003000
824#define PLL_OPBDIV_1 0x00000000
825#define PLL_OPBDIV_2 0x00001000
826#define PLL_OPBDIV_3 0x00002000
827#define PLL_OPBDIV_4 0x00003000
828 /* EBC divisor */
829#define PLL_EXTBUSDIV 0x00000300
830#define CPC0_PLLMR0_EPDV 0x00000300
831#define PLL_EXTBUSDIV_2 0x00000000
832#define PLL_EXTBUSDIV_3 0x00000100
833#define PLL_EXTBUSDIV_4 0x00000200
834#define PLL_EXTBUSDIV_5 0x00000300
835 /* MAL divisor */
836#define PLL_MALDIV 0x00000030
837#define CPC0_PLLMR0_MPDV 0x00000030
838#define PLL_MALDIV_1 0x00000000
839#define PLL_MALDIV_2 0x00000010
840#define PLL_MALDIV_3 0x00000020
841#define PLL_MALDIV_4 0x00000030
842 /* PCI divisor */
843#define PLL_PCIDIV 0x00000003
844#define CPC0_PLLMR0_PPFD 0x00000003
845#define PLL_PCIDIV_1 0x00000000
846#define PLL_PCIDIV_2 0x00000001
847#define PLL_PCIDIV_3 0x00000002
848#define PLL_PCIDIV_4 0x00000003
849
850/*
851 *-------------------------------------------------------------------------------
852 * PLL settings for 266MHz CPU, 133MHz PLB/SDRAM, 66MHz EBC, 33MHz PCI,
853 * assuming a 33.3MHz input clock to the 405EP.
854 *-------------------------------------------------------------------------------
855 */
856#define PLLMR0_266_133_66 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
857 PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
858 PLL_MALDIV_1 | PLL_PCIDIV_4)
859#define PLLMR1_266_133_66 (PLL_FBKDIV_8 | \
860 PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
861 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
862#define PLLMR0_133_66_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_1 | \
863 PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
864 PLL_MALDIV_1 | PLL_PCIDIV_4)
865#define PLLMR1_133_66_66_33 (PLL_FBKDIV_4 | \
866 PLL_FWDDIVA_6 | PLL_FWDDIVB_6 | \
867 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
868#define PLLMR0_200_100_50_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
869 PLL_OPBDIV_2 | PLL_EXTBUSDIV_3 | \
870 PLL_MALDIV_1 | PLL_PCIDIV_4)
871#define PLLMR1_200_100_50_33 (PLL_FBKDIV_6 | \
872 PLL_FWDDIVA_4 | PLL_FWDDIVB_4 | \
873 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
874#define PLLMR0_266_133_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
875 PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
876 PLL_MALDIV_1 | PLL_PCIDIV_4)
877#define PLLMR1_266_133_66_33 (PLL_FBKDIV_8 | \
878 PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
879 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
880#define PLLMR0_266_66_33_33 (PLL_CPUDIV_1 | PLL_PLBDIV_4 | \
881 PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
882 PLL_MALDIV_1 | PLL_PCIDIV_2)
883#define PLLMR1_266_66_33_33 (PLL_FBKDIV_8 | \
884 PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
885 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
886
887/*
888 * PLL Voltage Controlled Oscillator (VCO) definitions
889 * Maximum and minimum values (in MHz) for correct PLL operation.
890 */
891#define VCO_MIN 500
892#define VCO_MAX 1000
893#endif /* #if 0 */
stroeseb867d702003-05-23 11:18:02 +0000894#else /* #ifdef CONFIG_405EP */
wdenk0442ed82002-11-03 10:24:00 +0000895/******************************************************************************
896 * Control
897 ******************************************************************************/
898#define CNTRL_DCR_BASE 0x0b0
899#define pllmd (CNTRL_DCR_BASE+0x0) /* PLL mode register */
900#define cntrl0 (CNTRL_DCR_BASE+0x1) /* Control 0 register */
901#define cntrl1 (CNTRL_DCR_BASE+0x2) /* Control 1 register */
902#define reset (CNTRL_DCR_BASE+0x3) /* reset register */
Wolfgang Denk1636d1c2007-06-22 23:59:00 +0200903#define strap (CNTRL_DCR_BASE+0x4) /* strap register */
stroeseb867d702003-05-23 11:18:02 +0000904
905#define ecr (0xaa) /* edge conditioner register (405gpr) */
wdenk0442ed82002-11-03 10:24:00 +0000906
907/* Bit definitions */
908#define PLLMR_FWD_DIV_MASK 0xE0000000 /* Forward Divisor */
909#define PLLMR_FWD_DIV_BYPASS 0xE0000000
910#define PLLMR_FWD_DIV_3 0xA0000000
911#define PLLMR_FWD_DIV_4 0x80000000
912#define PLLMR_FWD_DIV_6 0x40000000
913
914#define PLLMR_FB_DIV_MASK 0x1E000000 /* Feedback Divisor */
915#define PLLMR_FB_DIV_1 0x02000000
916#define PLLMR_FB_DIV_2 0x04000000
917#define PLLMR_FB_DIV_3 0x06000000
918#define PLLMR_FB_DIV_4 0x08000000
919
920#define PLLMR_TUNING_MASK 0x01F80000
921
922#define PLLMR_CPU_TO_PLB_MASK 0x00060000 /* CPU:PLB Frequency Divisor */
923#define PLLMR_CPU_PLB_DIV_1 0x00000000
924#define PLLMR_CPU_PLB_DIV_2 0x00020000
925#define PLLMR_CPU_PLB_DIV_3 0x00040000
926#define PLLMR_CPU_PLB_DIV_4 0x00060000
927
928#define PLLMR_OPB_TO_PLB_MASK 0x00018000 /* OPB:PLB Frequency Divisor */
929#define PLLMR_OPB_PLB_DIV_1 0x00000000
930#define PLLMR_OPB_PLB_DIV_2 0x00008000
931#define PLLMR_OPB_PLB_DIV_3 0x00010000
932#define PLLMR_OPB_PLB_DIV_4 0x00018000
933
934#define PLLMR_PCI_TO_PLB_MASK 0x00006000 /* PCI:PLB Frequency Divisor */
935#define PLLMR_PCI_PLB_DIV_1 0x00000000
936#define PLLMR_PCI_PLB_DIV_2 0x00002000
937#define PLLMR_PCI_PLB_DIV_3 0x00004000
938#define PLLMR_PCI_PLB_DIV_4 0x00006000
939
940#define PLLMR_EXB_TO_PLB_MASK 0x00001800 /* External Bus:PLB Divisor */
941#define PLLMR_EXB_PLB_DIV_2 0x00000000
942#define PLLMR_EXB_PLB_DIV_3 0x00000800
943#define PLLMR_EXB_PLB_DIV_4 0x00001000
944#define PLLMR_EXB_PLB_DIV_5 0x00001800
945
946/* definitions for PPC405GPr (new mode strapping) */
947#define PLLMR_FWDB_DIV_MASK 0x00000007 /* Forward Divisor B */
948
949#define PSR_PLL_FWD_MASK 0xC0000000
950#define PSR_PLL_FDBACK_MASK 0x30000000
951#define PSR_PLL_TUNING_MASK 0x0E000000
952#define PSR_PLB_CPU_MASK 0x01800000
953#define PSR_OPB_PLB_MASK 0x00600000
954#define PSR_PCI_PLB_MASK 0x00180000
955#define PSR_EB_PLB_MASK 0x00060000
956#define PSR_ROM_WIDTH_MASK 0x00018000
957#define PSR_ROM_LOC 0x00004000
958#define PSR_PCI_ASYNC_EN 0x00001000
959#define PSR_PERCLK_SYNC_MODE_EN 0x00000800 /* PPC405GPr only */
960#define PSR_PCI_ARBIT_EN 0x00000400
961#define PSR_NEW_MODE_EN 0x00000020 /* PPC405GPr only */
962
stroese44acc8d2004-12-16 18:03:44 +0000963#ifndef CONFIG_IOP480
wdenk0442ed82002-11-03 10:24:00 +0000964/*
965 * PLL Voltage Controlled Oscillator (VCO) definitions
966 * Maximum and minimum values (in MHz) for correct PLL operation.
967 */
968#define VCO_MIN 400
969#define VCO_MAX 800
stroese44acc8d2004-12-16 18:03:44 +0000970#endif /* #ifndef CONFIG_IOP480 */
stroeseb867d702003-05-23 11:18:02 +0000971#endif /* #ifdef CONFIG_405EP */
wdenk0442ed82002-11-03 10:24:00 +0000972
973/******************************************************************************
974 * Memory Access Layer
975 ******************************************************************************/
Stefan Roesee01bd212007-03-21 13:38:59 +0100976#if defined(CONFIG_405EZ)
977#define MAL_DCR_BASE 0x380
978#define malmcr (MAL_DCR_BASE+0x00) /* MAL Config reg */
979#define malesr (MAL_DCR_BASE+0x01) /* Err Status reg (Read/Clear)*/
980#define malier (MAL_DCR_BASE+0x02) /* Interrupt enable reg */
981#define maldbr (MAL_DCR_BASE+0x03) /* Mal Debug reg (Read only) */
982#define maltxcasr (MAL_DCR_BASE+0x04) /* TX Channel active reg (set)*/
983#define maltxcarr (MAL_DCR_BASE+0x05) /* TX Channel active reg (Reset) */
984#define maltxeobisr (MAL_DCR_BASE+0x06) /* TX End of buffer int status reg */
985#define maltxdeir (MAL_DCR_BASE+0x07) /* TX Descr. Error Int reg */
986/* 0x08-0x0F Reserved */
987#define malrxcasr (MAL_DCR_BASE+0x10) /* RX Channel active reg (set)*/
988#define malrxcarr (MAL_DCR_BASE+0x11) /* RX Channel active reg (Reset) */
989#define malrxeobisr (MAL_DCR_BASE+0x12) /* RX End of buffer int status reg */
990#define malrxdeir (MAL_DCR_BASE+0x13) /* RX Descr. Error Int reg */
991/* 0x14-0x1F Reserved */
992#define maltxctp0r (MAL_DCR_BASE+0x20) /* TX 0 Channel table ptr reg */
993#define maltxctp1r (MAL_DCR_BASE+0x21) /* TX 1 Channel table ptr reg */
994#define maltxctp2r (MAL_DCR_BASE+0x22) /* TX 2 Channel table ptr reg */
995#define maltxctp3r (MAL_DCR_BASE+0x23) /* TX 3 Channel table ptr reg */
996#define maltxctp4r (MAL_DCR_BASE+0x24) /* TX 4 Channel table ptr reg */
997#define maltxctp5r (MAL_DCR_BASE+0x25) /* TX 5 Channel table ptr reg */
998#define maltxctp6r (MAL_DCR_BASE+0x26) /* TX 6 Channel table ptr reg */
999#define maltxctp7r (MAL_DCR_BASE+0x27) /* TX 7 Channel table ptr reg */
1000#define maltxctp8r (MAL_DCR_BASE+0x28) /* TX 8 Channel table ptr reg */
1001#define maltxctp9r (MAL_DCR_BASE+0x29) /* TX 9 Channel table ptr reg */
1002#define maltxctp10r (MAL_DCR_BASE+0x2A) /* TX 10 Channel table ptr reg */
1003#define maltxctp11r (MAL_DCR_BASE+0x2B) /* TX 11 Channel table ptr reg */
1004#define maltxctp12r (MAL_DCR_BASE+0x2C) /* TX 12 Channel table ptr reg */
1005#define maltxctp13r (MAL_DCR_BASE+0x2D) /* TX 13 Channel table ptr reg */
1006#define maltxctp14r (MAL_DCR_BASE+0x2E) /* TX 14 Channel table ptr reg */
1007#define maltxctp15r (MAL_DCR_BASE+0x2F) /* TX 15 Channel table ptr reg */
1008#define maltxctp16r (MAL_DCR_BASE+0x30) /* TX 16 Channel table ptr reg */
1009#define maltxctp17r (MAL_DCR_BASE+0x31) /* TX 17 Channel table ptr reg */
1010#define maltxctp18r (MAL_DCR_BASE+0x32) /* TX 18 Channel table ptr reg */
1011#define maltxctp19r (MAL_DCR_BASE+0x33) /* TX 19 Channel table ptr reg */
1012#define maltxctp20r (MAL_DCR_BASE+0x34) /* TX 20 Channel table ptr reg */
1013#define maltxctp21r (MAL_DCR_BASE+0x35) /* TX 21 Channel table ptr reg */
1014#define maltxctp22r (MAL_DCR_BASE+0x36) /* TX 22 Channel table ptr reg */
1015#define maltxctp23r (MAL_DCR_BASE+0x37) /* TX 23 Channel table ptr reg */
1016#define maltxctp24r (MAL_DCR_BASE+0x38) /* TX 24 Channel table ptr reg */
1017#define maltxctp25r (MAL_DCR_BASE+0x39) /* TX 25 Channel table ptr reg */
1018#define maltxctp26r (MAL_DCR_BASE+0x3A) /* TX 26 Channel table ptr reg */
1019#define maltxctp27r (MAL_DCR_BASE+0x3B) /* TX 27 Channel table ptr reg */
1020#define maltxctp28r (MAL_DCR_BASE+0x3C) /* TX 28 Channel table ptr reg */
1021#define maltxctp29r (MAL_DCR_BASE+0x3D) /* TX 29 Channel table ptr reg */
1022#define maltxctp30r (MAL_DCR_BASE+0x3E) /* TX 30 Channel table ptr reg */
1023#define maltxctp31r (MAL_DCR_BASE+0x3F) /* TX 31 Channel table ptr reg */
1024#define malrxctp0r (MAL_DCR_BASE+0x40) /* RX 0 Channel table ptr reg */
1025#define malrxctp1r (MAL_DCR_BASE+0x41) /* RX 1 Channel table ptr reg */
1026#define malrxctp2r (MAL_DCR_BASE+0x42) /* RX 2 Channel table ptr reg */
1027#define malrxctp3r (MAL_DCR_BASE+0x43) /* RX 3 Channel table ptr reg */
1028#define malrxctp4r (MAL_DCR_BASE+0x44) /* RX 4 Channel table ptr reg */
1029#define malrxctp5r (MAL_DCR_BASE+0x45) /* RX 5 Channel table ptr reg */
1030#define malrxctp6r (MAL_DCR_BASE+0x46) /* RX 6 Channel table ptr reg */
1031#define malrxctp7r (MAL_DCR_BASE+0x47) /* RX 7 Channel table ptr reg */
1032#define malrxctp8r (MAL_DCR_BASE+0x48) /* RX 8 Channel table ptr reg */
1033#define malrxctp9r (MAL_DCR_BASE+0x49) /* RX 9 Channel table ptr reg */
1034#define malrxctp10r (MAL_DCR_BASE+0x4A) /* RX 10 Channel table ptr reg */
1035#define malrxctp11r (MAL_DCR_BASE+0x4B) /* RX 11 Channel table ptr reg */
1036#define malrxctp12r (MAL_DCR_BASE+0x4C) /* RX 12 Channel table ptr reg */
1037#define malrxctp13r (MAL_DCR_BASE+0x4D) /* RX 13 Channel table ptr reg */
1038#define malrxctp14r (MAL_DCR_BASE+0x4E) /* RX 14 Channel table ptr reg */
1039#define malrxctp15r (MAL_DCR_BASE+0x4F) /* RX 15 Channel table ptr reg */
1040#define malrxctp16r (MAL_DCR_BASE+0x50) /* RX 16 Channel table ptr reg */
1041#define malrxctp17r (MAL_DCR_BASE+0x51) /* RX 17 Channel table ptr reg */
1042#define malrxctp18r (MAL_DCR_BASE+0x52) /* RX 18 Channel table ptr reg */
1043#define malrxctp19r (MAL_DCR_BASE+0x53) /* RX 19 Channel table ptr reg */
1044#define malrxctp20r (MAL_DCR_BASE+0x54) /* RX 20 Channel table ptr reg */
1045#define malrxctp21r (MAL_DCR_BASE+0x55) /* RX 21 Channel table ptr reg */
1046#define malrxctp22r (MAL_DCR_BASE+0x56) /* RX 22 Channel table ptr reg */
1047#define malrxctp23r (MAL_DCR_BASE+0x57) /* RX 23 Channel table ptr reg */
1048#define malrxctp24r (MAL_DCR_BASE+0x58) /* RX 24 Channel table ptr reg */
1049#define malrxctp25r (MAL_DCR_BASE+0x59) /* RX 25 Channel table ptr reg */
1050#define malrxctp26r (MAL_DCR_BASE+0x5A) /* RX 26 Channel table ptr reg */
1051#define malrxctp27r (MAL_DCR_BASE+0x5B) /* RX 27 Channel table ptr reg */
1052#define malrxctp28r (MAL_DCR_BASE+0x5C) /* RX 28 Channel table ptr reg */
1053#define malrxctp29r (MAL_DCR_BASE+0x5D) /* RX 29 Channel table ptr reg */
1054#define malrxctp30r (MAL_DCR_BASE+0x5E) /* RX 30 Channel table ptr reg */
1055#define malrxctp31r (MAL_DCR_BASE+0x5F) /* RX 31 Channel table ptr reg */
1056#define malrcbs0 (MAL_DCR_BASE+0x60) /* RX 0 Channel buffer size reg */
1057#define malrcbs1 (MAL_DCR_BASE+0x61) /* RX 1 Channel buffer size reg */
1058#define malrcbs2 (MAL_DCR_BASE+0x62) /* RX 2 Channel buffer size reg */
1059#define malrcbs3 (MAL_DCR_BASE+0x63) /* RX 3 Channel buffer size reg */
1060#define malrcbs4 (MAL_DCR_BASE+0x64) /* RX 4 Channel buffer size reg */
1061#define malrcbs5 (MAL_DCR_BASE+0x65) /* RX 5 Channel buffer size reg */
1062#define malrcbs6 (MAL_DCR_BASE+0x66) /* RX 6 Channel buffer size reg */
1063#define malrcbs7 (MAL_DCR_BASE+0x67) /* RX 7 Channel buffer size reg */
1064#define malrcbs8 (MAL_DCR_BASE+0x68) /* RX 8 Channel buffer size reg */
1065#define malrcbs9 (MAL_DCR_BASE+0x69) /* RX 9 Channel buffer size reg */
1066#define malrcbs10 (MAL_DCR_BASE+0x6A) /* RX 10 Channel buffer size reg */
1067#define malrcbs11 (MAL_DCR_BASE+0x6B) /* RX 11 Channel buffer size reg */
1068#define malrcbs12 (MAL_DCR_BASE+0x6C) /* RX 12 Channel buffer size reg */
1069#define malrcbs13 (MAL_DCR_BASE+0x6D) /* RX 13 Channel buffer size reg */
1070#define malrcbs14 (MAL_DCR_BASE+0x6E) /* RX 14 Channel buffer size reg */
1071#define malrcbs15 (MAL_DCR_BASE+0x6F) /* RX 15 Channel buffer size reg */
1072#define malrcbs16 (MAL_DCR_BASE+0x70) /* RX 16 Channel buffer size reg */
1073#define malrcbs17 (MAL_DCR_BASE+0x71) /* RX 17 Channel buffer size reg */
1074#define malrcbs18 (MAL_DCR_BASE+0x72) /* RX 18 Channel buffer size reg */
1075#define malrcbs19 (MAL_DCR_BASE+0x73) /* RX 19 Channel buffer size reg */
1076#define malrcbs20 (MAL_DCR_BASE+0x74) /* RX 20 Channel buffer size reg */
1077#define malrcbs21 (MAL_DCR_BASE+0x75) /* RX 21 Channel buffer size reg */
1078#define malrcbs22 (MAL_DCR_BASE+0x76) /* RX 22 Channel buffer size reg */
1079#define malrcbs23 (MAL_DCR_BASE+0x77) /* RX 23 Channel buffer size reg */
1080#define malrcbs24 (MAL_DCR_BASE+0x78) /* RX 24 Channel buffer size reg */
1081#define malrcbs25 (MAL_DCR_BASE+0x79) /* RX 25 Channel buffer size reg */
1082#define malrcbs26 (MAL_DCR_BASE+0x7A) /* RX 26 Channel buffer size reg */
1083#define malrcbs27 (MAL_DCR_BASE+0x7B) /* RX 27 Channel buffer size reg */
1084#define malrcbs28 (MAL_DCR_BASE+0x7C) /* RX 28 Channel buffer size reg */
1085#define malrcbs29 (MAL_DCR_BASE+0x7D) /* RX 29 Channel buffer size reg */
1086#define malrcbs30 (MAL_DCR_BASE+0x7E) /* RX 30 Channel buffer size reg */
1087#define malrcbs31 (MAL_DCR_BASE+0x7F) /* RX 31 Channel buffer size reg */
1088
1089#else /* !defined(CONFIG_405EZ) */
1090
wdenk0442ed82002-11-03 10:24:00 +00001091#define MAL_DCR_BASE 0x180
1092#define malmcr (MAL_DCR_BASE+0x00) /* MAL Config reg */
1093#define malesr (MAL_DCR_BASE+0x01) /* Error Status reg (Read/Clear) */
1094#define malier (MAL_DCR_BASE+0x02) /* Interrupt enable reg */
1095#define maldbr (MAL_DCR_BASE+0x03) /* Mal Debug reg (Read only) */
1096#define maltxcasr (MAL_DCR_BASE+0x04) /* TX Channel active reg (set) */
1097#define maltxcarr (MAL_DCR_BASE+0x05) /* TX Channel active reg (Reset) */
1098#define maltxeobisr (MAL_DCR_BASE+0x06) /* TX End of buffer int status reg */
1099#define maltxdeir (MAL_DCR_BASE+0x07) /* TX Descr. Error Int reg */
1100#define malrxcasr (MAL_DCR_BASE+0x10) /* RX Channel active reg (set) */
1101#define malrxcarr (MAL_DCR_BASE+0x11) /* RX Channel active reg (Reset) */
1102#define malrxeobisr (MAL_DCR_BASE+0x12) /* RX End of buffer int status reg */
1103#define malrxdeir (MAL_DCR_BASE+0x13) /* RX Descr. Error Int reg */
1104#define maltxctp0r (MAL_DCR_BASE+0x20) /* TX 0 Channel table pointer reg */
1105#define maltxctp1r (MAL_DCR_BASE+0x21) /* TX 1 Channel table pointer reg */
wdenkcea655a2004-06-06 23:53:59 +00001106#define maltxctp2r (MAL_DCR_BASE+0x22) /* TX 2 Channel table pointer reg */
wdenk0442ed82002-11-03 10:24:00 +00001107#define malrxctp0r (MAL_DCR_BASE+0x40) /* RX 0 Channel table pointer reg */
wdenkcea655a2004-06-06 23:53:59 +00001108#define malrxctp1r (MAL_DCR_BASE+0x41) /* RX 1 Channel table pointer reg */
wdenk0442ed82002-11-03 10:24:00 +00001109#define malrcbs0 (MAL_DCR_BASE+0x60) /* RX 0 Channel buffer size reg */
wdenkcea655a2004-06-06 23:53:59 +00001110#define malrcbs1 (MAL_DCR_BASE+0x61) /* RX 1 Channel buffer size reg */
Stefan Roesee01bd212007-03-21 13:38:59 +01001111#endif /* defined(CONFIG_405EZ) */
wdenk0442ed82002-11-03 10:24:00 +00001112
1113/*-----------------------------------------------------------------------------
1114| IIC Register Offsets
1115'----------------------------------------------------------------------------*/
1116#define IICMDBUF 0x00
1117#define IICSDBUF 0x02
1118#define IICLMADR 0x04
1119#define IICHMADR 0x05
1120#define IICCNTL 0x06
1121#define IICMDCNTL 0x07
1122#define IICSTS 0x08
1123#define IICEXTSTS 0x09
1124#define IICLSADR 0x0A
1125#define IICHSADR 0x0B
1126#define IICCLKDIV 0x0C
1127#define IICINTRMSK 0x0D
1128#define IICXFRCNT 0x0E
1129#define IICXTCNTLSS 0x0F
1130#define IICDIRECTCNTL 0x10
1131
1132/*-----------------------------------------------------------------------------
1133| UART Register Offsets
1134'----------------------------------------------------------------------------*/
1135#define DATA_REG 0x00
Wolfgang Denk1636d1c2007-06-22 23:59:00 +02001136#define DL_LSB 0x00
1137#define DL_MSB 0x01
wdenk0442ed82002-11-03 10:24:00 +00001138#define INT_ENABLE 0x01
1139#define FIFO_CONTROL 0x02
1140#define LINE_CONTROL 0x03
1141#define MODEM_CONTROL 0x04
Wolfgang Denk1636d1c2007-06-22 23:59:00 +02001142#define LINE_STATUS 0x05
wdenk0442ed82002-11-03 10:24:00 +00001143#define MODEM_STATUS 0x06
1144#define SCRATCH 0x07
1145
1146/******************************************************************************
1147 * On Chip Memory
1148 ******************************************************************************/
Stefan Roesee01bd212007-03-21 13:38:59 +01001149#if defined(CONFIG_405EZ)
1150#define OCM_DCR_BASE 0x020
1151#define ocmplb3cr1 (OCM_DCR_BASE+0x00) /* OCM PLB3 Bank 1 Config Reg */
1152#define ocmplb3cr2 (OCM_DCR_BASE+0x01) /* OCM PLB3 Bank 2 Config Reg */
1153#define ocmplb3bear (OCM_DCR_BASE+0x02) /* OCM PLB3 Bus Error Add Reg */
1154#define ocmplb3besr0 (OCM_DCR_BASE+0x03) /* OCM PLB3 Bus Error Stat Reg 0 */
1155#define ocmplb3besr1 (OCM_DCR_BASE+0x04) /* OCM PLB3 Bus Error Stat Reg 1 */
1156#define ocmcid (OCM_DCR_BASE+0x05) /* OCM Core ID */
1157#define ocmrevid (OCM_DCR_BASE+0x06) /* OCM Revision ID */
1158#define ocmplb3dpc (OCM_DCR_BASE+0x07) /* OCM PLB3 Data Parity Check */
1159#define ocmdscr1 (OCM_DCR_BASE+0x08) /* OCM D-side Bank 1 Config Reg */
1160#define ocmdscr2 (OCM_DCR_BASE+0x09) /* OCM D-side Bank 2 Config Reg */
1161#define ocmiscr1 (OCM_DCR_BASE+0x0A) /* OCM I-side Bank 1 Config Reg */
1162#define ocmiscr2 (OCM_DCR_BASE+0x0B) /* OCM I-side Bank 2 Config Reg */
1163#define ocmdsisdpc (OCM_DCR_BASE+0x0C) /* OCM D-side/I-side Data Par Chk*/
1164#define ocmdsisbear (OCM_DCR_BASE+0x0D) /* OCM D-side/I-side Bus Err Addr*/
1165#define ocmdsisbesr (OCM_DCR_BASE+0x0E) /* OCM D-side/I-side Bus Err Stat*/
1166#else
wdenk0442ed82002-11-03 10:24:00 +00001167#define OCM_DCR_BASE 0x018
1168#define ocmisarc (OCM_DCR_BASE+0x00) /* OCM I-side address compare reg */
1169#define ocmiscntl (OCM_DCR_BASE+0x01) /* OCM I-side control reg */
1170#define ocmdsarc (OCM_DCR_BASE+0x02) /* OCM D-side address compare reg */
1171#define ocmdscntl (OCM_DCR_BASE+0x03) /* OCM D-side control reg */
Stefan Roesee01bd212007-03-21 13:38:59 +01001172#endif /* CONFIG_405EZ */
wdenk0442ed82002-11-03 10:24:00 +00001173
stroeseb867d702003-05-23 11:18:02 +00001174/******************************************************************************
1175 * GPIO macro register defines
1176 ******************************************************************************/
Stefan Roesee01bd212007-03-21 13:38:59 +01001177#if defined(CONFIG_405EZ)
1178/* Only the 405EZ has 2 GPIOs */
1179#define GPIO_BASE 0xEF600700
1180#define GPIO0_OR (GPIO_BASE+0x0)
1181#define GPIO0_TCR (GPIO_BASE+0x4)
1182#define GPIO0_OSRL (GPIO_BASE+0x8)
1183#define GPIO0_OSRH (GPIO_BASE+0xC)
1184#define GPIO0_TSRL (GPIO_BASE+0x10)
1185#define GPIO0_TSRH (GPIO_BASE+0x14)
1186#define GPIO0_ODR (GPIO_BASE+0x18)
1187#define GPIO0_IR (GPIO_BASE+0x1C)
1188#define GPIO0_RR1 (GPIO_BASE+0x20)
1189#define GPIO0_RR2 (GPIO_BASE+0x24)
1190#define GPIO0_RR3 (GPIO_BASE+0x28)
1191#define GPIO0_ISR1L (GPIO_BASE+0x30)
1192#define GPIO0_ISR1H (GPIO_BASE+0x34)
1193#define GPIO0_ISR2L (GPIO_BASE+0x38)
1194#define GPIO0_ISR2H (GPIO_BASE+0x3C)
1195#define GPIO0_ISR3L (GPIO_BASE+0x40)
1196#define GPIO0_ISR3H (GPIO_BASE+0x44)
1197
1198#define GPIO1_BASE 0xEF600800
1199#define GPIO1_OR (GPIO1_BASE+0x0)
1200#define GPIO1_TCR (GPIO1_BASE+0x4)
1201#define GPIO1_OSRL (GPIO1_BASE+0x8)
1202#define GPIO1_OSRH (GPIO1_BASE+0xC)
1203#define GPIO1_TSRL (GPIO1_BASE+0x10)
1204#define GPIO1_TSRH (GPIO1_BASE+0x14)
1205#define GPIO1_ODR (GPIO1_BASE+0x18)
1206#define GPIO1_IR (GPIO1_BASE+0x1C)
1207#define GPIO1_RR1 (GPIO1_BASE+0x20)
1208#define GPIO1_RR2 (GPIO1_BASE+0x24)
1209#define GPIO1_RR3 (GPIO1_BASE+0x28)
1210#define GPIO1_ISR1L (GPIO1_BASE+0x30)
1211#define GPIO1_ISR1H (GPIO1_BASE+0x34)
1212#define GPIO1_ISR2L (GPIO1_BASE+0x38)
1213#define GPIO1_ISR2H (GPIO1_BASE+0x3C)
1214#define GPIO1_ISR3L (GPIO1_BASE+0x40)
1215#define GPIO1_ISR3H (GPIO1_BASE+0x44)
1216
1217#else /* !405EZ */
1218
stroeseb867d702003-05-23 11:18:02 +00001219#define GPIO_BASE 0xEF600700
1220#define GPIO0_OR (GPIO_BASE+0x0)
1221#define GPIO0_TCR (GPIO_BASE+0x4)
1222#define GPIO0_OSRH (GPIO_BASE+0x8)
1223#define GPIO0_OSRL (GPIO_BASE+0xC)
1224#define GPIO0_TSRH (GPIO_BASE+0x10)
1225#define GPIO0_TSRL (GPIO_BASE+0x14)
1226#define GPIO0_ODR (GPIO_BASE+0x18)
1227#define GPIO0_IR (GPIO_BASE+0x1C)
1228#define GPIO0_RR1 (GPIO_BASE+0x20)
1229#define GPIO0_RR2 (GPIO_BASE+0x24)
1230#define GPIO0_ISR1H (GPIO_BASE+0x30)
1231#define GPIO0_ISR1L (GPIO_BASE+0x34)
1232#define GPIO0_ISR2H (GPIO_BASE+0x38)
1233#define GPIO0_ISR2L (GPIO_BASE+0x3C)
1234
Stefan Roesee01bd212007-03-21 13:38:59 +01001235#endif /* CONFIG_405EZ */
wdenk0442ed82002-11-03 10:24:00 +00001236
1237/*
1238 * Macro for accessing the indirect EBC register
1239 */
1240#define mtebc(reg, data) mtdcr(ebccfga,reg);mtdcr(ebccfgd,data)
1241#define mfebc(reg, data) mtdcr(ebccfga,reg);data = mfdcr(ebccfgd)
1242
Stefan Roese779e9752007-08-14 14:44:41 +02001243#define mtsdram(reg, data) do { mtdcr(memcfga,reg);mtdcr(memcfgd,data); } while (0)
1244#define mfsdram(reg, data) do { mtdcr(memcfga,reg);data = mfdcr(memcfgd); } while (0)
wdenk0442ed82002-11-03 10:24:00 +00001245
1246#ifndef __ASSEMBLY__
1247
1248typedef struct
1249{
1250 unsigned long pllFwdDiv;
1251 unsigned long pllFwdDivB;
1252 unsigned long pllFbkDiv;
1253 unsigned long pllPlbDiv;
1254 unsigned long pllPciDiv;
1255 unsigned long pllExtBusDiv;
1256 unsigned long pllOpbDiv;
1257 unsigned long freqVCOMhz; /* in MHz */
1258 unsigned long freqProcessor;
1259 unsigned long freqPLB;
1260 unsigned long freqPCI;
1261 unsigned long pciIntArbEn; /* Internal PCI arbiter is enabled */
1262 unsigned long pciClkSync; /* PCI clock is synchronous */
stroese44acc8d2004-12-16 18:03:44 +00001263 unsigned long freqVCOHz;
wdenk0442ed82002-11-03 10:24:00 +00001264} PPC405_SYS_INFO;
1265
1266#endif /* _ASMLANGUAGE */
1267
1268#define RESET_VECTOR 0xfffffffc
1269#define CACHELINE_MASK (CFG_CACHELINE_SIZE - 1) /* Address mask for cache
1270 line aligned data. */
1271
1272#endif /* __PPC405_H__ */