scm.c 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. /*
  2. * (C) Copyright 2001
  3. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #include <common.h>
  24. #include <ioports.h>
  25. #include <mpc8260.h>
  26. #include "scm.h"
  27. DECLARE_GLOBAL_DATA_PTR;
  28. static void config_scoh_cs(void);
  29. extern int fpga_init(void);
  30. #if 0
  31. #define DEBUGF(fmt,args...) printf (fmt ,##args)
  32. #else
  33. #define DEBUGF(fmt,args...)
  34. #endif
  35. /*
  36. * I/O Port configuration table
  37. *
  38. * if conf is 1, then that port pin will be configured at boot time
  39. * according to the five values podr/pdir/ppar/psor/pdat for that entry
  40. */
  41. const iop_conf_t iop_conf_tab[4][32] = {
  42. /* Port A configuration */
  43. { /* conf ppar psor pdir podr pdat */
  44. /* PA31 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 MII COL */
  45. /* PA30 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 MII CRS */
  46. /* PA29 */ { 1, 1, 1, 1, 0, 0 }, /* FCC1 MII TX_ER */
  47. /* PA28 */ { 1, 1, 1, 1, 0, 0 }, /* FCC1 MII TX_EN */
  48. /* PA27 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 MII RX_DV */
  49. /* PA26 */ { 1, 1, 1, 0, 0, 0 }, /* FCC1 MII RX_ER */
  50. /* PA25 */ { 0, 0, 0, 1, 0, 0 },
  51. /* PA24 */ { 0, 0, 0, 1, 0, 0 },
  52. /* PA23 */ { 0, 0, 0, 1, 0, 0 },
  53. /* PA22 */ { 0, 0, 0, 1, 0, 0 },
  54. /* PA21 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[3] */
  55. /* PA20 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[2] */
  56. /* PA19 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[1] */
  57. /* PA18 */ { 1, 1, 0, 1, 0, 0 }, /* FCC1 MII TxD[0] */
  58. /* PA17 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[0] */
  59. /* PA16 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[1]*/
  60. /* PA15 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[2] */
  61. /* PA14 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII RxD[3] */
  62. /* PA13 */ { 0, 0, 0, 1, 0, 0 },
  63. /* PA12 */ { 0, 0, 0, 1, 0, 0 },
  64. /* PA11 */ { 0, 0, 0, 1, 0, 0 },
  65. /* PA10 */ { 0, 0, 0, 1, 0, 0 },
  66. /* PA9 */ { 1, 1, 1, 1, 0, 0 }, /* TDM_A1 L1TXD0 */
  67. /* PA8 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_A1 L1RXD0 */
  68. /* PA7 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_A1 L1TSYNC */
  69. /* PA6 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_A1 L1RSYNC */
  70. /* PA5 */ { 1, 0, 0, 0, 0, 0 }, /* FIOX_FPGA_PR */
  71. /* PA4 */ { 1, 0, 0, 0, 0, 0 }, /* DOHM_FPGA_PR */
  72. /* PA3 */ { 1, 1, 0, 0, 0, 0 }, /* TDM RXCLK4 */
  73. /* PA2 */ { 1, 1, 0, 0, 0, 0 }, /* TDM TXCLK4 */
  74. /* PA1 */ { 0, 0, 0, 1, 0, 0 },
  75. /* PA0 */ { 1, 0, 0, 0, 0, 0 } /* BUSY */
  76. },
  77. /* Port B configuration */
  78. { /* conf ppar psor pdir podr pdat */
  79. /* PB31 */ { 1, 0, 0, 1, 0, 0 }, /* EQ_ALARM_MIN */
  80. /* PB30 */ { 1, 0, 0, 1, 0, 0 }, /* EQ_ALARM_MAJ */
  81. /* PB29 */ { 1, 0, 0, 1, 0, 0 }, /* COM_ALARM_MIN */
  82. /* PB28 */ { 1, 0, 0, 1, 0, 0 }, /* COM_ALARM_MAJ */
  83. /* PB27 */ { 0, 1, 0, 0, 0, 0 },
  84. /* PB26 */ { 0, 1, 0, 0, 0, 0 },
  85. /* PB25 */ { 1, 0, 0, 1, 0, 0 }, /* LED_GREEN_L */
  86. /* PB24 */ { 1, 0, 0, 1, 0, 0 }, /* LED_RED_L */
  87. /* PB23 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_D2 L1TXD */
  88. /* PB22 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_D2 L1RXD */
  89. /* PB21 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_D2 L1TSYNC */
  90. /* PB20 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_D2 L1RSYNC */
  91. /* PB19 */ { 1, 0, 0, 0, 0, 0 }, /* UID */
  92. /* PB18 */ { 0, 1, 0, 0, 0, 0 },
  93. /* PB17 */ { 1, 1, 0, 0, 0, 0 }, /* FCC3 MII RX_DV */
  94. /* PB16 */ { 1, 1, 0, 0, 0, 0 }, /* FCC3 MII RX_ER */
  95. /* PB15 */ { 1, 1, 0, 1, 0, 0 }, /* FCC3 MII TX_ER */
  96. /* PB14 */ { 1, 1, 0, 1, 0, 0 }, /* FCC3 MII TX_EN */
  97. /* PB13 */ { 1, 1, 0, 0, 0, 0 }, /* FCC3 MII COL */
  98. /* PB12 */ { 1, 1, 0, 0, 0, 0 }, /* FCC3 MII CRS */
  99. /* PB11 */ { 1, 1, 0, 0, 0, 0 }, /* FCC3 MII RxD[3] */
  100. /* PB10 */ { 1, 1, 0, 0, 0, 0 }, /* FCC3 MII RxD[2] */
  101. /* PB9 */ { 1, 1, 0, 0, 0, 0 }, /* FCC3 MII RxD[1] */
  102. /* PB8 */ { 1, 1, 0, 0, 0, 0 }, /* FCC3 MII RxD[0] */
  103. /* PB7 */ { 1, 1, 0, 1, 0, 0 }, /* FCC3 MII TxD[3] */
  104. /* PB6 */ { 1, 1, 0, 1, 0, 0 }, /* FCC3 MII TxD[2] */
  105. /* PB5 */ { 1, 1, 0, 1, 0, 0 }, /* FCC3 MII TxD[1] */
  106. /* PB4 */ { 1, 1, 0, 1, 0, 0 }, /* FCC3 MII TxD[0] */
  107. /* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  108. /* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  109. /* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  110. /* PB0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
  111. },
  112. /* Port C configuration */
  113. { /* conf ppar psor pdir podr pdat */
  114. /* PC31 */ { 1, 1, 0, 0, 0, 0 }, /* TDM RXCLK1 */
  115. /* PC30 */ { 1, 1, 0, 0, 0, 0 }, /* TDM TXCLK1 */
  116. /* PC29 */ { 1, 1, 0, 0, 0, 0 }, /* TDM RXCLK3 */
  117. /* PC28 */ { 1, 1, 0, 0, 0, 0 }, /* TDM TXCLK3 */
  118. /* PC27 */ { 1, 1, 0, 0, 0, 0 }, /* TDM RXCLK2 */
  119. /* PC26 */ { 1, 1, 0, 0, 0, 0 }, /* TDM TXCLK2 */
  120. /* PC25 */ { 0, 0, 0, 1, 0, 0 },
  121. /* PC24 */ { 0, 0, 0, 1, 0, 0 },
  122. /* PC23 */ { 0, 1, 0, 1, 0, 0 },
  123. /* PC22 */ { 0, 1, 0, 0, 0, 0 },
  124. /* PC21 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII TX_CLK */
  125. /* PC20 */ { 1, 1, 0, 0, 0, 0 }, /* FCC1 MII RX_CLK */
  126. /* PC19 */ { 0, 1, 0, 0, 0, 0 },
  127. /* PC18 */ { 0, 1, 0, 0, 0, 0 },
  128. /* PC17 */ { 1, 1, 0, 0, 0, 0 }, /* FCC3 MII RX_CLK */
  129. /* PC16 */ { 1, 1, 0, 0, 0, 0 }, /* FCC3 MII TX_CLK */
  130. /* PC15 */ { 0, 0, 0, 1, 0, 0 },
  131. /* PC14 */ { 0, 1, 0, 0, 0, 0 },
  132. /* PC13 */ { 0, 0, 0, 1, 0, 0 }, /* RES_PHY_L */
  133. /* PC12 */ { 0, 0, 0, 1, 0, 0 },
  134. /* PC11 */ { 0, 0, 0, 1, 0, 0 },
  135. /* PC10 */ { 0, 0, 0, 1, 0, 0 },
  136. /* PC9 */ { 0, 1, 1, 0, 0, 0 }, /* TDM_A2 L1TSYNC */
  137. /* PC8 */ { 0, 0, 0, 0, 0, 0 }, /* FEP_RDY */
  138. /* PC7 */ { 0, 0, 0, 0, 0, 0 },
  139. /* PC6 */ { 0, 0, 0, 0, 0, 0 }, /* UC4_ALARM_L */
  140. /* PC5 */ { 0, 0, 0, 0, 0, 0 }, /* UC3_ALARM_L */
  141. /* PC4 */ { 0, 0, 0, 0, 0, 0 }, /* UC2_ALARM_L */
  142. /* PC3 */ { 0, 0, 0, 1, 0, 0 }, /* RES_MISC_L */
  143. /* PC2 */ { 0, 0, 0, 1, 0, 0 }, /* RES_OH_L */
  144. /* PC1 */ { 0, 0, 0, 1, 0, 0 }, /* RES_DOHM_L */
  145. /* PC0 */ { 0, 0, 0, 1, 0, 0 }, /* RES_FIOX_L */
  146. },
  147. /* Port D configuration */
  148. { /* conf ppar psor pdir podr pdat */
  149. /* PD31 */ { 1, 1, 0, 0, 0, 0 }, /* SCC1 EN RxD */
  150. /* PD30 */ { 1, 1, 1, 1, 0, 0 }, /* SCC1 EN TxD */
  151. /* PD29 */ { 0, 0, 0, 0, 0, 0 }, /* INIT_F */
  152. /* PD28 */ { 0, 0, 0, 1, 0, 0 }, /* DONE_F */
  153. /* PD27 */ { 0, 0, 0, 0, 0, 0 }, /* INIT_D */
  154. /* PD26 */ { 0, 0, 0, 1, 0, 0 }, /* DONE_D */
  155. /* PD25 */ { 0, 0, 0, 1, 0, 0 },
  156. /* PD24 */ { 0, 0, 0, 1, 0, 0 },
  157. /* PD23 */ { 0, 0, 0, 1, 0, 0 },
  158. /* PD22 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_A2 L1TXD */
  159. /* PD21 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_A2 L1RXD */
  160. /* PD20 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_A2 L1RSYNC */
  161. /* PD19 */ { 1, 1, 1, 0, 0, 0 }, /* SPI SPISEL */
  162. /* PD18 */ { 1, 1, 1, 0, 0, 0 }, /* SPI SPICLK */
  163. /* PD17 */ { 1, 1, 1, 0, 0, 0 }, /* SPI SPIMOSI */
  164. /* PD16 */ { 1, 1, 1, 0, 0, 0 }, /* SPI SPIMOSO */
  165. #if defined(CONFIG_SOFT_I2C)
  166. /* PD15 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SDA */
  167. /* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* I2C SCL */
  168. #else
  169. #if defined(CONFIG_HARD_I2C)
  170. /* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */
  171. /* PD14 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SCL */
  172. #else /* normal I/O port pins */
  173. /* PD15 */ { 0, 1, 1, 0, 1, 0 }, /* I2C SDA */
  174. /* PD14 */ { 0, 1, 1, 0, 1, 0 }, /* I2C SCL */
  175. #endif
  176. #endif
  177. /* PD13 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_B1 L1TXD */
  178. /* PD12 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_B1 L1RXD */
  179. /* PD11 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_B1 L1TSYNC */
  180. /* PD10 */ { 1, 1, 1, 0, 0, 0 }, /* TDM_B1 L1RSYNC */
  181. /* PD9 */ { 1, 1, 0, 1, 0, 0 }, /* SMC1 TXD */
  182. /* PD8 */ { 1, 1, 0, 0, 0, 0 }, /* SMC1 RXD */
  183. /* PD7 */ { 0, 0, 0, 1, 0, 1 },
  184. /* PD6 */ { 0, 0, 0, 1, 0, 1 },
  185. /* PD5 */ { 0, 0, 0, 1, 0, 0 }, /* PROG_F */
  186. /* PD4 */ { 0, 0, 0, 1, 0, 0 }, /* PROG_D */
  187. /* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  188. /* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  189. /* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* pin doesn't exist */
  190. /* PD0 */ { 0, 0, 0, 0, 0, 0 } /* pin doesn't exist */
  191. }
  192. };
  193. /* ------------------------------------------------------------------------- */
  194. /* Check Board Identity:
  195. */
  196. int checkboard (void)
  197. {
  198. char str[64];
  199. int i = getenv_r ("serial#", str, sizeof (str));
  200. puts ("Board: ");
  201. if (!i || strncmp (str, "TQM8260", 7)) {
  202. puts ("### No HW ID - assuming TQM8260\n");
  203. return (0);
  204. }
  205. puts (str);
  206. putc ('\n');
  207. return 0;
  208. }
  209. /* ------------------------------------------------------------------------- */
  210. /* Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx
  211. *
  212. * This routine performs standard 8260 initialization sequence
  213. * and calculates the available memory size. It may be called
  214. * several times to try different SDRAM configurations on both
  215. * 60x and local buses.
  216. */
  217. static long int try_init (volatile memctl8260_t * memctl, ulong sdmr,
  218. ulong orx, volatile uchar * base)
  219. {
  220. volatile uchar c = 0xff;
  221. volatile uint *sdmr_ptr;
  222. volatile uint *orx_ptr;
  223. ulong maxsize, size;
  224. int i;
  225. /* We must be able to test a location outsize the maximum legal size
  226. * to find out THAT we are outside; but this address still has to be
  227. * mapped by the controller. That means, that the initial mapping has
  228. * to be (at least) twice as large as the maximum expected size.
  229. */
  230. maxsize = (1 + (~orx | 0x7fff)) / 2;
  231. /* Since CONFIG_SYS_SDRAM_BASE is always 0 (??), we assume that
  232. * we are configuring CS1 if base != 0
  233. */
  234. sdmr_ptr = base ? &memctl->memc_lsdmr : &memctl->memc_psdmr;
  235. orx_ptr = base ? &memctl->memc_or2 : &memctl->memc_or1;
  236. *orx_ptr = orx;
  237. /*
  238. * Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35):
  239. *
  240. * "At system reset, initialization software must set up the
  241. * programmable parameters in the memory controller banks registers
  242. * (ORx, BRx, P/LSDMR). After all memory parameters are configured,
  243. * system software should execute the following initialization sequence
  244. * for each SDRAM device.
  245. *
  246. * 1. Issue a PRECHARGE-ALL-BANKS command
  247. * 2. Issue eight CBR REFRESH commands
  248. * 3. Issue a MODE-SET command to initialize the mode register
  249. *
  250. * The initial commands are executed by setting P/LSDMR[OP] and
  251. * accessing the SDRAM with a single-byte transaction."
  252. *
  253. * The appropriate BRx/ORx registers have already been set when we
  254. * get here. The SDRAM can be accessed at the address CONFIG_SYS_SDRAM_BASE.
  255. */
  256. *sdmr_ptr = sdmr | PSDMR_OP_PREA;
  257. *base = c;
  258. *sdmr_ptr = sdmr | PSDMR_OP_CBRR;
  259. for (i = 0; i < 8; i++)
  260. *base = c;
  261. *sdmr_ptr = sdmr | PSDMR_OP_MRW;
  262. *(base + CONFIG_SYS_MRS_OFFS) = c; /* setting MR on address lines */
  263. *sdmr_ptr = sdmr | PSDMR_OP_NORM | PSDMR_RFEN;
  264. *base = c;
  265. size = get_ram_size((long *)base, maxsize);
  266. *orx_ptr = orx | ~(size - 1);
  267. return (size);
  268. }
  269. /*
  270. * Test Power-On-Reset.
  271. */
  272. int power_on_reset (void)
  273. {
  274. /* Test Reset Status Register */
  275. return gd->reset_status & RSR_CSRS ? 0 : 1;
  276. }
  277. phys_size_t initdram (int board_type)
  278. {
  279. volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
  280. volatile memctl8260_t *memctl = &immap->im_memctl;
  281. #ifndef CONFIG_SYS_RAMBOOT
  282. long size8, size9;
  283. #endif
  284. long psize, lsize;
  285. psize = 16 * 1024 * 1024;
  286. lsize = 0;
  287. memctl->memc_psrt = CONFIG_SYS_PSRT;
  288. memctl->memc_mptpr = CONFIG_SYS_MPTPR;
  289. #if 0 /* Just for debugging */
  290. #define prt_br_or(brX,orX) do { \
  291. ulong start = memctl->memc_ ## brX & 0xFFFF8000; \
  292. ulong sizem = ~memctl->memc_ ## orX | 0x00007FFF; \
  293. printf ("\n" \
  294. #brX " 0x%08x " #orX " 0x%08x " \
  295. "==> 0x%08lx ... 0x%08lx = %ld MB\n", \
  296. memctl->memc_ ## brX, memctl->memc_ ## orX, \
  297. start, start+sizem, (sizem+1)>>20); \
  298. } while (0)
  299. prt_br_or (br0, or0);
  300. prt_br_or (br1, or1);
  301. prt_br_or (br2, or2);
  302. prt_br_or (br3, or3);
  303. #endif
  304. #ifndef CONFIG_SYS_RAMBOOT
  305. /* 60x SDRAM setup:
  306. */
  307. size8 = try_init (memctl, CONFIG_SYS_PSDMR_8COL, CONFIG_SYS_OR1_8COL,
  308. (uchar *) CONFIG_SYS_SDRAM_BASE);
  309. size9 = try_init (memctl, CONFIG_SYS_PSDMR_9COL, CONFIG_SYS_OR1_9COL,
  310. (uchar *) CONFIG_SYS_SDRAM_BASE);
  311. if (size8 < size9) {
  312. psize = size9;
  313. printf ("(60x:9COL - %ld MB, ", psize >> 20);
  314. } else {
  315. psize = try_init (memctl, CONFIG_SYS_PSDMR_8COL, CONFIG_SYS_OR1_8COL,
  316. (uchar *) CONFIG_SYS_SDRAM_BASE);
  317. printf ("(60x:8COL - %ld MB, ", psize >> 20);
  318. }
  319. /* Local SDRAM setup:
  320. */
  321. #ifdef CONFIG_SYS_INIT_LOCAL_SDRAM
  322. memctl->memc_lsrt = CONFIG_SYS_LSRT;
  323. size8 = try_init (memctl, CONFIG_SYS_LSDMR_8COL, CONFIG_SYS_OR2_8COL,
  324. (uchar *) SDRAM_BASE2_PRELIM);
  325. size9 = try_init (memctl, CONFIG_SYS_LSDMR_9COL, CONFIG_SYS_OR2_9COL,
  326. (uchar *) SDRAM_BASE2_PRELIM);
  327. if (size8 < size9) {
  328. lsize = size9;
  329. printf ("Local:9COL - %ld MB) using ", lsize >> 20);
  330. } else {
  331. lsize = try_init (memctl, CONFIG_SYS_LSDMR_8COL, CONFIG_SYS_OR2_8COL,
  332. (uchar *) SDRAM_BASE2_PRELIM);
  333. printf ("Local:8COL - %ld MB) using ", lsize >> 20);
  334. }
  335. #if 0
  336. /* Set up BR2 so that the local SDRAM goes
  337. * right after the 60x SDRAM
  338. */
  339. memctl->memc_br2 = (CONFIG_SYS_BR2_PRELIM & ~BRx_BA_MSK) |
  340. (CONFIG_SYS_SDRAM_BASE + psize);
  341. #endif
  342. #endif /* CONFIG_SYS_INIT_LOCAL_SDRAM */
  343. #endif /* CONFIG_SYS_RAMBOOT */
  344. icache_enable ();
  345. config_scoh_cs ();
  346. return (psize);
  347. }
  348. /* ------------------------------------------------------------------------- */
  349. static void config_scoh_cs (void)
  350. {
  351. volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
  352. volatile memctl8260_t *memctl = &immr->im_memctl;
  353. volatile can_reg_t *can = (volatile can_reg_t *) CONFIG_SYS_CAN0_BASE;
  354. volatile uint tmp, i;
  355. /* Initialize OR3 / BR3 for CAN Bus Controller 0 */
  356. memctl->memc_or3 = CONFIG_SYS_CAN0_OR3;
  357. memctl->memc_br3 = CONFIG_SYS_CAN0_BR3;
  358. /* Initialize OR4 / BR4 for CAN Bus Controller 1 */
  359. memctl->memc_or4 = CONFIG_SYS_CAN1_OR4;
  360. memctl->memc_br4 = CONFIG_SYS_CAN1_BR4;
  361. /* Initialize MAMR to write in the array at address 0x0 */
  362. memctl->memc_mamr = 0x00 | MxMR_OP_WARR | MxMR_GPL_x4DIS;
  363. /* Initialize UPMA for CAN: single read */
  364. memctl->memc_mdr = 0xcffeec00;
  365. udelay (1); /* Necessary to have the data correct in the UPM array!!!! */
  366. /* The read on the CAN controller write the data of mdr in UPMA array. */
  367. /* The index to the array will be incremented automatically
  368. through this read */
  369. tmp = can->cpu_interface;
  370. memctl->memc_mdr = 0x0ffcec00;
  371. udelay (1);
  372. tmp = can->cpu_interface;
  373. memctl->memc_mdr = 0x0ffcec00;
  374. udelay (1);
  375. tmp = can->cpu_interface;
  376. memctl->memc_mdr = 0x0ffcec00;
  377. udelay (1);
  378. tmp = can->cpu_interface;
  379. memctl->memc_mdr = 0x0ffcec00;
  380. udelay (1);
  381. tmp = can->cpu_interface;
  382. memctl->memc_mdr = 0x0ffcfc00;
  383. udelay (1);
  384. tmp = can->cpu_interface;
  385. memctl->memc_mdr = 0x0ffcfc00;
  386. udelay (1);
  387. tmp = can->cpu_interface;
  388. memctl->memc_mdr = 0xfffdec07;
  389. udelay (1);
  390. tmp = can->cpu_interface;
  391. /* Initialize MAMR to write in the array at address 0x18 */
  392. memctl->memc_mamr = 0x18 | MxMR_OP_WARR | MxMR_GPL_x4DIS;
  393. /* Initialize UPMA for CAN: single write */
  394. memctl->memc_mdr = 0xfcffec00;
  395. udelay (1);
  396. tmp = can->cpu_interface;
  397. memctl->memc_mdr = 0x00ffec00;
  398. udelay (1);
  399. tmp = can->cpu_interface;
  400. memctl->memc_mdr = 0x00ffec00;
  401. udelay (1);
  402. tmp = can->cpu_interface;
  403. memctl->memc_mdr = 0x00ffec00;
  404. udelay (1);
  405. tmp = can->cpu_interface;
  406. memctl->memc_mdr = 0x00ffec00;
  407. udelay (1);
  408. tmp = can->cpu_interface;
  409. memctl->memc_mdr = 0x00fffc00;
  410. udelay (1);
  411. tmp = can->cpu_interface;
  412. memctl->memc_mdr = 0x00fffc00;
  413. udelay (1);
  414. tmp = can->cpu_interface;
  415. memctl->memc_mdr = 0x30ffec07;
  416. udelay (1);
  417. tmp = can->cpu_interface;
  418. /* Initialize MAMR */
  419. memctl->memc_mamr = MxMR_GPL_x4DIS; /* GPL_B4 ouput line Disable */
  420. /* Initialize OR5 / BR5 for the extended EEPROM Bank0 */
  421. memctl->memc_or5 = CONFIG_SYS_EXTPROM_OR5;
  422. memctl->memc_br5 = CONFIG_SYS_EXTPROM_BR5;
  423. /* Initialize OR6 / BR6 for the extended EEPROM Bank1 */
  424. memctl->memc_or6 = CONFIG_SYS_EXTPROM_OR6;
  425. memctl->memc_br6 = CONFIG_SYS_EXTPROM_BR6;
  426. /* Initialize OR7 / BR7 for the Glue Logic */
  427. memctl->memc_or7 = CONFIG_SYS_FIOX_OR7;
  428. memctl->memc_br7 = CONFIG_SYS_FIOX_BR7;
  429. /* Initialize OR8 / BR8 for the DOH Logic */
  430. memctl->memc_or8 = CONFIG_SYS_FDOHM_OR8;
  431. memctl->memc_br8 = CONFIG_SYS_FDOHM_BR8;
  432. DEBUGF ("OR0 %08x BR0 %08x\n", memctl->memc_or0, memctl->memc_br0);
  433. DEBUGF ("OR1 %08x BR1 %08x\n", memctl->memc_or1, memctl->memc_br1);
  434. DEBUGF ("OR2 %08x BR2 %08x\n", memctl->memc_or2, memctl->memc_br2);
  435. DEBUGF ("OR3 %08x BR3 %08x\n", memctl->memc_or3, memctl->memc_br3);
  436. DEBUGF ("OR4 %08x BR4 %08x\n", memctl->memc_or4, memctl->memc_br4);
  437. DEBUGF ("OR5 %08x BR5 %08x\n", memctl->memc_or5, memctl->memc_br5);
  438. DEBUGF ("OR6 %08x BR6 %08x\n", memctl->memc_or6, memctl->memc_br6);
  439. DEBUGF ("OR7 %08x BR7 %08x\n", memctl->memc_or7, memctl->memc_br7);
  440. DEBUGF ("OR8 %08x BR8 %08x\n", memctl->memc_or8, memctl->memc_br8);
  441. DEBUGF ("UPMA addr 0x0\n");
  442. memctl->memc_mamr = 0x00 | MxMR_OP_RARR | MxMR_GPL_x4DIS;
  443. for (i = 0; i < 0x8; i++) {
  444. tmp = can->cpu_interface;
  445. udelay (1);
  446. DEBUGF (" %08x ", memctl->memc_mdr);
  447. }
  448. DEBUGF ("\nUPMA addr 0x18\n");
  449. memctl->memc_mamr = 0x18 | MxMR_OP_RARR | MxMR_GPL_x4DIS;
  450. for (i = 0; i < 0x8; i++) {
  451. tmp = can->cpu_interface;
  452. udelay (1);
  453. DEBUGF (" %08x ", memctl->memc_mdr);
  454. }
  455. DEBUGF ("\n");
  456. memctl->memc_mamr = MxMR_GPL_x4DIS;
  457. }
  458. /* ------------------------------------------------------------------------- */
  459. int misc_init_r (void)
  460. {
  461. fpga_init ();
  462. return (0);
  463. }
  464. /* ------------------------------------------------------------------------- */