mpc8555cds.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. /*
  2. * Copyright 2004 Freescale Semiconductor.
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <common.h>
  23. #include <pci.h>
  24. #include <asm/processor.h>
  25. #include <asm/immap_85xx.h>
  26. #include <ioports.h>
  27. #include <spd.h>
  28. #include "../common/cadmus.h"
  29. #include "../common/eeprom.h"
  30. #if defined(CONFIG_DDR_ECC)
  31. extern void ddr_enable_ecc(unsigned int dram_size);
  32. #endif
  33. extern long int spd_sdram(void);
  34. void local_bus_init(void);
  35. void sdram_init(void);
  36. /*
  37. * I/O Port configuration table
  38. *
  39. * if conf is 1, then that port pin will be configured at boot time
  40. * according to the five values podr/pdir/ppar/psor/pdat for that entry
  41. */
  42. const iop_conf_t iop_conf_tab[4][32] = {
  43. /* Port A configuration */
  44. { /* conf ppar psor pdir podr pdat */
  45. /* PA31 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxENB */
  46. /* PA30 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 TxClav */
  47. /* PA29 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxSOC */
  48. /* PA28 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 RxENB */
  49. /* PA27 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxSOC */
  50. /* PA26 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxClav */
  51. /* PA25 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[0] */
  52. /* PA24 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[1] */
  53. /* PA23 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[2] */
  54. /* PA22 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[3] */
  55. /* PA21 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[4] */
  56. /* PA20 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[5] */
  57. /* PA19 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[6] */
  58. /* PA18 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[7] */
  59. /* PA17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[7] */
  60. /* PA16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[6] */
  61. /* PA15 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[5] */
  62. /* PA14 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[4] */
  63. /* PA13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[3] */
  64. /* PA12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[2] */
  65. /* PA11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[1] */
  66. /* PA10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[0] */
  67. /* PA9 */ { 0, 1, 1, 1, 0, 0 }, /* FCC1 L1TXD */
  68. /* PA8 */ { 0, 1, 1, 0, 0, 0 }, /* FCC1 L1RXD */
  69. /* PA7 */ { 0, 0, 0, 1, 0, 0 }, /* PA7 */
  70. /* PA6 */ { 0, 1, 1, 1, 0, 0 }, /* TDM A1 L1RSYNC */
  71. /* PA5 */ { 0, 0, 0, 1, 0, 0 }, /* PA5 */
  72. /* PA4 */ { 0, 0, 0, 1, 0, 0 }, /* PA4 */
  73. /* PA3 */ { 0, 0, 0, 1, 0, 0 }, /* PA3 */
  74. /* PA2 */ { 0, 0, 0, 1, 0, 0 }, /* PA2 */
  75. /* PA1 */ { 1, 0, 0, 0, 0, 0 }, /* FREERUN */
  76. /* PA0 */ { 0, 0, 0, 1, 0, 0 } /* PA0 */
  77. },
  78. /* Port B configuration */
  79. { /* conf ppar psor pdir podr pdat */
  80. /* PB31 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TX_ER */
  81. /* PB30 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_DV */
  82. /* PB29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC2 MII TX_EN */
  83. /* PB28 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_ER */
  84. /* PB27 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII COL */
  85. /* PB26 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII CRS */
  86. /* PB25 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[3] */
  87. /* PB24 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[2] */
  88. /* PB23 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[1] */
  89. /* PB22 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[0] */
  90. /* PB21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[0] */
  91. /* PB20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[1] */
  92. /* PB19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[2] */
  93. /* PB18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[3] */
  94. /* PB17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_DIV */
  95. /* PB16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_ERR */
  96. /* PB15 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_ERR */
  97. /* PB14 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_EN */
  98. /* PB13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:COL */
  99. /* PB12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:CRS */
  100. /* PB11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  101. /* PB10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  102. /* PB9 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  103. /* PB8 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  104. /* PB7 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  105. /* PB6 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  106. /* PB5 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  107. /* PB4 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  108. /* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  109. /* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  110. /* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  111. /* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
  112. },
  113. /* Port C */
  114. { /* conf ppar psor pdir podr pdat */
  115. /* PC31 */ { 0, 0, 0, 1, 0, 0 }, /* PC31 */
  116. /* PC30 */ { 0, 0, 0, 1, 0, 0 }, /* PC30 */
  117. /* PC29 */ { 0, 1, 1, 0, 0, 0 }, /* SCC1 EN *CLSN */
  118. /* PC28 */ { 0, 0, 0, 1, 0, 0 }, /* PC28 */
  119. /* PC27 */ { 0, 0, 0, 1, 0, 0 }, /* UART Clock in */
  120. /* PC26 */ { 0, 0, 0, 1, 0, 0 }, /* PC26 */
  121. /* PC25 */ { 0, 0, 0, 1, 0, 0 }, /* PC25 */
  122. /* PC24 */ { 0, 0, 0, 1, 0, 0 }, /* PC24 */
  123. /* PC23 */ { 0, 1, 0, 1, 0, 0 }, /* ATMTFCLK */
  124. /* PC22 */ { 0, 1, 0, 0, 0, 0 }, /* ATMRFCLK */
  125. /* PC21 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RXCLK */
  126. /* PC20 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN TXCLK */
  127. /* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_CLK CLK13 */
  128. /* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK14) */
  129. /* PC17 */ { 0, 0, 0, 1, 0, 0 }, /* PC17 */
  130. /* PC16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK16) */
  131. /* PC15 */ { 1, 1, 0, 0, 0, 0 }, /* PC15 */
  132. /* PC14 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN *CD */
  133. /* PC13 */ { 0, 0, 0, 1, 0, 0 }, /* PC13 */
  134. /* PC12 */ { 0, 1, 0, 1, 0, 0 }, /* PC12 */
  135. /* PC11 */ { 0, 0, 0, 1, 0, 0 }, /* LXT971 transmit control */
  136. /* PC10 */ { 1, 0, 0, 1, 0, 0 }, /* FETHMDC */
  137. /* PC9 */ { 1, 0, 0, 0, 0, 0 }, /* FETHMDIO */
  138. /* PC8 */ { 0, 0, 0, 1, 0, 0 }, /* PC8 */
  139. /* PC7 */ { 0, 0, 0, 1, 0, 0 }, /* PC7 */
  140. /* PC6 */ { 0, 0, 0, 1, 0, 0 }, /* PC6 */
  141. /* PC5 */ { 0, 0, 0, 1, 0, 0 }, /* PC5 */
  142. /* PC4 */ { 0, 0, 0, 1, 0, 0 }, /* PC4 */
  143. /* PC3 */ { 0, 0, 0, 1, 0, 0 }, /* PC3 */
  144. /* PC2 */ { 0, 0, 0, 1, 0, 1 }, /* ENET FDE */
  145. /* PC1 */ { 0, 0, 0, 1, 0, 0 }, /* ENET DSQE */
  146. /* PC0 */ { 0, 0, 0, 1, 0, 0 }, /* ENET LBK */
  147. },
  148. /* Port D */
  149. { /* conf ppar psor pdir podr pdat */
  150. /* PD31 */ { 1, 1, 0, 0, 0, 0 }, /* SCC1 EN RxD */
  151. /* PD30 */ { 1, 1, 1, 1, 0, 0 }, /* SCC1 EN TxD */
  152. /* PD29 */ { 1, 1, 0, 1, 0, 0 }, /* SCC1 EN TENA */
  153. /* PD28 */ { 0, 1, 0, 0, 0, 0 }, /* PD28 */
  154. /* PD27 */ { 0, 1, 1, 1, 0, 0 }, /* PD27 */
  155. /* PD26 */ { 0, 0, 0, 1, 0, 0 }, /* PD26 */
  156. /* PD25 */ { 0, 0, 0, 1, 0, 0 }, /* PD25 */
  157. /* PD24 */ { 0, 0, 0, 1, 0, 0 }, /* PD24 */
  158. /* PD23 */ { 0, 0, 0, 1, 0, 0 }, /* PD23 */
  159. /* PD22 */ { 0, 0, 0, 1, 0, 0 }, /* PD22 */
  160. /* PD21 */ { 0, 0, 0, 1, 0, 0 }, /* PD21 */
  161. /* PD20 */ { 0, 0, 0, 1, 0, 0 }, /* PD20 */
  162. /* PD19 */ { 0, 0, 0, 1, 0, 0 }, /* PD19 */
  163. /* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD18 */
  164. /* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXPRTY */
  165. /* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXPRTY */
  166. /* PD15 */ { 0, 1, 1, 0, 1, 0 }, /* I2C SDA */
  167. /* PD14 */ { 0, 0, 0, 1, 0, 0 }, /* LED */
  168. /* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */
  169. /* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */
  170. /* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */
  171. /* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */
  172. /* PD9 */ { 0, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
  173. /* PD8 */ { 0, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
  174. /* PD7 */ { 0, 0, 0, 1, 0, 1 }, /* PD7 */
  175. /* PD6 */ { 0, 0, 0, 1, 0, 1 }, /* PD6 */
  176. /* PD5 */ { 0, 0, 0, 1, 0, 1 }, /* PD5 */
  177. /* PD4 */ { 0, 0, 0, 1, 0, 1 }, /* PD4 */
  178. /* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  179. /* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  180. /* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  181. /* PD0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
  182. }
  183. };
  184. int board_early_init_f (void)
  185. {
  186. return 0;
  187. }
  188. int checkboard (void)
  189. {
  190. volatile immap_t *immap = (immap_t *) CFG_CCSRBAR;
  191. volatile ccsr_gur_t *gur = &immap->im_gur;
  192. /* PCI slot in USER bits CSR[6:7] by convention. */
  193. uint pci_slot = get_pci_slot ();
  194. uint pci_dual = get_pci_dual (); /* PCI DUAL in CM_PCI[3] */
  195. uint pci1_32 = gur->pordevsr & 0x10000; /* PORDEVSR[15] */
  196. uint pci1_clk_sel = gur->porpllsr & 0x8000; /* PORPLLSR[16] */
  197. uint pci2_clk_sel = gur->porpllsr & 0x4000; /* PORPLLSR[17] */
  198. uint pci1_speed = get_clock_freq (); /* PCI PSPEED in [4:5] */
  199. uint cpu_board_rev = get_cpu_board_revision ();
  200. printf ("Board: CDS Version 0x%02x, PCI Slot %d\n",
  201. get_board_version (), pci_slot);
  202. printf ("CPU Board Revision %d.%d (0x%04x)\n",
  203. MPC85XX_CPU_BOARD_MAJOR (cpu_board_rev),
  204. MPC85XX_CPU_BOARD_MINOR (cpu_board_rev), cpu_board_rev);
  205. printf (" PCI1: %d bit, %s MHz, %s\n",
  206. (pci1_32) ? 32 : 64,
  207. (pci1_speed == 33000000) ? "33" :
  208. (pci1_speed == 66000000) ? "66" : "unknown",
  209. pci1_clk_sel ? "sync" : "async");
  210. if (pci_dual) {
  211. printf (" PCI2: 32 bit, 66 MHz, %s\n",
  212. pci2_clk_sel ? "sync" : "async");
  213. } else {
  214. printf (" PCI2: disabled\n");
  215. }
  216. /*
  217. * Initialize local bus.
  218. */
  219. local_bus_init ();
  220. return 0;
  221. }
  222. long int
  223. initdram(int board_type)
  224. {
  225. long dram_size = 0;
  226. volatile immap_t *immap = (immap_t *)CFG_IMMR;
  227. puts("Initializing\n");
  228. #if defined(CONFIG_DDR_DLL)
  229. {
  230. /*
  231. * Work around to stabilize DDR DLL MSYNC_IN.
  232. * Errata DDR9 seems to have been fixed.
  233. * This is now the workaround for Errata DDR11:
  234. * Override DLL = 1, Course Adj = 1, Tap Select = 0
  235. */
  236. volatile ccsr_gur_t *gur= &immap->im_gur;
  237. gur->ddrdllcr = 0x81000000;
  238. asm("sync;isync;msync");
  239. udelay(200);
  240. }
  241. #endif
  242. dram_size = spd_sdram();
  243. #if defined(CONFIG_DDR_ECC)
  244. /*
  245. * Initialize and enable DDR ECC.
  246. */
  247. ddr_enable_ecc(dram_size);
  248. #endif
  249. /*
  250. * SDRAM Initialization
  251. */
  252. sdram_init();
  253. puts(" DDR: ");
  254. return dram_size;
  255. }
  256. /*
  257. * Initialize Local Bus
  258. */
  259. void
  260. local_bus_init(void)
  261. {
  262. volatile immap_t *immap = (immap_t *)CFG_IMMR;
  263. volatile ccsr_gur_t *gur = &immap->im_gur;
  264. volatile ccsr_lbc_t *lbc = &immap->im_lbc;
  265. uint clkdiv;
  266. uint lbc_hz;
  267. sys_info_t sysinfo;
  268. uint temp_lbcdll;
  269. /*
  270. * Errata LBC11.
  271. * Fix Local Bus clock glitch when DLL is enabled.
  272. *
  273. * If localbus freq is < 66Mhz, DLL bypass mode must be used.
  274. * If localbus freq is > 133Mhz, DLL can be safely enabled.
  275. * Between 66 and 133, the DLL is enabled with an override workaround.
  276. */
  277. get_sys_info(&sysinfo);
  278. clkdiv = lbc->lcrr & 0x0f;
  279. lbc_hz = sysinfo.freqSystemBus / 1000000 / clkdiv;
  280. if (lbc_hz < 66) {
  281. lbc->lcrr |= 0x80000000; /* DLL Bypass */
  282. } else if (lbc_hz >= 133) {
  283. lbc->lcrr &= (~0x80000000); /* DLL Enabled */
  284. } else {
  285. lbc->lcrr &= (~0x8000000); /* DLL Enabled */
  286. udelay(200);
  287. /*
  288. * Sample LBC DLL ctrl reg, upshift it to set the
  289. * override bits.
  290. */
  291. temp_lbcdll = gur->lbcdllcr;
  292. gur->lbcdllcr = (((temp_lbcdll & 0xff) << 16) | 0x80000000);
  293. asm("sync;isync;msync");
  294. }
  295. }
  296. /*
  297. * Initialize SDRAM memory on the Local Bus.
  298. */
  299. void
  300. sdram_init(void)
  301. {
  302. #if defined(CFG_OR2_PRELIM) && defined(CFG_BR2_PRELIM)
  303. uint idx;
  304. volatile immap_t *immap = (immap_t *)CFG_IMMR;
  305. volatile ccsr_lbc_t *lbc = &immap->im_lbc;
  306. uint *sdram_addr = (uint *)CFG_LBC_SDRAM_BASE;
  307. uint cpu_board_rev;
  308. uint lsdmr_common;
  309. puts(" SDRAM: ");
  310. print_size (CFG_LBC_SDRAM_SIZE * 1024 * 1024, "\n");
  311. /*
  312. * Setup SDRAM Base and Option Registers
  313. */
  314. lbc->or2 = CFG_OR2_PRELIM;
  315. asm("msync");
  316. lbc->br2 = CFG_BR2_PRELIM;
  317. asm("msync");
  318. lbc->lbcr = CFG_LBC_LBCR;
  319. asm("msync");
  320. lbc->lsrt = CFG_LBC_LSRT;
  321. lbc->mrtpr = CFG_LBC_MRTPR;
  322. asm("msync");
  323. /*
  324. * Determine which address lines to use baed on CPU board rev.
  325. */
  326. cpu_board_rev = get_cpu_board_revision();
  327. lsdmr_common = CFG_LBC_LSDMR_COMMON;
  328. if (cpu_board_rev == MPC85XX_CPU_BOARD_REV_1_0) {
  329. lsdmr_common |= CFG_LBC_LSDMR_BSMA1617;
  330. } else if (cpu_board_rev == MPC85XX_CPU_BOARD_REV_1_1) {
  331. lsdmr_common |= CFG_LBC_LSDMR_BSMA1516;
  332. } else {
  333. /*
  334. * Assume something unable to identify itself is
  335. * really old, and likely has lines 16/17 mapped.
  336. */
  337. lsdmr_common |= CFG_LBC_LSDMR_BSMA1617;
  338. }
  339. /*
  340. * Issue PRECHARGE ALL command.
  341. */
  342. lbc->lsdmr = lsdmr_common | CFG_LBC_LSDMR_OP_PCHALL;
  343. asm("sync;msync");
  344. *sdram_addr = 0xff;
  345. ppcDcbf((unsigned long) sdram_addr);
  346. udelay(100);
  347. /*
  348. * Issue 8 AUTO REFRESH commands.
  349. */
  350. for (idx = 0; idx < 8; idx++) {
  351. lbc->lsdmr = lsdmr_common | CFG_LBC_LSDMR_OP_ARFRSH;
  352. asm("sync;msync");
  353. *sdram_addr = 0xff;
  354. ppcDcbf((unsigned long) sdram_addr);
  355. udelay(100);
  356. }
  357. /*
  358. * Issue 8 MODE-set command.
  359. */
  360. lbc->lsdmr = lsdmr_common | CFG_LBC_LSDMR_OP_MRW;
  361. asm("sync;msync");
  362. *sdram_addr = 0xff;
  363. ppcDcbf((unsigned long) sdram_addr);
  364. udelay(100);
  365. /*
  366. * Issue NORMAL OP command.
  367. */
  368. lbc->lsdmr = lsdmr_common | CFG_LBC_LSDMR_OP_NORMAL;
  369. asm("sync;msync");
  370. *sdram_addr = 0xff;
  371. ppcDcbf((unsigned long) sdram_addr);
  372. udelay(200); /* Overkill. Must wait > 200 bus cycles */
  373. #endif /* enable SDRAM init */
  374. }
  375. #if defined(CFG_DRAM_TEST)
  376. int
  377. testdram(void)
  378. {
  379. uint *pstart = (uint *) CFG_MEMTEST_START;
  380. uint *pend = (uint *) CFG_MEMTEST_END;
  381. uint *p;
  382. printf("Testing DRAM from 0x%08x to 0x%08x\n",
  383. CFG_MEMTEST_START,
  384. CFG_MEMTEST_END);
  385. printf("DRAM test phase 1:\n");
  386. for (p = pstart; p < pend; p++)
  387. *p = 0xaaaaaaaa;
  388. for (p = pstart; p < pend; p++) {
  389. if (*p != 0xaaaaaaaa) {
  390. printf ("DRAM test fails at: %08x\n", (uint) p);
  391. return 1;
  392. }
  393. }
  394. printf("DRAM test phase 2:\n");
  395. for (p = pstart; p < pend; p++)
  396. *p = 0x55555555;
  397. for (p = pstart; p < pend; p++) {
  398. if (*p != 0x55555555) {
  399. printf ("DRAM test fails at: %08x\n", (uint) p);
  400. return 1;
  401. }
  402. }
  403. printf("DRAM test passed.\n");
  404. return 0;
  405. }
  406. #endif
  407. #if defined(CONFIG_PCI)
  408. /*
  409. * Initialize PCI Devices, report devices found.
  410. */
  411. #ifndef CONFIG_PCI_PNP
  412. static struct pci_config_table pci_mpc85xxcds_config_table[] = {
  413. { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
  414. PCI_IDSEL_NUMBER, PCI_ANY_ID,
  415. pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
  416. PCI_ENET0_MEMADDR,
  417. PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER
  418. } },
  419. { }
  420. };
  421. #endif
  422. static struct pci_controller hose = {
  423. #ifndef CONFIG_PCI_PNP
  424. config_table: pci_mpc85xxcds_config_table,
  425. #endif
  426. };
  427. #endif /* CONFIG_PCI */
  428. void
  429. pci_init_board(void)
  430. {
  431. #ifdef CONFIG_PCI
  432. extern void pci_mpc85xx_init(struct pci_controller *hose);
  433. pci_mpc85xx_init(&hose);
  434. #endif
  435. }