mpc8555cds.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  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/mmu.h>
  26. #include <asm/immap_85xx.h>
  27. #include <asm/fsl_ddr_sdram.h>
  28. #include <ioports.h>
  29. #include <spd_sdram.h>
  30. #include <libfdt.h>
  31. #include <fdt_support.h>
  32. #include "../common/cadmus.h"
  33. #include "../common/eeprom.h"
  34. #include "../common/via.h"
  35. #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
  36. extern void ddr_enable_ecc(unsigned int dram_size);
  37. #endif
  38. void local_bus_init(void);
  39. void sdram_init(void);
  40. /*
  41. * I/O Port configuration table
  42. *
  43. * if conf is 1, then that port pin will be configured at boot time
  44. * according to the five values podr/pdir/ppar/psor/pdat for that entry
  45. */
  46. const iop_conf_t iop_conf_tab[4][32] = {
  47. /* Port A configuration */
  48. { /* conf ppar psor pdir podr pdat */
  49. /* PA31 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxENB */
  50. /* PA30 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 TxClav */
  51. /* PA29 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxSOC */
  52. /* PA28 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 RxENB */
  53. /* PA27 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxSOC */
  54. /* PA26 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxClav */
  55. /* PA25 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[0] */
  56. /* PA24 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[1] */
  57. /* PA23 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[2] */
  58. /* PA22 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[3] */
  59. /* PA21 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[4] */
  60. /* PA20 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[5] */
  61. /* PA19 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[6] */
  62. /* PA18 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[7] */
  63. /* PA17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[7] */
  64. /* PA16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[6] */
  65. /* PA15 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[5] */
  66. /* PA14 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[4] */
  67. /* PA13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[3] */
  68. /* PA12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[2] */
  69. /* PA11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[1] */
  70. /* PA10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[0] */
  71. /* PA9 */ { 0, 1, 1, 1, 0, 0 }, /* FCC1 L1TXD */
  72. /* PA8 */ { 0, 1, 1, 0, 0, 0 }, /* FCC1 L1RXD */
  73. /* PA7 */ { 0, 0, 0, 1, 0, 0 }, /* PA7 */
  74. /* PA6 */ { 0, 1, 1, 1, 0, 0 }, /* TDM A1 L1RSYNC */
  75. /* PA5 */ { 0, 0, 0, 1, 0, 0 }, /* PA5 */
  76. /* PA4 */ { 0, 0, 0, 1, 0, 0 }, /* PA4 */
  77. /* PA3 */ { 0, 0, 0, 1, 0, 0 }, /* PA3 */
  78. /* PA2 */ { 0, 0, 0, 1, 0, 0 }, /* PA2 */
  79. /* PA1 */ { 1, 0, 0, 0, 0, 0 }, /* FREERUN */
  80. /* PA0 */ { 0, 0, 0, 1, 0, 0 } /* PA0 */
  81. },
  82. /* Port B configuration */
  83. { /* conf ppar psor pdir podr pdat */
  84. /* PB31 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TX_ER */
  85. /* PB30 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_DV */
  86. /* PB29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC2 MII TX_EN */
  87. /* PB28 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_ER */
  88. /* PB27 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII COL */
  89. /* PB26 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII CRS */
  90. /* PB25 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[3] */
  91. /* PB24 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[2] */
  92. /* PB23 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[1] */
  93. /* PB22 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[0] */
  94. /* PB21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[0] */
  95. /* PB20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[1] */
  96. /* PB19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[2] */
  97. /* PB18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[3] */
  98. /* PB17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_DIV */
  99. /* PB16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_ERR */
  100. /* PB15 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_ERR */
  101. /* PB14 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_EN */
  102. /* PB13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:COL */
  103. /* PB12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:CRS */
  104. /* PB11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  105. /* PB10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  106. /* PB9 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  107. /* PB8 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  108. /* PB7 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  109. /* PB6 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  110. /* PB5 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  111. /* PB4 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  112. /* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  113. /* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  114. /* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  115. /* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
  116. },
  117. /* Port C */
  118. { /* conf ppar psor pdir podr pdat */
  119. /* PC31 */ { 0, 0, 0, 1, 0, 0 }, /* PC31 */
  120. /* PC30 */ { 0, 0, 0, 1, 0, 0 }, /* PC30 */
  121. /* PC29 */ { 0, 1, 1, 0, 0, 0 }, /* SCC1 EN *CLSN */
  122. /* PC28 */ { 0, 0, 0, 1, 0, 0 }, /* PC28 */
  123. /* PC27 */ { 0, 0, 0, 1, 0, 0 }, /* UART Clock in */
  124. /* PC26 */ { 0, 0, 0, 1, 0, 0 }, /* PC26 */
  125. /* PC25 */ { 0, 0, 0, 1, 0, 0 }, /* PC25 */
  126. /* PC24 */ { 0, 0, 0, 1, 0, 0 }, /* PC24 */
  127. /* PC23 */ { 0, 1, 0, 1, 0, 0 }, /* ATMTFCLK */
  128. /* PC22 */ { 0, 1, 0, 0, 0, 0 }, /* ATMRFCLK */
  129. /* PC21 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RXCLK */
  130. /* PC20 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN TXCLK */
  131. /* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_CLK CLK13 */
  132. /* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK14) */
  133. /* PC17 */ { 0, 0, 0, 1, 0, 0 }, /* PC17 */
  134. /* PC16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK16) */
  135. /* PC15 */ { 1, 1, 0, 0, 0, 0 }, /* PC15 */
  136. /* PC14 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN *CD */
  137. /* PC13 */ { 0, 0, 0, 1, 0, 0 }, /* PC13 */
  138. /* PC12 */ { 0, 1, 0, 1, 0, 0 }, /* PC12 */
  139. /* PC11 */ { 0, 0, 0, 1, 0, 0 }, /* LXT971 transmit control */
  140. /* PC10 */ { 1, 0, 0, 1, 0, 0 }, /* FETHMDC */
  141. /* PC9 */ { 1, 0, 0, 0, 0, 0 }, /* FETHMDIO */
  142. /* PC8 */ { 0, 0, 0, 1, 0, 0 }, /* PC8 */
  143. /* PC7 */ { 0, 0, 0, 1, 0, 0 }, /* PC7 */
  144. /* PC6 */ { 0, 0, 0, 1, 0, 0 }, /* PC6 */
  145. /* PC5 */ { 0, 0, 0, 1, 0, 0 }, /* PC5 */
  146. /* PC4 */ { 0, 0, 0, 1, 0, 0 }, /* PC4 */
  147. /* PC3 */ { 0, 0, 0, 1, 0, 0 }, /* PC3 */
  148. /* PC2 */ { 0, 0, 0, 1, 0, 1 }, /* ENET FDE */
  149. /* PC1 */ { 0, 0, 0, 1, 0, 0 }, /* ENET DSQE */
  150. /* PC0 */ { 0, 0, 0, 1, 0, 0 }, /* ENET LBK */
  151. },
  152. /* Port D */
  153. { /* conf ppar psor pdir podr pdat */
  154. /* PD31 */ { 1, 1, 0, 0, 0, 0 }, /* SCC1 EN RxD */
  155. /* PD30 */ { 1, 1, 1, 1, 0, 0 }, /* SCC1 EN TxD */
  156. /* PD29 */ { 1, 1, 0, 1, 0, 0 }, /* SCC1 EN TENA */
  157. /* PD28 */ { 0, 1, 0, 0, 0, 0 }, /* PD28 */
  158. /* PD27 */ { 0, 1, 1, 1, 0, 0 }, /* PD27 */
  159. /* PD26 */ { 0, 0, 0, 1, 0, 0 }, /* PD26 */
  160. /* PD25 */ { 0, 0, 0, 1, 0, 0 }, /* PD25 */
  161. /* PD24 */ { 0, 0, 0, 1, 0, 0 }, /* PD24 */
  162. /* PD23 */ { 0, 0, 0, 1, 0, 0 }, /* PD23 */
  163. /* PD22 */ { 0, 0, 0, 1, 0, 0 }, /* PD22 */
  164. /* PD21 */ { 0, 0, 0, 1, 0, 0 }, /* PD21 */
  165. /* PD20 */ { 0, 0, 0, 1, 0, 0 }, /* PD20 */
  166. /* PD19 */ { 0, 0, 0, 1, 0, 0 }, /* PD19 */
  167. /* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD18 */
  168. /* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXPRTY */
  169. /* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXPRTY */
  170. /* PD15 */ { 0, 1, 1, 0, 1, 0 }, /* I2C SDA */
  171. /* PD14 */ { 0, 0, 0, 1, 0, 0 }, /* LED */
  172. /* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */
  173. /* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */
  174. /* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */
  175. /* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */
  176. /* PD9 */ { 0, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
  177. /* PD8 */ { 0, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
  178. /* PD7 */ { 0, 0, 0, 1, 0, 1 }, /* PD7 */
  179. /* PD6 */ { 0, 0, 0, 1, 0, 1 }, /* PD6 */
  180. /* PD5 */ { 0, 0, 0, 1, 0, 1 }, /* PD5 */
  181. /* PD4 */ { 0, 0, 0, 1, 0, 1 }, /* PD4 */
  182. /* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  183. /* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  184. /* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  185. /* PD0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
  186. }
  187. };
  188. int checkboard (void)
  189. {
  190. volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  191. /* PCI slot in USER bits CSR[6:7] by convention. */
  192. uint pci_slot = get_pci_slot ();
  193. uint pci_dual = get_pci_dual (); /* PCI DUAL in CM_PCI[3] */
  194. uint pci1_32 = gur->pordevsr & 0x10000; /* PORDEVSR[15] */
  195. uint pci1_clk_sel = gur->porpllsr & 0x8000; /* PORPLLSR[16] */
  196. uint pci2_clk_sel = gur->porpllsr & 0x4000; /* PORPLLSR[17] */
  197. uint pci1_speed = get_clock_freq (); /* PCI PSPEED in [4:5] */
  198. uint cpu_board_rev = get_cpu_board_revision ();
  199. printf ("Board: CDS Version 0x%02x, PCI Slot %d\n",
  200. get_board_version (), pci_slot);
  201. printf ("CPU Board Revision %d.%d (0x%04x)\n",
  202. MPC85XX_CPU_BOARD_MAJOR (cpu_board_rev),
  203. MPC85XX_CPU_BOARD_MINOR (cpu_board_rev), cpu_board_rev);
  204. printf (" PCI1: %d bit, %s MHz, %s\n",
  205. (pci1_32) ? 32 : 64,
  206. (pci1_speed == 33000000) ? "33" :
  207. (pci1_speed == 66000000) ? "66" : "unknown",
  208. pci1_clk_sel ? "sync" : "async");
  209. if (pci_dual) {
  210. printf (" PCI2: 32 bit, 66 MHz, %s\n",
  211. pci2_clk_sel ? "sync" : "async");
  212. } else {
  213. printf (" PCI2: disabled\n");
  214. }
  215. /*
  216. * Initialize local bus.
  217. */
  218. local_bus_init ();
  219. return 0;
  220. }
  221. phys_size_t
  222. initdram(int board_type)
  223. {
  224. long dram_size = 0;
  225. puts("Initializing\n");
  226. #if defined(CONFIG_DDR_DLL)
  227. {
  228. /*
  229. * Work around to stabilize DDR DLL MSYNC_IN.
  230. * Errata DDR9 seems to have been fixed.
  231. * This is now the workaround for Errata DDR11:
  232. * Override DLL = 1, Course Adj = 1, Tap Select = 0
  233. */
  234. volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  235. gur->ddrdllcr = 0x81000000;
  236. asm("sync;isync;msync");
  237. udelay(200);
  238. }
  239. #endif
  240. dram_size = fsl_ddr_sdram();
  241. dram_size = setup_ddr_tlbs(dram_size / 0x100000);
  242. dram_size *= 0x100000;
  243. #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
  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 ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  263. volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
  264. uint clkdiv;
  265. uint lbc_hz;
  266. sys_info_t sysinfo;
  267. uint temp_lbcdll;
  268. /*
  269. * Errata LBC11.
  270. * Fix Local Bus clock glitch when DLL is enabled.
  271. *
  272. * If localbus freq is < 66MHz, DLL bypass mode must be used.
  273. * If localbus freq is > 133MHz, DLL can be safely enabled.
  274. * Between 66 and 133, the DLL is enabled with an override workaround.
  275. */
  276. get_sys_info(&sysinfo);
  277. clkdiv = lbc->lcrr & LCRR_CLKDIV;
  278. lbc_hz = sysinfo.freqSystemBus / 1000000 / clkdiv;
  279. if (lbc_hz < 66) {
  280. lbc->lcrr |= 0x80000000; /* DLL Bypass */
  281. } else if (lbc_hz >= 133) {
  282. lbc->lcrr &= (~0x80000000); /* DLL Enabled */
  283. } else {
  284. lbc->lcrr &= (~0x8000000); /* DLL Enabled */
  285. udelay(200);
  286. /*
  287. * Sample LBC DLL ctrl reg, upshift it to set the
  288. * override bits.
  289. */
  290. temp_lbcdll = gur->lbcdllcr;
  291. gur->lbcdllcr = (((temp_lbcdll & 0xff) << 16) | 0x80000000);
  292. asm("sync;isync;msync");
  293. }
  294. }
  295. /*
  296. * Initialize SDRAM memory on the Local Bus.
  297. */
  298. void
  299. sdram_init(void)
  300. {
  301. #if defined(CONFIG_SYS_OR2_PRELIM) && defined(CONFIG_SYS_BR2_PRELIM)
  302. uint idx;
  303. volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
  304. uint *sdram_addr = (uint *)CONFIG_SYS_LBC_SDRAM_BASE;
  305. uint cpu_board_rev;
  306. uint lsdmr_common;
  307. puts(" SDRAM: ");
  308. print_size (CONFIG_SYS_LBC_SDRAM_SIZE * 1024 * 1024, "\n");
  309. /*
  310. * Setup SDRAM Base and Option Registers
  311. */
  312. lbc->or2 = CONFIG_SYS_OR2_PRELIM;
  313. asm("msync");
  314. lbc->br2 = CONFIG_SYS_BR2_PRELIM;
  315. asm("msync");
  316. lbc->lbcr = CONFIG_SYS_LBC_LBCR;
  317. asm("msync");
  318. lbc->lsrt = CONFIG_SYS_LBC_LSRT;
  319. lbc->mrtpr = CONFIG_SYS_LBC_MRTPR;
  320. asm("msync");
  321. /*
  322. * Determine which address lines to use baed on CPU board rev.
  323. */
  324. cpu_board_rev = get_cpu_board_revision();
  325. lsdmr_common = CONFIG_SYS_LBC_LSDMR_COMMON;
  326. if (cpu_board_rev == MPC85XX_CPU_BOARD_REV_1_0) {
  327. lsdmr_common |= LSDMR_BSMA1617;
  328. } else if (cpu_board_rev == MPC85XX_CPU_BOARD_REV_1_1) {
  329. lsdmr_common |= LSDMR_BSMA1516;
  330. } else {
  331. /*
  332. * Assume something unable to identify itself is
  333. * really old, and likely has lines 16/17 mapped.
  334. */
  335. lsdmr_common |= LSDMR_BSMA1617;
  336. }
  337. /*
  338. * Issue PRECHARGE ALL command.
  339. */
  340. lbc->lsdmr = lsdmr_common | LSDMR_OP_PCHALL;
  341. asm("sync;msync");
  342. *sdram_addr = 0xff;
  343. ppcDcbf((unsigned long) sdram_addr);
  344. udelay(100);
  345. /*
  346. * Issue 8 AUTO REFRESH commands.
  347. */
  348. for (idx = 0; idx < 8; idx++) {
  349. lbc->lsdmr = lsdmr_common | LSDMR_OP_ARFRSH;
  350. asm("sync;msync");
  351. *sdram_addr = 0xff;
  352. ppcDcbf((unsigned long) sdram_addr);
  353. udelay(100);
  354. }
  355. /*
  356. * Issue 8 MODE-set command.
  357. */
  358. lbc->lsdmr = lsdmr_common | LSDMR_OP_MRW;
  359. asm("sync;msync");
  360. *sdram_addr = 0xff;
  361. ppcDcbf((unsigned long) sdram_addr);
  362. udelay(100);
  363. /*
  364. * Issue NORMAL OP command.
  365. */
  366. lbc->lsdmr = lsdmr_common | LSDMR_OP_NORMAL;
  367. asm("sync;msync");
  368. *sdram_addr = 0xff;
  369. ppcDcbf((unsigned long) sdram_addr);
  370. udelay(200); /* Overkill. Must wait > 200 bus cycles */
  371. #endif /* enable SDRAM init */
  372. }
  373. #ifdef CONFIG_PCI
  374. /* For some reason the Tundra PCI bridge shows up on itself as a
  375. * different device. Work around that by refusing to configure it
  376. */
  377. void dummy_func(struct pci_controller* hose, pci_dev_t dev, struct pci_config_table *tab) { }
  378. static struct pci_config_table pci_mpc85xxcds_config_table[] = {
  379. {0x10e3, 0x0513, PCI_ANY_ID, 1, 3, PCI_ANY_ID, dummy_func, {0,0,0}},
  380. {0x1106, 0x0686, PCI_ANY_ID, 1, VIA_ID, 0, mpc85xx_config_via, {0,0,0}},
  381. {0x1106, 0x0571, PCI_ANY_ID, 1, VIA_ID, 1,
  382. mpc85xx_config_via_usbide, {0,0,0}},
  383. {0x1105, 0x3038, PCI_ANY_ID, 1, VIA_ID, 2,
  384. mpc85xx_config_via_usb, {0,0,0}},
  385. {0x1106, 0x3038, PCI_ANY_ID, 1, VIA_ID, 3,
  386. mpc85xx_config_via_usb2, {0,0,0}},
  387. {0x1106, 0x3058, PCI_ANY_ID, 1, VIA_ID, 5,
  388. mpc85xx_config_via_power, {0,0,0}},
  389. {0x1106, 0x3068, PCI_ANY_ID, 1, VIA_ID, 6,
  390. mpc85xx_config_via_ac97, {0,0,0}},
  391. {},
  392. };
  393. static struct pci_controller hose[] = {
  394. {
  395. config_table: pci_mpc85xxcds_config_table,
  396. },
  397. #ifdef CONFIG_MPC85XX_PCI2
  398. {},
  399. #endif
  400. };
  401. #endif
  402. void
  403. pci_init_board(void)
  404. {
  405. #ifdef CONFIG_PCI
  406. pci_mpc85xx_init(hose);
  407. #endif
  408. }
  409. #if defined(CONFIG_OF_BOARD_SETUP)
  410. void
  411. ft_pci_setup(void *blob, bd_t *bd)
  412. {
  413. int node, tmp[2];
  414. const char *path;
  415. node = fdt_path_offset(blob, "/aliases");
  416. tmp[0] = 0;
  417. if (node >= 0) {
  418. #ifdef CONFIG_PCI1
  419. path = fdt_getprop(blob, node, "pci0", NULL);
  420. if (path) {
  421. tmp[1] = hose[0].last_busno - hose[0].first_busno;
  422. do_fixup_by_path(blob, path, "bus-range", &tmp, 8, 1);
  423. }
  424. #endif
  425. #ifdef CONFIG_MPC85XX_PCI2
  426. path = fdt_getprop(blob, node, "pci1", NULL);
  427. if (path) {
  428. tmp[1] = hose[1].last_busno - hose[1].first_busno;
  429. do_fixup_by_path(blob, path, "bus-range", &tmp, 8, 1);
  430. }
  431. #endif
  432. }
  433. }
  434. #endif