cpu.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. /*
  2. * (C) Copyright 2000-2002
  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. /*
  24. * m8xx.c
  25. *
  26. * CPU specific code
  27. *
  28. * written or collected and sometimes rewritten by
  29. * Magnus Damm <damm@bitsmart.com>
  30. *
  31. * minor modifications by
  32. * Wolfgang Denk <wd@denx.de>
  33. */
  34. #include <common.h>
  35. #include <watchdog.h>
  36. #include <command.h>
  37. #include <mpc8xx.h>
  38. #include <commproc.h>
  39. #include <netdev.h>
  40. #include <asm/cache.h>
  41. #if defined(CONFIG_OF_LIBFDT)
  42. #include <libfdt.h>
  43. #include <libfdt_env.h>
  44. #include <fdt_support.h>
  45. #endif
  46. DECLARE_GLOBAL_DATA_PTR;
  47. static char *cpu_warning = "\n " \
  48. "*** Warning: CPU Core has Silicon Bugs -- Check the Errata ***";
  49. #if ((defined(CONFIG_MPC86x) || defined(CONFIG_MPC855)) && \
  50. !defined(CONFIG_MPC862))
  51. static int check_CPU (long clock, uint pvr, uint immr)
  52. {
  53. char *id_str =
  54. # if defined(CONFIG_MPC855)
  55. "PC855";
  56. # elif defined(CONFIG_MPC860P)
  57. "PC860P";
  58. # else
  59. NULL;
  60. # endif
  61. volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);
  62. uint k, m;
  63. char buf[32];
  64. char pre = 'X';
  65. char *mid = "xx";
  66. char *suf;
  67. /* the highest 16 bits should be 0x0050 for a 860 */
  68. if ((pvr >> 16) != 0x0050)
  69. return -1;
  70. k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
  71. m = 0;
  72. suf = "";
  73. /*
  74. * Some boards use sockets so different CPUs can be used.
  75. * We have to check chip version in run time.
  76. */
  77. switch (k) {
  78. case 0x00020001: pre = 'P'; break;
  79. case 0x00030001: break;
  80. case 0x00120003: suf = "A"; break;
  81. case 0x00130003: suf = "A3"; break;
  82. case 0x00200004: suf = "B"; break;
  83. case 0x00300004: suf = "C"; break;
  84. case 0x00310004: suf = "C1"; m = 1; break;
  85. case 0x00200064: mid = "SR"; suf = "B"; break;
  86. case 0x00300065: mid = "SR"; suf = "C"; break;
  87. case 0x00310065: mid = "SR"; suf = "C1"; m = 1; break;
  88. case 0x05010000: suf = "D3"; m = 1; break;
  89. case 0x05020000: suf = "D4"; m = 1; break;
  90. /* this value is not documented anywhere */
  91. case 0x40000000: pre = 'P'; suf = "D"; m = 1; break;
  92. /* MPC866P/MPC866T/MPC859T/MPC859DSL/MPC852T */
  93. case 0x08010004: /* Rev. A.0 */
  94. suf = "A";
  95. /* fall through */
  96. case 0x08000003: /* Rev. 0.3 */
  97. pre = 'M'; m = 1;
  98. if (id_str == NULL)
  99. id_str =
  100. # if defined(CONFIG_MPC852T)
  101. "PC852T";
  102. # elif defined(CONFIG_MPC859T)
  103. "PC859T";
  104. # elif defined(CONFIG_MPC859DSL)
  105. "PC859DSL";
  106. # elif defined(CONFIG_MPC866T)
  107. "PC866T";
  108. # else
  109. "PC866x"; /* Unknown chip from MPC866 family */
  110. # endif
  111. break;
  112. case 0x09000000: pre = 'M'; mid = suf = ""; m = 1;
  113. if (id_str == NULL)
  114. id_str = "PC885"; /* 870/875/880/885 */
  115. break;
  116. default: suf = NULL; break;
  117. }
  118. if (id_str == NULL)
  119. id_str = "PC86x"; /* Unknown 86x chip */
  120. if (suf)
  121. printf ("%c%s%sZPnn%s", pre, id_str, mid, suf);
  122. else
  123. printf ("unknown M%s (0x%08x)", id_str, k);
  124. #if defined(CONFIG_SYS_8xx_CPUCLK_MIN) && defined(CONFIG_SYS_8xx_CPUCLK_MAX)
  125. printf (" at %s MHz [%d.%d...%d.%d MHz]\n ",
  126. strmhz (buf, clock),
  127. CONFIG_SYS_8xx_CPUCLK_MIN / 1000000,
  128. ((CONFIG_SYS_8xx_CPUCLK_MIN % 1000000) + 50000) / 100000,
  129. CONFIG_SYS_8xx_CPUCLK_MAX / 1000000,
  130. ((CONFIG_SYS_8xx_CPUCLK_MAX % 1000000) + 50000) / 100000
  131. );
  132. #else
  133. printf (" at %s MHz: ", strmhz (buf, clock));
  134. #endif
  135. printf ("%u kB I-Cache %u kB D-Cache",
  136. checkicache () >> 10,
  137. checkdcache () >> 10
  138. );
  139. /* do we have a FEC (860T/P or 852/859/866/885)? */
  140. immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;
  141. if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {
  142. printf (" FEC present");
  143. }
  144. if (!m) {
  145. puts (cpu_warning);
  146. }
  147. putc ('\n');
  148. #ifdef DEBUG
  149. if(clock != measure_gclk()) {
  150. printf ("clock %ldHz != %dHz\n", clock, measure_gclk());
  151. }
  152. #endif
  153. return 0;
  154. }
  155. #elif defined(CONFIG_MPC862)
  156. static int check_CPU (long clock, uint pvr, uint immr)
  157. {
  158. volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);
  159. uint k, m;
  160. char buf[32];
  161. char pre = 'X';
  162. char *mid = "xx";
  163. char *suf;
  164. /* the highest 16 bits should be 0x0050 for a 8xx */
  165. if ((pvr >> 16) != 0x0050)
  166. return -1;
  167. k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
  168. m = 0;
  169. switch (k) {
  170. /* this value is not documented anywhere */
  171. case 0x06000000: mid = "P"; suf = "0"; break;
  172. case 0x06010001: mid = "P"; suf = "A"; m = 1; break;
  173. case 0x07000003: mid = "P"; suf = "B"; m = 1; break;
  174. default: suf = NULL; break;
  175. }
  176. #ifndef CONFIG_MPC857
  177. if (suf)
  178. printf ("%cPC862%sZPnn%s", pre, mid, suf);
  179. else
  180. printf ("unknown MPC862 (0x%08x)", k);
  181. #else
  182. if (suf)
  183. printf ("%cPC857TZPnn%s", pre, suf); /* only 857T tested right now! */
  184. else
  185. printf ("unknown MPC857 (0x%08x)", k);
  186. #endif
  187. printf (" at %s MHz:", strmhz (buf, clock));
  188. printf (" %u kB I-Cache", checkicache () >> 10);
  189. printf (" %u kB D-Cache", checkdcache () >> 10);
  190. /* lets check and see if we're running on a 862T (or P?) */
  191. immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;
  192. if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {
  193. printf (" FEC present");
  194. }
  195. if (!m) {
  196. puts (cpu_warning);
  197. }
  198. putc ('\n');
  199. return 0;
  200. }
  201. #elif defined(CONFIG_MPC823)
  202. static int check_CPU (long clock, uint pvr, uint immr)
  203. {
  204. volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);
  205. uint k, m;
  206. char buf[32];
  207. char *suf;
  208. /* the highest 16 bits should be 0x0050 for a 8xx */
  209. if ((pvr >> 16) != 0x0050)
  210. return -1;
  211. k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
  212. m = 0;
  213. switch (k) {
  214. /* MPC823 */
  215. case 0x20000000: suf = "0"; break;
  216. case 0x20010000: suf = "0.1"; break;
  217. case 0x20020000: suf = "Z2/3"; break;
  218. case 0x20020001: suf = "Z3"; break;
  219. case 0x21000000: suf = "A"; break;
  220. case 0x21010000: suf = "B"; m = 1; break;
  221. case 0x21010001: suf = "B2"; m = 1; break;
  222. /* MPC823E */
  223. case 0x24010000: suf = NULL;
  224. puts ("PPC823EZTnnB2");
  225. m = 1;
  226. break;
  227. default:
  228. suf = NULL;
  229. printf ("unknown MPC823 (0x%08x)", k);
  230. break;
  231. }
  232. if (suf)
  233. printf ("PPC823ZTnn%s", suf);
  234. printf (" at %s MHz:", strmhz (buf, clock));
  235. printf (" %u kB I-Cache", checkicache () >> 10);
  236. printf (" %u kB D-Cache", checkdcache () >> 10);
  237. /* lets check and see if we're running on a 860T (or P?) */
  238. immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;
  239. if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {
  240. puts (" FEC present");
  241. }
  242. if (!m) {
  243. puts (cpu_warning);
  244. }
  245. putc ('\n');
  246. return 0;
  247. }
  248. #elif defined(CONFIG_MPC850)
  249. static int check_CPU (long clock, uint pvr, uint immr)
  250. {
  251. volatile immap_t *immap = (immap_t *) (immr & 0xFFFF0000);
  252. uint k, m;
  253. char buf[32];
  254. /* the highest 16 bits should be 0x0050 for a 8xx */
  255. if ((pvr >> 16) != 0x0050)
  256. return -1;
  257. k = (immr << 16) | *((ushort *) & immap->im_cpm.cp_dparam[0xB0]);
  258. m = 0;
  259. switch (k) {
  260. case 0x20020001:
  261. printf ("XPC850xxZT");
  262. break;
  263. case 0x21000065:
  264. printf ("XPC850xxZTA");
  265. break;
  266. case 0x21010067:
  267. printf ("XPC850xxZTB");
  268. m = 1;
  269. break;
  270. case 0x21020068:
  271. printf ("XPC850xxZTC");
  272. m = 1;
  273. break;
  274. default:
  275. printf ("unknown MPC850 (0x%08x)", k);
  276. }
  277. printf (" at %s MHz:", strmhz (buf, clock));
  278. printf (" %u kB I-Cache", checkicache () >> 10);
  279. printf (" %u kB D-Cache", checkdcache () >> 10);
  280. /* lets check and see if we're running on a 850T (or P?) */
  281. immap->im_cpm.cp_fec.fec_addr_low = 0x12345678;
  282. if (immap->im_cpm.cp_fec.fec_addr_low == 0x12345678) {
  283. printf (" FEC present");
  284. }
  285. if (!m) {
  286. puts (cpu_warning);
  287. }
  288. putc ('\n');
  289. return 0;
  290. }
  291. #else
  292. #error CPU undefined
  293. #endif
  294. /* ------------------------------------------------------------------------- */
  295. int checkcpu (void)
  296. {
  297. ulong clock = gd->cpu_clk;
  298. uint immr = get_immr (0); /* Return full IMMR contents */
  299. uint pvr = get_pvr ();
  300. puts ("CPU: ");
  301. /* 850 has PARTNUM 20 */
  302. /* 801 has PARTNUM 10 */
  303. return check_CPU (clock, pvr, immr);
  304. }
  305. /* ------------------------------------------------------------------------- */
  306. /* L1 i-cache */
  307. /* the standard 860 has 128 sets of 16 bytes in 2 ways (= 4 kB) */
  308. /* the 860 P (plus) has 256 sets of 16 bytes in 4 ways (= 16 kB) */
  309. int checkicache (void)
  310. {
  311. volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
  312. volatile memctl8xx_t *memctl = &immap->im_memctl;
  313. u32 cacheon = rd_ic_cst () & IDC_ENABLED;
  314. #ifdef CONFIG_IP86x
  315. u32 k = memctl->memc_br1 & ~0x00007fff; /* probe in flash memoryarea */
  316. #else
  317. u32 k = memctl->memc_br0 & ~0x00007fff; /* probe in flash memoryarea */
  318. #endif
  319. u32 m;
  320. u32 lines = -1;
  321. wr_ic_cst (IDC_UNALL);
  322. wr_ic_cst (IDC_INVALL);
  323. wr_ic_cst (IDC_DISABLE);
  324. __asm__ volatile ("isync");
  325. while (!((m = rd_ic_cst ()) & IDC_CERR2)) {
  326. wr_ic_adr (k);
  327. wr_ic_cst (IDC_LDLCK);
  328. __asm__ volatile ("isync");
  329. lines++;
  330. k += 0x10; /* the number of bytes in a cacheline */
  331. }
  332. wr_ic_cst (IDC_UNALL);
  333. wr_ic_cst (IDC_INVALL);
  334. if (cacheon)
  335. wr_ic_cst (IDC_ENABLE);
  336. else
  337. wr_ic_cst (IDC_DISABLE);
  338. __asm__ volatile ("isync");
  339. return lines << 4;
  340. };
  341. /* ------------------------------------------------------------------------- */
  342. /* L1 d-cache */
  343. /* the standard 860 has 128 sets of 16 bytes in 2 ways (= 4 kB) */
  344. /* the 860 P (plus) has 256 sets of 16 bytes in 2 ways (= 8 kB) */
  345. /* call with cache disabled */
  346. int checkdcache (void)
  347. {
  348. volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
  349. volatile memctl8xx_t *memctl = &immap->im_memctl;
  350. u32 cacheon = rd_dc_cst () & IDC_ENABLED;
  351. #ifdef CONFIG_IP86x
  352. u32 k = memctl->memc_br1 & ~0x00007fff; /* probe in flash memoryarea */
  353. #else
  354. u32 k = memctl->memc_br0 & ~0x00007fff; /* probe in flash memoryarea */
  355. #endif
  356. u32 m;
  357. u32 lines = -1;
  358. wr_dc_cst (IDC_UNALL);
  359. wr_dc_cst (IDC_INVALL);
  360. wr_dc_cst (IDC_DISABLE);
  361. while (!((m = rd_dc_cst ()) & IDC_CERR2)) {
  362. wr_dc_adr (k);
  363. wr_dc_cst (IDC_LDLCK);
  364. lines++;
  365. k += 0x10; /* the number of bytes in a cacheline */
  366. }
  367. wr_dc_cst (IDC_UNALL);
  368. wr_dc_cst (IDC_INVALL);
  369. if (cacheon)
  370. wr_dc_cst (IDC_ENABLE);
  371. else
  372. wr_dc_cst (IDC_DISABLE);
  373. return lines << 4;
  374. };
  375. /* ------------------------------------------------------------------------- */
  376. void upmconfig (uint upm, uint * table, uint size)
  377. {
  378. uint i;
  379. uint addr = 0;
  380. volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
  381. volatile memctl8xx_t *memctl = &immap->im_memctl;
  382. for (i = 0; i < size; i++) {
  383. memctl->memc_mdr = table[i]; /* (16-15) */
  384. memctl->memc_mcr = addr | upm; /* (16-16) */
  385. addr++;
  386. }
  387. }
  388. /* ------------------------------------------------------------------------- */
  389. #ifndef CONFIG_LWMON
  390. int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  391. {
  392. ulong msr, addr;
  393. volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
  394. immap->im_clkrst.car_plprcr |= PLPRCR_CSR; /* Checkstop Reset enable */
  395. /* Interrupts and MMU off */
  396. __asm__ volatile ("mtspr 81, 0");
  397. __asm__ volatile ("mfmsr %0":"=r" (msr));
  398. msr &= ~0x1030;
  399. __asm__ volatile ("mtmsr %0"::"r" (msr));
  400. /*
  401. * Trying to execute the next instruction at a non-existing address
  402. * should cause a machine check, resulting in reset
  403. */
  404. #ifdef CONFIG_SYS_RESET_ADDRESS
  405. addr = CONFIG_SYS_RESET_ADDRESS;
  406. #else
  407. /*
  408. * note: when CONFIG_SYS_MONITOR_BASE points to a RAM address, CONFIG_SYS_MONITOR_BASE
  409. * - sizeof (ulong) is usually a valid address. Better pick an address
  410. * known to be invalid on your system and assign it to CONFIG_SYS_RESET_ADDRESS.
  411. * "(ulong)-1" used to be a good choice for many systems...
  412. */
  413. addr = CONFIG_SYS_MONITOR_BASE - sizeof (ulong);
  414. #endif
  415. ((void (*)(void)) addr) ();
  416. return 1;
  417. }
  418. #else /* CONFIG_LWMON */
  419. /*
  420. * On the LWMON board, the MCLR reset input of the PIC's on the board
  421. * uses a 47K/1n RC combination which has a 47us time constant. The
  422. * low signal on the HRESET pin of the CPU is only 512 clocks = 8 us
  423. * and thus too short to reset the external hardware. So we use the
  424. * watchdog to reset the board.
  425. */
  426. int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
  427. {
  428. /* prevent triggering the watchdog */
  429. disable_interrupts ();
  430. /* make sure the watchdog is running */
  431. reset_8xx_watchdog ((immap_t *) CONFIG_SYS_IMMR);
  432. /* wait for watchdog reset */
  433. while (1) {};
  434. /* NOTREACHED */
  435. return 1;
  436. }
  437. #endif /* CONFIG_LWMON */
  438. /* ------------------------------------------------------------------------- */
  439. /*
  440. * Get timebase clock frequency (like cpu_clk in Hz)
  441. *
  442. * See sections 14.2 and 14.6 of the User's Manual
  443. */
  444. unsigned long get_tbclk (void)
  445. {
  446. uint immr = get_immr (0); /* Return full IMMR contents */
  447. volatile immap_t *immap = (volatile immap_t *)(immr & 0xFFFF0000);
  448. ulong oscclk, factor, pll;
  449. if (immap->im_clkrst.car_sccr & SCCR_TBS) {
  450. return (gd->cpu_clk / 16);
  451. }
  452. pll = immap->im_clkrst.car_plprcr;
  453. #define PLPRCR_val(a) ((pll & PLPRCR_ ## a ## _MSK) >> PLPRCR_ ## a ## _SHIFT)
  454. /*
  455. * For newer PQ1 chips (MPC866/87x/88x families), PLL multiplication
  456. * factor is calculated as follows:
  457. *
  458. * MFN
  459. * MFI + -------
  460. * MFD + 1
  461. * factor = -----------------
  462. * (PDF + 1) * 2^S
  463. *
  464. * For older chips, it's just MF field of PLPRCR plus one.
  465. */
  466. if ((immr & 0x0FFF) >= MPC8xx_NEW_CLK) { /* MPC866/87x/88x series */
  467. factor = (PLPRCR_val(MFI) + PLPRCR_val(MFN)/(PLPRCR_val(MFD)+1))/
  468. (PLPRCR_val(PDF)+1) / (1<<PLPRCR_val(S));
  469. } else {
  470. factor = PLPRCR_val(MF)+1;
  471. }
  472. oscclk = gd->cpu_clk / factor;
  473. if ((immap->im_clkrst.car_sccr & SCCR_RTSEL) == 0 || factor > 2) {
  474. return (oscclk / 4);
  475. }
  476. return (oscclk / 16);
  477. }
  478. /* ------------------------------------------------------------------------- */
  479. #if defined(CONFIG_WATCHDOG)
  480. void watchdog_reset (void)
  481. {
  482. int re_enable = disable_interrupts ();
  483. reset_8xx_watchdog ((immap_t *) CONFIG_SYS_IMMR);
  484. if (re_enable)
  485. enable_interrupts ();
  486. }
  487. #endif /* CONFIG_WATCHDOG */
  488. #if defined(CONFIG_WATCHDOG) || defined(CONFIG_LWMON)
  489. void reset_8xx_watchdog (volatile immap_t * immr)
  490. {
  491. # if defined(CONFIG_LWMON)
  492. /*
  493. * The LWMON board uses a MAX6301 Watchdog
  494. * with the trigger pin connected to port PA.7
  495. *
  496. * (The old board version used a MAX706TESA Watchdog, which
  497. * had to be handled exactly the same.)
  498. */
  499. # define WATCHDOG_BIT 0x0100
  500. immr->im_ioport.iop_papar &= ~(WATCHDOG_BIT); /* GPIO */
  501. immr->im_ioport.iop_padir |= WATCHDOG_BIT; /* Output */
  502. immr->im_ioport.iop_paodr &= ~(WATCHDOG_BIT); /* active output */
  503. immr->im_ioport.iop_padat ^= WATCHDOG_BIT; /* Toggle WDI */
  504. # elif defined(CONFIG_KUP4K) || defined(CONFIG_KUP4X)
  505. /*
  506. * The KUP4 boards uses a TPS3705 Watchdog
  507. * with the trigger pin connected to port PA.5
  508. */
  509. # define WATCHDOG_BIT 0x0400
  510. immr->im_ioport.iop_papar &= ~(WATCHDOG_BIT); /* GPIO */
  511. immr->im_ioport.iop_padir |= WATCHDOG_BIT; /* Output */
  512. immr->im_ioport.iop_paodr &= ~(WATCHDOG_BIT); /* active output */
  513. immr->im_ioport.iop_padat ^= WATCHDOG_BIT; /* Toggle WDI */
  514. # else
  515. /*
  516. * All other boards use the MPC8xx Internal Watchdog
  517. */
  518. immr->im_siu_conf.sc_swsr = 0x556c; /* write magic1 */
  519. immr->im_siu_conf.sc_swsr = 0xaa39; /* write magic2 */
  520. # endif /* CONFIG_LWMON */
  521. }
  522. #endif /* CONFIG_WATCHDOG */
  523. /*
  524. * Initializes on-chip ethernet controllers.
  525. * to override, implement board_eth_init()
  526. */
  527. int cpu_eth_init(bd_t *bis)
  528. {
  529. #if defined(SCC_ENET)
  530. scc_initialize(bis);
  531. #endif
  532. #if defined(FEC_ENET)
  533. fec_initialize(bis);
  534. #endif
  535. return 0;
  536. }