mpc8560ads.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. /*
  2. * Copyright 2004 Freescale Semiconductor.
  3. * (C) Copyright 2003,Motorola Inc.
  4. * Xianghua Xiao, (X.Xiao@motorola.com)
  5. *
  6. * (C) Copyright 2002 Scott McNutt <smcnutt@artesyncp.com>
  7. *
  8. * See file CREDITS for list of people who contributed to this
  9. * project.
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License as
  13. * published by the Free Software Foundation; either version 2 of
  14. * the License, or (at your option) any later version.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  24. * MA 02111-1307 USA
  25. */
  26. #include <common.h>
  27. #include <pci.h>
  28. #include <asm/processor.h>
  29. #include <asm/mmu.h>
  30. #include <asm/immap_85xx.h>
  31. #include <asm/fsl_ddr_sdram.h>
  32. #include <ioports.h>
  33. #include <spd_sdram.h>
  34. #include <miiphy.h>
  35. #include <libfdt.h>
  36. #include <fdt_support.h>
  37. #include <asm/fsl_lbc.h>
  38. #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
  39. extern void ddr_enable_ecc(unsigned int dram_size);
  40. #endif
  41. void local_bus_init(void);
  42. /*
  43. * I/O Port configuration table
  44. *
  45. * if conf is 1, then that port pin will be configured at boot time
  46. * according to the five values podr/pdir/ppar/psor/pdat for that entry
  47. */
  48. const iop_conf_t iop_conf_tab[4][32] = {
  49. /* Port A configuration */
  50. { /* conf ppar psor pdir podr pdat */
  51. /* PA31 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxENB */
  52. /* PA30 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 TxClav */
  53. /* PA29 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxSOC */
  54. /* PA28 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 RxENB */
  55. /* PA27 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxSOC */
  56. /* PA26 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxClav */
  57. /* PA25 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[0] */
  58. /* PA24 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[1] */
  59. /* PA23 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[2] */
  60. /* PA22 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[3] */
  61. /* PA21 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[4] */
  62. /* PA20 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[5] */
  63. /* PA19 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[6] */
  64. /* PA18 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[7] */
  65. /* PA17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[7] */
  66. /* PA16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[6] */
  67. /* PA15 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[5] */
  68. /* PA14 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[4] */
  69. /* PA13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[3] */
  70. /* PA12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[2] */
  71. /* PA11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[1] */
  72. /* PA10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[0] */
  73. /* PA9 */ { 0, 1, 1, 1, 0, 0 }, /* FCC1 L1TXD */
  74. /* PA8 */ { 0, 1, 1, 0, 0, 0 }, /* FCC1 L1RXD */
  75. /* PA7 */ { 0, 0, 0, 1, 0, 0 }, /* PA7 */
  76. /* PA6 */ { 0, 1, 1, 1, 0, 0 }, /* TDM A1 L1RSYNC */
  77. /* PA5 */ { 0, 0, 0, 1, 0, 0 }, /* PA5 */
  78. /* PA4 */ { 0, 0, 0, 1, 0, 0 }, /* PA4 */
  79. /* PA3 */ { 0, 0, 0, 1, 0, 0 }, /* PA3 */
  80. /* PA2 */ { 0, 0, 0, 1, 0, 0 }, /* PA2 */
  81. /* PA1 */ { 1, 0, 0, 0, 0, 0 }, /* FREERUN */
  82. /* PA0 */ { 0, 0, 0, 1, 0, 0 } /* PA0 */
  83. },
  84. /* Port B configuration */
  85. { /* conf ppar psor pdir podr pdat */
  86. /* PB31 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TX_ER */
  87. /* PB30 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_DV */
  88. /* PB29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC2 MII TX_EN */
  89. /* PB28 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_ER */
  90. /* PB27 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII COL */
  91. /* PB26 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII CRS */
  92. /* PB25 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[3] */
  93. /* PB24 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[2] */
  94. /* PB23 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[1] */
  95. /* PB22 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[0] */
  96. /* PB21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[0] */
  97. /* PB20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[1] */
  98. /* PB19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[2] */
  99. /* PB18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[3] */
  100. /* PB17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_DIV */
  101. /* PB16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_ERR */
  102. /* PB15 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_ERR */
  103. /* PB14 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_EN */
  104. /* PB13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:COL */
  105. /* PB12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:CRS */
  106. /* PB11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  107. /* PB10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  108. /* PB9 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  109. /* PB8 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  110. /* PB7 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  111. /* PB6 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  112. /* PB5 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  113. /* PB4 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  114. /* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  115. /* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  116. /* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  117. /* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
  118. },
  119. /* Port C */
  120. { /* conf ppar psor pdir podr pdat */
  121. /* PC31 */ { 0, 0, 0, 1, 0, 0 }, /* PC31 */
  122. /* PC30 */ { 0, 0, 0, 1, 0, 0 }, /* PC30 */
  123. /* PC29 */ { 0, 1, 1, 0, 0, 0 }, /* SCC1 EN *CLSN */
  124. /* PC28 */ { 0, 0, 0, 1, 0, 0 }, /* PC28 */
  125. /* PC27 */ { 0, 0, 0, 1, 0, 0 }, /* UART Clock in */
  126. /* PC26 */ { 0, 0, 0, 1, 0, 0 }, /* PC26 */
  127. /* PC25 */ { 0, 0, 0, 1, 0, 0 }, /* PC25 */
  128. /* PC24 */ { 0, 0, 0, 1, 0, 0 }, /* PC24 */
  129. /* PC23 */ { 0, 1, 0, 1, 0, 0 }, /* ATMTFCLK */
  130. /* PC22 */ { 0, 1, 0, 0, 0, 0 }, /* ATMRFCLK */
  131. /* PC21 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RXCLK */
  132. /* PC20 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN TXCLK */
  133. /* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_CLK CLK13 */
  134. /* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK14) */
  135. /* PC17 */ { 0, 0, 0, 1, 0, 0 }, /* PC17 */
  136. /* PC16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK16) */
  137. /* PC15 */ { 1, 1, 0, 0, 0, 0 }, /* PC15 */
  138. /* PC14 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN *CD */
  139. /* PC13 */ { 0, 0, 0, 1, 0, 0 }, /* PC13 */
  140. /* PC12 */ { 0, 1, 0, 1, 0, 0 }, /* PC12 */
  141. /* PC11 */ { 0, 0, 0, 1, 0, 0 }, /* LXT971 transmit control */
  142. /* PC10 */ { 1, 0, 0, 1, 0, 0 }, /* FETHMDC */
  143. /* PC9 */ { 1, 0, 0, 0, 0, 0 }, /* FETHMDIO */
  144. /* PC8 */ { 0, 0, 0, 1, 0, 0 }, /* PC8 */
  145. /* PC7 */ { 0, 0, 0, 1, 0, 0 }, /* PC7 */
  146. /* PC6 */ { 0, 0, 0, 1, 0, 0 }, /* PC6 */
  147. /* PC5 */ { 0, 0, 0, 1, 0, 0 }, /* PC5 */
  148. /* PC4 */ { 0, 0, 0, 1, 0, 0 }, /* PC4 */
  149. /* PC3 */ { 0, 0, 0, 1, 0, 0 }, /* PC3 */
  150. /* PC2 */ { 0, 0, 0, 1, 0, 1 }, /* ENET FDE */
  151. /* PC1 */ { 0, 0, 0, 1, 0, 0 }, /* ENET DSQE */
  152. /* PC0 */ { 0, 0, 0, 1, 0, 0 }, /* ENET LBK */
  153. },
  154. /* Port D */
  155. { /* conf ppar psor pdir podr pdat */
  156. /* PD31 */ { 1, 1, 0, 0, 0, 0 }, /* SCC1 EN RxD */
  157. /* PD30 */ { 1, 1, 1, 1, 0, 0 }, /* SCC1 EN TxD */
  158. /* PD29 */ { 1, 1, 0, 1, 0, 0 }, /* SCC1 EN TENA */
  159. /* PD28 */ { 0, 1, 0, 0, 0, 0 }, /* PD28 */
  160. /* PD27 */ { 0, 1, 1, 1, 0, 0 }, /* PD27 */
  161. /* PD26 */ { 0, 0, 0, 1, 0, 0 }, /* PD26 */
  162. /* PD25 */ { 0, 0, 0, 1, 0, 0 }, /* PD25 */
  163. /* PD24 */ { 0, 0, 0, 1, 0, 0 }, /* PD24 */
  164. /* PD23 */ { 0, 0, 0, 1, 0, 0 }, /* PD23 */
  165. /* PD22 */ { 0, 0, 0, 1, 0, 0 }, /* PD22 */
  166. /* PD21 */ { 0, 0, 0, 1, 0, 0 }, /* PD21 */
  167. /* PD20 */ { 0, 0, 0, 1, 0, 0 }, /* PD20 */
  168. /* PD19 */ { 0, 0, 0, 1, 0, 0 }, /* PD19 */
  169. /* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD18 */
  170. /* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXPRTY */
  171. /* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXPRTY */
  172. /* PD15 */ { 0, 1, 1, 0, 1, 0 }, /* I2C SDA */
  173. /* PD14 */ { 0, 0, 0, 1, 0, 0 }, /* LED */
  174. /* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */
  175. /* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */
  176. /* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */
  177. /* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */
  178. /* PD9 */ { 0, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
  179. /* PD8 */ { 0, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
  180. /* PD7 */ { 0, 0, 0, 1, 0, 1 }, /* PD7 */
  181. /* PD6 */ { 0, 0, 0, 1, 0, 1 }, /* PD6 */
  182. /* PD5 */ { 0, 0, 0, 1, 0, 1 }, /* PD5 */
  183. /* PD4 */ { 0, 0, 0, 1, 0, 1 }, /* PD4 */
  184. /* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  185. /* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  186. /* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  187. /* PD0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
  188. }
  189. };
  190. /*
  191. * MPC8560ADS Board Status & Control Registers
  192. */
  193. typedef struct bcsr_ {
  194. volatile unsigned char bcsr0;
  195. volatile unsigned char bcsr1;
  196. volatile unsigned char bcsr2;
  197. volatile unsigned char bcsr3;
  198. volatile unsigned char bcsr4;
  199. volatile unsigned char bcsr5;
  200. } bcsr_t;
  201. void reset_phy (void)
  202. {
  203. #if defined(CONFIG_ETHER_ON_FCC) /* avoid compile warnings for now */
  204. volatile bcsr_t *bcsr = (bcsr_t *) CONFIG_SYS_BCSR;
  205. #endif
  206. /* reset Giga bit Ethernet port if needed here */
  207. /* reset the CPM FEC port */
  208. #if (CONFIG_ETHER_INDEX == 2)
  209. bcsr->bcsr2 &= ~FETH2_RST;
  210. udelay(2);
  211. bcsr->bcsr2 |= FETH2_RST;
  212. udelay(1000);
  213. #elif (CONFIG_ETHER_INDEX == 3)
  214. bcsr->bcsr3 &= ~FETH3_RST;
  215. udelay(2);
  216. bcsr->bcsr3 |= FETH3_RST;
  217. udelay(1000);
  218. #endif
  219. #if defined(CONFIG_MII) && defined(CONFIG_ETHER_ON_FCC)
  220. /* reset PHY */
  221. miiphy_reset("FCC1", 0x0);
  222. /* change PHY address to 0x02 */
  223. bb_miiphy_write(NULL, 0, MII_MIPSCR, 0xf028);
  224. bb_miiphy_write(NULL, 0x02, MII_BMCR,
  225. BMCR_ANENABLE | BMCR_ANRESTART);
  226. #endif /* CONFIG_MII */
  227. }
  228. int checkboard (void)
  229. {
  230. puts("Board: ADS\n");
  231. #ifdef CONFIG_PCI
  232. printf("PCI1: 32 bit, %d MHz (compiled)\n",
  233. CONFIG_SYS_CLK_FREQ / 1000000);
  234. #else
  235. printf("PCI1: disabled\n");
  236. #endif
  237. /*
  238. * Initialize local bus.
  239. */
  240. local_bus_init();
  241. return 0;
  242. }
  243. /*
  244. * Initialize Local Bus
  245. */
  246. void
  247. local_bus_init(void)
  248. {
  249. volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  250. volatile fsl_lbc_t *lbc = LBC_BASE_ADDR;
  251. uint clkdiv;
  252. uint lbc_hz;
  253. sys_info_t sysinfo;
  254. /*
  255. * Errata LBC11.
  256. * Fix Local Bus clock glitch when DLL is enabled.
  257. *
  258. * If localbus freq is < 66MHz, DLL bypass mode must be used.
  259. * If localbus freq is > 133MHz, DLL can be safely enabled.
  260. * Between 66 and 133, the DLL is enabled with an override workaround.
  261. */
  262. get_sys_info(&sysinfo);
  263. clkdiv = lbc->lcrr & LCRR_CLKDIV;
  264. lbc_hz = sysinfo.freqSystemBus / 1000000 / clkdiv;
  265. if (lbc_hz < 66) {
  266. lbc->lcrr = CONFIG_SYS_LBC_LCRR | 0x80000000; /* DLL Bypass */
  267. } else if (lbc_hz >= 133) {
  268. lbc->lcrr = CONFIG_SYS_LBC_LCRR & (~0x80000000); /* DLL Enabled */
  269. } else {
  270. /*
  271. * On REV1 boards, need to change CLKDIV before enable DLL.
  272. * Default CLKDIV is 8, change it to 4 temporarily.
  273. */
  274. uint pvr = get_pvr();
  275. uint temp_lbcdll = 0;
  276. if (pvr == PVR_85xx_REV1) {
  277. /* FIXME: Justify the high bit here. */
  278. lbc->lcrr = 0x10000004;
  279. }
  280. lbc->lcrr = CONFIG_SYS_LBC_LCRR & (~0x80000000);/* DLL Enabled */
  281. udelay(200);
  282. /*
  283. * Sample LBC DLL ctrl reg, upshift it to set the
  284. * override bits.
  285. */
  286. temp_lbcdll = gur->lbcdllcr;
  287. gur->lbcdllcr = (((temp_lbcdll & 0xff) << 16) | 0x80000000);
  288. asm("sync;isync;msync");
  289. }
  290. }
  291. /*
  292. * Initialize SDRAM memory on the Local Bus.
  293. */
  294. void lbc_sdram_init(void)
  295. {
  296. volatile fsl_lbc_t *lbc = LBC_BASE_ADDR;
  297. uint *sdram_addr = (uint *)CONFIG_SYS_LBC_SDRAM_BASE;
  298. puts("LBC SDRAM: ");
  299. print_size(CONFIG_SYS_LBC_SDRAM_SIZE * 1024 * 1024,
  300. "\n ");
  301. /*
  302. * Setup SDRAM Base and Option Registers
  303. */
  304. set_lbc_or(2, CONFIG_SYS_OR2_PRELIM);
  305. set_lbc_br(2, CONFIG_SYS_BR2_PRELIM);
  306. lbc->lbcr = CONFIG_SYS_LBC_LBCR;
  307. asm("msync");
  308. lbc->lsrt = CONFIG_SYS_LBC_LSRT;
  309. lbc->mrtpr = CONFIG_SYS_LBC_MRTPR;
  310. asm("sync");
  311. /*
  312. * Configure the SDRAM controller.
  313. */
  314. lbc->lsdmr = CONFIG_SYS_LBC_LSDMR_1;
  315. asm("sync");
  316. *sdram_addr = 0xff;
  317. ppcDcbf((unsigned long) sdram_addr);
  318. udelay(100);
  319. lbc->lsdmr = CONFIG_SYS_LBC_LSDMR_2;
  320. asm("sync");
  321. *sdram_addr = 0xff;
  322. ppcDcbf((unsigned long) sdram_addr);
  323. udelay(100);
  324. lbc->lsdmr = CONFIG_SYS_LBC_LSDMR_3;
  325. asm("sync");
  326. *sdram_addr = 0xff;
  327. ppcDcbf((unsigned long) sdram_addr);
  328. udelay(100);
  329. lbc->lsdmr = CONFIG_SYS_LBC_LSDMR_4;
  330. asm("sync");
  331. *sdram_addr = 0xff;
  332. ppcDcbf((unsigned long) sdram_addr);
  333. udelay(100);
  334. lbc->lsdmr = CONFIG_SYS_LBC_LSDMR_5;
  335. asm("sync");
  336. *sdram_addr = 0xff;
  337. ppcDcbf((unsigned long) sdram_addr);
  338. udelay(100);
  339. }
  340. #if !defined(CONFIG_SPD_EEPROM)
  341. /*************************************************************************
  342. * fixed sdram init -- doesn't use serial presence detect.
  343. ************************************************************************/
  344. phys_size_t fixed_sdram(void)
  345. {
  346. #ifndef CONFIG_SYS_RAMBOOT
  347. volatile ccsr_ddr_t *ddr= (void *)(CONFIG_SYS_MPC85xx_DDR_ADDR);
  348. ddr->cs0_bnds = CONFIG_SYS_DDR_CS0_BNDS;
  349. ddr->cs0_config = CONFIG_SYS_DDR_CS0_CONFIG;
  350. ddr->timing_cfg_1 = CONFIG_SYS_DDR_TIMING_1;
  351. ddr->timing_cfg_2 = CONFIG_SYS_DDR_TIMING_2;
  352. ddr->sdram_mode = CONFIG_SYS_DDR_MODE;
  353. ddr->sdram_interval = CONFIG_SYS_DDR_INTERVAL;
  354. #if defined (CONFIG_DDR_ECC)
  355. ddr->err_disable = 0x0000000D;
  356. ddr->err_sbe = 0x00ff0000;
  357. #endif
  358. asm("sync;isync;msync");
  359. udelay(500);
  360. #if defined (CONFIG_DDR_ECC)
  361. /* Enable ECC checking */
  362. ddr->sdram_cfg = (CONFIG_SYS_DDR_CONTROL | 0x20000000);
  363. #else
  364. ddr->sdram_cfg = CONFIG_SYS_DDR_CONTROL;
  365. #endif
  366. asm("sync; isync; msync");
  367. udelay(500);
  368. #endif
  369. return CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
  370. }
  371. #endif /* !defined(CONFIG_SPD_EEPROM) */
  372. #if defined(CONFIG_PCI)
  373. /*
  374. * Initialize PCI Devices, report devices found.
  375. */
  376. #ifndef CONFIG_PCI_PNP
  377. static struct pci_config_table pci_mpc85xxads_config_table[] = {
  378. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  379. PCI_IDSEL_NUMBER, PCI_ANY_ID,
  380. pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
  381. PCI_ENET0_MEMADDR,
  382. PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER
  383. } },
  384. { }
  385. };
  386. #endif
  387. static struct pci_controller hose = {
  388. #ifndef CONFIG_PCI_PNP
  389. config_table: pci_mpc85xxads_config_table,
  390. #endif
  391. };
  392. #endif /* CONFIG_PCI */
  393. void
  394. pci_init_board(void)
  395. {
  396. #ifdef CONFIG_PCI
  397. pci_mpc85xx_init(&hose);
  398. #endif /* CONFIG_PCI */
  399. }
  400. #if defined(CONFIG_OF_BOARD_SETUP)
  401. void
  402. ft_board_setup(void *blob, bd_t *bd)
  403. {
  404. int node, tmp[2];
  405. const char *path;
  406. ft_cpu_setup(blob, bd);
  407. node = fdt_path_offset(blob, "/aliases");
  408. tmp[0] = 0;
  409. if (node >= 0) {
  410. #ifdef CONFIG_PCI
  411. path = fdt_getprop(blob, node, "pci0", NULL);
  412. if (path) {
  413. tmp[1] = hose.last_busno - hose.first_busno;
  414. do_fixup_by_path(blob, path, "bus-range", &tmp, 8, 1);
  415. }
  416. #endif
  417. }
  418. }
  419. #endif