blob: ae69f5a1b1a0e2b75742e0b083fe31f6fa95b404 [file] [log] [blame]
Stefan Roese3e1f1b32005-08-01 16:49:12 +02001/*
Stefan Roesec7698642007-06-01 15:19:29 +02002 * (C) Copyright 2005-2007
Stefan Roese3e1f1b32005-08-01 16:49:12 +02003 * Stefan Roese, DENX Software Engineering, sr@denx.de.
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Stefan Roese3e1f1b32005-08-01 16:49:12 +02006 */
7
8#include <common.h>
9#include <asm/processor.h>
Stefan Roesede21eab2010-09-16 14:30:37 +020010#include <asm/ppc4xx-gpio.h>
Stefan Roese3e1f1b32005-08-01 16:49:12 +020011#include <spd_sdram.h>
Stefan Roese247e9d72010-09-09 19:18:00 +020012#include <asm/ppc440.h>
Stefan Roese363330b2005-08-04 17:09:16 +020013#include "bamboo.h"
Stefan Roese3e1f1b32005-08-01 16:49:12 +020014
Stefan Roese363330b2005-08-04 17:09:16 +020015void ext_bus_cntlr_init(void);
16void configure_ppc440ep_pins(void);
Stefan Roese797d8572005-08-11 17:56:56 +020017int is_nand_selected(void);
Stefan Roese3e1f1b32005-08-01 16:49:12 +020018
Eugene OBrienc59d1a02007-07-31 10:24:56 +020019/*************************************************************************
20 *
21 * Bamboo has one bank onboard sdram (plus DIMM)
22 *
23 * Fixed memory is composed of :
24 * MT46V16M16TG-75 from Micron (x 2), 256Mb, 16 M x16, DDR266,
25 * 13 row add bits, 10 column add bits (but 12 row used only).
26 * ECC device: MT46V16M8TG-75 from Micron (x 1), 128Mb, x8, DDR266,
27 * 12 row add bits, 10 column add bits.
28 * Prepare a subset (only the used ones) of SPD data
29 *
30 * Note : if the ECC is enabled (SDRAM_ECC_ENABLE) the size of
31 * the corresponding bank is divided by 2 due to number of Row addresses
32 * 12 in the ECC module
33 *
34 * Assumes: 64 MB, ECC, non-registered
35 * PLB @ 133 MHz
36 *
37 ************************************************************************/
38const unsigned char cfg_simulate_spd_eeprom[128] = {
39 0x80, /* number of SPD bytes used: 128 */
40 0x08, /* total number bytes in SPD device = 256 */
41 0x07, /* DDR ram */
42#ifdef CONFIG_DDR_ECC
43 0x0C, /* num Row Addr: 12 */
44#else
45 0x0D, /* num Row Addr: 13 */
46#endif
47 0x09, /* numColAddr: 9 */
48 0x01, /* numBanks: 1 */
49 0x20, /* Module data width: 32 bits */
50 0x00, /* Module data width continued: +0 */
51 0x04, /* 2.5 Volt */
52 0x75, /* SDRAM Cycle Time (cas latency 2.5) = 7.5 ns */
Eugene O'Brienc8fd2002007-10-23 08:29:10 +020053 0x00, /* SDRAM Access from clock */
Eugene OBrienc59d1a02007-07-31 10:24:56 +020054#ifdef CONFIG_DDR_ECC
55 0x02, /* ECC ON : 02 OFF : 00 */
56#else
57 0x00, /* ECC ON : 02 OFF : 00 */
58#endif
Eugene O'Brienc8fd2002007-10-23 08:29:10 +020059 0x82, /* refresh Rate Type: Normal (7.8us) + Self refresh */
Eugene OBrienc59d1a02007-07-31 10:24:56 +020060 0,
61 0,
62 0x01, /* wcsbc = 1 */
63 0,
64 0,
65 0x0C, /* casBit (2,2.5) */
66 0,
67 0,
68 0x00, /* not registered: 0 registered : 0x02*/
69 0,
70 0xA0, /* SDRAM Cycle Time (cas latency 2) = 10 ns */
71 0,
72 0x00, /* SDRAM Cycle Time (cas latency 1.5) = N.A */
73 0,
74 0x50, /* tRpNs = 20 ns */
75 0,
76 0x50, /* tRcdNs = 20 ns */
77 45, /* tRasNs */
78#ifdef CONFIG_DDR_ECC
79 0x08, /* bankSizeID: 32MB */
80#else
81 0x10, /* bankSizeID: 64MB */
82#endif
83 0,
84 0,
85 0,
86 0,
87 0,
88 0,
89 0,
90 0,
91 0,
92 0,
93 0,
94 0,
95 0,
96 0,
97 0,
98 0,
99 0,
100 0,
101 0,
102 0,
103 0,
104 0,
105 0,
106 0,
107 0,
108 0,
109 0,
110 0,
111 0,
112 0,
113 0,
114 0,
115 0,
116 0,
117 0,
118 0,
119 0,
120 0,
121 0,
122 0,
123 0,
124 0,
125 0,
126 0,
127 0,
128 0,
129 0,
130 0,
131 0,
132 0,
133 0,
134 0,
135 0,
136 0,
137 0,
138 0,
139 0,
140 0,
141 0,
142 0,
143 0,
144 0,
145 0,
146 0,
147 0,
148 0,
149 0,
150 0,
151 0,
152 0,
153 0,
154 0,
155 0,
156 0,
157 0,
158 0,
159 0,
160 0,
161 0,
162 0,
163 0,
164 0,
165 0,
166 0,
167 0,
168 0,
169 0,
170 0,
171 0,
172 0,
173 0,
174 0,
175 0,
176 0,
177 0,
178 0
179};
Stefan Roesec45d1e32005-11-15 16:04:58 +0100180
Stefan Roese363330b2005-08-04 17:09:16 +0200181#if 0
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200182{ /* GPIO Alternate1 Alternate2 Alternate3 */
183 {
184 /* GPIO Core 0 */
185 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_0 -> EBC_ADDR(7) DMA_REQ(2) */
186 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_1 -> EBC_ADDR(6) DMA_ACK(2) */
187 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_2 -> EBC_ADDR(5) DMA_EOT/TC(2) */
188 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_3 -> EBC_ADDR(4) DMA_REQ(3) */
189 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_4 -> EBC_ADDR(3) DMA_ACK(3) */
190 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_5 ................. */
191 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_6 -> EBC_CS_N(1) */
192 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_7 -> EBC_CS_N(2) */
193 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_8 -> EBC_CS_N(3) */
194 { GPIO0_BASE, GPIO_DIS, GPIO_ALT1 }, /* GPIO0_9 -> EBC_CS_N(4) */
195 { GPIO0_BASE, GPIO_OUT, GPIO_ALT1 }, /* GPIO0_10 -> EBC_CS_N(5) */
196 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_11 -> EBC_BUS_ERR */
197 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_12 -> ZII_p0Rxd(0) */
198 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_13 -> ZII_p0Rxd(1) */
199 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_14 -> ZII_p0Rxd(2) */
200 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_15 -> ZII_p0Rxd(3) */
201 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_16 -> ZII_p0Txd(0) */
202 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_17 -> ZII_p0Txd(1) */
203 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_18 -> ZII_p0Txd(2) */
204 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_19 -> ZII_p0Txd(3) */
205 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_20 -> ZII_p0Rx_er */
206 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_21 -> ZII_p0Rx_dv */
207 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_22 -> ZII_p0RxCrs */
208 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_23 -> ZII_p0Tx_er */
209 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_24 -> ZII_p0Tx_en */
210 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_25 -> ZII_p0Col */
211 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_26 -> USB2D_RXVALID */
212 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_27 -> EXT_EBC_REQ USB2D_RXERROR */
213 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_28 -> USB2D_TXVALID */
214 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_29 -> EBC_EXT_HDLA USB2D_PAD_SUSPNDM */
215 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_30 -> EBC_EXT_ACK USB2D_XCVRSELECT */
216 { GPIO0_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO0_31 -> EBC_EXR_BUSREQ USB2D_TERMSELECT */
217 },
218 {
219 /* GPIO Core 1 */
220 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_0 -> USB2D_OPMODE0 */
221 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_1 -> USB2D_OPMODE1 */
222 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_2 -> UART0_DCD_N UART1_DSR_CTS_N UART2_SOUT */
223 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_3 -> UART0_8PIN_DSR_N UART1_RTS_DTR_N UART2_SIN */
224 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_4 -> UART0_8PIN_CTS_N UART3_SIN */
225 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_5 -> UART0_RTS_N */
226 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_6 -> UART0_DTR_N UART1_SOUT */
227 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_7 -> UART0_RI_N UART1_SIN */
228 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_8 -> UIC_IRQ(0) */
229 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_9 -> UIC_IRQ(1) */
230 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_10 -> UIC_IRQ(2) */
231 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_11 -> UIC_IRQ(3) */
232 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_12 -> UIC_IRQ(4) DMA_ACK(1) */
233 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_13 -> UIC_IRQ(6) DMA_EOT/TC(1) */
234 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_14 -> UIC_IRQ(7) DMA_REQ(0) */
235 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_15 -> UIC_IRQ(8) DMA_ACK(0) */
236 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_16 -> UIC_IRQ(9) DMA_EOT/TC(0) */
237 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_17 -> - */
238 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_18 -> | */
239 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_19 -> | */
240 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_20 -> | */
241 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_21 -> | */
242 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_22 -> | */
243 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_23 -> \ Can be unselected thru TraceSelect Bit */
244 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_24 -> / in PowerPC440EP Chip */
245 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_25 -> | */
246 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_26 -> | */
247 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_27 -> | */
248 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_28 -> | */
249 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_29 -> | */
250 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_30 -> | */
251 { GPIO1_BASE, GPIO_DIS, GPIO_SEL }, /* GPIO1_31 -> - */
252 }
Stefan Roese363330b2005-08-04 17:09:16 +0200253};
254#endif
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200255
Stefan Roese363330b2005-08-04 17:09:16 +0200256/*----------------------------------------------------------------------------+
257 | EBC Devices Characteristics
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200258 | Peripheral Bank Access Parameters - EBC0_BnAP
259 | Peripheral Bank Configuration Register - EBC0_BnCR
Stefan Roese363330b2005-08-04 17:09:16 +0200260 +----------------------------------------------------------------------------*/
261/* Small Flash */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200262#define EBC0_BNAP_SMALL_FLASH \
263 EBC0_BNAP_BME_DISABLED | \
264 EBC0_BNAP_TWT_ENCODE(6) | \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200265 EBC0_BNAP_CSN_ENCODE(0) | \
266 EBC0_BNAP_OEN_ENCODE(1) | \
267 EBC0_BNAP_WBN_ENCODE(1) | \
268 EBC0_BNAP_WBF_ENCODE(3) | \
269 EBC0_BNAP_TH_ENCODE(1) | \
270 EBC0_BNAP_RE_ENABLED | \
271 EBC0_BNAP_SOR_DELAYED | \
272 EBC0_BNAP_BEM_WRITEONLY | \
Stefan Roese363330b2005-08-04 17:09:16 +0200273 EBC0_BNAP_PEN_DISABLED
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200274
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200275#define EBC0_BNCR_SMALL_FLASH_CS0 \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200276 EBC0_BNCR_BAS_ENCODE(0xFFF00000) | \
277 EBC0_BNCR_BS_1MB | \
278 EBC0_BNCR_BU_RW | \
Stefan Roese363330b2005-08-04 17:09:16 +0200279 EBC0_BNCR_BW_8BIT
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200280
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200281#define EBC0_BNCR_SMALL_FLASH_CS4 \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200282 EBC0_BNCR_BAS_ENCODE(0x87F00000) | \
283 EBC0_BNCR_BS_1MB | \
284 EBC0_BNCR_BU_RW | \
Stefan Roese797d8572005-08-11 17:56:56 +0200285 EBC0_BNCR_BW_8BIT
Stefan Roese363330b2005-08-04 17:09:16 +0200286
287/* Large Flash or SRAM */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200288#define EBC0_BNAP_LARGE_FLASH_OR_SRAM \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200289 EBC0_BNAP_BME_DISABLED | \
290 EBC0_BNAP_TWT_ENCODE(8) | \
291 EBC0_BNAP_CSN_ENCODE(0) | \
292 EBC0_BNAP_OEN_ENCODE(1) | \
293 EBC0_BNAP_WBN_ENCODE(1) | \
294 EBC0_BNAP_WBF_ENCODE(1) | \
295 EBC0_BNAP_TH_ENCODE(2) | \
296 EBC0_BNAP_SOR_DELAYED | \
297 EBC0_BNAP_BEM_RW | \
Stefan Roese363330b2005-08-04 17:09:16 +0200298 EBC0_BNAP_PEN_DISABLED
299
Wolfgang Denka1be4762008-05-20 16:00:29 +0200300#define EBC0_BNCR_LARGE_FLASH_OR_SRAM_CS0 \
301 EBC0_BNCR_BAS_ENCODE(0xFF800000) | \
302 EBC0_BNCR_BS_8MB | \
303 EBC0_BNCR_BU_RW | \
Stefan Roese363330b2005-08-04 17:09:16 +0200304 EBC0_BNCR_BW_16BIT
305
306
Wolfgang Denka1be4762008-05-20 16:00:29 +0200307#define EBC0_BNCR_LARGE_FLASH_OR_SRAM_CS4 \
308 EBC0_BNCR_BAS_ENCODE(0x87800000) | \
309 EBC0_BNCR_BS_8MB | \
310 EBC0_BNCR_BU_RW | \
Stefan Roese363330b2005-08-04 17:09:16 +0200311 EBC0_BNCR_BW_16BIT
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200312
Stefan Roese363330b2005-08-04 17:09:16 +0200313/* NVRAM - FPGA */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200314#define EBC0_BNAP_NVRAM_FPGA \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200315 EBC0_BNAP_BME_DISABLED | \
316 EBC0_BNAP_TWT_ENCODE(9) | \
317 EBC0_BNAP_CSN_ENCODE(0) | \
318 EBC0_BNAP_OEN_ENCODE(1) | \
319 EBC0_BNAP_WBN_ENCODE(1) | \
320 EBC0_BNAP_WBF_ENCODE(0) | \
321 EBC0_BNAP_TH_ENCODE(2) | \
322 EBC0_BNAP_RE_ENABLED | \
323 EBC0_BNAP_SOR_DELAYED | \
324 EBC0_BNAP_BEM_WRITEONLY | \
Stefan Roese363330b2005-08-04 17:09:16 +0200325 EBC0_BNAP_PEN_DISABLED
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200326
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200327#define EBC0_BNCR_NVRAM_FPGA_CS5 \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200328 EBC0_BNCR_BAS_ENCODE(0x80000000) | \
329 EBC0_BNCR_BS_1MB | \
330 EBC0_BNCR_BU_RW | \
Stefan Roese363330b2005-08-04 17:09:16 +0200331 EBC0_BNCR_BW_8BIT
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200332
Stefan Roese363330b2005-08-04 17:09:16 +0200333/* Nand Flash */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200334#define EBC0_BNAP_NAND_FLASH \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200335 EBC0_BNAP_BME_DISABLED | \
336 EBC0_BNAP_TWT_ENCODE(3) | \
337 EBC0_BNAP_CSN_ENCODE(0) | \
338 EBC0_BNAP_OEN_ENCODE(0) | \
339 EBC0_BNAP_WBN_ENCODE(0) | \
340 EBC0_BNAP_WBF_ENCODE(0) | \
341 EBC0_BNAP_TH_ENCODE(1) | \
342 EBC0_BNAP_RE_ENABLED | \
343 EBC0_BNAP_SOR_NOT_DELAYED | \
344 EBC0_BNAP_BEM_RW | \
Stefan Roese363330b2005-08-04 17:09:16 +0200345 EBC0_BNAP_PEN_DISABLED
346
347
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200348#define EBC0_BNCR_NAND_FLASH_CS0 0xB8400000
Stefan Roese363330b2005-08-04 17:09:16 +0200349
350/* NAND0 */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200351#define EBC0_BNCR_NAND_FLASH_CS1 \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200352 EBC0_BNCR_BAS_ENCODE(0x90000000) | \
353 EBC0_BNCR_BS_1MB | \
354 EBC0_BNCR_BU_RW | \
Stefan Roese363330b2005-08-04 17:09:16 +0200355 EBC0_BNCR_BW_32BIT
356/* NAND1 - Bank2 */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200357#define EBC0_BNCR_NAND_FLASH_CS2 \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200358 EBC0_BNCR_BAS_ENCODE(0x94000000) | \
359 EBC0_BNCR_BS_1MB | \
360 EBC0_BNCR_BU_RW | \
Stefan Roese363330b2005-08-04 17:09:16 +0200361 EBC0_BNCR_BW_32BIT
362
363/* NAND1 - Bank3 */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200364#define EBC0_BNCR_NAND_FLASH_CS3 \
Wolfgang Denka1be4762008-05-20 16:00:29 +0200365 EBC0_BNCR_BAS_ENCODE(0x94000000) | \
366 EBC0_BNCR_BS_1MB | \
367 EBC0_BNCR_BU_RW | \
Stefan Roese363330b2005-08-04 17:09:16 +0200368 EBC0_BNCR_BW_32BIT
369
370int board_early_init_f(void)
371{
372 ext_bus_cntlr_init();
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200373
374 /*--------------------------------------------------------------------
375 * Setup the interrupt controller polarities, triggers, etc.
376 *-------------------------------------------------------------------*/
Stefan Roese707fd362009-09-24 09:55:50 +0200377 mtdcr(UIC0SR, 0xffffffff); /* clear all */
378 mtdcr(UIC0ER, 0x00000000); /* disable all */
379 mtdcr(UIC0CR, 0x00000009); /* ATI & UIC1 crit are critical */
380 mtdcr(UIC0PR, 0xfffffe13); /* per ref-board manual */
381 mtdcr(UIC0TR, 0x01c00008); /* per ref-board manual */
382 mtdcr(UIC0VR, 0x00000001); /* int31 highest, base=0x000 */
383 mtdcr(UIC0SR, 0xffffffff); /* clear all */
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200384
Stefan Roese707fd362009-09-24 09:55:50 +0200385 mtdcr(UIC1SR, 0xffffffff); /* clear all */
386 mtdcr(UIC1ER, 0x00000000); /* disable all */
387 mtdcr(UIC1CR, 0x00000000); /* all non-critical */
388 mtdcr(UIC1PR, 0xffffe0ff); /* per ref-board manual */
389 mtdcr(UIC1TR, 0x00ffc000); /* per ref-board manual */
390 mtdcr(UIC1VR, 0x00000001); /* int31 highest, base=0x000 */
391 mtdcr(UIC1SR, 0xffffffff); /* clear all */
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200392
393 /*--------------------------------------------------------------------
394 * Setup the GPIO pins
395 *-------------------------------------------------------------------*/
Stefan Roese363330b2005-08-04 17:09:16 +0200396 out32(GPIO0_OSRL, 0x00000400);
397 out32(GPIO0_OSRH, 0x00000000);
398 out32(GPIO0_TSRL, 0x00000400);
399 out32(GPIO0_TSRH, 0x00000000);
400 out32(GPIO0_ISR1L, 0x00000000);
401 out32(GPIO0_ISR1H, 0x00000000);
402 out32(GPIO0_ISR2L, 0x00000000);
403 out32(GPIO0_ISR2H, 0x00000000);
404 out32(GPIO0_ISR3L, 0x00000000);
405 out32(GPIO0_ISR3H, 0x00000000);
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200406
Stefan Roese363330b2005-08-04 17:09:16 +0200407 out32(GPIO1_OSRL, 0x0C380000);
408 out32(GPIO1_OSRH, 0x00000000);
409 out32(GPIO1_TSRL, 0x0C380000);
410 out32(GPIO1_TSRH, 0x00000000);
411 out32(GPIO1_ISR1L, 0x0FC30000);
412 out32(GPIO1_ISR1H, 0x00000000);
413 out32(GPIO1_ISR2L, 0x0C010000);
414 out32(GPIO1_ISR2H, 0x00000000);
415 out32(GPIO1_ISR3L, 0x01400000);
416 out32(GPIO1_ISR3H, 0x00000000);
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200417
Stefan Roese363330b2005-08-04 17:09:16 +0200418 configure_ppc440ep_pins();
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200419
420 return 0;
421}
Stefan Roese797d8572005-08-11 17:56:56 +0200422
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200423int checkboard(void)
424{
Wolfgang Denk5c1cfee2011-05-04 10:32:28 +0000425 char buf[64];
426 int i = getenv_f("serial#", buf, sizeof(buf));
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200427
428 printf("Board: Bamboo - AMCC PPC440EP Evaluation Board");
Wolfgang Denk5c1cfee2011-05-04 10:32:28 +0000429 if (i > 0) {
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200430 puts(", serial# ");
Wolfgang Denk5c1cfee2011-05-04 10:32:28 +0000431 puts(buf);
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200432 }
433 putc('\n');
434
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200435 return (0);
436}
437
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200438
Simon Glassb4de3f32017-03-31 08:40:24 -0600439phys_size_t initdram(void)
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200440{
Masahiro Yamada04cfea52016-09-06 22:17:38 +0900441 return spd_sdram();
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200442}
443
Stefan Roese363330b2005-08-04 17:09:16 +0200444/*----------------------------------------------------------------------------+
445 | is_powerpc440ep_pass1.
446 +----------------------------------------------------------------------------*/
447int is_powerpc440ep_pass1(void)
448{
449 unsigned long pvr;
450
451 pvr = get_pvr();
452
453 if (pvr == PVR_POWERPC_440EP_PASS1)
York Sun4a598092013-04-01 11:29:11 -0700454 return true;
Stefan Roese363330b2005-08-04 17:09:16 +0200455 else if (pvr == PVR_POWERPC_440EP_PASS2)
York Sun4a598092013-04-01 11:29:11 -0700456 return false;
Stefan Roese363330b2005-08-04 17:09:16 +0200457 else {
458 printf("brdutil error 3\n");
459 for (;;)
460 ;
461 }
462
York Sun4a598092013-04-01 11:29:11 -0700463 return false;
Stefan Roese363330b2005-08-04 17:09:16 +0200464}
465
466/*----------------------------------------------------------------------------+
467 | is_nand_selected.
468 +----------------------------------------------------------------------------*/
469int is_nand_selected(void)
470{
Stefan Roese797d8572005-08-11 17:56:56 +0200471#ifdef CONFIG_BAMBOO_NAND
York Sun4a598092013-04-01 11:29:11 -0700472 return true;
Stefan Roese797d8572005-08-11 17:56:56 +0200473#else
York Sun4a598092013-04-01 11:29:11 -0700474 return false;
Stefan Roese797d8572005-08-11 17:56:56 +0200475#endif
Stefan Roese363330b2005-08-04 17:09:16 +0200476}
477
478/*----------------------------------------------------------------------------+
479 | config_on_ebc_cs4_is_small_flash => from EPLD
480 +----------------------------------------------------------------------------*/
481unsigned char config_on_ebc_cs4_is_small_flash(void)
482{
483 /* Not implemented yet => returns constant value */
York Sun4a598092013-04-01 11:29:11 -0700484 return true;
Stefan Roese363330b2005-08-04 17:09:16 +0200485}
486
487/*----------------------------------------------------------------------------+
488 | Ext_bus_cntlr_init.
489 | Initialize the external bus controller
490 +----------------------------------------------------------------------------*/
491void ext_bus_cntlr_init(void)
492{
493 unsigned long sdr0_pstrp0, sdr0_sdstp1;
494 unsigned long bootstrap_settings, boot_selection, ebc_boot_size;
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200495 int computed_boot_device = BOOT_DEVICE_UNKNOWN;
Stefan Roese363330b2005-08-04 17:09:16 +0200496 unsigned long ebc0_cs0_bnap_value = 0, ebc0_cs0_bncr_value = 0;
497 unsigned long ebc0_cs1_bnap_value = 0, ebc0_cs1_bncr_value = 0;
498 unsigned long ebc0_cs2_bnap_value = 0, ebc0_cs2_bncr_value = 0;
499 unsigned long ebc0_cs3_bnap_value = 0, ebc0_cs3_bncr_value = 0;
500 unsigned long ebc0_cs4_bnap_value = 0, ebc0_cs4_bncr_value = 0;
501
502
503 /*-------------------------------------------------------------------------+
504 |
505 | PART 1 : Initialize EBC Bank 5
506 | ==============================
507 | Bank5 is always associated to the NVRAM/EPLD.
508 | It has to be initialized prior to other banks settings computation since
509 | some board registers values may be needed
510 |
511 +-------------------------------------------------------------------------*/
512 /* NVRAM - FPGA */
Stefan Roese918010a2009-09-09 16:25:29 +0200513 mtebc(PB5AP, EBC0_BNAP_NVRAM_FPGA);
514 mtebc(PB5CR, EBC0_BNCR_NVRAM_FPGA_CS5);
Stefan Roese363330b2005-08-04 17:09:16 +0200515
516 /*-------------------------------------------------------------------------+
517 |
518 | PART 2 : Determine which boot device was selected
519 | =========================================
520 |
521 | Read Pin Strap Register in PPC440EP
522 | In case of boot from IIC, read Serial Device Strap Register1
523 |
524 | Result can either be :
525 | - Boot from EBC 8bits => SMALL FLASH
526 | - Boot from EBC 16bits => Large Flash or SRAM
527 | - Boot from NAND Flash
528 | - Boot from PCI
529 |
530 +-------------------------------------------------------------------------*/
531 /* Read Pin Strap Register in PPC440EP */
Stefan Roese95ca5fa2010-09-11 09:31:43 +0200532 mfsdr(SDR0_PINSTP, sdr0_pstrp0);
Stefan Roese363330b2005-08-04 17:09:16 +0200533 bootstrap_settings = sdr0_pstrp0 & SDR0_PSTRP0_BOOTSTRAP_MASK;
534
535 /*-------------------------------------------------------------------------+
536 | PPC440EP Pass1
537 +-------------------------------------------------------------------------*/
York Sun4a598092013-04-01 11:29:11 -0700538 if (is_powerpc440ep_pass1() == true) {
Stefan Roese363330b2005-08-04 17:09:16 +0200539 switch(bootstrap_settings) {
540 case SDR0_PSTRP0_BOOTSTRAP_SETTINGS0:
541 /* Default Strap Settings 0 : CPU 400 - PLB 133 - Boot EBC 8 bit 33MHz */
542 /* Boot from Small Flash */
543 computed_boot_device = BOOT_FROM_SMALL_FLASH;
544 break;
545 case SDR0_PSTRP0_BOOTSTRAP_SETTINGS1:
546 /* Default Strap Settings 1 : CPU 533 - PLB 133 - Boot PCI 66MHz */
547 /* Boot from PCI */
548 computed_boot_device = BOOT_FROM_PCI;
549 break;
550
551 case SDR0_PSTRP0_BOOTSTRAP_SETTINGS2:
552 /* Default Strap Settings 2 : CPU 500 - PLB 100 - Boot NDFC16 66MHz */
553 /* Boot from Nand Flash */
554 computed_boot_device = BOOT_FROM_NAND_FLASH0;
555 break;
556
557 case SDR0_PSTRP0_BOOTSTRAP_SETTINGS3:
558 /* Default Strap Settings 3 : CPU 333 - PLB 133 - Boot EBC 8 bit 66MHz */
559 /* Boot from Small Flash */
560 computed_boot_device = BOOT_FROM_SMALL_FLASH;
561 break;
562
563 case SDR0_PSTRP0_BOOTSTRAP_IIC_A8_EN:
564 case SDR0_PSTRP0_BOOTSTRAP_IIC_A4_EN:
565 /* Boot Settings in IIC EEprom address 0xA8 or 0xA4 */
566 /* Read Serial Device Strap Register1 in PPC440EP */
Stefan Roese918010a2009-09-09 16:25:29 +0200567 mfsdr(SDR0_SDSTP1, sdr0_sdstp1);
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200568 boot_selection = sdr0_sdstp1 & SDR0_SDSTP1_BOOT_SEL_MASK;
569 ebc_boot_size = sdr0_sdstp1 & SDR0_SDSTP1_EBC_ROM_BS_MASK;
Stefan Roese363330b2005-08-04 17:09:16 +0200570
571 switch(boot_selection) {
572 case SDR0_SDSTP1_BOOT_SEL_EBC:
573 switch(ebc_boot_size) {
574 case SDR0_SDSTP1_EBC_ROM_BS_16BIT:
575 computed_boot_device = BOOT_FROM_LARGE_FLASH_OR_SRAM;
576 break;
577 case SDR0_SDSTP1_EBC_ROM_BS_8BIT:
578 computed_boot_device = BOOT_FROM_SMALL_FLASH;
579 break;
580 }
581 break;
582
583 case SDR0_SDSTP1_BOOT_SEL_PCI:
584 computed_boot_device = BOOT_FROM_PCI;
585 break;
586
587 case SDR0_SDSTP1_BOOT_SEL_NDFC:
588 computed_boot_device = BOOT_FROM_NAND_FLASH0;
589 break;
590 }
591 break;
592 }
593 }
594
595 /*-------------------------------------------------------------------------+
596 | PPC440EP Pass2
597 +-------------------------------------------------------------------------*/
598 else {
599 switch(bootstrap_settings) {
600 case SDR0_PSTRP0_BOOTSTRAP_SETTINGS0:
601 /* Default Strap Settings 0 : CPU 400 - PLB 133 - Boot EBC 8 bit 33MHz */
602 /* Boot from Small Flash */
603 computed_boot_device = BOOT_FROM_SMALL_FLASH;
604 break;
605 case SDR0_PSTRP0_BOOTSTRAP_SETTINGS1:
606 /* Default Strap Settings 1 : CPU 333 - PLB 133 - Boot PCI 66MHz */
607 /* Boot from PCI */
608 computed_boot_device = BOOT_FROM_PCI;
609 break;
610
611 case SDR0_PSTRP0_BOOTSTRAP_SETTINGS2:
612 /* Default Strap Settings 2 : CPU 400 - PLB 100 - Boot NDFC16 33MHz */
613 /* Boot from Nand Flash */
614 computed_boot_device = BOOT_FROM_NAND_FLASH0;
615 break;
616
617 case SDR0_PSTRP0_BOOTSTRAP_SETTINGS3:
618 /* Default Strap Settings 3 : CPU 400 - PLB 100 - Boot EBC 16 bit 33MHz */
619 /* Boot from Large Flash or SRAM */
620 computed_boot_device = BOOT_FROM_LARGE_FLASH_OR_SRAM;
621 break;
622
623 case SDR0_PSTRP0_BOOTSTRAP_SETTINGS4:
624 /* Default Strap Settings 4 : CPU 333 - PLB 133 - Boot EBC 16 bit 66MHz */
625 /* Boot from Large Flash or SRAM */
626 computed_boot_device = BOOT_FROM_LARGE_FLASH_OR_SRAM;
627 break;
628
629 case SDR0_PSTRP0_BOOTSTRAP_SETTINGS6:
630 /* Default Strap Settings 6 : CPU 400 - PLB 100 - Boot PCI 33MHz */
631 /* Boot from PCI */
632 computed_boot_device = BOOT_FROM_PCI;
633 break;
634
635 case SDR0_PSTRP0_BOOTSTRAP_IIC_A8_EN:
636 case SDR0_PSTRP0_BOOTSTRAP_IIC_A4_EN:
637 /* Default Strap Settings 5-7 */
638 /* Boot Settings in IIC EEprom address 0xA8 or 0xA4 */
639 /* Read Serial Device Strap Register1 in PPC440EP */
Stefan Roese918010a2009-09-09 16:25:29 +0200640 mfsdr(SDR0_SDSTP1, sdr0_sdstp1);
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200641 boot_selection = sdr0_sdstp1 & SDR0_SDSTP1_BOOT_SEL_MASK;
642 ebc_boot_size = sdr0_sdstp1 & SDR0_SDSTP1_EBC_ROM_BS_MASK;
Stefan Roese363330b2005-08-04 17:09:16 +0200643
644 switch(boot_selection) {
645 case SDR0_SDSTP1_BOOT_SEL_EBC:
646 switch(ebc_boot_size) {
647 case SDR0_SDSTP1_EBC_ROM_BS_16BIT:
648 computed_boot_device = BOOT_FROM_LARGE_FLASH_OR_SRAM;
649 break;
650 case SDR0_SDSTP1_EBC_ROM_BS_8BIT:
651 computed_boot_device = BOOT_FROM_SMALL_FLASH;
652 break;
653 }
654 break;
655
656 case SDR0_SDSTP1_BOOT_SEL_PCI:
657 computed_boot_device = BOOT_FROM_PCI;
658 break;
659
660 case SDR0_SDSTP1_BOOT_SEL_NDFC:
661 computed_boot_device = BOOT_FROM_NAND_FLASH0;
662 break;
663 }
664 break;
665 }
666 }
667
668 /*-------------------------------------------------------------------------+
669 |
670 | PART 3 : Compute EBC settings depending on selected boot device
671 | ====== ======================================================
672 |
673 | Resulting EBC init will be among following configurations :
674 |
675 | - Boot from EBC 8bits => boot from SMALL FLASH selected
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200676 | EBC-CS0 = Small Flash
677 | EBC-CS1,2,3 = NAND Flash or
678 | Exp.Slot depending on Soft Config
679 | EBC-CS4 = SRAM/Large Flash or
680 | Large Flash/SRAM depending on jumpers
681 | EBC-CS5 = NVRAM / EPLD
Stefan Roese363330b2005-08-04 17:09:16 +0200682 |
683 | - Boot from EBC 16bits => boot from Large Flash or SRAM selected
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200684 | EBC-CS0 = SRAM/Large Flash or
685 | Large Flash/SRAM depending on jumpers
686 | EBC-CS1,2,3 = NAND Flash or
687 | Exp.Slot depending on Software Configuration
688 | EBC-CS4 = Small Flash
689 | EBC-CS5 = NVRAM / EPLD
Stefan Roese363330b2005-08-04 17:09:16 +0200690 |
691 | - Boot from NAND Flash
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200692 | EBC-CS0 = NAND Flash0
693 | EBC-CS1,2,3 = NAND Flash1
694 | EBC-CS4 = SRAM/Large Flash or
695 | Large Flash/SRAM depending on jumpers
696 | EBC-CS5 = NVRAM / EPLD
Stefan Roese363330b2005-08-04 17:09:16 +0200697 |
698 | - Boot from PCI
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200699 | EBC-CS0 = ...
700 | EBC-CS1,2,3 = NAND Flash or
701 | Exp.Slot depending on Software Configuration
702 | EBC-CS4 = SRAM/Large Flash or
703 | Large Flash/SRAM or
704 | Small Flash depending on jumpers
705 | EBC-CS5 = NVRAM / EPLD
Stefan Roese363330b2005-08-04 17:09:16 +0200706 |
707 +-------------------------------------------------------------------------*/
708
709 switch(computed_boot_device) {
710 /*------------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200711 case BOOT_FROM_SMALL_FLASH:
Stefan Roese363330b2005-08-04 17:09:16 +0200712 /*------------------------------------------------------------------------- */
713 ebc0_cs0_bnap_value = EBC0_BNAP_SMALL_FLASH;
714 ebc0_cs0_bncr_value = EBC0_BNCR_SMALL_FLASH_CS0;
York Sun4a598092013-04-01 11:29:11 -0700715 if ((is_nand_selected()) == true) {
Stefan Roese363330b2005-08-04 17:09:16 +0200716 /* NAND Flash */
717 ebc0_cs1_bnap_value = EBC0_BNAP_NAND_FLASH;
718 ebc0_cs1_bncr_value = EBC0_BNCR_NAND_FLASH_CS1;
Stefan Roese797d8572005-08-11 17:56:56 +0200719 ebc0_cs2_bnap_value = EBC0_BNAP_NAND_FLASH;
720 ebc0_cs2_bncr_value = EBC0_BNCR_NAND_FLASH_CS2;
Stefan Roese363330b2005-08-04 17:09:16 +0200721 ebc0_cs3_bnap_value = 0;
722 ebc0_cs3_bncr_value = 0;
723 } else {
724 /* Expansion Slot */
725 ebc0_cs1_bnap_value = 0;
726 ebc0_cs1_bncr_value = 0;
727 ebc0_cs2_bnap_value = 0;
728 ebc0_cs2_bncr_value = 0;
729 ebc0_cs3_bnap_value = 0;
730 ebc0_cs3_bncr_value = 0;
731 }
732 ebc0_cs4_bnap_value = EBC0_BNAP_LARGE_FLASH_OR_SRAM;
733 ebc0_cs4_bncr_value = EBC0_BNCR_LARGE_FLASH_OR_SRAM_CS4;
734
735 break;
736
737 /*------------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200738 case BOOT_FROM_LARGE_FLASH_OR_SRAM:
Stefan Roese363330b2005-08-04 17:09:16 +0200739 /*------------------------------------------------------------------------- */
740 ebc0_cs0_bnap_value = EBC0_BNAP_LARGE_FLASH_OR_SRAM;
741 ebc0_cs0_bncr_value = EBC0_BNCR_LARGE_FLASH_OR_SRAM_CS0;
York Sun4a598092013-04-01 11:29:11 -0700742 if ((is_nand_selected()) == true) {
Stefan Roese363330b2005-08-04 17:09:16 +0200743 /* NAND Flash */
744 ebc0_cs1_bnap_value = EBC0_BNAP_NAND_FLASH;
745 ebc0_cs1_bncr_value = EBC0_BNCR_NAND_FLASH_CS1;
746 ebc0_cs2_bnap_value = 0;
747 ebc0_cs2_bncr_value = 0;
748 ebc0_cs3_bnap_value = 0;
749 ebc0_cs3_bncr_value = 0;
750 } else {
751 /* Expansion Slot */
752 ebc0_cs1_bnap_value = 0;
753 ebc0_cs1_bncr_value = 0;
754 ebc0_cs2_bnap_value = 0;
755 ebc0_cs2_bncr_value = 0;
756 ebc0_cs3_bnap_value = 0;
757 ebc0_cs3_bncr_value = 0;
758 }
759 ebc0_cs4_bnap_value = EBC0_BNAP_SMALL_FLASH;
760 ebc0_cs4_bncr_value = EBC0_BNCR_SMALL_FLASH_CS4;
761
762 break;
763
764 /*------------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200765 case BOOT_FROM_NAND_FLASH0:
Stefan Roese363330b2005-08-04 17:09:16 +0200766 /*------------------------------------------------------------------------- */
Stefan Roesec7698642007-06-01 15:19:29 +0200767 ebc0_cs0_bnap_value = EBC0_BNAP_NAND_FLASH;
768 ebc0_cs0_bncr_value = EBC0_BNCR_NAND_FLASH_CS1;
Stefan Roese363330b2005-08-04 17:09:16 +0200769
Stefan Roesec7698642007-06-01 15:19:29 +0200770 ebc0_cs1_bnap_value = 0;
771 ebc0_cs1_bncr_value = 0;
Stefan Roese363330b2005-08-04 17:09:16 +0200772 ebc0_cs2_bnap_value = 0;
773 ebc0_cs2_bncr_value = 0;
774 ebc0_cs3_bnap_value = 0;
775 ebc0_cs3_bncr_value = 0;
776
777 /* Large Flash or SRAM */
778 ebc0_cs4_bnap_value = EBC0_BNAP_LARGE_FLASH_OR_SRAM;
779 ebc0_cs4_bncr_value = EBC0_BNCR_LARGE_FLASH_OR_SRAM_CS4;
780
781 break;
782
783 /*------------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200784 case BOOT_FROM_PCI:
Stefan Roese363330b2005-08-04 17:09:16 +0200785 /*------------------------------------------------------------------------- */
786 ebc0_cs0_bnap_value = 0;
787 ebc0_cs0_bncr_value = 0;
788
York Sun4a598092013-04-01 11:29:11 -0700789 if ((is_nand_selected()) == true) {
Stefan Roese363330b2005-08-04 17:09:16 +0200790 /* NAND Flash */
791 ebc0_cs1_bnap_value = EBC0_BNAP_NAND_FLASH;
792 ebc0_cs1_bncr_value = EBC0_BNCR_NAND_FLASH_CS1;
793 ebc0_cs2_bnap_value = 0;
794 ebc0_cs2_bncr_value = 0;
795 ebc0_cs3_bnap_value = 0;
796 ebc0_cs3_bncr_value = 0;
797 } else {
798 /* Expansion Slot */
799 ebc0_cs1_bnap_value = 0;
800 ebc0_cs1_bncr_value = 0;
801 ebc0_cs2_bnap_value = 0;
802 ebc0_cs2_bncr_value = 0;
803 ebc0_cs3_bnap_value = 0;
804 ebc0_cs3_bncr_value = 0;
805 }
806
York Sun4a598092013-04-01 11:29:11 -0700807 if ((config_on_ebc_cs4_is_small_flash()) == true) {
Stefan Roese363330b2005-08-04 17:09:16 +0200808 /* Small Flash */
809 ebc0_cs4_bnap_value = EBC0_BNAP_SMALL_FLASH;
810 ebc0_cs4_bncr_value = EBC0_BNCR_SMALL_FLASH_CS4;
811 } else {
812 /* Large Flash or SRAM */
813 ebc0_cs4_bnap_value = EBC0_BNAP_LARGE_FLASH_OR_SRAM;
814 ebc0_cs4_bncr_value = EBC0_BNCR_LARGE_FLASH_OR_SRAM_CS4;
815 }
816
817 break;
818
819 /*------------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200820 case BOOT_DEVICE_UNKNOWN:
Stefan Roese363330b2005-08-04 17:09:16 +0200821 /*------------------------------------------------------------------------- */
822 /* Error */
823 break;
824
825 }
826
827
828 /*-------------------------------------------------------------------------+
829 | Initialize EBC CONFIG
830 +-------------------------------------------------------------------------*/
Stefan Roese918010a2009-09-09 16:25:29 +0200831 mtdcr(EBC0_CFGADDR, EBC0_CFG);
832 mtdcr(EBC0_CFGDATA, EBC0_CFG_EBTC_DRIVEN |
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200833 EBC0_CFG_PTD_ENABLED |
834 EBC0_CFG_RTC_2048PERCLK |
835 EBC0_CFG_EMPL_LOW |
836 EBC0_CFG_EMPH_LOW |
837 EBC0_CFG_CSTC_DRIVEN |
838 EBC0_CFG_BPF_ONEDW |
839 EBC0_CFG_EMS_8BIT |
840 EBC0_CFG_PME_DISABLED |
841 EBC0_CFG_PMT_ENCODE(0) );
Stefan Roese363330b2005-08-04 17:09:16 +0200842
843 /*-------------------------------------------------------------------------+
844 | Initialize EBC Bank 0-4
845 +-------------------------------------------------------------------------*/
846 /* EBC Bank0 */
Stefan Roese918010a2009-09-09 16:25:29 +0200847 mtebc(PB0AP, ebc0_cs0_bnap_value);
848 mtebc(PB0CR, ebc0_cs0_bncr_value);
Stefan Roese363330b2005-08-04 17:09:16 +0200849 /* EBC Bank1 */
Stefan Roese918010a2009-09-09 16:25:29 +0200850 mtebc(PB1AP, ebc0_cs1_bnap_value);
851 mtebc(PB1CR, ebc0_cs1_bncr_value);
Stefan Roese363330b2005-08-04 17:09:16 +0200852 /* EBC Bank2 */
Stefan Roese918010a2009-09-09 16:25:29 +0200853 mtebc(PB2AP, ebc0_cs2_bnap_value);
854 mtebc(PB2CR, ebc0_cs2_bncr_value);
Stefan Roese363330b2005-08-04 17:09:16 +0200855 /* EBC Bank3 */
Stefan Roese918010a2009-09-09 16:25:29 +0200856 mtebc(PB3AP, ebc0_cs3_bnap_value);
857 mtebc(PB3CR, ebc0_cs3_bncr_value);
Stefan Roese363330b2005-08-04 17:09:16 +0200858 /* EBC Bank4 */
Stefan Roese918010a2009-09-09 16:25:29 +0200859 mtebc(PB4AP, ebc0_cs4_bnap_value);
860 mtebc(PB4CR, ebc0_cs4_bncr_value);
Stefan Roese363330b2005-08-04 17:09:16 +0200861
862 return;
863}
864
865
866/*----------------------------------------------------------------------------+
867 | get_uart_configuration.
868 +----------------------------------------------------------------------------*/
869uart_config_nb_t get_uart_configuration(void)
870{
Stefan Roese797d8572005-08-11 17:56:56 +0200871 return (L4);
Stefan Roese363330b2005-08-04 17:09:16 +0200872}
873
874/*----------------------------------------------------------------------------+
875 | set_phy_configuration_through_fpga => to EPLD
876 +----------------------------------------------------------------------------*/
877void set_phy_configuration_through_fpga(zmii_config_t config)
878{
879
880 unsigned long fpga_selection_reg;
881
882 fpga_selection_reg = in8(FPGA_SELECTION_1_REG) & ~FPGA_SEL_1_REG_PHY_MASK;
883
884 switch(config)
885 {
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200886 case ZMII_CONFIGURATION_IS_MII:
Stefan Roese363330b2005-08-04 17:09:16 +0200887 fpga_selection_reg = fpga_selection_reg | FPGA_SEL_1_REG_MII;
888 break;
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200889 case ZMII_CONFIGURATION_IS_RMII:
Stefan Roese363330b2005-08-04 17:09:16 +0200890 fpga_selection_reg = fpga_selection_reg | FPGA_SEL_1_REG_RMII;
891 break;
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200892 case ZMII_CONFIGURATION_IS_SMII:
Stefan Roese363330b2005-08-04 17:09:16 +0200893 fpga_selection_reg = fpga_selection_reg | FPGA_SEL_1_REG_SMII;
894 break;
Wolfgang Denk8dd4d332005-08-06 01:42:58 +0200895 case ZMII_CONFIGURATION_UNKNOWN:
896 default:
Stefan Roese363330b2005-08-04 17:09:16 +0200897 break;
898 }
899 out8(FPGA_SELECTION_1_REG,fpga_selection_reg);
900
901}
902
903/*----------------------------------------------------------------------------+
904 | scp_selection_in_fpga.
905 +----------------------------------------------------------------------------*/
906void scp_selection_in_fpga(void)
907{
908 unsigned long fpga_selection_2_reg;
909
910 fpga_selection_2_reg = in8(FPGA_SELECTION_2_REG) & ~FPGA_SEL2_REG_IIC1_SCP_SEL_MASK;
911 fpga_selection_2_reg |= FPGA_SEL2_REG_SEL_SCP;
912 out8(FPGA_SELECTION_2_REG,fpga_selection_2_reg);
913}
914
915/*----------------------------------------------------------------------------+
916 | iic1_selection_in_fpga.
917 +----------------------------------------------------------------------------*/
918void iic1_selection_in_fpga(void)
919{
920 unsigned long fpga_selection_2_reg;
921
922 fpga_selection_2_reg = in8(FPGA_SELECTION_2_REG) & ~FPGA_SEL2_REG_IIC1_SCP_SEL_MASK;
923 fpga_selection_2_reg |= FPGA_SEL2_REG_SEL_IIC1;
924 out8(FPGA_SELECTION_2_REG,fpga_selection_2_reg);
925}
926
927/*----------------------------------------------------------------------------+
928 | dma_a_b_selection_in_fpga.
929 +----------------------------------------------------------------------------*/
930void dma_a_b_selection_in_fpga(void)
931{
932 unsigned long fpga_selection_2_reg;
933
934 fpga_selection_2_reg = in8(FPGA_SELECTION_2_REG) | FPGA_SEL2_REG_SEL_DMA_A_B;
935 out8(FPGA_SELECTION_2_REG,fpga_selection_2_reg);
936}
937
938/*----------------------------------------------------------------------------+
939 | dma_a_b_unselect_in_fpga.
940 +----------------------------------------------------------------------------*/
941void dma_a_b_unselect_in_fpga(void)
942{
943 unsigned long fpga_selection_2_reg;
944
945 fpga_selection_2_reg = in8(FPGA_SELECTION_2_REG) & ~FPGA_SEL2_REG_SEL_DMA_A_B;
946 out8(FPGA_SELECTION_2_REG,fpga_selection_2_reg);
947}
948
949/*----------------------------------------------------------------------------+
950 | dma_c_d_selection_in_fpga.
951 +----------------------------------------------------------------------------*/
952void dma_c_d_selection_in_fpga(void)
953{
954 unsigned long fpga_selection_2_reg;
955
956 fpga_selection_2_reg = in8(FPGA_SELECTION_2_REG) | FPGA_SEL2_REG_SEL_DMA_C_D;
957 out8(FPGA_SELECTION_2_REG,fpga_selection_2_reg);
958}
959
960/*----------------------------------------------------------------------------+
961 | dma_c_d_unselect_in_fpga.
962 +----------------------------------------------------------------------------*/
963void dma_c_d_unselect_in_fpga(void)
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200964{
Stefan Roese363330b2005-08-04 17:09:16 +0200965 unsigned long fpga_selection_2_reg;
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200966
Stefan Roese363330b2005-08-04 17:09:16 +0200967 fpga_selection_2_reg = in8(FPGA_SELECTION_2_REG) & ~FPGA_SEL2_REG_SEL_DMA_C_D;
968 out8(FPGA_SELECTION_2_REG,fpga_selection_2_reg);
Stefan Roese3e1f1b32005-08-01 16:49:12 +0200969}
Stefan Roese363330b2005-08-04 17:09:16 +0200970
971/*----------------------------------------------------------------------------+
972 | usb2_device_selection_in_fpga.
973 +----------------------------------------------------------------------------*/
974void usb2_device_selection_in_fpga(void)
975{
976 unsigned long fpga_selection_1_reg;
977
978 fpga_selection_1_reg = in8(FPGA_SELECTION_1_REG) | FPGA_SEL_1_REG_USB2_DEV_SEL;
979 out8(FPGA_SELECTION_1_REG,fpga_selection_1_reg);
980}
981
982/*----------------------------------------------------------------------------+
983 | usb2_device_reset_through_fpga.
984 +----------------------------------------------------------------------------*/
985void usb2_device_reset_through_fpga(void)
986{
987 /* Perform soft Reset pulse */
988 unsigned long fpga_reset_reg;
989 int i;
990
991 fpga_reset_reg = in8(FPGA_RESET_REG);
992 out8(FPGA_RESET_REG,fpga_reset_reg | FPGA_RESET_REG_RESET_USB20_DEV);
993 for (i=0; i<500; i++)
994 udelay(1000);
995 out8(FPGA_RESET_REG,fpga_reset_reg);
996}
997
998/*----------------------------------------------------------------------------+
999 | usb2_host_selection_in_fpga.
1000 +----------------------------------------------------------------------------*/
1001void usb2_host_selection_in_fpga(void)
1002{
1003 unsigned long fpga_selection_1_reg;
1004
1005 fpga_selection_1_reg = in8(FPGA_SELECTION_1_REG) | FPGA_SEL_1_REG_USB2_HOST_SEL;
1006 out8(FPGA_SELECTION_1_REG,fpga_selection_1_reg);
1007}
1008
1009/*----------------------------------------------------------------------------+
1010 | ndfc_selection_in_fpga.
1011 +----------------------------------------------------------------------------*/
1012void ndfc_selection_in_fpga(void)
1013{
1014 unsigned long fpga_selection_1_reg;
1015
1016 fpga_selection_1_reg = in8(FPGA_SELECTION_1_REG) &~FPGA_SEL_1_REG_NF_SELEC_MASK;
1017 fpga_selection_1_reg |= FPGA_SEL_1_REG_NF0_SEL_BY_NFCS1;
Stefan Roese797d8572005-08-11 17:56:56 +02001018 fpga_selection_1_reg |= FPGA_SEL_1_REG_NF1_SEL_BY_NFCS2;
Stefan Roese363330b2005-08-04 17:09:16 +02001019 out8(FPGA_SELECTION_1_REG,fpga_selection_1_reg);
1020}
1021
1022/*----------------------------------------------------------------------------+
1023 | uart_selection_in_fpga.
1024 +----------------------------------------------------------------------------*/
1025void uart_selection_in_fpga(uart_config_nb_t uart_config)
1026{
1027 /* FPGA register */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001028 unsigned char fpga_selection_3_reg;
Stefan Roese363330b2005-08-04 17:09:16 +02001029
1030 /* Read FPGA Reagister */
1031 fpga_selection_3_reg = in8(FPGA_SELECTION_3_REG);
1032
1033 switch (uart_config)
1034 {
1035 case L1:
1036 /* ----------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001037 /* L1 configuration: UART0 = 8 pins */
Stefan Roese363330b2005-08-04 17:09:16 +02001038 /* ----------------------------------------------------------------------- */
1039 /* Configure FPGA */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001040 fpga_selection_3_reg = fpga_selection_3_reg & ~FPGA_SEL3_REG_SEL_UART_CONFIG_MASK;
1041 fpga_selection_3_reg = fpga_selection_3_reg | FPGA_SEL3_REG_SEL_UART_CONFIG1;
Stefan Roese363330b2005-08-04 17:09:16 +02001042 out8(FPGA_SELECTION_3_REG, fpga_selection_3_reg);
1043
1044 break;
1045
1046 case L2:
1047 /* ----------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001048 /* L2 configuration: UART0 = 4 pins */
1049 /* UART1 = 4 pins */
Stefan Roese363330b2005-08-04 17:09:16 +02001050 /* ----------------------------------------------------------------------- */
1051 /* Configure FPGA */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001052 fpga_selection_3_reg = fpga_selection_3_reg & ~FPGA_SEL3_REG_SEL_UART_CONFIG_MASK;
1053 fpga_selection_3_reg = fpga_selection_3_reg | FPGA_SEL3_REG_SEL_UART_CONFIG2;
Stefan Roese363330b2005-08-04 17:09:16 +02001054 out8(FPGA_SELECTION_3_REG, fpga_selection_3_reg);
1055
1056 break;
1057
1058 case L3:
1059 /* ----------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001060 /* L3 configuration: UART0 = 4 pins */
1061 /* UART1 = 2 pins */
1062 /* UART2 = 2 pins */
Stefan Roese363330b2005-08-04 17:09:16 +02001063 /* ----------------------------------------------------------------------- */
1064 /* Configure FPGA */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001065 fpga_selection_3_reg = fpga_selection_3_reg & ~FPGA_SEL3_REG_SEL_UART_CONFIG_MASK;
1066 fpga_selection_3_reg = fpga_selection_3_reg | FPGA_SEL3_REG_SEL_UART_CONFIG3;
Stefan Roese363330b2005-08-04 17:09:16 +02001067 out8(FPGA_SELECTION_3_REG, fpga_selection_3_reg);
1068 break;
1069
1070 case L4:
1071 /* Configure FPGA */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001072 fpga_selection_3_reg = fpga_selection_3_reg & ~FPGA_SEL3_REG_SEL_UART_CONFIG_MASK;
1073 fpga_selection_3_reg = fpga_selection_3_reg | FPGA_SEL3_REG_SEL_UART_CONFIG4;
Stefan Roese363330b2005-08-04 17:09:16 +02001074 out8(FPGA_SELECTION_3_REG, fpga_selection_3_reg);
1075
1076 break;
1077
1078 default:
1079 /* Unsupported UART configuration number */
1080 for (;;)
1081 ;
1082 break;
1083
1084 }
1085}
1086
1087
1088/*----------------------------------------------------------------------------+
1089 | init_default_gpio
1090 +----------------------------------------------------------------------------*/
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001091void init_default_gpio(gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001092{
1093 int i;
1094
1095 /* Init GPIO0 */
1096 for(i=0; i<GPIO_MAX; i++)
1097 {
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001098 gpio_tab[GPIO0][i].add = GPIO0_BASE;
Stefan Roese363330b2005-08-04 17:09:16 +02001099 gpio_tab[GPIO0][i].in_out = GPIO_DIS;
1100 gpio_tab[GPIO0][i].alt_nb = GPIO_SEL;
1101 }
1102
1103 /* Init GPIO1 */
1104 for(i=0; i<GPIO_MAX; i++)
1105 {
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001106 gpio_tab[GPIO1][i].add = GPIO1_BASE;
Stefan Roese363330b2005-08-04 17:09:16 +02001107 gpio_tab[GPIO1][i].in_out = GPIO_DIS;
1108 gpio_tab[GPIO1][i].alt_nb = GPIO_SEL;
1109 }
1110
1111 /* EBC_CS_N(5) - GPIO0_10 */
1112 gpio_tab[GPIO0][10].in_out = GPIO_OUT;
1113 gpio_tab[GPIO0][10].alt_nb = GPIO_ALT1;
1114
1115 /* EBC_CS_N(4) - GPIO0_9 */
1116 gpio_tab[GPIO0][9].in_out = GPIO_OUT;
1117 gpio_tab[GPIO0][9].alt_nb = GPIO_ALT1;
1118}
1119
1120/*----------------------------------------------------------------------------+
1121 | update_uart_ios
1122 +------------------------------------------------------------------------------
1123 |
1124 | Set UART Configuration in PowerPC440EP
1125 |
1126 | +---------------------------------------------------------------------+
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001127 | | Configuartion | Connector | Nb of pins | Pins | Associated |
1128 | | Number | Port Name | available | naming | CORE |
Stefan Roese363330b2005-08-04 17:09:16 +02001129 | +-----------------+---------------+------------+--------+-------------+
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001130 | | L1 | Port_A | 8 | UART | UART core 0 |
Stefan Roese363330b2005-08-04 17:09:16 +02001131 | +-----------------+---------------+------------+--------+-------------+
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001132 | | L2 | Port_A | 4 | UART1 | UART core 0 |
1133 | | (L2D) | Port_B | 4 | UART2 | UART core 1 |
Stefan Roese363330b2005-08-04 17:09:16 +02001134 | +-----------------+---------------+------------+--------+-------------+
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001135 | | L3 | Port_A | 4 | UART1 | UART core 0 |
1136 | | (L3D) | Port_B | 2 | UART2 | UART core 1 |
1137 | | | Port_C | 2 | UART3 | UART core 2 |
Stefan Roese363330b2005-08-04 17:09:16 +02001138 | +-----------------+---------------+------------+--------+-------------+
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001139 | | | Port_A | 2 | UART1 | UART core 0 |
1140 | | L4 | Port_B | 2 | UART2 | UART core 1 |
1141 | | (L4D) | Port_C | 2 | UART3 | UART core 2 |
1142 | | | Port_D | 2 | UART4 | UART core 3 |
Stefan Roese363330b2005-08-04 17:09:16 +02001143 | +-----------------+---------------+------------+--------+-------------+
1144 |
1145 | Involved GPIOs
1146 |
1147 | +------------------------------------------------------------------------------+
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001148 | | GPIO | Aternate 1 | I/O | Alternate 2 | I/O | Alternate 3 | I/O |
Stefan Roese363330b2005-08-04 17:09:16 +02001149 | +---------+------------------+-----+-----------------+-----+-------------+-----+
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001150 | | GPIO1_2 | UART0_DCD_N | I | UART1_DSR_CTS_N | I | UART2_SOUT | O |
1151 | | GPIO1_3 | UART0_8PIN_DSR_N | I | UART1_RTS_DTR_N | O | UART2_SIN | I |
1152 | | GPIO1_4 | UART0_8PIN_CTS_N | I | NA | NA | UART3_SIN | I |
1153 | | GPIO1_5 | UART0_RTS_N | O | NA | NA | UART3_SOUT | O |
1154 | | GPIO1_6 | UART0_DTR_N | O | UART1_SOUT | O | NA | NA |
1155 | | GPIO1_7 | UART0_RI_N | I | UART1_SIN | I | NA | NA |
Stefan Roese363330b2005-08-04 17:09:16 +02001156 | +------------------------------------------------------------------------------+
1157 |
1158 |
1159 +----------------------------------------------------------------------------*/
1160
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001161void update_uart_ios(uart_config_nb_t uart_config, gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001162{
1163 switch (uart_config)
1164 {
1165 case L1:
1166 /* ----------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001167 /* L1 configuration: UART0 = 8 pins */
Stefan Roese363330b2005-08-04 17:09:16 +02001168 /* ----------------------------------------------------------------------- */
1169 /* Update GPIO Configuration Table */
1170 gpio_tab[GPIO1][2].in_out = GPIO_IN;
1171 gpio_tab[GPIO1][2].alt_nb = GPIO_ALT1;
1172
1173 gpio_tab[GPIO1][3].in_out = GPIO_IN;
1174 gpio_tab[GPIO1][3].alt_nb = GPIO_ALT1;
1175
1176 gpio_tab[GPIO1][4].in_out = GPIO_IN;
1177 gpio_tab[GPIO1][4].alt_nb = GPIO_ALT1;
1178
1179 gpio_tab[GPIO1][5].in_out = GPIO_OUT;
1180 gpio_tab[GPIO1][5].alt_nb = GPIO_ALT1;
1181
1182 gpio_tab[GPIO1][6].in_out = GPIO_OUT;
1183 gpio_tab[GPIO1][6].alt_nb = GPIO_ALT1;
1184
1185 gpio_tab[GPIO1][7].in_out = GPIO_IN;
1186 gpio_tab[GPIO1][7].alt_nb = GPIO_ALT1;
1187
1188 break;
1189
1190 case L2:
1191 /* ----------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001192 /* L2 configuration: UART0 = 4 pins */
1193 /* UART1 = 4 pins */
Stefan Roese363330b2005-08-04 17:09:16 +02001194 /* ----------------------------------------------------------------------- */
1195 /* Update GPIO Configuration Table */
1196 gpio_tab[GPIO1][2].in_out = GPIO_IN;
1197 gpio_tab[GPIO1][2].alt_nb = GPIO_ALT2;
1198
1199 gpio_tab[GPIO1][3].in_out = GPIO_OUT;
1200 gpio_tab[GPIO1][3].alt_nb = GPIO_ALT2;
1201
1202 gpio_tab[GPIO1][4].in_out = GPIO_IN;
1203 gpio_tab[GPIO1][4].alt_nb = GPIO_ALT1;
1204
1205 gpio_tab[GPIO1][5].in_out = GPIO_OUT;
1206 gpio_tab[GPIO1][5].alt_nb = GPIO_ALT1;
1207
1208 gpio_tab[GPIO1][6].in_out = GPIO_OUT;
1209 gpio_tab[GPIO1][6].alt_nb = GPIO_ALT2;
1210
1211 gpio_tab[GPIO1][7].in_out = GPIO_IN;
1212 gpio_tab[GPIO1][7].alt_nb = GPIO_ALT2;
1213
1214 break;
1215
1216 case L3:
1217 /* ----------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001218 /* L3 configuration: UART0 = 4 pins */
1219 /* UART1 = 2 pins */
1220 /* UART2 = 2 pins */
Stefan Roese363330b2005-08-04 17:09:16 +02001221 /* ----------------------------------------------------------------------- */
1222 /* Update GPIO Configuration Table */
1223 gpio_tab[GPIO1][2].in_out = GPIO_OUT;
1224 gpio_tab[GPIO1][2].alt_nb = GPIO_ALT3;
1225
1226 gpio_tab[GPIO1][3].in_out = GPIO_IN;
1227 gpio_tab[GPIO1][3].alt_nb = GPIO_ALT3;
1228
1229 gpio_tab[GPIO1][4].in_out = GPIO_IN;
1230 gpio_tab[GPIO1][4].alt_nb = GPIO_ALT1;
1231
1232 gpio_tab[GPIO1][5].in_out = GPIO_OUT;
1233 gpio_tab[GPIO1][5].alt_nb = GPIO_ALT1;
1234
1235 gpio_tab[GPIO1][6].in_out = GPIO_OUT;
1236 gpio_tab[GPIO1][6].alt_nb = GPIO_ALT2;
1237
1238 gpio_tab[GPIO1][7].in_out = GPIO_IN;
1239 gpio_tab[GPIO1][7].alt_nb = GPIO_ALT2;
1240
1241 break;
1242
1243 case L4:
1244 /* ----------------------------------------------------------------------- */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001245 /* L4 configuration: UART0 = 2 pins */
1246 /* UART1 = 2 pins */
1247 /* UART2 = 2 pins */
1248 /* UART3 = 2 pins */
Stefan Roese363330b2005-08-04 17:09:16 +02001249 /* ----------------------------------------------------------------------- */
1250 /* Update GPIO Configuration Table */
1251 gpio_tab[GPIO1][2].in_out = GPIO_OUT;
1252 gpio_tab[GPIO1][2].alt_nb = GPIO_ALT3;
1253
1254 gpio_tab[GPIO1][3].in_out = GPIO_IN;
1255 gpio_tab[GPIO1][3].alt_nb = GPIO_ALT3;
1256
1257 gpio_tab[GPIO1][4].in_out = GPIO_IN;
1258 gpio_tab[GPIO1][4].alt_nb = GPIO_ALT3;
1259
1260 gpio_tab[GPIO1][5].in_out = GPIO_OUT;
1261 gpio_tab[GPIO1][5].alt_nb = GPIO_ALT3;
1262
1263 gpio_tab[GPIO1][6].in_out = GPIO_OUT;
1264 gpio_tab[GPIO1][6].alt_nb = GPIO_ALT2;
1265
1266 gpio_tab[GPIO1][7].in_out = GPIO_IN;
1267 gpio_tab[GPIO1][7].alt_nb = GPIO_ALT2;
1268
1269 break;
1270
1271 default:
1272 /* Unsupported UART configuration number */
1273 printf("ERROR - Unsupported UART configuration number.\n\n");
1274 for (;;)
1275 ;
1276 break;
1277
1278 }
1279
1280 /* Set input Selection Register on Alt_Receive for UART Input Core */
1281 out32(GPIO1_IS1L, (in32(GPIO1_IS1L) | 0x0FC30000));
1282 out32(GPIO1_IS2L, (in32(GPIO1_IS2L) | 0x0C030000));
1283 out32(GPIO1_IS3L, (in32(GPIO1_IS3L) | 0x03C00000));
1284}
1285
1286/*----------------------------------------------------------------------------+
1287 | update_ndfc_ios(void).
1288 +----------------------------------------------------------------------------*/
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001289void update_ndfc_ios(gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001290{
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001291 /* Update GPIO Configuration Table */
1292 gpio_tab[GPIO0][6].in_out = GPIO_OUT; /* EBC_CS_N(1) */
1293 gpio_tab[GPIO0][6].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001294
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001295 gpio_tab[GPIO0][7].in_out = GPIO_OUT; /* EBC_CS_N(2) */
Stefan Roese363330b2005-08-04 17:09:16 +02001296 gpio_tab[GPIO0][7].alt_nb = GPIO_ALT1;
1297
Stefan Roesec7698642007-06-01 15:19:29 +02001298#if 0
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001299 gpio_tab[GPIO0][7].in_out = GPIO_OUT; /* EBC_CS_N(3) */
Stefan Roese363330b2005-08-04 17:09:16 +02001300 gpio_tab[GPIO0][7].alt_nb = GPIO_ALT1;
Stefan Roese3e1f1b32005-08-01 16:49:12 +02001301#endif
Stefan Roese363330b2005-08-04 17:09:16 +02001302}
1303
1304/*----------------------------------------------------------------------------+
1305 | update_zii_ios(void).
1306 +----------------------------------------------------------------------------*/
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001307void update_zii_ios(gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001308{
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001309 /* Update GPIO Configuration Table */
1310 gpio_tab[GPIO0][12].in_out = GPIO_IN; /* ZII_p0Rxd(0) */
1311 gpio_tab[GPIO0][12].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001312
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001313 gpio_tab[GPIO0][13].in_out = GPIO_IN; /* ZII_p0Rxd(1) */
1314 gpio_tab[GPIO0][13].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001315
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001316 gpio_tab[GPIO0][14].in_out = GPIO_IN; /* ZII_p0Rxd(2) */
1317 gpio_tab[GPIO0][14].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001318
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001319 gpio_tab[GPIO0][15].in_out = GPIO_IN; /* ZII_p0Rxd(3) */
1320 gpio_tab[GPIO0][15].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001321
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001322 gpio_tab[GPIO0][16].in_out = GPIO_OUT; /* ZII_p0Txd(0) */
1323 gpio_tab[GPIO0][16].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001324
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001325 gpio_tab[GPIO0][17].in_out = GPIO_OUT; /* ZII_p0Txd(1) */
1326 gpio_tab[GPIO0][17].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001327
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001328 gpio_tab[GPIO0][18].in_out = GPIO_OUT; /* ZII_p0Txd(2) */
1329 gpio_tab[GPIO0][18].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001330
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001331 gpio_tab[GPIO0][19].in_out = GPIO_OUT; /* ZII_p0Txd(3) */
1332 gpio_tab[GPIO0][19].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001333
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001334 gpio_tab[GPIO0][20].in_out = GPIO_IN; /* ZII_p0Rx_er */
1335 gpio_tab[GPIO0][20].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001336
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001337 gpio_tab[GPIO0][21].in_out = GPIO_IN; /* ZII_p0Rx_dv */
1338 gpio_tab[GPIO0][21].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001339
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001340 gpio_tab[GPIO0][22].in_out = GPIO_IN; /* ZII_p0Crs */
1341 gpio_tab[GPIO0][22].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001342
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001343 gpio_tab[GPIO0][23].in_out = GPIO_OUT; /* ZII_p0Tx_er */
1344 gpio_tab[GPIO0][23].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001345
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001346 gpio_tab[GPIO0][24].in_out = GPIO_OUT; /* ZII_p0Tx_en */
1347 gpio_tab[GPIO0][24].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001348
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001349 gpio_tab[GPIO0][25].in_out = GPIO_IN; /* ZII_p0Col */
1350 gpio_tab[GPIO0][25].alt_nb = GPIO_ALT1;
Stefan Roese363330b2005-08-04 17:09:16 +02001351
1352}
1353
1354/*----------------------------------------------------------------------------+
1355 | update_uic_0_3_irq_ios().
1356 +----------------------------------------------------------------------------*/
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001357void update_uic_0_3_irq_ios(gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001358{
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001359 gpio_tab[GPIO1][8].in_out = GPIO_IN; /* UIC_IRQ(0) */
Stefan Roese363330b2005-08-04 17:09:16 +02001360 gpio_tab[GPIO1][8].alt_nb = GPIO_ALT1;
1361
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001362 gpio_tab[GPIO1][9].in_out = GPIO_IN; /* UIC_IRQ(1) */
Stefan Roese363330b2005-08-04 17:09:16 +02001363 gpio_tab[GPIO1][9].alt_nb = GPIO_ALT1;
1364
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001365 gpio_tab[GPIO1][10].in_out = GPIO_IN; /* UIC_IRQ(2) */
Stefan Roese363330b2005-08-04 17:09:16 +02001366 gpio_tab[GPIO1][10].alt_nb = GPIO_ALT1;
1367
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001368 gpio_tab[GPIO1][11].in_out = GPIO_IN; /* UIC_IRQ(3) */
Stefan Roese363330b2005-08-04 17:09:16 +02001369 gpio_tab[GPIO1][11].alt_nb = GPIO_ALT1;
1370}
1371
1372/*----------------------------------------------------------------------------+
1373 | update_uic_4_9_irq_ios().
1374 +----------------------------------------------------------------------------*/
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001375void update_uic_4_9_irq_ios(gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001376{
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001377 gpio_tab[GPIO1][12].in_out = GPIO_IN; /* UIC_IRQ(4) */
Stefan Roese363330b2005-08-04 17:09:16 +02001378 gpio_tab[GPIO1][12].alt_nb = GPIO_ALT1;
1379
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001380 gpio_tab[GPIO1][13].in_out = GPIO_IN; /* UIC_IRQ(6) */
Stefan Roese363330b2005-08-04 17:09:16 +02001381 gpio_tab[GPIO1][13].alt_nb = GPIO_ALT1;
1382
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001383 gpio_tab[GPIO1][14].in_out = GPIO_IN; /* UIC_IRQ(7) */
Stefan Roese363330b2005-08-04 17:09:16 +02001384 gpio_tab[GPIO1][14].alt_nb = GPIO_ALT1;
1385
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001386 gpio_tab[GPIO1][15].in_out = GPIO_IN; /* UIC_IRQ(8) */
Stefan Roese363330b2005-08-04 17:09:16 +02001387 gpio_tab[GPIO1][15].alt_nb = GPIO_ALT1;
1388
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001389 gpio_tab[GPIO1][16].in_out = GPIO_IN; /* UIC_IRQ(9) */
Stefan Roese363330b2005-08-04 17:09:16 +02001390 gpio_tab[GPIO1][16].alt_nb = GPIO_ALT1;
1391}
1392
1393/*----------------------------------------------------------------------------+
1394 | update_dma_a_b_ios().
1395 +----------------------------------------------------------------------------*/
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001396void update_dma_a_b_ios(gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001397{
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001398 gpio_tab[GPIO1][12].in_out = GPIO_OUT; /* DMA_ACK(1) */
Stefan Roese363330b2005-08-04 17:09:16 +02001399 gpio_tab[GPIO1][12].alt_nb = GPIO_ALT2;
1400
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001401 gpio_tab[GPIO1][13].in_out = GPIO_BI; /* DMA_EOT/TC(1) */
Stefan Roese363330b2005-08-04 17:09:16 +02001402 gpio_tab[GPIO1][13].alt_nb = GPIO_ALT2;
1403
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001404 gpio_tab[GPIO1][14].in_out = GPIO_IN; /* DMA_REQ(0) */
Stefan Roese363330b2005-08-04 17:09:16 +02001405 gpio_tab[GPIO1][14].alt_nb = GPIO_ALT2;
1406
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001407 gpio_tab[GPIO1][15].in_out = GPIO_OUT; /* DMA_ACK(0) */
Stefan Roese363330b2005-08-04 17:09:16 +02001408 gpio_tab[GPIO1][15].alt_nb = GPIO_ALT2;
1409
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001410 gpio_tab[GPIO1][16].in_out = GPIO_BI; /* DMA_EOT/TC(0) */
Stefan Roese363330b2005-08-04 17:09:16 +02001411 gpio_tab[GPIO1][16].alt_nb = GPIO_ALT2;
1412}
1413
1414/*----------------------------------------------------------------------------+
1415 | update_dma_c_d_ios().
1416 +----------------------------------------------------------------------------*/
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001417void update_dma_c_d_ios(gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001418{
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001419 gpio_tab[GPIO0][0].in_out = GPIO_IN; /* DMA_REQ(2) */
Stefan Roese363330b2005-08-04 17:09:16 +02001420 gpio_tab[GPIO0][0].alt_nb = GPIO_ALT2;
1421
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001422 gpio_tab[GPIO0][1].in_out = GPIO_OUT; /* DMA_ACK(2) */
Stefan Roese363330b2005-08-04 17:09:16 +02001423 gpio_tab[GPIO0][1].alt_nb = GPIO_ALT2;
1424
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001425 gpio_tab[GPIO0][2].in_out = GPIO_BI; /* DMA_EOT/TC(2) */
Stefan Roese363330b2005-08-04 17:09:16 +02001426 gpio_tab[GPIO0][2].alt_nb = GPIO_ALT2;
1427
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001428 gpio_tab[GPIO0][3].in_out = GPIO_IN; /* DMA_REQ(3) */
Stefan Roese363330b2005-08-04 17:09:16 +02001429 gpio_tab[GPIO0][3].alt_nb = GPIO_ALT2;
1430
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001431 gpio_tab[GPIO0][4].in_out = GPIO_OUT; /* DMA_ACK(3) */
Stefan Roese363330b2005-08-04 17:09:16 +02001432 gpio_tab[GPIO0][4].alt_nb = GPIO_ALT2;
1433
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001434 gpio_tab[GPIO0][5].in_out = GPIO_BI; /* DMA_EOT/TC(3) */
Stefan Roese363330b2005-08-04 17:09:16 +02001435 gpio_tab[GPIO0][5].alt_nb = GPIO_ALT2;
1436
1437}
1438
1439/*----------------------------------------------------------------------------+
1440 | update_ebc_master_ios().
1441 +----------------------------------------------------------------------------*/
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001442void update_ebc_master_ios(gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001443{
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001444 gpio_tab[GPIO0][27].in_out = GPIO_IN; /* EXT_EBC_REQ */
Stefan Roese363330b2005-08-04 17:09:16 +02001445 gpio_tab[GPIO0][27].alt_nb = GPIO_ALT1;
1446
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001447 gpio_tab[GPIO0][29].in_out = GPIO_OUT; /* EBC_EXT_HDLA */
Stefan Roese363330b2005-08-04 17:09:16 +02001448 gpio_tab[GPIO0][29].alt_nb = GPIO_ALT1;
1449
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001450 gpio_tab[GPIO0][30].in_out = GPIO_OUT; /* EBC_EXT_ACK */
Stefan Roese363330b2005-08-04 17:09:16 +02001451 gpio_tab[GPIO0][30].alt_nb = GPIO_ALT1;
1452
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001453 gpio_tab[GPIO0][31].in_out = GPIO_OUT; /* EBC_EXR_BUSREQ */
Stefan Roese363330b2005-08-04 17:09:16 +02001454 gpio_tab[GPIO0][31].alt_nb = GPIO_ALT1;
1455}
1456
1457/*----------------------------------------------------------------------------+
1458 | update_usb2_device_ios().
1459 +----------------------------------------------------------------------------*/
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001460void update_usb2_device_ios(gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001461{
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001462 gpio_tab[GPIO0][26].in_out = GPIO_IN; /* USB2D_RXVALID */
Stefan Roese363330b2005-08-04 17:09:16 +02001463 gpio_tab[GPIO0][26].alt_nb = GPIO_ALT2;
1464
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001465 gpio_tab[GPIO0][27].in_out = GPIO_IN; /* USB2D_RXERROR */
Stefan Roese363330b2005-08-04 17:09:16 +02001466 gpio_tab[GPIO0][27].alt_nb = GPIO_ALT2;
1467
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001468 gpio_tab[GPIO0][28].in_out = GPIO_OUT; /* USB2D_TXVALID */
Stefan Roese363330b2005-08-04 17:09:16 +02001469 gpio_tab[GPIO0][28].alt_nb = GPIO_ALT2;
1470
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001471 gpio_tab[GPIO0][29].in_out = GPIO_OUT; /* USB2D_PAD_SUSPNDM */
Stefan Roese363330b2005-08-04 17:09:16 +02001472 gpio_tab[GPIO0][29].alt_nb = GPIO_ALT2;
1473
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001474 gpio_tab[GPIO0][30].in_out = GPIO_OUT; /* USB2D_XCVRSELECT */
Stefan Roese363330b2005-08-04 17:09:16 +02001475 gpio_tab[GPIO0][30].alt_nb = GPIO_ALT2;
1476
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001477 gpio_tab[GPIO0][31].in_out = GPIO_OUT; /* USB2D_TERMSELECT */
Stefan Roese363330b2005-08-04 17:09:16 +02001478 gpio_tab[GPIO0][31].alt_nb = GPIO_ALT2;
1479
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001480 gpio_tab[GPIO1][0].in_out = GPIO_OUT; /* USB2D_OPMODE0 */
Stefan Roese363330b2005-08-04 17:09:16 +02001481 gpio_tab[GPIO1][0].alt_nb = GPIO_ALT1;
1482
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001483 gpio_tab[GPIO1][1].in_out = GPIO_OUT; /* USB2D_OPMODE1 */
Stefan Roese363330b2005-08-04 17:09:16 +02001484 gpio_tab[GPIO1][1].alt_nb = GPIO_ALT1;
1485
1486}
1487
1488/*----------------------------------------------------------------------------+
1489 | update_pci_patch_ios().
1490 +----------------------------------------------------------------------------*/
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001491void update_pci_patch_ios(gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001492{
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001493 gpio_tab[GPIO0][29].in_out = GPIO_OUT; /* EBC_EXT_HDLA */
Stefan Roese363330b2005-08-04 17:09:16 +02001494 gpio_tab[GPIO0][29].alt_nb = GPIO_ALT1;
1495}
1496
1497/*----------------------------------------------------------------------------+
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001498 | set_chip_gpio_configuration(unsigned char gpio_core,
1499 | gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001500 | Put the core impacted by clock modification and sharing in reset.
1501 | Config the select registers to resolve the sharing depending of the config.
1502 | Configure the GPIO registers.
1503 |
1504 +----------------------------------------------------------------------------*/
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001505void set_chip_gpio_configuration(unsigned char gpio_core, gpio_param_s (*gpio_tab)[GPIO_MAX])
Stefan Roese363330b2005-08-04 17:09:16 +02001506{
1507 unsigned char i=0, j=0, reg_offset = 0;
1508 unsigned long gpio_reg, gpio_core_add;
1509
1510 /* GPIO config of the GPIOs 0 to 31 */
1511 for (i=0; i<GPIO_MAX; i++, j++)
1512 {
1513 if (i == GPIO_MAX/2)
1514 {
1515 reg_offset = 4;
1516 j = i-16;
1517 }
1518
1519 gpio_core_add = gpio_tab[gpio_core][i].add;
1520
1521 if ( (gpio_tab[gpio_core][i].in_out == GPIO_IN) ||
1522 (gpio_tab[gpio_core][i].in_out == GPIO_BI ))
1523 {
1524 switch (gpio_tab[gpio_core][i].alt_nb)
1525 {
1526 case GPIO_SEL:
1527 break;
1528
1529 case GPIO_ALT1:
1530 gpio_reg = in32(GPIO_IS1(gpio_core_add+reg_offset)) & ~(GPIO_MASK >> (j*2));
1531 gpio_reg = gpio_reg | (GPIO_IN_SEL >> (j*2));
1532 out32(GPIO_IS1(gpio_core_add+reg_offset), gpio_reg);
1533 break;
1534
1535 case GPIO_ALT2:
1536 gpio_reg = in32(GPIO_IS2(gpio_core_add+reg_offset)) & ~(GPIO_MASK >> (j*2));
1537 gpio_reg = gpio_reg | (GPIO_IN_SEL >> (j*2));
1538 out32(GPIO_IS2(gpio_core_add+reg_offset), gpio_reg);
1539 break;
1540
1541 case GPIO_ALT3:
1542 gpio_reg = in32(GPIO_IS3(gpio_core_add+reg_offset)) & ~(GPIO_MASK >> (j*2));
1543 gpio_reg = gpio_reg | (GPIO_IN_SEL >> (j*2));
1544 out32(GPIO_IS3(gpio_core_add+reg_offset), gpio_reg);
1545 break;
1546 }
1547 }
1548 if ( (gpio_tab[gpio_core][i].in_out == GPIO_OUT) ||
1549 (gpio_tab[gpio_core][i].in_out == GPIO_BI ))
1550 {
1551
1552 switch (gpio_tab[gpio_core][i].alt_nb)
1553 {
1554 case GPIO_SEL:
1555 break;
1556 case GPIO_ALT1:
1557 gpio_reg = in32(GPIO_OS(gpio_core_add+reg_offset)) & ~(GPIO_MASK >> (j*2));
1558 gpio_reg = gpio_reg | (GPIO_ALT1_SEL >> (j*2));
1559 out32(GPIO_OS(gpio_core_add+reg_offset), gpio_reg);
1560 gpio_reg = in32(GPIO_TS(gpio_core_add+reg_offset)) & ~(GPIO_MASK >> (j*2));
1561 gpio_reg = gpio_reg | (GPIO_ALT1_SEL >> (j*2));
1562 out32(GPIO_TS(gpio_core_add+reg_offset), gpio_reg);
1563 break;
1564 case GPIO_ALT2:
1565 gpio_reg = in32(GPIO_OS(gpio_core_add+reg_offset)) & ~(GPIO_MASK >> (j*2));
1566 gpio_reg = gpio_reg | (GPIO_ALT2_SEL >> (j*2));
1567 out32(GPIO_OS(gpio_core_add+reg_offset), gpio_reg);
1568 gpio_reg = in32(GPIO_TS(gpio_core_add+reg_offset)) & ~(GPIO_MASK >> (j*2));
1569 gpio_reg = gpio_reg | (GPIO_ALT2_SEL >> (j*2));
1570 out32(GPIO_TS(gpio_core_add+reg_offset), gpio_reg);
1571 break;
1572 case GPIO_ALT3:
1573 gpio_reg = in32(GPIO_OS(gpio_core_add+reg_offset)) & ~(GPIO_MASK >> (j*2));
1574 gpio_reg = gpio_reg | (GPIO_ALT3_SEL >> (j*2));
1575 out32(GPIO_OS(gpio_core_add+reg_offset), gpio_reg);
1576 gpio_reg = in32(GPIO_TS(gpio_core_add+reg_offset)) & ~(GPIO_MASK >> (j*2));
1577 gpio_reg = gpio_reg | (GPIO_ALT3_SEL >> (j*2));
1578 out32(GPIO_TS(gpio_core_add+reg_offset), gpio_reg);
1579 break;
1580 }
1581 }
1582 }
1583}
1584
1585/*----------------------------------------------------------------------------+
1586 | force_bup_core_selection.
1587 +----------------------------------------------------------------------------*/
1588void force_bup_core_selection(core_selection_t *core_select_P, config_validity_t *config_val_P)
1589{
1590 /* Pointer invalid */
1591 if (core_select_P == NULL)
1592 {
1593 printf("Configuration invalid pointer 1\n");
1594 for (;;)
1595 ;
1596 }
1597
1598 /* L4 Selection */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001599 *(core_select_P+UART_CORE0) = CORE_SELECTED;
1600 *(core_select_P+UART_CORE1) = CORE_SELECTED;
1601 *(core_select_P+UART_CORE2) = CORE_SELECTED;
1602 *(core_select_P+UART_CORE3) = CORE_SELECTED;
Stefan Roese363330b2005-08-04 17:09:16 +02001603
1604 /* RMII Selection */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001605 *(core_select_P+RMII_SEL) = CORE_SELECTED;
Stefan Roese363330b2005-08-04 17:09:16 +02001606
1607 /* External Interrupt 0-9 selection */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001608 *(core_select_P+UIC_0_3) = CORE_SELECTED;
1609 *(core_select_P+UIC_4_9) = CORE_SELECTED;
Stefan Roese363330b2005-08-04 17:09:16 +02001610
Stefan Roese797d8572005-08-11 17:56:56 +02001611 *(core_select_P+SCP_CORE) = CORE_SELECTED;
1612 *(core_select_P+DMA_CHANNEL_CD) = CORE_SELECTED;
1613 *(core_select_P+PACKET_REJ_FUNC_AVAIL) = CORE_SELECTED;
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001614 *(core_select_P+USB1_DEVICE) = CORE_SELECTED;
Stefan Roese363330b2005-08-04 17:09:16 +02001615
Stefan Roese797d8572005-08-11 17:56:56 +02001616 if (is_nand_selected()) {
1617 *(core_select_P+NAND_FLASH) = CORE_SELECTED;
1618 }
1619
Stefan Roese363330b2005-08-04 17:09:16 +02001620 *config_val_P = CONFIG_IS_VALID;
1621
1622}
1623
1624/*----------------------------------------------------------------------------+
1625 | configure_ppc440ep_pins.
1626 +----------------------------------------------------------------------------*/
1627void configure_ppc440ep_pins(void)
1628{
1629 uart_config_nb_t uart_configuration;
1630 config_validity_t config_val = CONFIG_IS_INVALID;
1631
1632 /* Create Core Selection Table */
1633 core_selection_t ppc440ep_core_selection[MAX_CORE_SELECT_NB] =
1634 {
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001635 CORE_NOT_SELECTED, /* IIC_CORE, */
1636 CORE_NOT_SELECTED, /* SPC_CORE, */
1637 CORE_NOT_SELECTED, /* DMA_CHANNEL_AB, */
1638 CORE_NOT_SELECTED, /* UIC_4_9, */
1639 CORE_NOT_SELECTED, /* USB2_HOST, */
1640 CORE_NOT_SELECTED, /* DMA_CHANNEL_CD, */
1641 CORE_NOT_SELECTED, /* USB2_DEVICE, */
1642 CORE_NOT_SELECTED, /* PACKET_REJ_FUNC_AVAIL, */
1643 CORE_NOT_SELECTED, /* USB1_DEVICE, */
1644 CORE_NOT_SELECTED, /* EBC_MASTER, */
1645 CORE_NOT_SELECTED, /* NAND_FLASH, */
1646 CORE_NOT_SELECTED, /* UART_CORE0, */
1647 CORE_NOT_SELECTED, /* UART_CORE1, */
1648 CORE_NOT_SELECTED, /* UART_CORE2, */
1649 CORE_NOT_SELECTED, /* UART_CORE3, */
1650 CORE_NOT_SELECTED, /* MII_SEL, */
1651 CORE_NOT_SELECTED, /* RMII_SEL, */
1652 CORE_NOT_SELECTED, /* SMII_SEL, */
1653 CORE_NOT_SELECTED, /* PACKET_REJ_FUNC_EN */
1654 CORE_NOT_SELECTED, /* UIC_0_3 */
1655 CORE_NOT_SELECTED, /* USB1_HOST */
1656 CORE_NOT_SELECTED /* PCI_PATCH */
Stefan Roese363330b2005-08-04 17:09:16 +02001657 };
1658
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001659 gpio_param_s gpio_tab[GPIO_GROUP_MAX][GPIO_MAX];
Stefan Roese363330b2005-08-04 17:09:16 +02001660
1661 /* Table Default Initialisation + FPGA Access */
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001662 init_default_gpio(gpio_tab);
1663 set_chip_gpio_configuration(GPIO0, gpio_tab);
1664 set_chip_gpio_configuration(GPIO1, gpio_tab);
Stefan Roese363330b2005-08-04 17:09:16 +02001665
1666 /* Update Table */
1667 force_bup_core_selection(ppc440ep_core_selection, &config_val);
1668#if 0 /* test-only */
1669 /* If we are running PIBS 1, force known configuration */
1670 update_core_selection_table(ppc440ep_core_selection, &config_val);
1671#endif
1672
1673 /*----------------------------------------------------------------------------+
1674 | SDR + ios table update + fpga initialization
1675 +----------------------------------------------------------------------------*/
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001676 unsigned long sdr0_pfc1 = 0;
1677 unsigned long sdr0_usb0 = 0;
1678 unsigned long sdr0_mfr = 0;
Stefan Roese363330b2005-08-04 17:09:16 +02001679
1680 /* PCI Always selected */
1681
1682 /* I2C Selection */
1683 if (ppc440ep_core_selection[IIC_CORE] == CORE_SELECTED)
1684 {
1685 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SIS_MASK) | SDR0_PFC1_SIS_IIC1_SEL;
1686 iic1_selection_in_fpga();
1687 }
1688
1689 /* SCP Selection */
1690 if (ppc440ep_core_selection[SCP_CORE] == CORE_SELECTED)
1691 {
1692 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_SIS_MASK) | SDR0_PFC1_SIS_SCP_SEL;
1693 scp_selection_in_fpga();
1694 }
1695
1696 /* UIC 0:3 Selection */
1697 if (ppc440ep_core_selection[UIC_0_3] == CORE_SELECTED)
1698 {
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001699 update_uic_0_3_irq_ios(gpio_tab);
Stefan Roese363330b2005-08-04 17:09:16 +02001700 dma_a_b_unselect_in_fpga();
1701 }
1702
1703 /* UIC 4:9 Selection */
1704 if (ppc440ep_core_selection[UIC_4_9] == CORE_SELECTED)
1705 {
1706 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_DIS_MASK) | SDR0_PFC1_DIS_UICIRQ5_SEL;
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001707 update_uic_4_9_irq_ios(gpio_tab);
Stefan Roese363330b2005-08-04 17:09:16 +02001708 }
1709
1710 /* DMA AB Selection */
1711 if (ppc440ep_core_selection[DMA_CHANNEL_AB] == CORE_SELECTED)
1712 {
1713 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_DIS_MASK) | SDR0_PFC1_DIS_DMAR_SEL;
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001714 update_dma_a_b_ios(gpio_tab);
Stefan Roese363330b2005-08-04 17:09:16 +02001715 dma_a_b_selection_in_fpga();
1716 }
1717
1718 /* DMA CD Selection */
1719 if (ppc440ep_core_selection[DMA_CHANNEL_CD] == CORE_SELECTED)
1720 {
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001721 update_dma_c_d_ios(gpio_tab);
Stefan Roese363330b2005-08-04 17:09:16 +02001722 dma_c_d_selection_in_fpga();
1723 }
1724
1725 /* EBC Master Selection */
1726 if (ppc440ep_core_selection[EBC_MASTER] == CORE_SELECTED)
1727 {
1728 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_ERE_MASK) | SDR0_PFC1_ERE_EXTR_SEL;
1729 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_UES_MASK) | SDR0_PFC1_UES_EBCHR_SEL;
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001730 update_ebc_master_ios(gpio_tab);
Stefan Roese363330b2005-08-04 17:09:16 +02001731 }
1732
1733 /* PCI Patch Enable */
1734 if (ppc440ep_core_selection[PCI_PATCH] == CORE_SELECTED)
1735 {
1736 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_UES_MASK) | SDR0_PFC1_UES_EBCHR_SEL;
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001737 update_pci_patch_ios(gpio_tab);
Stefan Roese363330b2005-08-04 17:09:16 +02001738 }
1739
1740 /* USB2 Host Selection - Not Implemented in PowerPC 440EP Pass1 */
1741 if (ppc440ep_core_selection[USB2_HOST] == CORE_SELECTED)
1742 {
1743 /* Not Implemented in PowerPC 440EP Pass1-Pass2 */
1744 printf("Invalid configuration => USB2 Host selected\n");
1745 for (;;)
1746 ;
1747 /*usb2_host_selection_in_fpga(); */
1748 }
1749
1750 /* USB2.0 Device Selection */
1751 if (ppc440ep_core_selection[USB2_DEVICE] == CORE_SELECTED)
1752 {
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001753 update_usb2_device_ios(gpio_tab);
Stefan Roese363330b2005-08-04 17:09:16 +02001754 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_UES_MASK) | SDR0_PFC1_UES_USB2D_SEL;
1755 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_UPR_MASK) | SDR0_PFC1_UPR_DISABLE;
1756
Stefan Roese918010a2009-09-09 16:25:29 +02001757 mfsdr(SDR0_USB0, sdr0_usb0);
Stefan Roese363330b2005-08-04 17:09:16 +02001758 sdr0_usb0 = sdr0_usb0 &~SDR0_USB0_USB_DEVSEL_MASK;
1759 sdr0_usb0 = sdr0_usb0 | SDR0_USB0_USB20D_DEVSEL;
Stefan Roese918010a2009-09-09 16:25:29 +02001760 mtsdr(SDR0_USB0, sdr0_usb0);
Stefan Roese363330b2005-08-04 17:09:16 +02001761
1762 usb2_device_selection_in_fpga();
1763 }
1764
1765 /* USB1.1 Device Selection */
1766 if (ppc440ep_core_selection[USB1_DEVICE] == CORE_SELECTED)
1767 {
Stefan Roese918010a2009-09-09 16:25:29 +02001768 mfsdr(SDR0_USB0, sdr0_usb0);
Stefan Roese363330b2005-08-04 17:09:16 +02001769 sdr0_usb0 = sdr0_usb0 &~SDR0_USB0_USB_DEVSEL_MASK;
1770 sdr0_usb0 = sdr0_usb0 | SDR0_USB0_USB11D_DEVSEL;
Stefan Roese918010a2009-09-09 16:25:29 +02001771 mtsdr(SDR0_USB0, sdr0_usb0);
Stefan Roese363330b2005-08-04 17:09:16 +02001772 }
1773
1774 /* USB1.1 Host Selection */
1775 if (ppc440ep_core_selection[USB1_HOST] == CORE_SELECTED)
1776 {
Stefan Roese918010a2009-09-09 16:25:29 +02001777 mfsdr(SDR0_USB0, sdr0_usb0);
Stefan Roese363330b2005-08-04 17:09:16 +02001778 sdr0_usb0 = sdr0_usb0 &~SDR0_USB0_LEEN_MASK;
1779 sdr0_usb0 = sdr0_usb0 | SDR0_USB0_LEEN_ENABLE;
Stefan Roese918010a2009-09-09 16:25:29 +02001780 mtsdr(SDR0_USB0, sdr0_usb0);
Stefan Roese363330b2005-08-04 17:09:16 +02001781 }
1782
1783 /* NAND Flash Selection */
1784 if (ppc440ep_core_selection[NAND_FLASH] == CORE_SELECTED)
1785 {
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001786 update_ndfc_ios(gpio_tab);
Stefan Roese918010a2009-09-09 16:25:29 +02001787 mtsdr(SDR0_CUST0, SDR0_CUST0_MUX_NDFC_SEL |
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001788 SDR0_CUST0_NDFC_ENABLE |
1789 SDR0_CUST0_NDFC_BW_8_BIT |
1790 SDR0_CUST0_NDFC_ARE_MASK |
Stefan Roese797d8572005-08-11 17:56:56 +02001791 SDR0_CUST0_CHIPSELGAT_EN1 |
1792 SDR0_CUST0_CHIPSELGAT_EN2);
Stefan Roese363330b2005-08-04 17:09:16 +02001793 ndfc_selection_in_fpga();
1794 }
1795 else
1796 {
1797 /* Set Mux on EMAC */
Stefan Roese918010a2009-09-09 16:25:29 +02001798 mtsdr(SDR0_CUST0, SDR0_CUST0_MUX_EMAC_SEL);
Stefan Roese363330b2005-08-04 17:09:16 +02001799 }
1800
1801 /* MII Selection */
1802 if (ppc440ep_core_selection[MII_SEL] == CORE_SELECTED)
1803 {
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001804 update_zii_ios(gpio_tab);
Stefan Roese918010a2009-09-09 16:25:29 +02001805 mfsdr(SDR0_MFR, sdr0_mfr);
Stefan Roese363330b2005-08-04 17:09:16 +02001806 sdr0_mfr = (sdr0_mfr & ~SDR0_MFR_ZMII_MODE_MASK) | SDR0_MFR_ZMII_MODE_MII;
Stefan Roese918010a2009-09-09 16:25:29 +02001807 mtsdr(SDR0_MFR, sdr0_mfr);
Stefan Roese363330b2005-08-04 17:09:16 +02001808
1809 set_phy_configuration_through_fpga(ZMII_CONFIGURATION_IS_MII);
1810 }
1811
1812 /* RMII Selection */
1813 if (ppc440ep_core_selection[RMII_SEL] == CORE_SELECTED)
1814 {
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001815 update_zii_ios(gpio_tab);
Stefan Roese918010a2009-09-09 16:25:29 +02001816 mfsdr(SDR0_MFR, sdr0_mfr);
Stefan Roese363330b2005-08-04 17:09:16 +02001817 sdr0_mfr = (sdr0_mfr & ~SDR0_MFR_ZMII_MODE_MASK) | SDR0_MFR_ZMII_MODE_RMII_10M;
Stefan Roese918010a2009-09-09 16:25:29 +02001818 mtsdr(SDR0_MFR, sdr0_mfr);
Stefan Roese363330b2005-08-04 17:09:16 +02001819
1820 set_phy_configuration_through_fpga(ZMII_CONFIGURATION_IS_RMII);
1821 }
1822
1823 /* SMII Selection */
1824 if (ppc440ep_core_selection[SMII_SEL] == CORE_SELECTED)
1825 {
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001826 update_zii_ios(gpio_tab);
Stefan Roese918010a2009-09-09 16:25:29 +02001827 mfsdr(SDR0_MFR, sdr0_mfr);
Stefan Roese363330b2005-08-04 17:09:16 +02001828 sdr0_mfr = (sdr0_mfr & ~SDR0_MFR_ZMII_MODE_MASK) | SDR0_MFR_ZMII_MODE_SMII;
Stefan Roese918010a2009-09-09 16:25:29 +02001829 mtsdr(SDR0_MFR, sdr0_mfr);
Stefan Roese363330b2005-08-04 17:09:16 +02001830
1831 set_phy_configuration_through_fpga(ZMII_CONFIGURATION_IS_SMII);
1832 }
1833
1834 /* UART Selection */
1835 uart_configuration = get_uart_configuration();
1836 switch (uart_configuration)
1837 {
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001838 case L1: /* L1 Selection */
Stefan Roese363330b2005-08-04 17:09:16 +02001839 /* UART0 8 pins Only */
1840 /*sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0ME_MASK) | SDR0_PFC1_U0ME_DSR_DTR; */
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001841 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0ME_MASK) |SDR0_PFC1_U0ME_CTS_RTS; /* Chip Pb */
Stefan Roese363330b2005-08-04 17:09:16 +02001842 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0IM_MASK) | SDR0_PFC1_U0IM_8PINS;
1843 break;
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001844 case L2: /* L2 Selection */
Stefan Roese363330b2005-08-04 17:09:16 +02001845 /* UART0 and UART1 4 pins */
1846 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0ME_MASK) | SDR0_PFC1_U1ME_DSR_DTR;
1847 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0IM_MASK) | SDR0_PFC1_U0IM_4PINS;
1848 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U1ME_MASK) | SDR0_PFC1_U1ME_DSR_DTR;
1849 break;
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001850 case L3: /* L3 Selection */
Stefan Roese363330b2005-08-04 17:09:16 +02001851 /* UART0 4 pins, UART1 and UART2 2 pins */
1852 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0ME_MASK) | SDR0_PFC1_U1ME_DSR_DTR;
1853 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0IM_MASK) | SDR0_PFC1_U0IM_4PINS;
1854 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U1ME_MASK) | SDR0_PFC1_U1ME_DSR_DTR;
1855 break;
Wolfgang Denk8dd4d332005-08-06 01:42:58 +02001856 case L4: /* L4 Selection */
Stefan Roese363330b2005-08-04 17:09:16 +02001857 /* UART0, UART1, UART2 and UART3 2 pins */
1858 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0ME_MASK) | SDR0_PFC1_U0ME_DSR_DTR;
1859 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U0IM_MASK) | SDR0_PFC1_U0IM_4PINS;
1860 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_U1ME_MASK) | SDR0_PFC1_U1ME_DSR_DTR;
1861 break;
1862 }
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001863 update_uart_ios(uart_configuration, gpio_tab);
Stefan Roese363330b2005-08-04 17:09:16 +02001864
1865 /* UART Selection in all cases */
1866 uart_selection_in_fpga(uart_configuration);
1867
1868 /* Packet Reject Function Available */
1869 if (ppc440ep_core_selection[PACKET_REJ_FUNC_AVAIL] == CORE_SELECTED)
1870 {
1871 /* Set UPR Bit in SDR0_PFC1 Register */
1872 sdr0_pfc1 = (sdr0_pfc1 & ~SDR0_PFC1_UPR_MASK) | SDR0_PFC1_UPR_ENABLE;
1873 }
1874
1875 /* Packet Reject Function Enable */
1876 if (ppc440ep_core_selection[PACKET_REJ_FUNC_EN] == CORE_SELECTED)
1877 {
Stefan Roese918010a2009-09-09 16:25:29 +02001878 mfsdr(SDR0_MFR, sdr0_mfr);
Stefan Roese363330b2005-08-04 17:09:16 +02001879 sdr0_mfr = (sdr0_mfr & ~SDR0_MFR_PKT_REJ_MASK) | SDR0_MFR_PKT_REJ_EN;;
Stefan Roese918010a2009-09-09 16:25:29 +02001880 mtsdr(SDR0_MFR, sdr0_mfr);
Stefan Roese363330b2005-08-04 17:09:16 +02001881 }
1882
1883 /* Perform effective access to hardware */
Stefan Roese918010a2009-09-09 16:25:29 +02001884 mtsdr(SDR0_PFC1, sdr0_pfc1);
Eugene OBrienc59d1a02007-07-31 10:24:56 +02001885 set_chip_gpio_configuration(GPIO0, gpio_tab);
1886 set_chip_gpio_configuration(GPIO1, gpio_tab);
Stefan Roese363330b2005-08-04 17:09:16 +02001887
1888 /* USB2.0 Device Reset must be done after GPIO setting */
1889 if (ppc440ep_core_selection[USB2_DEVICE] == CORE_SELECTED)
1890 usb2_device_reset_through_fpga();
1891
1892}