2 * (C) Copyright 2001-2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * (C) Copyright 2003-2005 Arabella Software Ltd.
6 * Yuli Barcohen <yuli@arabellasw.com>
8 * SPDX-License-Identifier: GPL-2.0+
17 * I/O Port configuration table
19 * if conf is 1, then that port pin will be configured at boot time
20 * according to the five values podr/pdir/ppar/psor/pdat for that entry
23 const iop_conf_t iop_conf_tab[4][32] = {
26 { /* conf ppar psor pdir podr pdat */
27 /* PA31 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxENB */
28 /* PA30 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 TxClav */
29 /* PA29 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxSOC */
30 /* PA28 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 RxENB */
31 /* PA27 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxSOC */
32 /* PA26 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxClav */
33 /* PA25 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[0] */
34 /* PA24 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[1] */
35 /* PA23 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[2] */
36 /* PA22 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[3] */
37 /* PA21 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[4] */
38 /* PA20 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[5] */
39 /* PA19 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[6] */
40 /* PA18 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[7] */
41 /* PA17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[7] */
42 /* PA16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[6] */
43 /* PA15 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[5] */
44 /* PA14 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[4] */
45 /* PA13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[3] */
46 /* PA12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[2] */
47 /* PA11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[1] */
48 /* PA10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[0] */
49 /* PA9 */ { 0, 1, 1, 1, 0, 0 }, /* SMC2 TXD */
50 /* PA8 */ { 0, 1, 1, 0, 0, 0 }, /* SMC2 RXD */
51 /* PA7 */ { 0, 0, 0, 0, 0, 0 }, /* PA7 */
52 /* PA6 */ { 0, 0, 0, 0, 0, 0 }, /* PA6 */
53 /* PA5 */ { 0, 0, 0, 0, 0, 0 }, /* PA5 */
54 /* PA4 */ { 0, 0, 0, 0, 0, 0 }, /* PA4 */
55 /* PA3 */ { 0, 0, 0, 0, 0, 0 }, /* PA3 */
56 /* PA2 */ { 0, 0, 0, 0, 0, 0 }, /* PA2 */
57 /* PA1 */ { 0, 0, 0, 0, 0, 0 }, /* PA1 */
58 /* PA0 */ { 0, 0, 0, 0, 0, 0 } /* PA0 */
62 { /* conf ppar psor pdir podr pdat */
63 /* PB31 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TX_ER */
64 /* PB30 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_DV */
65 /* PB29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC2 MII TX_EN */
66 /* PB28 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_ER */
67 /* PB27 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII COL */
68 /* PB26 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII CRS */
69 /* PB25 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[3] */
70 /* PB24 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[2] */
71 /* PB23 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[1] */
72 /* PB22 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[0] */
73 /* PB21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[0] */
74 /* PB20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[1] */
75 /* PB19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[2] */
76 /* PB18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[3] */
77 /* PB17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_DIV */
78 /* PB16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_ERR */
79 /* PB15 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_ERR */
80 /* PB14 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_EN */
81 /* PB13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:COL */
82 /* PB12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:CRS */
83 /* PB11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
84 /* PB10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
85 /* PB9 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
86 /* PB8 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
87 /* PB7 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
88 /* PB6 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
89 /* PB5 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
90 /* PB4 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
91 /* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
92 /* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
93 /* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
94 /* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
98 { /* conf ppar psor pdir podr pdat */
99 /* PC31 */ { 0, 0, 0, 0, 0, 0 }, /* PC31 */
100 /* PC30 */ { 0, 0, 0, 0, 0, 0 }, /* PC30 */
101 /* PC29 */ { 0, 1, 1, 0, 0, 0 }, /* SCC1 EN CLSN */
102 /* PC28 */ { 0, 0, 0, 0, 0, 0 }, /* PC28 */
103 /* PC27 */ { 0, 0, 0, 0, 0, 0 }, /* PC27 */
104 /* PC26 */ { 0, 0, 0, 0, 0, 0 }, /* PC26 */
105 /* PC25 */ { 0, 0, 0, 0, 0, 0 }, /* PC25 */
106 /* PC24 */ { 0, 0, 0, 0, 0, 0 }, /* PC24 */
107 /* PC23 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RXCLK */
108 /* PC22 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN TXCLK */
109 /* PC21 */ { 0, 0, 0, 0, 0, 0 }, /* PC21 */
110 /* PC20 */ { 0, 0, 0, 0, 0, 0 }, /* PC20 */
111 /* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII Rx Clock (CLK13) */
112 /* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII Tx Clock (CLK14) */
113 /* PC17 */ { 0, 0, 0, 0, 0, 0 }, /* PC17 */
114 /* PC16 */ { 0, 0, 0, 0, 0, 0 }, /* PC16 */
115 /* PC15 */ { 0, 0, 0, 0, 0, 0 }, /* PC15 */
116 /* PC14 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RENA */
117 /* PC13 */ { 0, 0, 0, 0, 0, 0 }, /* PC13 */
118 /* PC12 */ { 0, 0, 0, 0, 0, 0 }, /* PC12 */
119 /* PC11 */ { 0, 0, 0, 0, 0, 0 }, /* PC11 */
120 /* PC10 */ { 1, 0, 0, 1, 0, 0 }, /* LXT972 MDC */
121 /* PC9 */ { 1, 0, 0, 0, 0, 0 }, /* LXT972 MDIO */
122 /* PC8 */ { 0, 0, 0, 0, 0, 0 }, /* PC8 */
123 /* PC7 */ { 0, 0, 0, 0, 0, 0 }, /* PC7 */
124 /* PC6 */ { 0, 0, 0, 0, 0, 0 }, /* PC6 */
125 /* PC5 */ { 0, 0, 0, 0, 0, 0 }, /* PC5 */
126 /* PC4 */ { 0, 0, 0, 0, 0, 0 }, /* PC4 */
127 /* PC3 */ { 0, 0, 0, 0, 0, 0 }, /* PC3 */
128 /* PC2 */ { 0, 0, 0, 0, 0, 0 }, /* PC2 */
129 /* PC1 */ { 0, 0, 0, 0, 0, 0 }, /* PC1 */
130 /* PC0 */ { 0, 0, 0, 0, 0, 0 }, /* PC0 */
134 { /* conf ppar psor pdir podr pdat */
135 /* PD31 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RxD */
136 /* PD30 */ { 0, 1, 1, 1, 0, 0 }, /* SCC1 EN TxD */
137 /* PD29 */ { 0, 1, 0, 1, 0, 0 }, /* SCC1 EN TENA */
138 /* PD28 */ { 0, 0, 0, 0, 0, 0 }, /* PD28 */
139 /* PD27 */ { 0, 0, 0, 0, 0, 0 }, /* PD27 */
140 /* PD26 */ { 0, 0, 0, 0, 0, 0 }, /* PD26 */
141 /* PD25 */ { 0, 0, 0, 0, 0, 0 }, /* PD25 */
142 /* PD24 */ { 0, 0, 0, 0, 0, 0 }, /* PD24 */
143 /* PD23 */ { 0, 0, 0, 0, 0, 0 }, /* PD23 */
144 /* PD22 */ { 0, 0, 0, 0, 0, 0 }, /* PD22 */
145 /* PD21 */ { 0, 0, 0, 0, 0, 0 }, /* PD21 */
146 /* PD20 */ { 0, 0, 0, 0, 0, 0 }, /* PD20 */
147 /* PD19 */ { 0, 0, 0, 0, 0, 0 }, /* PD19 */
148 /* PD18 */ { 0, 0, 0, 0, 0, 0 }, /* PD18 */
149 /* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXPRTY */
150 /* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXPRTY */
151 /* PD15 */ { 0, 1, 1, 0, 1, 0 }, /* I2C SDA */
152 /* PD14 */ { 0, 1, 1, 0, 1, 0 }, /* I2C SCL */
153 /* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */
154 /* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */
155 /* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */
156 /* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */
157 /* PD9 */ { 1, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
158 /* PD8 */ { 1, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
159 /* PD7 */ { 0, 0, 0, 0, 0, 0 }, /* PD7 */
160 /* PD6 */ { 0, 0, 0, 0, 0, 0 }, /* PD6 */
161 /* PD5 */ { 0, 0, 0, 0, 0, 0 }, /* PD5 */
162 /* PD4 */ { 0, 0, 0, 0, 0, 0 }, /* PD4 */
163 /* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
164 /* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
165 /* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
166 /* PD0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
170 #ifdef CONFIG_SYS_NVRAM_ACCESS_ROUTINE
171 void *nvram_read(void *dest, long src, size_t count)
173 return memcpy(dest, (const void *)src, count);
176 void nvram_write(long dest, const void *src, size_t count)
178 vu_char *p1 = (vu_char *)(CONFIG_SYS_EEPROM + 0x1555);
179 vu_char *p2 = (vu_char *)(CONFIG_SYS_EEPROM + 0x0AAA);
180 vu_char *d = (vu_char *)dest;
181 const uchar *s = (const uchar *)src;
183 /* Unprotect the EEPROM */
192 /* Write the data to the EEPROM */
195 while (*(d - 1) != *(s - 1))
199 /* Protect the EEPROM */
205 #endif /* CONFIG_SYS_NVRAM_ACCESS_ROUTINE */
207 phys_size_t initdram(int board_type)
209 vu_char *bcsr = (vu_char *)CONFIG_SYS_BCSR;
210 volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
211 volatile memctl8260_t *memctl = &immap->im_memctl;
214 long int msize = CONFIG_SYS_SDRAM_SIZE;
217 if (bcsr[4] & BCSR_PCI_MODE) { /* PCI mode selected by JP9 */
218 immap->im_clkrst.car_sccr |= SCCR_PCI_MODE;
219 immap->im_siu_conf.sc_siumcr =
220 (immap->im_siu_conf.sc_siumcr & ~SIUMCR_LBPC11)
224 #ifndef CONFIG_SYS_RAMBOOT
225 immap->im_siu_conf.sc_ppc_acr = 0x03;
226 immap->im_siu_conf.sc_ppc_alrh = 0x30126745;
227 immap->im_siu_conf.sc_tescr1 = 0x00004000;
229 memctl->memc_mptpr = CONFIG_SYS_MPTPR;
231 #ifdef CONFIG_SYS_LSDRAM_BASE
233 Initialise local bus SDRAM only if the pins
234 are configured as local bus pins and not as PCI.
236 if ((immap->im_siu_conf.sc_siumcr & SIUMCR_LBPC11) == SIUMCR_LBPC00) {
237 memctl->memc_lsrt = CONFIG_SYS_LSRT;
238 memctl->memc_or4 = CONFIG_SYS_LSDRAM_OR;
239 memctl->memc_br4 = CONFIG_SYS_LSDRAM_BR;
240 ramaddr = (vu_char *)CONFIG_SYS_LSDRAM_BASE;
241 memctl->memc_lsdmr = CONFIG_SYS_LSDMR | PSDMR_OP_PREA;
243 memctl->memc_lsdmr = CONFIG_SYS_LSDMR | PSDMR_OP_CBRR;
244 for (i = 0; i < 8; i++)
246 memctl->memc_lsdmr = CONFIG_SYS_LSDMR | PSDMR_OP_MRW;
248 memctl->memc_lsdmr = CONFIG_SYS_LSDMR | PSDMR_RFEN;
250 #endif /* CONFIG_SYS_LSDRAM_BASE */
252 /* Initialise 60x bus SDRAM */
253 memctl->memc_psrt = CONFIG_SYS_PSRT;
254 memctl->memc_or2 = CONFIG_SYS_PSDRAM_OR;
255 memctl->memc_br2 = CONFIG_SYS_PSDRAM_BR;
257 * The mode data for Mode Register Write command must appear on
258 * the address lines during a mode-set cycle. It is driven by
259 * the memory controller, in single PowerQUICC II mode,
260 * according to PSDMR[CL] and PSDMR[BL] fields. In
261 * 60x-compatible mode, software must drive the correct value on
262 * the address lines. BL=0 because for 64-bit port size burst
265 ramaddr = (vu_char *)(CONFIG_SYS_SDRAM_BASE |
266 ((CONFIG_SYS_PSDMR & PSDMR_CL_MSK) << 7) | 0x10);
267 memctl->memc_psdmr = CONFIG_SYS_PSDMR | PSDMR_OP_PREA; /* Precharge all banks */
269 memctl->memc_psdmr = CONFIG_SYS_PSDMR | PSDMR_OP_CBRR; /* CBR refresh */
270 for (i = 0; i < 8; i++)
272 memctl->memc_psdmr = CONFIG_SYS_PSDMR | PSDMR_OP_MRW; /* Mode Register write */
274 memctl->memc_psdmr = CONFIG_SYS_PSDMR | PSDMR_RFEN; /* Refresh enable */
276 #endif /* CONFIG_SYS_RAMBOOT */
278 /* Return total 60x bus SDRAM size */
279 return msize * 1024 * 1024;
284 vu_char *bcsr = (vu_char *)CONFIG_SYS_BCSR;
286 printf("Board: Zephyr ZPC.1900 Rev. %c\n", bcsr[2] + 0x40);