hermes.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. /*
  2. * (C) Copyright 2000
  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 <commproc.h>
  25. #include <mpc8xx.h>
  26. #ifdef CONFIG_SHOW_BOOT_PROGRESS
  27. # include <status_led.h>
  28. # define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
  29. #else
  30. # define SHOW_BOOT_PROGRESS(arg)
  31. #endif
  32. DECLARE_GLOBAL_DATA_PTR;
  33. /* ------------------------------------------------------------------------- */
  34. static long int dram_size (long int, long int *, long int);
  35. static ulong board_init (void);
  36. static void send_smi_frame (volatile scc_t * sp, volatile cbd_t * bd,
  37. uchar * msg);
  38. /* ------------------------------------------------------------------------- */
  39. #define _NOT_USED_ 0xFFFFFFFF
  40. const uint sdram_table[] = {
  41. /*
  42. * Single Read. (Offset 0 in UPMA RAM)
  43. */
  44. 0x1f07fc04, 0xeeaefc04, 0x11adfc04, 0xefbbbc00,
  45. 0x1ff77c47, /* last */
  46. /*
  47. * SDRAM Initialization (offset 5 in UPMA RAM)
  48. *
  49. * This is no UPM entry point. The following definition uses
  50. * the remaining space to establish an initialization
  51. * sequence, which is executed by a RUN command.
  52. *
  53. */
  54. 0x1fe77c35, 0xffaffc34, 0x1fa57c35, /* last */
  55. /*
  56. * Burst Read. (Offset 8 in UPMA RAM)
  57. */
  58. 0x1f07fc04, 0xeeaefc04, 0x10adfc04, 0xf0affc00,
  59. 0xf0affc00, 0xf1affc00, 0xefbbbc00, 0x1ff77c47, /* last */
  60. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  61. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  62. /*
  63. * Single Write. (Offset 18 in UPMA RAM)
  64. */
  65. 0x1f27fc04, 0xeeaebc00, 0x01b93c04, 0x1ff77c47, /* last */
  66. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  67. /*
  68. * Burst Write. (Offset 20 in UPMA RAM)
  69. */
  70. 0x1f07fc04, 0xeeaebc00, 0x10ad4c00, 0xf0afcc00,
  71. 0xf0afcc00, 0xe1bb8c06, 0x1ff77c47, /* last */
  72. _NOT_USED_,
  73. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  74. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  75. /*
  76. * Refresh (Offset 30 in UPMA RAM)
  77. */
  78. 0x1ff5fc84, 0xfffffc04, 0xfffffc04, 0xfffffc04,
  79. 0xfffffc84, 0xfffffc07, /* last */
  80. _NOT_USED_, _NOT_USED_,
  81. _NOT_USED_, _NOT_USED_, _NOT_USED_, _NOT_USED_,
  82. /*
  83. * Exception. (Offset 3c in UPMA RAM)
  84. */
  85. 0x7ffffc07, /* last */
  86. _NOT_USED_, _NOT_USED_, _NOT_USED_,
  87. };
  88. /* ------------------------------------------------------------------------- */
  89. /*
  90. * Check Board Identity:
  91. *
  92. * Test ID string (HERMES...)
  93. *
  94. * Return code for board revision and network speed
  95. */
  96. int checkboard (void)
  97. {
  98. char *s = getenv ("serial#");
  99. char *e;
  100. puts ("Board: ");
  101. if (!s || strncmp (s, "HERMES", 6)) {
  102. puts ("### No HW ID - assuming HERMES-PRO");
  103. } else {
  104. for (e = s; *e; ++e) {
  105. if (*e == ' ')
  106. break;
  107. }
  108. for (; s < e; ++s) {
  109. putc (*s);
  110. }
  111. }
  112. gd->board_type = board_init ();
  113. printf (" Rev. %ld.x\n", (gd->board_type >> 16));
  114. return (0);
  115. }
  116. /* ------------------------------------------------------------------------- */
  117. long int initdram (int board_type)
  118. {
  119. volatile immap_t *immap = (immap_t *) CFG_IMMR;
  120. volatile memctl8xx_t *memctl = &immap->im_memctl;
  121. long int size, size8, size9;
  122. upmconfig (UPMA, (uint *) sdram_table,
  123. sizeof (sdram_table) / sizeof (uint));
  124. /*
  125. * Preliminary prescaler for refresh
  126. */
  127. memctl->memc_mptpr = 0x0400;
  128. memctl->memc_mar = 0x00000088;
  129. /*
  130. * Map controller banks 1 to the SDRAM banks at preliminary address
  131. */
  132. memctl->memc_or1 = CFG_OR1_PRELIM;
  133. memctl->memc_br1 = CFG_BR1_PRELIM;
  134. /* HERMES-PRO boards have only one bank SDRAM */
  135. udelay (200);
  136. /* perform SDRAM initializsation sequence */
  137. memctl->memc_mamr = 0xD0802114;
  138. memctl->memc_mcr = 0x80002105;
  139. udelay (1);
  140. memctl->memc_mamr = 0xD0802118;
  141. memctl->memc_mcr = 0x80002130;
  142. udelay (1);
  143. memctl->memc_mamr = 0xD0802114;
  144. memctl->memc_mcr = 0x80002106;
  145. udelay (1000);
  146. /*
  147. * Check Bank 0 Memory Size for re-configuration
  148. *
  149. * try 8 column mode
  150. */
  151. size8 = dram_size (CFG_MAMR_8COL, (long *) SDRAM_BASE_PRELIM,
  152. SDRAM_MAX_SIZE);
  153. udelay (1000);
  154. /*
  155. * try 9 column mode
  156. */
  157. size9 = dram_size (CFG_MAMR_9COL, (long *) SDRAM_BASE_PRELIM,
  158. SDRAM_MAX_SIZE);
  159. if (size8 < size9) { /* leave configuration at 9 columns */
  160. size = size9;
  161. /* debug ("SDRAM Bank 0 in 9 column mode: %ld MB\n", size >> 20); */
  162. } else { /* back to 8 columns */
  163. size = size8;
  164. memctl->memc_mamr = CFG_MAMR_8COL;
  165. udelay (500);
  166. /* debug ("SDRAM Bank 0 in 8 column mode: %ld MB\n", size >> 20); */
  167. }
  168. udelay (1000);
  169. memctl->memc_or1 = ((-size) & 0xFFFF0000) | SDRAM_TIMING;
  170. memctl->memc_br1 = (CFG_SDRAM_BASE & BR_BA_MSK) | BR_MS_UPMA | BR_V;
  171. udelay (10000);
  172. return (size);
  173. }
  174. /* ------------------------------------------------------------------------- */
  175. /*
  176. * Check memory range for valid RAM. A simple memory test determines
  177. * the actually available RAM size between addresses `base' and
  178. * `base + maxsize'. Some (not all) hardware errors are detected:
  179. * - short between address lines
  180. * - short between data lines
  181. */
  182. static long int dram_size (long int mamr_value, long int *base,
  183. long int maxsize)
  184. {
  185. volatile immap_t *immap = (immap_t *) CFG_IMMR;
  186. volatile memctl8xx_t *memctl = &immap->im_memctl;
  187. memctl->memc_mamr = mamr_value;
  188. return (get_ram_size(base, maxsize));
  189. }
  190. /* ------------------------------------------------------------------------- */
  191. #define PB_LED_3 0x00020000 /* Status LED's */
  192. #define PB_LED_2 0x00010000
  193. #define PB_LED_1 0x00008000
  194. #define PB_LED_0 0x00004000
  195. #define PB_LED_ALL (PB_LED_0 | PB_LED_1 | PB_LED_2 | PB_LED_3)
  196. #define PC_REP_SPD1 0x00000800
  197. #define PC_REP_SPD0 0x00000400
  198. #define PB_RESET_2081 0x00000020 /* Reset PEB2081 */
  199. #define PB_MAI_4 0x00000010 /* Configuration */
  200. #define PB_MAI_3 0x00000008
  201. #define PB_MAI_2 0x00000004
  202. #define PB_MAI_1 0x00000002
  203. #define PB_MAI_0 0x00000001
  204. #define PB_MAI_ALL (PB_MAI_0 | PB_MAI_1 | PB_MAI_2 | PB_MAI_3 | PB_MAI_4)
  205. #define PC_REP_MGRPRS 0x0200
  206. #define PC_REP_SPD 0x0040 /* Select 100 Mbps */
  207. #define PC_REP_RES 0x0004
  208. #define PC_BIT14 0x0002 /* ??? */
  209. #define PC_BIT15 0x0001 /* ??? ENDSL ?? */
  210. /* ------------------------------------------------------------------------- */
  211. static ulong board_init (void)
  212. {
  213. volatile immap_t *immr = (immap_t *) CFG_IMMR;
  214. ulong reg, revision, speed = 100;
  215. int ethspeed;
  216. char *s;
  217. if ((s = getenv ("ethspeed")) != NULL) {
  218. if (strcmp (s, "100") == 0) {
  219. ethspeed = 100;
  220. } else if (strcmp (s, "10") == 0) {
  221. ethspeed = 10;
  222. } else {
  223. ethspeed = 0;
  224. }
  225. } else {
  226. ethspeed = 0;
  227. }
  228. /* Configure Port B Output Pins => 0x0003cc3F */
  229. reg = PB_LED_ALL | PC_REP_SPD1 | PC_REP_SPD0 | PB_RESET_2081 |
  230. PB_MAI_ALL;
  231. immr->im_cpm.cp_pbpar &= ~reg;
  232. immr->im_cpm.cp_pbodr &= ~reg;
  233. immr->im_cpm.cp_pbdat &= ~reg; /* all 0 */
  234. immr->im_cpm.cp_pbdir |= reg;
  235. /* Check hardware revision */
  236. if ((immr->im_ioport.iop_pcdat & 0x0003) == 0x0003) {
  237. /*
  238. * Revision 3.x hardware
  239. */
  240. revision = 3;
  241. immr->im_ioport.iop_pcdat = 0x0240;
  242. immr->im_ioport.iop_pcdir = (PC_REP_MGRPRS | PC_REP_SPD | PC_REP_RES | PC_BIT14); /* = 0x0246 */
  243. immr->im_ioport.iop_pcdat |= PC_REP_RES;
  244. } else {
  245. immr->im_ioport.iop_pcdat = 0x0002;
  246. immr->im_ioport.iop_pcdir = (PC_REP_MGRPRS | PC_REP_RES | PC_BIT14 | PC_BIT15); /* = 0x0207 */
  247. if ((immr->im_ioport.iop_pcdat & PC_REP_SPD) == 0) {
  248. /*
  249. * Revision 2.x hardware: PC9 connected to PB21
  250. */
  251. revision = 2;
  252. if (ethspeed == 0) {
  253. /* both 10 and 100 Mbps allowed:
  254. * select 10 Mbps and autonegotiation
  255. */
  256. puts (" [10+100]");
  257. immr->im_cpm.cp_pbdat = 0; /* SPD1:SPD0 = 0:0 - autonegot. */
  258. speed = 10;
  259. } else if (ethspeed == 10) {
  260. /* we are asked for 10 Mbps,
  261. * so select 10 Mbps
  262. */
  263. puts (" [10]");
  264. immr->im_cpm.cp_pbdat = 0; /* ??? */
  265. speed = 10;
  266. } else {
  267. /* anything else:
  268. * select 100 Mbps
  269. */
  270. puts (" [100]");
  271. immr->im_cpm.cp_pbdat = PC_REP_SPD0 | PC_REP_SPD1;
  272. /* SPD1:SPD0 = 1:1 - 100 Mbps */
  273. speed = 100;
  274. }
  275. immr->im_ioport.iop_pcdat |= (PC_REP_RES | PC_BIT14);
  276. /* must be run from RAM */
  277. /* start_lxt980 (speed); */
  278. /*************************/
  279. } else {
  280. /*
  281. * Revision 1.x hardware
  282. */
  283. revision = 1;
  284. immr->im_ioport.iop_pcdat = PC_REP_MGRPRS | PC_BIT14; /* = 0x0202 */
  285. immr->im_ioport.iop_pcdir = (PC_REP_MGRPRS | PC_REP_SPD | PC_REP_RES | PC_BIT14 | PC_BIT15); /* = 0x0247 */
  286. if (ethspeed == 0) {
  287. /* both 10 and 100 Mbps allowed:
  288. * select 100 Mbps and autonegotiation
  289. */
  290. puts (" [10+100]");
  291. immr->im_cpm.cp_pbdat = 0; /* SPD1:SPD0 = 0:0 - autonegot. */
  292. immr->im_ioport.iop_pcdat |= PC_REP_SPD;
  293. } else if (ethspeed == 10) {
  294. /* we are asked for 10 Mbps,
  295. * so select 10 Mbps
  296. */
  297. puts (" [10]");
  298. immr->im_cpm.cp_pbdat = PC_REP_SPD0; /* SPD1:SPD0 = 0:1 - 10 Mbps */
  299. } else {
  300. /* anything else:
  301. * select 100 Mbps
  302. */
  303. puts (" [100]");
  304. immr->im_cpm.cp_pbdat = PC_REP_SPD0 | PC_REP_SPD1;
  305. /* SPD1:SPD0 = 1:1 - 100 Mbps */
  306. immr->im_ioport.iop_pcdat |= PC_REP_SPD;
  307. }
  308. immr->im_ioport.iop_pcdat |= PC_REP_RES;
  309. }
  310. }
  311. SHOW_BOOT_PROGRESS (0x00);
  312. return ((revision << 16) | (speed & 0xFFFF));
  313. }
  314. /* ------------------------------------------------------------------------- */
  315. #define SCC_SM 1 /* Index => SCC2 */
  316. #define PROFF PROFF_SCC2
  317. #define SMI_MSGLEN 8 /* Length of SMI Messages */
  318. #define PHYGPCR_ADDR 0x109 /* Port Enable */
  319. #define PHYPCR_ADDR 0x132 /* PHY Port Control Reg. (port 1) */
  320. #define LEDPCR_ADDR 0x141 /* LED Port Control Reg. */
  321. #define RPRESET_ADDR 0x144 /* Repeater Reset */
  322. #define PHYPCR_SPEED 0x2000 /* on for 100 Mbps, off for 10 Mbps */
  323. #define PHYPCR_AN 0x1000 /* on to enable Auto-Negotiation */
  324. #define PHYPCR_REST_AN 0x0200 /* on to restart Auto-Negotiation */
  325. #define PHYPCR_FDX 0x0100 /* on for Full Duplex, off for HDX */
  326. #define PHYPCR_COLT 0x0080 /* on to enable COL signal test */
  327. /* ------------------------------------------------------------------------- */
  328. /*
  329. * Must run from RAM:
  330. * uses parameter RAM area which is used for stack while running from ROM
  331. */
  332. void hermes_start_lxt980 (int speed)
  333. {
  334. volatile immap_t *immr = (immap_t *) CFG_IMMR;
  335. volatile cpm8xx_t *cp = (cpm8xx_t *) & (immr->im_cpm);
  336. volatile scc_t *sp = (scc_t *) & (cp->cp_scc[SCC_SM]);
  337. volatile cbd_t *bd;
  338. volatile hdlc_pram_t *hp;
  339. uchar smimsg[SMI_MSGLEN];
  340. ushort phypcrval;
  341. uint bd_off;
  342. int pnr;
  343. printf ("LXT9880: %3d Mbps\n", speed);
  344. immr->im_ioport.iop_paodr |= 0x0008; /* init PAODR: PA12 (TXD2) open drain */
  345. immr->im_ioport.iop_papar |= 0x400c; /* init PAPAR: TXD2, RXD2, BRGO4 */
  346. immr->im_ioport.iop_padir &= 0xbff3; /* init PADIR: BRGO4 */
  347. immr->im_ioport.iop_padir |= 0x4000;
  348. /* get temporary BD; no need for permanent alloc */
  349. bd_off = dpram_base_align (8);
  350. bd = (cbd_t *) (immr->im_cpm.cp_dpmem + bd_off);
  351. bd->cbd_bufaddr = 0;
  352. bd->cbd_datlen = 0;
  353. bd->cbd_sc = BD_SC_WRAP | BD_SC_LAST | BD_SC_INTRPT | BD_SC_TC;
  354. /* init. baudrate generator BRG4 */
  355. cp->cp_brgc4 = (0x00010000 | (50 << 1)); /* output 1 MHz */
  356. cp->cp_sicr &= 0xFFFF00FF; /* SICR: mask SCC2 */
  357. cp->cp_sicr |= 0x00001B00; /* SICR: SCC2 clk BRG4 */
  358. /* init SCC_SM register */
  359. sp->scc_psmr = 0x0000; /* init PSMR: no additional flags */
  360. sp->scc_todr = 0x0000;
  361. sp->scc_dsr = 0x7e7e;
  362. /* init. SCC_SM parameter area */
  363. hp = (hdlc_pram_t *) & cp->cp_dparam[PROFF];
  364. hp->tbase = bd_off; /* offset from beginning of DPRAM */
  365. hp->rfcr = 0x18;
  366. hp->tfcr = 0x18;
  367. hp->mrblr = 10;
  368. hp->c_mask = 0x0000f0b8;
  369. hp->c_pres = 0x0000ffff;
  370. hp->disfc = 0;
  371. hp->crcec = 0;
  372. hp->abtsc = 0;
  373. hp->nmarc = 0;
  374. hp->retrc = 0;
  375. hp->mflr = 10;
  376. hp->rfthr = 1;
  377. hp->hmask = 0;
  378. hp->haddr1 = 0;
  379. hp->haddr2 = 0;
  380. hp->haddr3 = 0;
  381. hp->haddr4 = 0;
  382. cp->cp_cpcr = SCC_SM << 6 | 0x0001; /* SCC_SM: init TX/RX params */
  383. while (cp->cp_cpcr & CPM_CR_FLG);
  384. /* clear all outstanding SCC events */
  385. sp->scc_scce = ~0;
  386. /* enable transmitter: GSMR_L: TPL=2(16bits), TPP=3(all ones), ENT */
  387. sp->scc_gsmrh = 0;
  388. sp->scc_gsmrl |= SCC_GSMRL_TPL_16 | SCC_GSMRL_TPP_ALL1 |
  389. SCC_GSMRL_ENT | SCC_GSMRL_MODE_HDLC;
  390. #if 0
  391. smimsg[0] = 0x00; /* CHIP/HUB ID */
  392. smimsg[1] = 0x38; /* WRITE CMD */
  393. smimsg[2] = (RPRESET_ADDR << 4) & 0xf0;
  394. smimsg[3] = RPRESET_ADDR >> 4;
  395. smimsg[4] = 0x01;
  396. smimsg[5] = 0x00;
  397. smimsg[6] = 0x00;
  398. smimsg[7] = 0x00;
  399. send_smi_frame (sp, bd, smimsg);
  400. #endif
  401. smimsg[0] = 0x7f; /* BROADCAST */
  402. smimsg[1] = 0x34; /* ASSIGN HUB ID */
  403. smimsg[2] = 0x00;
  404. smimsg[3] = 0x00;
  405. smimsg[4] = 0x00; /* HUB ID = 0 */
  406. smimsg[5] = 0x00;
  407. smimsg[6] = 0x00;
  408. smimsg[7] = 0x00;
  409. send_smi_frame (sp, bd, smimsg);
  410. smimsg[0] = 0x7f; /* BROADCAST */
  411. smimsg[1] = 0x3c; /* SET ARBOUT TO 0 */
  412. smimsg[2] = 0x00; /* ADDRESS = 0 */
  413. smimsg[3] = 0x00;
  414. smimsg[4] = 0x00; /* DATA = 0 */
  415. smimsg[5] = 0x00;
  416. smimsg[6] = 0x00;
  417. smimsg[7] = 0x00;
  418. send_smi_frame (sp, bd, smimsg);
  419. if (speed == 100) {
  420. phypcrval = PHYPCR_SPEED; /* 100 MBIT, disable autoneg. */
  421. } else {
  422. phypcrval = 0; /* 10 MBIT, disable autoneg. */
  423. }
  424. /* send MSGs */
  425. for (pnr = 0; pnr < 8; pnr++) {
  426. smimsg[0] = 0x00; /* CHIP/HUB ID */
  427. smimsg[1] = 0x38; /* WRITE CMD */
  428. smimsg[2] = ((PHYPCR_ADDR + pnr) << 4) & 0xf0;
  429. smimsg[3] = (PHYPCR_ADDR + pnr) >> 4;
  430. smimsg[4] = (unsigned char) (phypcrval & 0xff);
  431. smimsg[5] = (unsigned char) (phypcrval >> 8);
  432. smimsg[6] = 0x00;
  433. smimsg[7] = 0x00;
  434. send_smi_frame (sp, bd, smimsg);
  435. }
  436. smimsg[0] = 0x00; /* CHIP/HUB ID */
  437. smimsg[1] = 0x38; /* WRITE CMD */
  438. smimsg[2] = (PHYGPCR_ADDR << 4) & 0xf0;
  439. smimsg[3] = PHYGPCR_ADDR >> 4;
  440. smimsg[4] = 0xff; /* enable port 1-8 */
  441. smimsg[5] = 0x01; /* enable MII1 (0x01) */
  442. smimsg[6] = 0x00;
  443. smimsg[7] = 0x00;
  444. send_smi_frame (sp, bd, smimsg);
  445. smimsg[0] = 0x00; /* CHIP/HUB ID */
  446. smimsg[1] = 0x38; /* WRITE CMD */
  447. smimsg[2] = (LEDPCR_ADDR << 4) & 0xf0;
  448. smimsg[3] = LEDPCR_ADDR >> 4;
  449. smimsg[4] = 0xaa; /* Port 1-8 Conf.bits = 10 (Hardware control) */
  450. smimsg[5] = 0xaa;
  451. smimsg[6] = 0x00;
  452. smimsg[7] = 0x00;
  453. send_smi_frame (sp, bd, smimsg);
  454. /*
  455. * Disable Transmitter (so that we can free the BD, too)
  456. */
  457. sp->scc_gsmrl &= ~SCC_GSMRL_ENT;
  458. }
  459. /* ------------------------------------------------------------------------- */
  460. static void send_smi_frame (volatile scc_t * sp, volatile cbd_t * bd,
  461. uchar * msg)
  462. {
  463. #ifdef DEBUG
  464. unsigned hub, chip, cmd, length, addr;
  465. hub = msg[0] & 0x1F;
  466. chip = msg[0] >> 5;
  467. cmd = msg[1] & 0x1F;
  468. length = (msg[1] >> 5) | ((msg[2] & 0x0F) << 3);
  469. addr = (msg[2] >> 4) | (msg[3] << 4);
  470. printf ("SMI send: Hub %02x Chip %x Cmd %02x Len %d Addr %03x: "
  471. "%02x %02x %02x %02x\n",
  472. hub, chip, cmd, length, addr, msg[4], msg[5], msg[6], msg[7]);
  473. #endif /* DEBUG */
  474. bd->cbd_bufaddr = (uint) msg;
  475. bd->cbd_datlen = SMI_MSGLEN;
  476. bd->cbd_sc |= BD_SC_READY;
  477. /* wait for msg transmitted */
  478. while ((sp->scc_scce & 0x0002) == 0);
  479. /* clear all events */
  480. sp->scc_scce = ~0;
  481. }
  482. /* ------------------------------------------------------------------------- */
  483. void show_boot_progress (int status)
  484. {
  485. volatile immap_t *immr = (immap_t *) CFG_IMMR;
  486. status ^= 0x0F;
  487. status = (status & 0x0F) << 14;
  488. immr->im_cpm.cp_pbdat = (immr->im_cpm.cp_pbdat & ~PB_LED_ALL) | status;
  489. }
  490. /* ------------------------------------------------------------------------- */