mpc8560ads.c 15 KB

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