blob: e0d165e572516b57c8ab484040e7394822f2f70e [file] [log] [blame]
wdenk0442ed82002-11-03 10:24:00 +00001/*----------------------------------------------------------------------------+
Josh Boyer471573b2009-08-07 13:53:20 -04002| 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.
wdenk0442ed82002-11-03 10:24:00 +00004|
Wolfgang Denka1be4762008-05-20 16:00:29 +02005| 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.
wdenk0442ed82002-11-03 10:24:00 +000011|
Wolfgang Denka1be4762008-05-20 16:00:29 +020012| 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.
wdenk0442ed82002-11-03 10:24:00 +000015|
Wolfgang Denka1be4762008-05-20 16:00:29 +020016| 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.
wdenk0442ed82002-11-03 10:24:00 +000019|
Wolfgang Denka1be4762008-05-20 16:00:29 +020020| COPYRIGHT I B M CORPORATION 1999
21| LICENSED MATERIAL - PROGRAM PROPERTY OF I B M
wdenk0442ed82002-11-03 10:24:00 +000022+----------------------------------------------------------------------------*/
23
24#ifndef __PPC405_H__
25#define __PPC405_H__
26
Grant Ericksonb6933412008-05-22 14:44:14 -070027/* 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
Stefan Roeseeff3a0a2007-10-31 17:55:58 +010031#ifndef CONFIG_IOP480
Niklaus Giger3c8ef442009-10-04 20:04:22 +020032#define CONFIG_SYS_DCACHE_SIZE (16 << 10) /* For AMCC 405 CPUs */
Stefan Roeseeff3a0a2007-10-31 17:55:58 +010033#else
Niklaus Giger3c8ef442009-10-04 20:04:22 +020034#define CONFIG_SYS_DCACHE_SIZE (2 << 10) /* For PLX IOP480(403)*/
Stefan Roeseeff3a0a2007-10-31 17:55:58 +010035#endif
36
Stefan Roese95ca5fa2010-09-11 09:31:43 +020037/* DCR registers */
38#define PLB0_ACR 0x0087
39
wdenk0442ed82002-11-03 10:24:00 +000040/******************************************************************************
41 * Special for PPC405GP
42 ******************************************************************************/
43
44/******************************************************************************
45 * DMA
46 ******************************************************************************/
47#define DMA_DCR_BASE 0x100
Stefan Roese918010a2009-09-09 16:25:29 +020048#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 */
wdenk0442ed82002-11-03 10:24:00 +000071
stroeseb0ca12d2003-12-09 14:59:11 +000072#ifndef CONFIG_405EP
wdenk0442ed82002-11-03 10:24:00 +000073/******************************************************************************
74 * Decompression Controller
75 ******************************************************************************/
76#define DECOMP_DCR_BASE 0x14
Niklaus Giger3c8ef442009-10-04 20:04:22 +020077#define KIAR (DECOMP_DCR_BASE+0x0) /* Decompression controller addr reg */
78#define KIDR (DECOMP_DCR_BASE+0x1) /* Decompression controller data reg */
Stefan Roese918010a2009-09-09 16:25:29 +020079/* values for kiar register - indirect addressing of these regs */
Niklaus Giger3c8ef442009-10-04 20:04:22 +020080#define KCONF 0x40 /* decompression core config register */
stroeseb0ca12d2003-12-09 14:59:11 +000081#endif
wdenk0442ed82002-11-03 10:24:00 +000082
83/******************************************************************************
84 * Power Management
85 ******************************************************************************/
Stefan Roese153b3e22007-10-05 17:10:59 +020086#ifdef CONFIG_405EX
87#define POWERMAN_DCR_BASE 0xb0
88#else
wdenk0442ed82002-11-03 10:24:00 +000089#define POWERMAN_DCR_BASE 0xb8
Stefan Roese153b3e22007-10-05 17:10:59 +020090#endif
Niklaus Giger3c8ef442009-10-04 20:04:22 +020091#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 */
wdenk0442ed82002-11-03 10:24:00 +000094
95/******************************************************************************
96 * Extrnal Bus Controller
97 ******************************************************************************/
Stefan Roese918010a2009-09-09 16:25:29 +020098 /* values for EBC0_CFGADDR register - indirect addressing of these regs */
Niklaus Giger3c8ef442009-10-04 20:04:22 +020099 #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 */
stroeseb0ca12d2003-12-09 14:59:11 +0000104#ifndef CONFIG_405EP
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200105 #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 */
stroeseb0ca12d2003-12-09 14:59:11 +0000108#endif
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200109 #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 */
stroeseb0ca12d2003-12-09 14:59:11 +0000114#ifndef CONFIG_405EP
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200115 #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 */
stroeseb0ca12d2003-12-09 14:59:11 +0000118#endif
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200119 #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 */
wdenk0442ed82002-11-03 10:24:00 +0000123
stroese434979e2003-05-23 11:18:02 +0000124#ifdef CONFIG_405EP
wdenk0442ed82002-11-03 10:24:00 +0000125/******************************************************************************
126 * Control
127 ******************************************************************************/
stroese434979e2003-05-23 11:18:02 +0000128#define CNTRL_DCR_BASE 0x0f0
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200129#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 */
stroese434979e2003-05-23 11:18:02 +0000135
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200136#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 */
stroese434979e2003-05-23 11:18:02 +0000146
147/* Bit definitions */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200148#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
stroese434979e2003-05-23 11:18:02 +0000153
Wolfgang Denka1be4762008-05-20 16:00:29 +0200154#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
stroese434979e2003-05-23 11:18:02 +0000159
Wolfgang Denka1be4762008-05-20 16:00:29 +0200160#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
stroese434979e2003-05-23 11:18:02 +0000165
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200166#define PLLMR0_EXB_TO_PLB_MASK 0x00000300 /* External Bus:PLB Divisor */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200167#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
stroese434979e2003-05-23 11:18:02 +0000171
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200172#define PLLMR0_MAL_TO_PLB_MASK 0x00000030 /* MAL:PLB Divisor */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200173#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
stroese434979e2003-05-23 11:18:02 +0000177
Wolfgang Denka1be4762008-05-20 16:00:29 +0200178#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
stroese434979e2003-05-23 11:18:02 +0000183
Wolfgang Denka1be4762008-05-20 16:00:29 +0200184#define PLLMR1_SSCS_MASK 0x80000000 /* Select system clock source */
185#define PLLMR1_PLLR_MASK 0x40000000 /* PLL reset */
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200186#define PLLMR1_FBMUL_MASK 0x00F00000 /* PLL feedback multiplier value */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200187#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
stroese434979e2003-05-23 11:18:02 +0000203
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200204#define PLLMR1_FWDVA_MASK 0x00070000 /* PLL forward divider A value */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200205#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
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200213#define PLLMR1_FWDVB_MASK 0x00007000 /* PLL forward divider B value */
214#define PLLMR1_TUNING_MASK 0x000003FF /* PLL tune bits */
stroese434979e2003-05-23 11:18:02 +0000215
216/* Defines for CPC0_EPRCSR register */
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200217#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
stroese434979e2003-05-23 11:18:02 +0000225
226/* Defines for CPC0_PCI Register */
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200227#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 */
stroese434979e2003-05-23 11:18:02 +0000230
231/* Defines for CPC0_BOOR Register */
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200232#define CPC0_BOOT_SEP 0x00000002 /* serial EEPROM present */
stroese434979e2003-05-23 11:18:02 +0000233
234/* Defines for CPC0_PLLMR1 Register fields */
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200235#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 */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200281#define PLL_TUNE_MASK 0x000003FF
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200282#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 */
stroese434979e2003-05-23 11:18:02 +0000289
290/* Defines for CPC0_PLLMR0 Register fields */
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200291 /* 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
stroese434979e2003-05-23 11:18:02 +0000333
334/*
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200335 *------------------------------------------------------------------------------
stroese434979e2003-05-23 11:18:02 +0000336 * PLL settings for 266MHz CPU, 133MHz PLB/SDRAM, 66MHz EBC, 33MHz PCI,
337 * assuming a 33.3MHz input clock to the 405EP.
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200338 *------------------------------------------------------------------------------
stroese434979e2003-05-23 11:18:02 +0000339 */
340#define PLLMR0_266_133_66 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
wdenk57b2d802003-06-27 21:31:46 +0000341 PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
342 PLL_MALDIV_1 | PLL_PCIDIV_4)
stroese434979e2003-05-23 11:18:02 +0000343#define PLLMR1_266_133_66 (PLL_FBKDIV_8 | \
wdenk57b2d802003-06-27 21:31:46 +0000344 PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
345 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
stroese434979e2003-05-23 11:18:02 +0000346
347#define PLLMR0_133_66_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_1 | \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200348 PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
wdenk57b2d802003-06-27 21:31:46 +0000349 PLL_MALDIV_1 | PLL_PCIDIV_4)
stroese434979e2003-05-23 11:18:02 +0000350#define PLLMR1_133_66_66_33 (PLL_FBKDIV_4 | \
wdenk57b2d802003-06-27 21:31:46 +0000351 PLL_FWDDIVA_6 | PLL_FWDDIVB_6 | \
352 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
stroese434979e2003-05-23 11:18:02 +0000353#define PLLMR0_200_100_50_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200354 PLL_OPBDIV_2 | PLL_EXTBUSDIV_3 | \
wdenk57b2d802003-06-27 21:31:46 +0000355 PLL_MALDIV_1 | PLL_PCIDIV_4)
stroese434979e2003-05-23 11:18:02 +0000356#define PLLMR1_200_100_50_33 (PLL_FBKDIV_6 | \
wdenk57b2d802003-06-27 21:31:46 +0000357 PLL_FWDDIVA_4 | PLL_FWDDIVB_4 | \
358 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
stroese434979e2003-05-23 11:18:02 +0000359#define PLLMR0_266_133_66_33 (PLL_CPUDIV_1 | PLL_PLBDIV_2 | \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200360 PLL_OPBDIV_2 | PLL_EXTBUSDIV_4 | \
wdenk57b2d802003-06-27 21:31:46 +0000361 PLL_MALDIV_1 | PLL_PCIDIV_4)
stroese434979e2003-05-23 11:18:02 +0000362#define PLLMR1_266_133_66_33 (PLL_FBKDIV_8 | \
wdenk57b2d802003-06-27 21:31:46 +0000363 PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
364 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
stroese317a25f2004-12-16 18:03:44 +0000365#define PLLMR0_266_66_33_33 (PLL_CPUDIV_1 | PLL_PLBDIV_4 | \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200366 PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
wdenk07d7e6b2004-12-16 21:44:03 +0000367 PLL_MALDIV_1 | PLL_PCIDIV_2)
stroese317a25f2004-12-16 18:03:44 +0000368#define PLLMR1_266_66_33_33 (PLL_FBKDIV_8 | \
wdenk07d7e6b2004-12-16 21:44:03 +0000369 PLL_FWDDIVA_3 | PLL_FWDDIVB_3 | \
370 PLL_TUNE_15_M_40 | PLL_TUNE_VCO_LOW)
Stefan Roesea5d182e2007-08-14 14:44:41 +0200371#define PLLMR0_333_111_55_37 (PLL_CPUDIV_1 | PLL_PLBDIV_3 | \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200372 PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
Stefan Roesea5d182e2007-08-14 14:44:41 +0200373 PLL_MALDIV_1 | PLL_PCIDIV_3)
Wolfgang Denka1be4762008-05-20 16:00:29 +0200374#define PLLMR1_333_111_55_37 (PLL_FBKDIV_10 | \
Stefan Roesea5d182e2007-08-14 14:44:41 +0200375 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 | \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200378 PLL_OPBDIV_2 | PLL_EXTBUSDIV_2 | \
Stefan Roesea5d182e2007-08-14 14:44:41 +0200379 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)
stroese434979e2003-05-23 11:18:02 +0000383
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
Stefan Roese17ffbc82007-03-21 13:38:59 +0100390#elif defined(CONFIG_405EZ)
Stefan Roese918010a2009-09-09 16:25:29 +0200391#define SDR0_NAND0 0x4000
392#define SDR0_ULTRA0 0x4040
393#define SDR0_ULTRA1 0x4050
394#define SDR0_ICINTSTAT 0x4510
Stefan Roese17ffbc82007-03-21 13:38:59 +0100395
396#define SDR_NAND0_NDEN 0x80000000
Stefan Roese23d8d342007-06-06 11:42:13 +0200397#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
Stefan Roese17ffbc82007-03-21 13:38:59 +0100402
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
Stefan Roese23d8d342007-06-06 11:42:13 +0200409#define SDR_ULTRA0_EBCRDYEN 0x04000000
410#define SDR_ULTRA0_SPISSINEN 0x02000000
411#define SDR_ULTRA0_NFSRSTEN 0x01000000
Stefan Roese17ffbc82007-03-21 13:38:59 +0100412
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
Stefan Roese918010a2009-09-09 16:25:29 +0200419#define SDR0_PINSTP 0x40
Stefan Roese3a75ac12007-04-18 12:05:59 +0200420
Stefan Roese17ffbc82007-03-21 13:38:59 +0100421/******************************************************************************
422 * Control
423 ******************************************************************************/
Stefan Roese17ffbc82007-03-21 13:38:59 +0100424/* CPR Registers */
Stefan Roese918010a2009-09-09 16:25:29 +0200425#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 */
Stefan Roese17ffbc82007-03-21 13:38:59 +0100432
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200433#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 */
Stefan Roese17ffbc82007-03-21 13:38:59 +0100436
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200437#define PLLC_SRC_MASK 0x20000000 /* PLL feedback source */
Stefan Roese87476ba2007-08-13 09:05:33 +0200438
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200439#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 */
Stefan Roese17ffbc82007-03-21 13:38:59 +0100442
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200443#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 */
Stefan Roese17ffbc82007-03-21 13:38:59 +0100447
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200448#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 */
Stefan Roese17ffbc82007-03-21 13:38:59 +0100452
stroese434979e2003-05-23 11:18:02 +0000453#else /* #ifdef CONFIG_405EP */
454/******************************************************************************
455 * Control
456 ******************************************************************************/
wdenk0442ed82002-11-03 10:24:00 +0000457#define CNTRL_DCR_BASE 0x0b0
Stefan Roese918010a2009-09-09 16:25:29 +0200458#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 */
Niklaus Giger907a3042008-02-05 10:26:41 +0100462
463/* CPC0_ECR/CPC0_EIRR: PPC405GPr only */
Stefan Roese918010a2009-09-09 16:25:29 +0200464#define CPC0_EIRR (CNTRL_DCR_BASE + 0x6) /* ext interrupt routing reg */
465#define CPC0_ECR 0xaa /* edge conditioner register */
wdenk0442ed82002-11-03 10:24:00 +0000466
467/* Bit definitions */
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200468#define PLLMR_FWD_DIV_MASK 0xE0000000 /* Forward Divisor */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200469#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
wdenk0442ed82002-11-03 10:24:00 +0000473
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200474#define PLLMR_FB_DIV_MASK 0x1E000000 /* Feedback Divisor */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200475#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
wdenk0442ed82002-11-03 10:24:00 +0000479
Wolfgang Denka1be4762008-05-20 16:00:29 +0200480#define PLLMR_TUNING_MASK 0x01F80000
wdenk0442ed82002-11-03 10:24:00 +0000481
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200482#define PLLMR_CPU_TO_PLB_MASK 0x00060000 /* CPU:PLB Frequency Divisor */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200483#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
wdenk0442ed82002-11-03 10:24:00 +0000487
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200488#define PLLMR_OPB_TO_PLB_MASK 0x00018000 /* OPB:PLB Frequency Divisor */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200489#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
wdenk0442ed82002-11-03 10:24:00 +0000493
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200494#define PLLMR_PCI_TO_PLB_MASK 0x00006000 /* PCI:PLB Frequency Divisor */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200495#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
wdenk0442ed82002-11-03 10:24:00 +0000499
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200500#define PLLMR_EXB_TO_PLB_MASK 0x00001800 /* External Bus:PLB Divisor */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200501#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
wdenk0442ed82002-11-03 10:24:00 +0000505
506/* definitions for PPC405GPr (new mode strapping) */
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200507#define PLLMR_FWDB_DIV_MASK 0x00000007 /* Forward Divisor B */
wdenk0442ed82002-11-03 10:24:00 +0000508
Wolfgang Denka1be4762008-05-20 16:00:29 +0200509#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
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200519#define PSR_PERCLK_SYNC_MODE_EN 0x00000800 /* PPC405GPr only */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200520#define PSR_PCI_ARBIT_EN 0x00000400
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200521#define PSR_NEW_MODE_EN 0x00000020 /* PPC405GPr only */
wdenk0442ed82002-11-03 10:24:00 +0000522
stroese317a25f2004-12-16 18:03:44 +0000523#ifndef CONFIG_IOP480
wdenk0442ed82002-11-03 10:24:00 +0000524/*
525 * PLL Voltage Controlled Oscillator (VCO) definitions
526 * Maximum and minimum values (in MHz) for correct PLL operation.
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200527*/
wdenk0442ed82002-11-03 10:24:00 +0000528#define VCO_MIN 400
529#define VCO_MAX 800
stroese317a25f2004-12-16 18:03:44 +0000530#endif /* #ifndef CONFIG_IOP480 */
stroese434979e2003-05-23 11:18:02 +0000531#endif /* #ifdef CONFIG_405EP */
wdenk0442ed82002-11-03 10:24:00 +0000532
Stefan Roese95ca5fa2010-09-11 09:31:43 +0200533#if 0
wdenk0442ed82002-11-03 10:24:00 +0000534/******************************************************************************
535 * Memory Access Layer
536 ******************************************************************************/
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200537#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 */
Stefan Roese95ca5fa2010-09-11 09:31:43 +0200566#endif
wdenk0442ed82002-11-03 10:24:00 +0000567
568/*-----------------------------------------------------------------------------
wdenk0442ed82002-11-03 10:24:00 +0000569| UART Register Offsets
570'----------------------------------------------------------------------------*/
571#define DATA_REG 0x00
Wolfgang Denk70df7bc2007-06-22 23:59:00 +0200572#define DL_LSB 0x00
573#define DL_MSB 0x01
Wolfgang Denka1be4762008-05-20 16:00:29 +0200574#define INT_ENABLE 0x01
575#define FIFO_CONTROL 0x02
576#define LINE_CONTROL 0x03
577#define MODEM_CONTROL 0x04
Wolfgang Denk70df7bc2007-06-22 23:59:00 +0200578#define LINE_STATUS 0x05
Wolfgang Denka1be4762008-05-20 16:00:29 +0200579#define MODEM_STATUS 0x06
580#define SCRATCH 0x07
wdenk0442ed82002-11-03 10:24:00 +0000581
582/******************************************************************************
583 * On Chip Memory
584 ******************************************************************************/
Stefan Roese17ffbc82007-03-21 13:38:59 +0100585#if defined(CONFIG_405EZ)
586#define OCM_DCR_BASE 0x020
Stefan Roese918010a2009-09-09 16:25:29 +0200587#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 */
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200594#define OCM0_DISDPC (OCM_DCR_BASE + 0x0C) /* OCM D-/I-side Data Par Chk */
Stefan Roese17ffbc82007-03-21 13:38:59 +0100595#else
wdenk0442ed82002-11-03 10:24:00 +0000596#define OCM_DCR_BASE 0x018
Stefan Roese918010a2009-09-09 16:25:29 +0200597#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 */
Stefan Roese17ffbc82007-03-21 13:38:59 +0100600#endif /* CONFIG_405EZ */
wdenk0442ed82002-11-03 10:24:00 +0000601
stroese434979e2003-05-23 11:18:02 +0000602/******************************************************************************
603 * GPIO macro register defines
604 ******************************************************************************/
Stefan Roese17ffbc82007-03-21 13:38:59 +0100605#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
Stefan Roese153b3e22007-10-05 17:10:59 +0200645#elif defined(CONFIG_405EX)
646#define GPIO_BASE 0xEF600800
Wolfgang Denka1be4762008-05-20 16:00:29 +0200647#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)
Stefan Roese153b3e22007-10-05 17:10:59 +0200663
Stefan Roese17ffbc82007-03-21 13:38:59 +0100664#else /* !405EZ */
665
stroese434979e2003-05-23 11:18:02 +0000666#define GPIO_BASE 0xEF600700
Wolfgang Denka1be4762008-05-20 16:00:29 +0200667#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)
stroese434979e2003-05-23 11:18:02 +0000681
Stefan Roese17ffbc82007-03-21 13:38:59 +0100682#endif /* CONFIG_405EZ */
wdenk0442ed82002-11-03 10:24:00 +0000683
Stefan Roese1bca9192007-11-15 14:23:55 +0100684#define GPIO0_BASE GPIO_BASE
685
Stefan Roese153b3e22007-10-05 17:10:59 +0200686#if defined(CONFIG_405EX)
687#define SDR0_SRST 0x0200
688
Grant Ericksonbe156f52008-07-09 16:31:36 -0700689/*
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
Stefan Roese918010a2009-09-09 16:25:29 +0200725#define SDR0_UART0 0x0120 /* UART0 Config */
726#define SDR0_UART1 0x0121 /* UART1 Config */
727#define SDR0_MFR 0x4300 /* SDR0_MFR reg */
Stefan Roese153b3e22007-10-05 17:10:59 +0200728
729/* Defines for CPC0_EPRCSR register */
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200730#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
Stefan Roese153b3e22007-10-05 17:10:59 +0200738
Stefan Roese918010a2009-09-09 16:25:29 +0200739#define CPR0_CLKUPD 0x020
740#define CPR0_PLLC 0x040
741#define CPR0_PLLD 0x060
742#define CPR0_CPUD 0x080
743#define CPR0_PLBD 0x0a0
Niklaus Gigera9a9b1f2009-10-04 20:04:19 +0200744#define CPR0_OPBD0 0x0c0
Stefan Roese918010a2009-09-09 16:25:29 +0200745#define CPR0_PERD 0x0e0
Stefan Roese153b3e22007-10-05 17:10:59 +0200746
Stefan Roese918010a2009-09-09 16:25:29 +0200747#define SDR0_PINSTP 0x0040
748#define SDR0_SDCS0 0x0060
Stefan Roese153b3e22007-10-05 17:10:59 +0200749
750#define SDR0_SDCS_SDD (0x80000000 >> 31)
751
752/* CUST0 Customer Configuration Register0 */
Wolfgang Denka1be4762008-05-20 16:00:29 +0200753#define SDR0_CUST0 0x4000
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200754#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 */
Stefan Roese153b3e22007-10-05 17:10:59 +0200758
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200759#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 */
Stefan Roese153b3e22007-10-05 17:10:59 +0200762
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200763#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 */
Stefan Roese153b3e22007-10-05 17:10:59 +0200766
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200767#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)
Stefan Roese153b3e22007-10-05 17:10:59 +0200770
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200771#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)
Stefan Roese153b3e22007-10-05 17:10:59 +0200774
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200775#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 */
Stefan Roese153b3e22007-10-05 17:10:59 +0200778
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200779#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 */
Stefan Roese153b3e22007-10-05 17:10:59 +0200782
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200783#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)
Stefan Roese153b3e22007-10-05 17:10:59 +0200786
Niklaus Giger3c8ef442009-10-04 20:04:22 +0200787#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 */
Stefan Roesee971ead2007-12-08 14:47:34 +0100794
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
Stefan Roese153b3e22007-10-05 17:10:59 +0200807#endif
808
wdenk0442ed82002-11-03 10:24:00 +0000809#endif /* __PPC405_H__ */