mpc8541cds.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. /*
  2. * Copyright 2004 Freescale Semiconductor.
  3. *
  4. * (C) Copyright 2002 Scott McNutt <smcnutt@artesyncp.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #include <common.h>
  25. #include <pci.h>
  26. #include <asm/processor.h>
  27. #include <asm/mmu.h>
  28. #include <asm/immap_85xx.h>
  29. #include <asm/fsl_ddr_sdram.h>
  30. #include <ioports.h>
  31. #include <spd_sdram.h>
  32. #include <libfdt.h>
  33. #include <fdt_support.h>
  34. #include "../common/cadmus.h"
  35. #include "../common/eeprom.h"
  36. #include "../common/via.h"
  37. #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
  38. extern void ddr_enable_ecc(unsigned int dram_size);
  39. #endif
  40. void local_bus_init(void);
  41. void sdram_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. int checkboard (void)
  191. {
  192. volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  193. /* PCI slot in USER bits CSR[6:7] by convention. */
  194. uint pci_slot = get_pci_slot ();
  195. uint pci_dual = get_pci_dual (); /* PCI DUAL in CM_PCI[3] */
  196. uint pci1_32 = gur->pordevsr & 0x10000; /* PORDEVSR[15] */
  197. uint pci1_clk_sel = gur->porpllsr & 0x8000; /* PORPLLSR[16] */
  198. uint pci2_clk_sel = gur->porpllsr & 0x4000; /* PORPLLSR[17] */
  199. uint pci1_speed = get_clock_freq (); /* PCI PSPEED in [4:5] */
  200. uint cpu_board_rev = get_cpu_board_revision ();
  201. printf ("Board: CDS Version 0x%02x, PCI Slot %d\n",
  202. get_board_version (), pci_slot);
  203. printf ("CPU Board Revision %d.%d (0x%04x)\n",
  204. MPC85XX_CPU_BOARD_MAJOR (cpu_board_rev),
  205. MPC85XX_CPU_BOARD_MINOR (cpu_board_rev), cpu_board_rev);
  206. printf (" PCI1: %d bit, %s MHz, %s\n",
  207. (pci1_32) ? 32 : 64,
  208. (pci1_speed == 33000000) ? "33" :
  209. (pci1_speed == 66000000) ? "66" : "unknown",
  210. pci1_clk_sel ? "sync" : "async");
  211. if (pci_dual) {
  212. printf (" PCI2: 32 bit, 66 MHz, %s\n",
  213. pci2_clk_sel ? "sync" : "async");
  214. } else {
  215. printf (" PCI2: disabled\n");
  216. }
  217. /*
  218. * Initialize local bus.
  219. */
  220. local_bus_init ();
  221. return 0;
  222. }
  223. phys_size_t
  224. initdram(int board_type)
  225. {
  226. long dram_size = 0;
  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 = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  237. gur->ddrdllcr = 0x81000000;
  238. asm("sync;isync;msync");
  239. udelay(200);
  240. }
  241. #endif
  242. dram_size = fsl_ddr_sdram();
  243. dram_size = setup_ddr_tlbs(dram_size / 0x100000);
  244. dram_size *= 0x100000;
  245. #if defined(CONFIG_DDR_ECC) && !defined(CONFIG_ECC_INIT_VIA_DDRCONTROLLER)
  246. /*
  247. * Initialize and enable DDR ECC.
  248. */
  249. ddr_enable_ecc(dram_size);
  250. #endif
  251. /*
  252. * SDRAM Initialization
  253. */
  254. sdram_init();
  255. puts(" DDR: ");
  256. return dram_size;
  257. }
  258. /*
  259. * Initialize Local Bus
  260. */
  261. void
  262. local_bus_init(void)
  263. {
  264. volatile ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
  265. volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
  266. uint clkdiv;
  267. uint lbc_hz;
  268. sys_info_t sysinfo;
  269. uint temp_lbcdll;
  270. /*
  271. * Errata LBC11.
  272. * Fix Local Bus clock glitch when DLL is enabled.
  273. *
  274. * If localbus freq is < 66MHz, DLL bypass mode must be used.
  275. * If localbus freq is > 133MHz, DLL can be safely enabled.
  276. * Between 66 and 133, the DLL is enabled with an override workaround.
  277. */
  278. get_sys_info(&sysinfo);
  279. clkdiv = lbc->lcrr & LCRR_CLKDIV;
  280. lbc_hz = sysinfo.freqSystemBus / 1000000 / clkdiv;
  281. if (lbc_hz < 66) {
  282. lbc->lcrr |= 0x80000000; /* DLL Bypass */
  283. } else if (lbc_hz >= 133) {
  284. lbc->lcrr &= (~0x80000000); /* DLL Enabled */
  285. } else {
  286. lbc->lcrr &= (~0x8000000); /* DLL Enabled */
  287. udelay(200);
  288. /*
  289. * Sample LBC DLL ctrl reg, upshift it to set the
  290. * override bits.
  291. */
  292. temp_lbcdll = gur->lbcdllcr;
  293. gur->lbcdllcr = (((temp_lbcdll & 0xff) << 16) | 0x80000000);
  294. asm("sync;isync;msync");
  295. }
  296. }
  297. /*
  298. * Initialize SDRAM memory on the Local Bus.
  299. */
  300. void
  301. sdram_init(void)
  302. {
  303. #if defined(CONFIG_SYS_OR2_PRELIM) && defined(CONFIG_SYS_BR2_PRELIM)
  304. uint idx;
  305. volatile ccsr_lbc_t *lbc = (void *)(CONFIG_SYS_MPC85xx_LBC_ADDR);
  306. uint *sdram_addr = (uint *)CONFIG_SYS_LBC_SDRAM_BASE;
  307. uint cpu_board_rev;
  308. uint lsdmr_common;
  309. puts(" SDRAM: ");
  310. print_size (CONFIG_SYS_LBC_SDRAM_SIZE * 1024 * 1024, "\n");
  311. /*
  312. * Setup SDRAM Base and Option Registers
  313. */
  314. lbc->or2 = CONFIG_SYS_OR2_PRELIM;
  315. asm("msync");
  316. lbc->br2 = CONFIG_SYS_BR2_PRELIM;
  317. asm("msync");
  318. lbc->lbcr = CONFIG_SYS_LBC_LBCR;
  319. asm("msync");
  320. lbc->lsrt = CONFIG_SYS_LBC_LSRT;
  321. lbc->mrtpr = CONFIG_SYS_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 = CONFIG_SYS_LBC_LSDMR_COMMON;
  328. if (cpu_board_rev == MPC85XX_CPU_BOARD_REV_1_0) {
  329. lsdmr_common |= LSDMR_BSMA1617;
  330. } else if (cpu_board_rev == MPC85XX_CPU_BOARD_REV_1_1) {
  331. lsdmr_common |= 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 |= LSDMR_BSMA1617;
  338. }
  339. /*
  340. * Issue PRECHARGE ALL command.
  341. */
  342. lbc->lsdmr = lsdmr_common | 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 | 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 | 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 | 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(CONFIG_PCI)
  376. /* For some reason the Tundra PCI bridge shows up on itself as a
  377. * different device. Work around that by refusing to configure it.
  378. */
  379. void dummy_func(struct pci_controller* hose, pci_dev_t dev, struct pci_config_table *tab) { }
  380. static struct pci_config_table pci_mpc85xxcds_config_table[] = {
  381. {0x10e3, 0x0513, PCI_ANY_ID, 1, 3, PCI_ANY_ID, dummy_func, {0,0,0}},
  382. {0x1106, 0x0686, PCI_ANY_ID, 1, VIA_ID, 0, mpc85xx_config_via, {0,0,0}},
  383. {0x1106, 0x0571, PCI_ANY_ID, 1, VIA_ID, 1,
  384. mpc85xx_config_via_usbide, {0,0,0}},
  385. {0x1105, 0x3038, PCI_ANY_ID, 1, VIA_ID, 2,
  386. mpc85xx_config_via_usb, {0,0,0}},
  387. {0x1106, 0x3038, PCI_ANY_ID, 1, VIA_ID, 3,
  388. mpc85xx_config_via_usb2, {0,0,0}},
  389. {0x1106, 0x3058, PCI_ANY_ID, 1, VIA_ID, 5,
  390. mpc85xx_config_via_power, {0,0,0}},
  391. {0x1106, 0x3068, PCI_ANY_ID, 1, VIA_ID, 6,
  392. mpc85xx_config_via_ac97, {0,0,0}},
  393. {},
  394. };
  395. static struct pci_controller hose[] = {
  396. { config_table: pci_mpc85xxcds_config_table,},
  397. #ifdef CONFIG_MPC85XX_PCI2
  398. {},
  399. #endif
  400. };
  401. #endif /* CONFIG_PCI */
  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