stxgp3.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. /*
  2. * (C) Copyright 2003, Embedded Edge, LLC
  3. * Dan Malek, <dan@embeddededge.com>
  4. * Copied from ADS85xx.
  5. * Updates for Silicon Tx GP3 8560
  6. *
  7. * (C) Copyright 2003,Motorola Inc.
  8. * Xianghua Xiao, (X.Xiao@motorola.com)
  9. *
  10. * (C) Copyright 2002 Scott McNutt <smcnutt@artesyncp.com>
  11. *
  12. * See file CREDITS for list of people who contributed to this
  13. * project.
  14. *
  15. * This program is free software; you can redistribute it and/or
  16. * modify it under the terms of the GNU General Public License as
  17. * published by the Free Software Foundation; either version 2 of
  18. * the License, or (at your option) any later version.
  19. *
  20. * This program is distributed in the hope that it will be useful,
  21. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. * GNU General Public License for more details.
  24. *
  25. * You should have received a copy of the GNU General Public License
  26. * along with this program; if not, write to the Free Software
  27. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  28. * MA 02111-1307 USA
  29. */
  30. extern long int spd_sdram (void);
  31. #include <common.h>
  32. #include <asm/processor.h>
  33. #include <asm/immap_85xx.h>
  34. #include <ioports.h>
  35. #include <asm/io.h>
  36. #include <spd.h>
  37. #include <miiphy.h>
  38. long int fixed_sdram (void);
  39. /*
  40. * I/O Port configuration table
  41. *
  42. * if conf is 1, then that port pin will be configured at boot time
  43. * according to the five values podr/pdir/ppar/psor/pdat for that entry
  44. */
  45. const iop_conf_t iop_conf_tab[4][32] = {
  46. /* Port A configuration */
  47. { /* conf ppar psor pdir podr pdat */
  48. /* PA31 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxENB */
  49. /* PA30 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 TxClav */
  50. /* PA29 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 TxSOC */
  51. /* PA28 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 RxENB */
  52. /* PA27 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxSOC */
  53. /* PA26 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 RxClav */
  54. /* PA25 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[0] */
  55. /* PA24 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[1] */
  56. /* PA23 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[2] */
  57. /* PA22 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[3] */
  58. /* PA21 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[4] */
  59. /* PA20 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[5] */
  60. /* PA19 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[6] */
  61. /* PA18 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXD[7] */
  62. /* PA17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[7] */
  63. /* PA16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[6] */
  64. /* PA15 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[5] */
  65. /* PA14 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[4] */
  66. /* PA13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[3] */
  67. /* PA12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[2] */
  68. /* PA11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[1] */
  69. /* PA10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXD[0] */
  70. /* PA9 */ { 0, 1, 1, 1, 0, 0 }, /* FCC1 L1TXD */
  71. /* PA8 */ { 0, 1, 1, 0, 0, 0 }, /* FCC1 L1RXD */
  72. /* PA7 */ { 0, 0, 0, 1, 0, 0 }, /* PA7 */
  73. /* PA6 */ { 0, 1, 1, 1, 0, 0 }, /* TDM A1 L1RSYNC */
  74. /* PA5 */ { 0, 0, 0, 1, 0, 0 }, /* PA5 */
  75. /* PA4 */ { 0, 0, 0, 1, 0, 0 }, /* PA4 */
  76. /* PA3 */ { 0, 0, 0, 1, 0, 0 }, /* PA3 */
  77. /* PA2 */ { 0, 0, 0, 1, 0, 0 }, /* PA2 */
  78. /* PA1 */ { 1, 0, 0, 0, 0, 0 }, /* FREERUN */
  79. /* PA0 */ { 0, 0, 0, 1, 0, 0 } /* PA0 */
  80. },
  81. /* Port B configuration */
  82. { /* conf ppar psor pdir podr pdat */
  83. /* PB31 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TX_ER */
  84. /* PB30 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_DV */
  85. /* PB29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC2 MII TX_EN */
  86. /* PB28 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_ER */
  87. /* PB27 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII COL */
  88. /* PB26 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII CRS */
  89. /* PB25 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[3] */
  90. /* PB24 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[2] */
  91. /* PB23 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[1] */
  92. /* PB22 */ { 1, 1, 0, 1, 0, 0 }, /* FCC2 MII TxD[0] */
  93. /* PB21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[0] */
  94. /* PB20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[1] */
  95. /* PB19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[2] */
  96. /* PB18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RxD[3] */
  97. /* PB17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_DIV */
  98. /* PB16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RX_ERR */
  99. /* PB15 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_ERR */
  100. /* PB14 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TX_EN */
  101. /* PB13 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:COL */
  102. /* PB12 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:CRS */
  103. /* PB11 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  104. /* PB10 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  105. /* PB9 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  106. /* PB8 */ { 0, 1, 0, 0, 0, 0 }, /* FCC3:RXD */
  107. /* PB7 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  108. /* PB6 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  109. /* PB5 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  110. /* PB4 */ { 0, 1, 0, 1, 0, 0 }, /* FCC3:TXD */
  111. /* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  112. /* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  113. /* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  114. /* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
  115. },
  116. /* Port C */
  117. { /* conf ppar psor pdir podr pdat */
  118. /* PC31 */ { 0, 0, 0, 1, 0, 0 }, /* PC31 */
  119. /* PC30 */ { 0, 0, 0, 1, 0, 0 }, /* PC30 */
  120. /* PC29 */ { 0, 1, 1, 0, 0, 0 }, /* SCC1 EN *CLSN */
  121. /* PC28 */ { 0, 0, 0, 1, 0, 0 }, /* PC28 */
  122. /* PC27 */ { 0, 0, 0, 1, 0, 0 }, /* UART Clock in */
  123. /* PC26 */ { 0, 0, 0, 1, 0, 0 }, /* PC26 */
  124. /* PC25 */ { 0, 0, 0, 1, 0, 0 }, /* PC25 */
  125. /* PC24 */ { 0, 0, 0, 1, 0, 0 }, /* PC24 */
  126. /* PC23 */ { 0, 1, 0, 1, 0, 0 }, /* ATMTFCLK */
  127. /* PC22 */ { 0, 1, 0, 0, 0, 0 }, /* ATMRFCLK */
  128. /* PC21 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RXCLK */
  129. /* PC20 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN TXCLK */
  130. /* PC19 */ { 1, 1, 0, 0, 0, 0 }, /* FCC2 MII RX_CLK CLK13 */
  131. /* PC18 */ { 1, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK14) */
  132. /* PC17 */ { 0, 0, 0, 1, 0, 0 }, /* PC17 */
  133. /* PC16 */ { 0, 1, 0, 0, 0, 0 }, /* FCC Tx Clock (CLK16) */
  134. /* PC15 */ { 0, 1, 0, 0, 0, 0 }, /* PC15 */
  135. /* PC14 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN *CD */
  136. /* PC13 */ { 0, 0, 0, 1, 0, 0 }, /* PC13 */
  137. /* PC12 */ { 0, 1, 0, 1, 0, 0 }, /* PC12 */
  138. /* PC11 */ { 0, 0, 0, 1, 0, 0 }, /* LXT971 transmit control */
  139. /* PC10 */ { 0, 0, 0, 1, 0, 0 }, /* FETHMDC */
  140. /* PC9 */ { 0, 0, 0, 0, 0, 0 }, /* FETHMDIO */
  141. /* PC8 */ { 0, 0, 0, 1, 0, 0 }, /* PC8 */
  142. /* PC7 */ { 0, 0, 0, 1, 0, 0 }, /* PC7 */
  143. /* PC6 */ { 0, 0, 0, 1, 0, 0 }, /* PC6 */
  144. /* PC5 */ { 0, 0, 0, 1, 0, 0 }, /* PC5 */
  145. /* PC4 */ { 0, 0, 0, 1, 0, 0 }, /* PC4 */
  146. /* PC3 */ { 0, 0, 0, 1, 0, 0 }, /* PC3 */
  147. /* PC2 */ { 0, 0, 0, 1, 0, 1 }, /* ENET FDE */
  148. /* PC1 */ { 0, 0, 0, 1, 0, 0 }, /* ENET DSQE */
  149. /* PC0 */ { 0, 0, 0, 1, 0, 0 }, /* ENET LBK */
  150. },
  151. /* Port D */
  152. { /* conf ppar psor pdir podr pdat */
  153. /* PD31 */ { 0, 1, 0, 0, 0, 0 }, /* SCC1 EN RxD */
  154. /* PD30 */ { 0, 1, 1, 1, 0, 0 }, /* SCC1 EN TxD */
  155. /* PD29 */ { 0, 1, 0, 1, 0, 0 }, /* SCC1 EN TENA */
  156. /* PD28 */ { 1, 1, 0, 0, 0, 0 }, /* SCC2 RxD */
  157. /* PD27 */ { 1, 1, 0, 1, 0, 0 }, /* SCC2 TxD */
  158. /* PD26 */ { 0, 0, 0, 1, 0, 0 }, /* PD26 */
  159. /* PD25 */ { 0, 0, 0, 1, 0, 0 }, /* PD25 */
  160. /* PD24 */ { 0, 0, 0, 1, 0, 0 }, /* PD24 */
  161. /* PD23 */ { 0, 0, 0, 1, 0, 0 }, /* PD23 */
  162. /* PD22 */ { 0, 0, 0, 1, 0, 0 }, /* PD22 */
  163. /* PD21 */ { 0, 0, 0, 1, 0, 0 }, /* PD21 */
  164. /* PD20 */ { 0, 0, 0, 1, 0, 0 }, /* PD20 */
  165. /* PD19 */ { 0, 0, 0, 1, 0, 0 }, /* PD19 */
  166. /* PD18 */ { 0, 0, 0, 1, 0, 0 }, /* PD18 */
  167. /* PD17 */ { 0, 1, 0, 0, 0, 0 }, /* FCC1 ATMRXPRTY */
  168. /* PD16 */ { 0, 1, 0, 1, 0, 0 }, /* FCC1 ATMTXPRTY */
  169. /* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */
  170. /* PD14 */ { 1, 1, 1, 0, 0, 0 }, /* I2C CLK */
  171. /* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */
  172. /* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */
  173. /* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */
  174. /* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */
  175. /* PD9 */ { 0, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
  176. /* PD8 */ { 0, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
  177. /* PD7 */ { 0, 0, 0, 1, 0, 1 }, /* PD7 */
  178. /* PD6 */ { 0, 0, 0, 1, 0, 1 }, /* PD6 */
  179. /* PD5 */ { 0, 0, 0, 1, 0, 1 }, /* PD5 */
  180. /* PD4 */ { 0, 0, 0, 1, 0, 1 }, /* PD4 */
  181. /* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  182. /* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  183. /* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  184. /* PD0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
  185. }
  186. };
  187. static uint64_t next_led_update;
  188. static uint led_bit;
  189. int board_pre_init (void)
  190. {
  191. #if defined(CONFIG_PCI)
  192. volatile immap_t *immr = (immap_t *)CFG_IMMR;
  193. volatile ccsr_pcix_t *pci = &immr->im_pcix;
  194. pci->peer &= 0xfffffffdf; /* disable master abort */
  195. #endif
  196. return 0;
  197. }
  198. void reset_phy (void)
  199. {
  200. volatile uint *blatch;
  201. blatch = (volatile uint *)CFG_LBC_LCLDEVS_BASE;
  202. /* reset Giga bit Ethernet port if needed here */
  203. *blatch &= ~0x000000c0;
  204. udelay(100);
  205. *blatch = 0x000000c1; /* Light one led, too */
  206. udelay(1000);
  207. #if 0 /* This is the port we really want to use for debugging. */
  208. /* reset the CPM FEC port */
  209. #if (CONFIG_ETHER_INDEX == 2)
  210. bcsr->bcsr2 &= ~FETH2_RST;
  211. udelay(2);
  212. bcsr->bcsr2 |= FETH2_RST;
  213. udelay(1000);
  214. #elif (CONFIG_ETHER_INDEX == 3)
  215. bcsr->bcsr3 &= ~FETH3_RST;
  216. udelay(2);
  217. bcsr->bcsr3 |= FETH3_RST;
  218. udelay(1000);
  219. #endif
  220. #if defined(CONFIG_MII) && defined(CONFIG_ETHER_ON_FCC)
  221. miiphy_reset(0x0); /* reset PHY */
  222. miiphy_write(0, PHY_MIPSCR, 0xf028); /* change PHY address to 0x02 */
  223. miiphy_write(0x02, PHY_BMCR, PHY_BMCR_AUTON | PHY_BMCR_RST_NEG);
  224. #endif /* CONFIG_MII */
  225. #endif
  226. }
  227. int checkboard (void)
  228. {
  229. sys_info_t sysinfo;
  230. get_sys_info (&sysinfo);
  231. printf ("Board: Silicon Tx GPPP 8560 Board\n");
  232. printf ("\tCPU: %lu MHz\n", sysinfo.freqProcessor / 1000000);
  233. printf ("\tCCB: %lu MHz\n", sysinfo.freqSystemBus / 1000000);
  234. printf ("\tDDR: %lu MHz\n", sysinfo.freqSystemBus / 2000000);
  235. if((CFG_LBC_LCRR & 0x0f) == 2 || (CFG_LBC_LCRR & 0x0f) == 4 \
  236. || (CFG_LBC_LCRR & 0x0f) == 8) {
  237. printf ("\tLBC: %lu MHz\n", sysinfo.freqSystemBus / 1000000 /(CFG_LBC_LCRR & 0x0f));
  238. } else {
  239. printf("\tLBC: unknown\n");
  240. }
  241. printf("\tCPM: %lu Mhz\n", sysinfo.freqSystemBus / 1000000);
  242. printf("L1 D-cache 32KB, L1 I-cache 32KB enabled.\n");
  243. return (0);
  244. }
  245. /* Blinkin' LEDS for Robert.
  246. */
  247. void
  248. show_activity(int flag)
  249. {
  250. volatile uint *blatch;
  251. if (next_led_update > get_ticks())
  252. return;
  253. blatch = (volatile uint *)CFG_LBC_LCLDEVS_BASE;
  254. led_bit >>= 1;
  255. if (led_bit == 0)
  256. led_bit = 0x08;
  257. *blatch = (0xc0 | led_bit);
  258. eieio();
  259. next_led_update += (get_tbclk() / 4);
  260. }
  261. long int initdram (int board_type)
  262. {
  263. long dram_size = 0;
  264. extern long spd_sdram (void);
  265. volatile immap_t *immap = (immap_t *)CFG_IMMR;
  266. #if defined(CONFIG_DDR_DLL)
  267. volatile ccsr_gur_t *gur= &immap->im_gur;
  268. uint temp_ddrdll = 0;
  269. /* Work around to stabilize DDR DLL */
  270. temp_ddrdll = gur->ddrdllcr;
  271. gur->ddrdllcr = ((temp_ddrdll & 0xff) << 16) | 0x80000000;
  272. asm("sync;isync;msync");
  273. #endif
  274. dram_size = spd_sdram ();
  275. #if defined(CONFIG_DDR_ECC)
  276. {
  277. /* Initialize all of memory for ECC, then
  278. * enable errors */
  279. uint *p = 0;
  280. uint i = 0;
  281. volatile immap_t *immap = (immap_t *)CFG_IMMR;
  282. volatile ccsr_ddr_t *ddr= &immap->im_ddr;
  283. dma_init();
  284. for (*p = 0; p < (uint *)(8 * 1024); p++) {
  285. if (((unsigned int)p & 0x1f) == 0) { dcbz(p); }
  286. *p = (unsigned int)0xdeadbeef;
  287. if (((unsigned int)p & 0x1c) == 0x1c) { dcbf(p); }
  288. }
  289. /* 8K */
  290. dma_xfer((uint *)0x2000,0x2000,(uint *)0);
  291. /* 16K */
  292. dma_xfer((uint *)0x4000,0x4000,(uint *)0);
  293. /* 32K */
  294. dma_xfer((uint *)0x8000,0x8000,(uint *)0);
  295. /* 64K */
  296. dma_xfer((uint *)0x10000,0x10000,(uint *)0);
  297. /* 128k */
  298. dma_xfer((uint *)0x20000,0x20000,(uint *)0);
  299. /* 256k */
  300. dma_xfer((uint *)0x40000,0x40000,(uint *)0);
  301. /* 512k */
  302. dma_xfer((uint *)0x80000,0x80000,(uint *)0);
  303. /* 1M */
  304. dma_xfer((uint *)0x100000,0x100000,(uint *)0);
  305. /* 2M */
  306. dma_xfer((uint *)0x200000,0x200000,(uint *)0);
  307. /* 4M */
  308. dma_xfer((uint *)0x400000,0x400000,(uint *)0);
  309. for (i = 1; i < dram_size / 0x800000; i++) {
  310. dma_xfer((uint *)(0x800000*i),0x800000,(uint *)0);
  311. }
  312. /* Enable errors for ECC */
  313. ddr->err_disable = 0x00000000;
  314. asm("sync;isync;msync");
  315. }
  316. #endif
  317. return dram_size;
  318. }
  319. #if defined(CFG_DRAM_TEST)
  320. int testdram (void)
  321. {
  322. uint *pstart = (uint *) CFG_MEMTEST_START;
  323. uint *pend = (uint *) CFG_MEMTEST_END;
  324. uint *p;
  325. printf("SDRAM test phase 1:\n");
  326. for (p = pstart; p < pend; p++)
  327. *p = 0xaaaaaaaa;
  328. for (p = pstart; p < pend; p++) {
  329. if (*p != 0xaaaaaaaa) {
  330. printf ("SDRAM test fails at: %08x\n", (uint) p);
  331. return 1;
  332. }
  333. }
  334. printf("SDRAM test phase 2:\n");
  335. for (p = pstart; p < pend; p++)
  336. *p = 0x55555555;
  337. for (p = pstart; p < pend; p++) {
  338. if (*p != 0x55555555) {
  339. printf ("SDRAM test fails at: %08x\n", (uint) p);
  340. return 1;
  341. }
  342. }
  343. printf("SDRAM test passed.\n");
  344. return 0;
  345. }
  346. #endif
  347. #if !defined(CONFIG_SPD_EEPROM)
  348. /*************************************************************************
  349. * fixed sdram init -- doesn't use serial presence detect.
  350. ************************************************************************/
  351. long int fixed_sdram (void)
  352. {
  353. #ifndef CFG_RAMBOOT
  354. volatile immap_t *immap = (immap_t *)CFG_IMMR;
  355. volatile ccsr_ddr_t *ddr= &immap->im_ddr;
  356. ddr->cs0_bnds = CFG_DDR_CS0_BNDS;
  357. ddr->cs0_config = CFG_DDR_CS0_CONFIG;
  358. ddr->timing_cfg_1 = CFG_DDR_TIMING_1;
  359. ddr->timing_cfg_2 = CFG_DDR_TIMING_2;
  360. ddr->sdram_mode = CFG_DDR_MODE;
  361. ddr->sdram_interval = CFG_DDR_INTERVAL;
  362. #if defined (CONFIG_DDR_ECC)
  363. ddr->err_disable = 0x0000000D;
  364. ddr->err_sbe = 0x00ff0000;
  365. #endif
  366. asm("sync;isync;msync");
  367. udelay(500);
  368. #if defined (CONFIG_DDR_ECC)
  369. /* Enable ECC checking */
  370. ddr->sdram_cfg = (CFG_DDR_CONTROL | 0x20000000);
  371. #else
  372. ddr->sdram_cfg = CFG_DDR_CONTROL;
  373. #endif
  374. asm("sync; isync; msync");
  375. udelay(500);
  376. #endif
  377. return ( CFG_SDRAM_SIZE * 1024 * 1024);
  378. }
  379. #endif /* !defined(CONFIG_SPD_EEPROM) */