tqm8xx.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. /*
  2. * (C) Copyright 2000-2008
  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 <mpc8xx.h>
  25. #ifdef CONFIG_PS2MULT
  26. #include <ps2mult.h>
  27. #endif
  28. extern flash_info_t flash_info[]; /* FLASH chips info */
  29. DECLARE_GLOBAL_DATA_PTR;
  30. static long int dram_size (long int, long int *, long int);
  31. #define _NOT_USED_ 0xFFFFFFFF
  32. /* UPM initialization table for SDRAM: 40, 50, 66 MHz CLKOUT @ CAS latency 2, tWR=2 */
  33. const uint sdram_table[] =
  34. {
  35. /*
  36. * Single Read. (Offset 0 in UPMA RAM)
  37. */
  38. 0x1F0DFC04, 0xEEAFBC04, 0x11AF7C04, 0xEFBAFC00,
  39. 0x1FF5FC47, /* last */
  40. /*
  41. * SDRAM Initialization (offset 5 in UPMA RAM)
  42. *
  43. * This is no UPM entry point. The following definition uses
  44. * the remaining space to establish an initialization
  45. * sequence, which is executed by a RUN command.
  46. *
  47. */
  48. 0x1FF5FC34, 0xEFEABC34, 0x1FB57C35, /* last */
  49. /*
  50. * Burst Read. (Offset 8 in UPMA RAM)
  51. */
  52. 0x1F0DFC04, 0xEEAFBC04, 0x10AF7C04, 0xF0AFFC00,
  53. 0xF0AFFC00, 0xF1AFFC00, 0xEFBAFC00, 0x1FF5FC47, /* last */
  54. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  55. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  56. /*
  57. * Single Write. (Offset 18 in UPMA RAM)
  58. */
  59. 0x1F0DFC04, 0xEEABBC00, 0x11B77C04, 0xEFFAFC44,
  60. 0x1FF5FC47, /* last */
  61. _NOT_USED_, _NOT_USED_, _NOT_USED_,
  62. /*
  63. * Burst Write. (Offset 20 in UPMA RAM)
  64. */
  65. 0x1F0DFC04, 0xEEABBC00, 0x10A77C00, 0xF0AFFC00,
  66. 0xF0AFFC00, 0xF0AFFC04, 0xE1BAFC44, 0x1FF5FC47, /* last */
  67. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  68. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  69. /*
  70. * Refresh (Offset 30 in UPMA RAM)
  71. */
  72. 0x1FFD7C84, 0xFFFFFC04, 0xFFFFFC04, 0xFFFFFC04,
  73. 0xFFFFFC84, 0xFFFFFC07, /* last */
  74. _NOT_USED_, _NOT_USED_,
  75. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  76. /*
  77. * Exception. (Offset 3c in UPMA RAM)
  78. */
  79. 0xFFFFFC07, /* last */
  80. _NOT_USED_, _NOT_USED_, _NOT_USED_,
  81. };
  82. /* ------------------------------------------------------------------------- */
  83. /*
  84. * Check Board Identity:
  85. *
  86. * Test TQ ID string (TQM8xx...)
  87. * If present, check for "L" type (no second DRAM bank),
  88. * otherwise "L" type is assumed as default.
  89. *
  90. * Set board_type to 'L' for "L" type, 'M' for "M" type, 0 else.
  91. */
  92. int checkboard (void)
  93. {
  94. char *s = getenv ("serial#");
  95. puts ("Board: ");
  96. if (!s || strncmp (s, "TQM8", 4)) {
  97. puts ("### No HW ID - assuming TQM8xxL\n");
  98. return (0);
  99. }
  100. if ((*(s + 6) == 'L')) { /* a TQM8xxL type */
  101. gd->board_type = 'L';
  102. }
  103. if ((*(s + 6) == 'M')) { /* a TQM8xxM type */
  104. gd->board_type = 'M';
  105. }
  106. if ((*(s + 6) == 'D')) { /* a TQM885D type */
  107. gd->board_type = 'D';
  108. }
  109. for (; *s; ++s) {
  110. if (*s == ' ')
  111. break;
  112. putc (*s);
  113. }
  114. #ifdef CONFIG_VIRTLAB2
  115. puts (" (Virtlab2)");
  116. #endif
  117. putc ('\n');
  118. return (0);
  119. }
  120. /* ------------------------------------------------------------------------- */
  121. phys_size_t initdram (int board_type)
  122. {
  123. volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
  124. volatile memctl8xx_t *memctl = &immap->im_memctl;
  125. long int size8, size9, size10;
  126. long int size_b0 = 0;
  127. long int size_b1 = 0;
  128. upmconfig (UPMA, (uint *) sdram_table,
  129. sizeof (sdram_table) / sizeof (uint));
  130. /*
  131. * Preliminary prescaler for refresh (depends on number of
  132. * banks): This value is selected for four cycles every 62.4 us
  133. * with two SDRAM banks or four cycles every 31.2 us with one
  134. * bank. It will be adjusted after memory sizing.
  135. */
  136. memctl->memc_mptpr = CONFIG_SYS_MPTPR_2BK_8K;
  137. /*
  138. * The following value is used as an address (i.e. opcode) for
  139. * the LOAD MODE REGISTER COMMAND during SDRAM initialisation. If
  140. * the port size is 32bit the SDRAM does NOT "see" the lower two
  141. * address lines, i.e. mar=0x00000088 -> opcode=0x00000022 for
  142. * MICRON SDRAMs:
  143. * -> 0 00 010 0 010
  144. * | | | | +- Burst Length = 4
  145. * | | | +----- Burst Type = Sequential
  146. * | | +------- CAS Latency = 2
  147. * | +----------- Operating Mode = Standard
  148. * +-------------- Write Burst Mode = Programmed Burst Length
  149. */
  150. memctl->memc_mar = 0x00000088;
  151. /*
  152. * Map controller banks 2 and 3 to the SDRAM banks 2 and 3 at
  153. * preliminary addresses - these have to be modified after the
  154. * SDRAM size has been determined.
  155. */
  156. memctl->memc_or2 = CONFIG_SYS_OR2_PRELIM;
  157. memctl->memc_br2 = CONFIG_SYS_BR2_PRELIM;
  158. #ifndef CONFIG_CAN_DRIVER
  159. if ((board_type != 'L') &&
  160. (board_type != 'M') &&
  161. (board_type != 'D') ) { /* only one SDRAM bank on L, M and D modules */
  162. memctl->memc_or3 = CONFIG_SYS_OR3_PRELIM;
  163. memctl->memc_br3 = CONFIG_SYS_BR3_PRELIM;
  164. }
  165. #endif /* CONFIG_CAN_DRIVER */
  166. memctl->memc_mamr = CONFIG_SYS_MAMR_8COL & (~(MAMR_PTAE)); /* no refresh yet */
  167. udelay (200);
  168. /* perform SDRAM initializsation sequence */
  169. memctl->memc_mcr = 0x80004105; /* SDRAM bank 0 */
  170. udelay (1);
  171. memctl->memc_mcr = 0x80004230; /* SDRAM bank 0 - execute twice */
  172. udelay (1);
  173. #ifndef CONFIG_CAN_DRIVER
  174. if ((board_type != 'L') &&
  175. (board_type != 'M') &&
  176. (board_type != 'D') ) { /* only one SDRAM bank on L, M and D modules */
  177. memctl->memc_mcr = 0x80006105; /* SDRAM bank 1 */
  178. udelay (1);
  179. memctl->memc_mcr = 0x80006230; /* SDRAM bank 1 - execute twice */
  180. udelay (1);
  181. }
  182. #endif /* CONFIG_CAN_DRIVER */
  183. memctl->memc_mamr |= MAMR_PTAE; /* enable refresh */
  184. udelay (1000);
  185. /*
  186. * Check Bank 0 Memory Size for re-configuration
  187. *
  188. * try 8 column mode
  189. */
  190. size8 = dram_size (CONFIG_SYS_MAMR_8COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
  191. debug ("SDRAM Bank 0 in 8 column mode: %ld MB\n", size8 >> 20);
  192. udelay (1000);
  193. /*
  194. * try 9 column mode
  195. */
  196. size9 = dram_size (CONFIG_SYS_MAMR_9COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
  197. debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size9 >> 20);
  198. udelay(1000);
  199. #if defined(CONFIG_SYS_MAMR_10COL)
  200. /*
  201. * try 10 column mode
  202. */
  203. size10 = dram_size (CONFIG_SYS_MAMR_10COL, SDRAM_BASE2_PRELIM, SDRAM_MAX_SIZE);
  204. debug ("SDRAM Bank 0 in 10 column mode: %ld MB\n", size10 >> 20);
  205. #else
  206. size10 = 0;
  207. #endif /* CONFIG_SYS_MAMR_10COL */
  208. if ((size8 < size10) && (size9 < size10)) {
  209. size_b0 = size10;
  210. } else if ((size8 < size9) && (size10 < size9)) {
  211. size_b0 = size9;
  212. memctl->memc_mamr = CONFIG_SYS_MAMR_9COL;
  213. udelay (500);
  214. } else {
  215. size_b0 = size8;
  216. memctl->memc_mamr = CONFIG_SYS_MAMR_8COL;
  217. udelay (500);
  218. }
  219. debug ("SDRAM Bank 0: %ld MB\n", size_b0 >> 20);
  220. #ifndef CONFIG_CAN_DRIVER
  221. if ((board_type != 'L') &&
  222. (board_type != 'M') &&
  223. (board_type != 'D') ) { /* only one SDRAM bank on L, M and D modules */
  224. /*
  225. * Check Bank 1 Memory Size
  226. * use current column settings
  227. * [9 column SDRAM may also be used in 8 column mode,
  228. * but then only half the real size will be used.]
  229. */
  230. size_b1 = dram_size (memctl->memc_mamr, (long int *)SDRAM_BASE3_PRELIM,
  231. SDRAM_MAX_SIZE);
  232. debug ("SDRAM Bank 1: %ld MB\n", size_b1 >> 20);
  233. } else {
  234. size_b1 = 0;
  235. }
  236. #endif /* CONFIG_CAN_DRIVER */
  237. udelay (1000);
  238. /*
  239. * Adjust refresh rate depending on SDRAM type, both banks
  240. * For types > 128 MBit leave it at the current (fast) rate
  241. */
  242. if ((size_b0 < 0x02000000) && (size_b1 < 0x02000000)) {
  243. /* reduce to 15.6 us (62.4 us / quad) */
  244. memctl->memc_mptpr = CONFIG_SYS_MPTPR_2BK_4K;
  245. udelay (1000);
  246. }
  247. /*
  248. * Final mapping: map bigger bank first
  249. */
  250. if (size_b1 > size_b0) { /* SDRAM Bank 1 is bigger - map first */
  251. memctl->memc_or3 = ((-size_b1) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
  252. memctl->memc_br3 = (CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
  253. if (size_b0 > 0) {
  254. /*
  255. * Position Bank 0 immediately above Bank 1
  256. */
  257. memctl->memc_or2 = ((-size_b0) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
  258. memctl->memc_br2 = ((CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V)
  259. + size_b1;
  260. } else {
  261. unsigned long reg;
  262. /*
  263. * No bank 0
  264. *
  265. * invalidate bank
  266. */
  267. memctl->memc_br2 = 0;
  268. /* adjust refresh rate depending on SDRAM type, one bank */
  269. reg = memctl->memc_mptpr;
  270. reg >>= 1; /* reduce to CONFIG_SYS_MPTPR_1BK_8K / _4K */
  271. memctl->memc_mptpr = reg;
  272. }
  273. } else { /* SDRAM Bank 0 is bigger - map first */
  274. memctl->memc_or2 = ((-size_b0) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
  275. memctl->memc_br2 =
  276. (CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
  277. if (size_b1 > 0) {
  278. /*
  279. * Position Bank 1 immediately above Bank 0
  280. */
  281. memctl->memc_or3 =
  282. ((-size_b1) & 0xFFFF0000) | CONFIG_SYS_OR_TIMING_SDRAM;
  283. memctl->memc_br3 =
  284. ((CONFIG_SYS_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V)
  285. + size_b0;
  286. } else {
  287. unsigned long reg;
  288. #ifndef CONFIG_CAN_DRIVER
  289. /*
  290. * No bank 1
  291. *
  292. * invalidate bank
  293. */
  294. memctl->memc_br3 = 0;
  295. #endif /* CONFIG_CAN_DRIVER */
  296. /* adjust refresh rate depending on SDRAM type, one bank */
  297. reg = memctl->memc_mptpr;
  298. reg >>= 1; /* reduce to CONFIG_SYS_MPTPR_1BK_8K / _4K */
  299. memctl->memc_mptpr = reg;
  300. }
  301. }
  302. udelay (10000);
  303. #ifdef CONFIG_CAN_DRIVER
  304. /* UPM initialization for CAN @ CLKOUT <= 66 MHz */
  305. /* Initialize OR3 / BR3 */
  306. memctl->memc_or3 = CONFIG_SYS_OR3_CAN;
  307. memctl->memc_br3 = CONFIG_SYS_BR3_CAN;
  308. /* Initialize MBMR */
  309. memctl->memc_mbmr = MBMR_GPL_B4DIS; /* GPL_B4 ouput line Disable */
  310. /* Initialize UPMB for CAN: single read */
  311. memctl->memc_mdr = 0xFFFFCC04;
  312. memctl->memc_mcr = 0x0100 | UPMB;
  313. memctl->memc_mdr = 0x0FFFD004;
  314. memctl->memc_mcr = 0x0101 | UPMB;
  315. memctl->memc_mdr = 0x0FFFC000;
  316. memctl->memc_mcr = 0x0102 | UPMB;
  317. memctl->memc_mdr = 0x3FFFC004;
  318. memctl->memc_mcr = 0x0103 | UPMB;
  319. memctl->memc_mdr = 0xFFFFDC07;
  320. memctl->memc_mcr = 0x0104 | UPMB;
  321. /* Initialize UPMB for CAN: single write */
  322. memctl->memc_mdr = 0xFFFCCC04;
  323. memctl->memc_mcr = 0x0118 | UPMB;
  324. memctl->memc_mdr = 0xCFFCDC04;
  325. memctl->memc_mcr = 0x0119 | UPMB;
  326. memctl->memc_mdr = 0x3FFCC000;
  327. memctl->memc_mcr = 0x011A | UPMB;
  328. memctl->memc_mdr = 0xFFFCC004;
  329. memctl->memc_mcr = 0x011B | UPMB;
  330. memctl->memc_mdr = 0xFFFDC405;
  331. memctl->memc_mcr = 0x011C | UPMB;
  332. #endif /* CONFIG_CAN_DRIVER */
  333. #ifdef CONFIG_ISP1362_USB
  334. /* Initialize OR5 / BR5 */
  335. memctl->memc_or5 = CONFIG_SYS_OR5_ISP1362;
  336. memctl->memc_br5 = CONFIG_SYS_BR5_ISP1362;
  337. #endif /* CONFIG_ISP1362_USB */
  338. return (size_b0 + size_b1);
  339. }
  340. /* ------------------------------------------------------------------------- */
  341. /*
  342. * Check memory range for valid RAM. A simple memory test determines
  343. * the actually available RAM size between addresses `base' and
  344. * `base + maxsize'. Some (not all) hardware errors are detected:
  345. * - short between address lines
  346. * - short between data lines
  347. */
  348. static long int dram_size (long int mamr_value, long int *base, long int maxsize)
  349. {
  350. volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
  351. volatile memctl8xx_t *memctl = &immap->im_memctl;
  352. memctl->memc_mamr = mamr_value;
  353. return (get_ram_size(base, maxsize));
  354. }
  355. /* ------------------------------------------------------------------------- */
  356. #ifdef CONFIG_PS2MULT
  357. #ifdef CONFIG_HMI10
  358. #define BASE_BAUD ( 1843200 / 16 )
  359. struct serial_state rs_table[] = {
  360. { BASE_BAUD, 4, (void*)0xec140000 },
  361. { BASE_BAUD, 2, (void*)0xec150000 },
  362. { BASE_BAUD, 6, (void*)0xec160000 },
  363. { BASE_BAUD, 10, (void*)0xec170000 },
  364. };
  365. #ifdef CONFIG_BOARD_EARLY_INIT_R
  366. int board_early_init_r (void)
  367. {
  368. ps2mult_early_init();
  369. return (0);
  370. }
  371. #endif
  372. #endif /* CONFIG_HMI10 */
  373. #endif /* CONFIG_PS2MULT */
  374. #ifdef CONFIG_MISC_INIT_R
  375. int misc_init_r (void)
  376. {
  377. volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
  378. volatile memctl8xx_t *memctl = &immap->im_memctl;
  379. #ifdef CONFIG_SYS_OR_TIMING_FLASH_AT_50MHZ
  380. int scy, trlx, flash_or_timing, clk_diff;
  381. scy = (CONFIG_SYS_OR_TIMING_FLASH_AT_50MHZ & OR_SCY_MSK) >> 4;
  382. if (CONFIG_SYS_OR_TIMING_FLASH_AT_50MHZ & OR_TRLX) {
  383. trlx = OR_TRLX;
  384. scy *= 2;
  385. } else {
  386. trlx = 0;
  387. }
  388. /*
  389. * We assume that each 10MHz of bus clock require 1-clk SCY
  390. * adjustment.
  391. */
  392. clk_diff = (gd->bus_clk / 1000000) - 50;
  393. /*
  394. * We need proper rounding here. This is what the "+5" and "-5"
  395. * are here for.
  396. */
  397. if (clk_diff >= 0)
  398. scy += (clk_diff + 5) / 10;
  399. else
  400. scy += (clk_diff - 5) / 10;
  401. /*
  402. * For bus frequencies above 50MHz, we want to use relaxed timing
  403. * (OR_TRLX).
  404. */
  405. if (gd->bus_clk >= 50000000)
  406. trlx = OR_TRLX;
  407. else
  408. trlx = 0;
  409. if (trlx)
  410. scy /= 2;
  411. if (scy > 0xf)
  412. scy = 0xf;
  413. if (scy < 1)
  414. scy = 1;
  415. flash_or_timing = (scy << 4) | trlx |
  416. (CONFIG_SYS_OR_TIMING_FLASH_AT_50MHZ & ~(OR_TRLX | OR_SCY_MSK));
  417. memctl->memc_or0 =
  418. flash_or_timing | (-flash_info[0].size & OR_AM_MSK);
  419. #else
  420. memctl->memc_or0 =
  421. CONFIG_SYS_OR_TIMING_FLASH | (-flash_info[0].size & OR_AM_MSK);
  422. #endif
  423. memctl->memc_br0 = (CONFIG_SYS_FLASH_BASE & BR_BA_MSK) | BR_MS_GPCM | BR_V;
  424. debug ("## BR0: 0x%08x OR0: 0x%08x\n",
  425. memctl->memc_br0, memctl->memc_or0);
  426. if (flash_info[1].size) {
  427. #ifdef CONFIG_SYS_OR_TIMING_FLASH_AT_50MHZ
  428. memctl->memc_or1 = flash_or_timing |
  429. (-flash_info[1].size & 0xFFFF8000);
  430. #else
  431. memctl->memc_or1 = CONFIG_SYS_OR_TIMING_FLASH |
  432. (-flash_info[1].size & 0xFFFF8000);
  433. #endif
  434. memctl->memc_br1 =
  435. ((CONFIG_SYS_FLASH_BASE +
  436. flash_info[0].
  437. size) & BR_BA_MSK) | BR_MS_GPCM | BR_V;
  438. debug ("## BR1: 0x%08x OR1: 0x%08x\n",
  439. memctl->memc_br1, memctl->memc_or1);
  440. } else {
  441. memctl->memc_br1 = 0; /* invalidate bank */
  442. debug ("## DISABLE BR1: 0x%08x OR1: 0x%08x\n",
  443. memctl->memc_br1, memctl->memc_or1);
  444. }
  445. # ifdef CONFIG_IDE_LED
  446. /* Configure PA15 as output port */
  447. immap->im_ioport.iop_padir |= 0x0001;
  448. immap->im_ioport.iop_paodr |= 0x0001;
  449. immap->im_ioport.iop_papar &= ~0x0001;
  450. immap->im_ioport.iop_padat &= ~0x0001; /* turn it off */
  451. # endif
  452. #ifdef CONFIG_NSCU
  453. /* wake up ethernet module */
  454. immap->im_ioport.iop_pcpar &= ~0x0004; /* GPIO pin */
  455. immap->im_ioport.iop_pcdir |= 0x0004; /* output */
  456. immap->im_ioport.iop_pcso &= ~0x0004; /* for clarity */
  457. immap->im_ioport.iop_pcdat |= 0x0004; /* enable */
  458. #endif /* CONFIG_NSCU */
  459. return (0);
  460. }
  461. #endif /* CONFIG_MISC_INIT_R */
  462. # ifdef CONFIG_IDE_LED
  463. void ide_led (uchar led, uchar status)
  464. {
  465. volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
  466. /* We have one led for both pcmcia slots */
  467. if (status) { /* led on */
  468. immap->im_ioport.iop_padat |= 0x0001;
  469. } else {
  470. immap->im_ioport.iop_padat &= ~0x0001;
  471. }
  472. }
  473. # endif
  474. #ifdef CONFIG_LCD_INFO
  475. #include <lcd.h>
  476. #include <version.h>
  477. void lcd_show_board_info(void)
  478. {
  479. char temp[32];
  480. lcd_printf ("%s (%s - %s)\n", U_BOOT_VERSION, __DATE__, __TIME__);
  481. lcd_printf ("(C) 2008 DENX Software Engineering GmbH\n");
  482. lcd_printf (" Wolfgang DENK, wd@denx.de\n");
  483. #ifdef CONFIG_LCD_INFO_BELOW_LOGO
  484. lcd_printf ("MPC823 CPU at %s MHz\n",
  485. strmhz(temp, gd->cpu_clk));
  486. lcd_printf (" %ld MB RAM, %ld MB Flash\n",
  487. gd->ram_size >> 20,
  488. gd->bd->bi_flashsize >> 20 );
  489. #else
  490. /* leave one blank line */
  491. lcd_printf ("\nMPC823 CPU at %s MHz, %ld MB RAM, %ld MB Flash\n",
  492. strmhz(temp, gd->cpu_clk),
  493. gd->ram_size >> 20,
  494. gd->bd->bi_flashsize >> 20 );
  495. #endif /* CONFIG_LCD_INFO_BELOW_LOGO */
  496. }
  497. #endif /* CONFIG_LCD_INFO */
  498. /* ---------------------------------------------------------------------------- */
  499. /* TK885D specific initializaion */
  500. /* ---------------------------------------------------------------------------- */
  501. #ifdef CONFIG_TK885D
  502. #include <miiphy.h>
  503. int last_stage_init(void)
  504. {
  505. const unsigned char phy[] = {CONFIG_FEC1_PHY, CONFIG_FEC2_PHY};
  506. unsigned short reg;
  507. int ret, i = 100;
  508. char *s;
  509. mii_init();
  510. /* Without this delay 0xff is read from the UART buffer later in
  511. * abortboot() and autoboot is aborted */
  512. udelay(10000);
  513. while (tstc() && i--)
  514. (void)getc();
  515. /* Check if auto-negotiation is prohibited */
  516. s = getenv("phy_auto_nego");
  517. if (!s || !strcmp(s, "on"))
  518. /* Nothing to do - autonegotiation by default */
  519. return 0;
  520. for (i = 0; i < 2; i++) {
  521. ret = miiphy_read("FEC ETHERNET", phy[i], PHY_BMCR, &reg);
  522. if (ret) {
  523. printf("Cannot read BMCR on PHY %d\n", phy[i]);
  524. return 0;
  525. }
  526. /* Auto-negotiation off, hard set full duplex, 100Mbps */
  527. ret = miiphy_write("FEC ETHERNET", phy[i],
  528. PHY_BMCR, (reg | PHY_BMCR_100MB |
  529. PHY_BMCR_DPLX) & ~PHY_BMCR_AUTON);
  530. if (ret) {
  531. printf("Cannot write BMCR on PHY %d\n", phy[i]);
  532. return 0;
  533. }
  534. }
  535. return 0;
  536. }
  537. #endif