cpu_init.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. /*
  2. * Copyright (C) 2004-2009 Freescale Semiconductor, Inc.
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License as
  9. * published by the Free Software Foundation; either version 2 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  20. * MA 02111-1307 USA
  21. */
  22. #include <common.h>
  23. #include <mpc83xx.h>
  24. #include <ioports.h>
  25. #include <asm/io.h>
  26. #ifdef CONFIG_USB_EHCI_FSL
  27. #include <usb/ehci-fsl.h>
  28. #endif
  29. DECLARE_GLOBAL_DATA_PTR;
  30. #ifdef CONFIG_QE
  31. extern qe_iop_conf_t qe_iop_conf_tab[];
  32. extern void qe_config_iopin(u8 port, u8 pin, int dir,
  33. int open_drain, int assign);
  34. extern void qe_init(uint qe_base);
  35. extern void qe_reset(void);
  36. static void config_qe_ioports(void)
  37. {
  38. u8 port, pin;
  39. int dir, open_drain, assign;
  40. int i;
  41. for (i = 0; qe_iop_conf_tab[i].assign != QE_IOP_TAB_END; i++) {
  42. port = qe_iop_conf_tab[i].port;
  43. pin = qe_iop_conf_tab[i].pin;
  44. dir = qe_iop_conf_tab[i].dir;
  45. open_drain = qe_iop_conf_tab[i].open_drain;
  46. assign = qe_iop_conf_tab[i].assign;
  47. qe_config_iopin(port, pin, dir, open_drain, assign);
  48. }
  49. }
  50. #endif
  51. /*
  52. * Breathe some life into the CPU...
  53. *
  54. * Set up the memory map,
  55. * initialize a bunch of registers,
  56. * initialize the UPM's
  57. */
  58. void cpu_init_f (volatile immap_t * im)
  59. {
  60. __be32 acr_mask =
  61. #ifdef CONFIG_SYS_ACR_PIPE_DEP /* Arbiter pipeline depth */
  62. ACR_PIPE_DEP |
  63. #endif
  64. #ifdef CONFIG_SYS_ACR_RPTCNT /* Arbiter repeat count */
  65. ACR_RPTCNT |
  66. #endif
  67. #ifdef CONFIG_SYS_ACR_APARK /* Arbiter address parking mode */
  68. ACR_APARK |
  69. #endif
  70. #ifdef CONFIG_SYS_ACR_PARKM /* Arbiter parking master */
  71. ACR_PARKM |
  72. #endif
  73. 0;
  74. __be32 acr_val =
  75. #ifdef CONFIG_SYS_ACR_PIPE_DEP /* Arbiter pipeline depth */
  76. (CONFIG_SYS_ACR_PIPE_DEP << ACR_PIPE_DEP_SHIFT) |
  77. #endif
  78. #ifdef CONFIG_SYS_ACR_RPTCNT /* Arbiter repeat count */
  79. (CONFIG_SYS_ACR_RPTCNT << ACR_RPTCNT_SHIFT) |
  80. #endif
  81. #ifdef CONFIG_SYS_ACR_APARK /* Arbiter address parking mode */
  82. (CONFIG_SYS_ACR_APARK << ACR_APARK_SHIFT) |
  83. #endif
  84. #ifdef CONFIG_SYS_ACR_PARKM /* Arbiter parking master */
  85. (CONFIG_SYS_ACR_PARKM << ACR_PARKM_SHIFT) |
  86. #endif
  87. 0;
  88. __be32 spcr_mask =
  89. #ifdef CONFIG_SYS_SPCR_OPT /* Optimize transactions between CSB and other dev */
  90. SPCR_OPT |
  91. #endif
  92. #ifdef CONFIG_SYS_SPCR_TSECEP /* all eTSEC's Emergency priority */
  93. SPCR_TSECEP |
  94. #endif
  95. #ifdef CONFIG_SYS_SPCR_TSEC1EP /* TSEC1 Emergency priority */
  96. SPCR_TSEC1EP |
  97. #endif
  98. #ifdef CONFIG_SYS_SPCR_TSEC2EP /* TSEC2 Emergency priority */
  99. SPCR_TSEC2EP |
  100. #endif
  101. 0;
  102. __be32 spcr_val =
  103. #ifdef CONFIG_SYS_SPCR_OPT
  104. (CONFIG_SYS_SPCR_OPT << SPCR_OPT_SHIFT) |
  105. #endif
  106. #ifdef CONFIG_SYS_SPCR_TSECEP /* all eTSEC's Emergency priority */
  107. (CONFIG_SYS_SPCR_TSECEP << SPCR_TSECEP_SHIFT) |
  108. #endif
  109. #ifdef CONFIG_SYS_SPCR_TSEC1EP /* TSEC1 Emergency priority */
  110. (CONFIG_SYS_SPCR_TSEC1EP << SPCR_TSEC1EP_SHIFT) |
  111. #endif
  112. #ifdef CONFIG_SYS_SPCR_TSEC2EP /* TSEC2 Emergency priority */
  113. (CONFIG_SYS_SPCR_TSEC2EP << SPCR_TSEC2EP_SHIFT) |
  114. #endif
  115. 0;
  116. __be32 sccr_mask =
  117. #ifdef CONFIG_SYS_SCCR_ENCCM /* Encryption clock mode */
  118. SCCR_ENCCM |
  119. #endif
  120. #ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
  121. SCCR_PCICM |
  122. #endif
  123. #ifdef CONFIG_SYS_SCCR_PCIEXP1CM /* PCIE1 clock mode */
  124. SCCR_PCIEXP1CM |
  125. #endif
  126. #ifdef CONFIG_SYS_SCCR_PCIEXP2CM /* PCIE2 clock mode */
  127. SCCR_PCIEXP2CM |
  128. #endif
  129. #ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
  130. SCCR_TSECCM |
  131. #endif
  132. #ifdef CONFIG_SYS_SCCR_TSEC1CM /* TSEC1 clock mode */
  133. SCCR_TSEC1CM |
  134. #endif
  135. #ifdef CONFIG_SYS_SCCR_TSEC2CM /* TSEC2 clock mode */
  136. SCCR_TSEC2CM |
  137. #endif
  138. #ifdef CONFIG_SYS_SCCR_TSEC1ON /* TSEC1 clock switch */
  139. SCCR_TSEC1ON |
  140. #endif
  141. #ifdef CONFIG_SYS_SCCR_TSEC2ON /* TSEC2 clock switch */
  142. SCCR_TSEC2ON |
  143. #endif
  144. #ifdef CONFIG_SYS_SCCR_USBMPHCM /* USB MPH clock mode */
  145. SCCR_USBMPHCM |
  146. #endif
  147. #ifdef CONFIG_SYS_SCCR_USBDRCM /* USB DR clock mode */
  148. SCCR_USBDRCM |
  149. #endif
  150. #ifdef CONFIG_SYS_SCCR_SATACM /* SATA controller clock mode */
  151. SCCR_SATACM |
  152. #endif
  153. 0;
  154. __be32 sccr_val =
  155. #ifdef CONFIG_SYS_SCCR_ENCCM /* Encryption clock mode */
  156. (CONFIG_SYS_SCCR_ENCCM << SCCR_ENCCM_SHIFT) |
  157. #endif
  158. #ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
  159. (CONFIG_SYS_SCCR_PCICM << SCCR_PCICM_SHIFT) |
  160. #endif
  161. #ifdef CONFIG_SYS_SCCR_PCIEXP1CM /* PCIE1 clock mode */
  162. (CONFIG_SYS_SCCR_PCIEXP1CM << SCCR_PCIEXP1CM_SHIFT) |
  163. #endif
  164. #ifdef CONFIG_SYS_SCCR_PCIEXP2CM /* PCIE2 clock mode */
  165. (CONFIG_SYS_SCCR_PCIEXP2CM << SCCR_PCIEXP2CM_SHIFT) |
  166. #endif
  167. #ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
  168. (CONFIG_SYS_SCCR_TSECCM << SCCR_TSECCM_SHIFT) |
  169. #endif
  170. #ifdef CONFIG_SYS_SCCR_TSEC1CM /* TSEC1 clock mode */
  171. (CONFIG_SYS_SCCR_TSEC1CM << SCCR_TSEC1CM_SHIFT) |
  172. #endif
  173. #ifdef CONFIG_SYS_SCCR_TSEC2CM /* TSEC2 clock mode */
  174. (CONFIG_SYS_SCCR_TSEC2CM << SCCR_TSEC2CM_SHIFT) |
  175. #endif
  176. #ifdef CONFIG_SYS_SCCR_TSEC1ON /* TSEC1 clock switch */
  177. (CONFIG_SYS_SCCR_TSEC1ON << SCCR_TSEC1ON_SHIFT) |
  178. #endif
  179. #ifdef CONFIG_SYS_SCCR_TSEC2ON /* TSEC2 clock switch */
  180. (CONFIG_SYS_SCCR_TSEC2ON << SCCR_TSEC2ON_SHIFT) |
  181. #endif
  182. #ifdef CONFIG_SYS_SCCR_USBMPHCM /* USB MPH clock mode */
  183. (CONFIG_SYS_SCCR_USBMPHCM << SCCR_USBMPHCM_SHIFT) |
  184. #endif
  185. #ifdef CONFIG_SYS_SCCR_USBDRCM /* USB DR clock mode */
  186. (CONFIG_SYS_SCCR_USBDRCM << SCCR_USBDRCM_SHIFT) |
  187. #endif
  188. #ifdef CONFIG_SYS_SCCR_SATACM /* SATA controller clock mode */
  189. (CONFIG_SYS_SCCR_SATACM << SCCR_SATACM_SHIFT) |
  190. #endif
  191. 0;
  192. __be32 lcrr_mask =
  193. #ifdef CONFIG_SYS_LCRR_DBYP /* PLL bypass */
  194. LCRR_DBYP |
  195. #endif
  196. #ifdef CONFIG_SYS_LCRR_EADC /* external address delay */
  197. LCRR_EADC |
  198. #endif
  199. #ifdef CONFIG_SYS_LCRR_CLKDIV /* system clock divider */
  200. LCRR_CLKDIV |
  201. #endif
  202. 0;
  203. __be32 lcrr_val =
  204. #ifdef CONFIG_SYS_LCRR_DBYP /* PLL bypass */
  205. CONFIG_SYS_LCRR_DBYP |
  206. #endif
  207. #ifdef CONFIG_SYS_LCRR_EADC
  208. CONFIG_SYS_LCRR_EADC |
  209. #endif
  210. #ifdef CONFIG_SYS_LCRR_CLKDIV /* system clock divider */
  211. CONFIG_SYS_LCRR_CLKDIV |
  212. #endif
  213. 0;
  214. /* Pointer is writable since we allocated a register for it */
  215. gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
  216. /* Clear initial global data */
  217. memset ((void *) gd, 0, sizeof (gd_t));
  218. /* system performance tweaking */
  219. clrsetbits_be32(&im->arbiter.acr, acr_mask, acr_val);
  220. clrsetbits_be32(&im->sysconf.spcr, spcr_mask, spcr_val);
  221. clrsetbits_be32(&im->clk.sccr, sccr_mask, sccr_val);
  222. /* RSR - Reset Status Register - clear all status (4.6.1.3) */
  223. gd->reset_status = __raw_readl(&im->reset.rsr);
  224. __raw_writel(~(RSR_RES), &im->reset.rsr);
  225. /* AER - Arbiter Event Register - store status */
  226. gd->arbiter_event_attributes = __raw_readl(&im->arbiter.aeatr);
  227. gd->arbiter_event_address = __raw_readl(&im->arbiter.aeadr);
  228. /*
  229. * RMR - Reset Mode Register
  230. * contains checkstop reset enable (4.6.1.4)
  231. */
  232. __raw_writel(RMR_CSRE & (1<<RMR_CSRE_SHIFT), &im->reset.rmr);
  233. /* LCRR - Clock Ratio Register (10.3.1.16)
  234. * write, read, and isync per MPC8379ERM rev.1 CLKDEV field description
  235. */
  236. clrsetbits_be32(&im->im_lbc.lcrr, lcrr_mask, lcrr_val);
  237. __raw_readl(&im->im_lbc.lcrr);
  238. isync();
  239. /* Enable Time Base & Decrementer ( so we will have udelay() )*/
  240. setbits_be32(&im->sysconf.spcr, SPCR_TBEN);
  241. /* System General Purpose Register */
  242. #ifdef CONFIG_SYS_SICRH
  243. #if defined(CONFIG_MPC834x) || defined(CONFIG_MPC8313)
  244. /* regarding to MPC34x manual rev.1 bits 28..29 must be preserved */
  245. __raw_writel((im->sysconf.sicrh & 0x0000000C) | CONFIG_SYS_SICRH,
  246. &im->sysconf.sicrh);
  247. #else
  248. __raw_writel(CONFIG_SYS_SICRH, &im->sysconf.sicrh);
  249. #endif
  250. #endif
  251. #ifdef CONFIG_SYS_SICRL
  252. __raw_writel(CONFIG_SYS_SICRL, &im->sysconf.sicrl);
  253. #endif
  254. #ifdef CONFIG_SYS_DDRCDR /* DDR control driver register */
  255. __raw_writel(CONFIG_SYS_DDRCDR, &im->sysconf.ddrcdr);
  256. #endif
  257. #ifdef CONFIG_SYS_OBIR /* Output buffer impedance register */
  258. __raw_writel(CONFIG_SYS_OBIR, &im->sysconf.obir);
  259. #endif
  260. #ifdef CONFIG_QE
  261. /* Config QE ioports */
  262. config_qe_ioports();
  263. #endif
  264. /* Set up preliminary BR/OR regs */
  265. init_early_memctl_regs();
  266. /* Local Access window setup */
  267. #if defined(CONFIG_SYS_LBLAWBAR0_PRELIM) && defined(CONFIG_SYS_LBLAWAR0_PRELIM)
  268. im->sysconf.lblaw[0].bar = CONFIG_SYS_LBLAWBAR0_PRELIM;
  269. im->sysconf.lblaw[0].ar = CONFIG_SYS_LBLAWAR0_PRELIM;
  270. #else
  271. #error CONFIG_SYS_LBLAWBAR0_PRELIM & CONFIG_SYS_LBLAWAR0_PRELIM must be defined
  272. #endif
  273. #if defined(CONFIG_SYS_LBLAWBAR1_PRELIM) && defined(CONFIG_SYS_LBLAWAR1_PRELIM)
  274. im->sysconf.lblaw[1].bar = CONFIG_SYS_LBLAWBAR1_PRELIM;
  275. im->sysconf.lblaw[1].ar = CONFIG_SYS_LBLAWAR1_PRELIM;
  276. #endif
  277. #if defined(CONFIG_SYS_LBLAWBAR2_PRELIM) && defined(CONFIG_SYS_LBLAWAR2_PRELIM)
  278. im->sysconf.lblaw[2].bar = CONFIG_SYS_LBLAWBAR2_PRELIM;
  279. im->sysconf.lblaw[2].ar = CONFIG_SYS_LBLAWAR2_PRELIM;
  280. #endif
  281. #if defined(CONFIG_SYS_LBLAWBAR3_PRELIM) && defined(CONFIG_SYS_LBLAWAR3_PRELIM)
  282. im->sysconf.lblaw[3].bar = CONFIG_SYS_LBLAWBAR3_PRELIM;
  283. im->sysconf.lblaw[3].ar = CONFIG_SYS_LBLAWAR3_PRELIM;
  284. #endif
  285. #if defined(CONFIG_SYS_LBLAWBAR4_PRELIM) && defined(CONFIG_SYS_LBLAWAR4_PRELIM)
  286. im->sysconf.lblaw[4].bar = CONFIG_SYS_LBLAWBAR4_PRELIM;
  287. im->sysconf.lblaw[4].ar = CONFIG_SYS_LBLAWAR4_PRELIM;
  288. #endif
  289. #if defined(CONFIG_SYS_LBLAWBAR5_PRELIM) && defined(CONFIG_SYS_LBLAWAR5_PRELIM)
  290. im->sysconf.lblaw[5].bar = CONFIG_SYS_LBLAWBAR5_PRELIM;
  291. im->sysconf.lblaw[5].ar = CONFIG_SYS_LBLAWAR5_PRELIM;
  292. #endif
  293. #if defined(CONFIG_SYS_LBLAWBAR6_PRELIM) && defined(CONFIG_SYS_LBLAWAR6_PRELIM)
  294. im->sysconf.lblaw[6].bar = CONFIG_SYS_LBLAWBAR6_PRELIM;
  295. im->sysconf.lblaw[6].ar = CONFIG_SYS_LBLAWAR6_PRELIM;
  296. #endif
  297. #if defined(CONFIG_SYS_LBLAWBAR7_PRELIM) && defined(CONFIG_SYS_LBLAWAR7_PRELIM)
  298. im->sysconf.lblaw[7].bar = CONFIG_SYS_LBLAWBAR7_PRELIM;
  299. im->sysconf.lblaw[7].ar = CONFIG_SYS_LBLAWAR7_PRELIM;
  300. #endif
  301. #ifdef CONFIG_SYS_GPIO1_PRELIM
  302. im->gpio[0].dat = CONFIG_SYS_GPIO1_DAT;
  303. im->gpio[0].dir = CONFIG_SYS_GPIO1_DIR;
  304. #endif
  305. #ifdef CONFIG_SYS_GPIO2_PRELIM
  306. im->gpio[1].dat = CONFIG_SYS_GPIO2_DAT;
  307. im->gpio[1].dir = CONFIG_SYS_GPIO2_DIR;
  308. #endif
  309. #ifdef CONFIG_USB_EHCI_FSL
  310. #ifndef CONFIG_MPC834x
  311. uint32_t temp;
  312. struct usb_ehci *ehci = (struct usb_ehci *)CONFIG_SYS_FSL_USB_ADDR;
  313. /* Configure interface. */
  314. setbits_be32(&ehci->control, REFSEL_16MHZ | UTMI_PHY_EN);
  315. /* Wait for clock to stabilize */
  316. do {
  317. temp = __raw_readl(&ehci->control);
  318. udelay(1000);
  319. } while (!(temp & PHY_CLK_VALID));
  320. #endif
  321. #endif
  322. }
  323. int cpu_init_r (void)
  324. {
  325. #ifdef CONFIG_QE
  326. uint qe_base = CONFIG_SYS_IMMR + 0x00100000; /* QE immr base */
  327. qe_init(qe_base);
  328. qe_reset();
  329. #endif
  330. return 0;
  331. }
  332. /*
  333. * Print out the bus arbiter event
  334. */
  335. #if defined(CONFIG_DISPLAY_AER_FULL)
  336. static int print_83xx_arb_event(int force)
  337. {
  338. static char* event[] = {
  339. "Address Time Out",
  340. "Data Time Out",
  341. "Address Only Transfer Type",
  342. "External Control Word Transfer Type",
  343. "Reserved Transfer Type",
  344. "Transfer Error",
  345. "reserved",
  346. "reserved"
  347. };
  348. static char* master[] = {
  349. "e300 Core Data Transaction",
  350. "reserved",
  351. "e300 Core Instruction Fetch",
  352. "reserved",
  353. "TSEC1",
  354. "TSEC2",
  355. "USB MPH",
  356. "USB DR",
  357. "Encryption Core",
  358. "I2C Boot Sequencer",
  359. "JTAG",
  360. "reserved",
  361. "eSDHC",
  362. "PCI1",
  363. "PCI2",
  364. "DMA",
  365. "QUICC Engine 00",
  366. "QUICC Engine 01",
  367. "QUICC Engine 10",
  368. "QUICC Engine 11",
  369. "reserved",
  370. "reserved",
  371. "reserved",
  372. "reserved",
  373. "SATA1",
  374. "SATA2",
  375. "SATA3",
  376. "SATA4",
  377. "reserved",
  378. "PCI Express 1",
  379. "PCI Express 2",
  380. "TDM-DMAC"
  381. };
  382. static char *transfer[] = {
  383. "Address-only, Clean Block",
  384. "Address-only, lwarx reservation set",
  385. "Single-beat or Burst write",
  386. "reserved",
  387. "Address-only, Flush Block",
  388. "reserved",
  389. "Burst write",
  390. "reserved",
  391. "Address-only, sync",
  392. "Address-only, tlbsync",
  393. "Single-beat or Burst read",
  394. "Single-beat or Burst read",
  395. "Address-only, Kill Block",
  396. "Address-only, icbi",
  397. "Burst read",
  398. "reserved",
  399. "Address-only, eieio",
  400. "reserved",
  401. "Single-beat write",
  402. "reserved",
  403. "ecowx - Illegal single-beat write",
  404. "reserved",
  405. "reserved",
  406. "reserved",
  407. "Address-only, TLB Invalidate",
  408. "reserved",
  409. "Single-beat or Burst read",
  410. "reserved",
  411. "eciwx - Illegal single-beat read",
  412. "reserved",
  413. "Burst read",
  414. "reserved"
  415. };
  416. int etype = (gd->arbiter_event_attributes & AEATR_EVENT)
  417. >> AEATR_EVENT_SHIFT;
  418. int mstr_id = (gd->arbiter_event_attributes & AEATR_MSTR_ID)
  419. >> AEATR_MSTR_ID_SHIFT;
  420. int tbst = (gd->arbiter_event_attributes & AEATR_TBST)
  421. >> AEATR_TBST_SHIFT;
  422. int tsize = (gd->arbiter_event_attributes & AEATR_TSIZE)
  423. >> AEATR_TSIZE_SHIFT;
  424. int ttype = (gd->arbiter_event_attributes & AEATR_TTYPE)
  425. >> AEATR_TTYPE_SHIFT;
  426. if (!force && !gd->arbiter_event_address)
  427. return 0;
  428. puts("Arbiter Event Status:\n");
  429. printf(" Event Address: 0x%08lX\n", gd->arbiter_event_address);
  430. printf(" Event Type: 0x%1x = %s\n", etype, event[etype]);
  431. printf(" Master ID: 0x%02x = %s\n", mstr_id, master[mstr_id]);
  432. printf(" Transfer Size: 0x%1x = %d bytes\n", (tbst<<3) | tsize,
  433. tbst ? (tsize ? tsize : 8) : 16 + 8 * tsize);
  434. printf(" Transfer Type: 0x%02x = %s\n", ttype, transfer[ttype]);
  435. return gd->arbiter_event_address;
  436. }
  437. #elif defined(CONFIG_DISPLAY_AER_BRIEF)
  438. static int print_83xx_arb_event(int force)
  439. {
  440. if (!force && !gd->arbiter_event_address)
  441. return 0;
  442. printf("Arbiter Event Status: AEATR=0x%08lX, AEADR=0x%08lX\n",
  443. gd->arbiter_event_attributes, gd->arbiter_event_address);
  444. return gd->arbiter_event_address;
  445. }
  446. #endif /* CONFIG_DISPLAY_AER_xxxx */
  447. /*
  448. * Figure out the cause of the reset
  449. */
  450. int prt_83xx_rsr(void)
  451. {
  452. static struct {
  453. ulong mask;
  454. char *desc;
  455. } bits[] = {
  456. {
  457. RSR_SWSR, "Software Soft"}, {
  458. RSR_SWHR, "Software Hard"}, {
  459. RSR_JSRS, "JTAG Soft"}, {
  460. RSR_CSHR, "Check Stop"}, {
  461. RSR_SWRS, "Software Watchdog"}, {
  462. RSR_BMRS, "Bus Monitor"}, {
  463. RSR_SRS, "External/Internal Soft"}, {
  464. RSR_HRS, "External/Internal Hard"}
  465. };
  466. static int n = sizeof bits / sizeof bits[0];
  467. ulong rsr = gd->reset_status;
  468. int i;
  469. char *sep;
  470. puts("Reset Status:");
  471. sep = " ";
  472. for (i = 0; i < n; i++)
  473. if (rsr & bits[i].mask) {
  474. printf("%s%s", sep, bits[i].desc);
  475. sep = ", ";
  476. }
  477. puts("\n");
  478. #if defined(CONFIG_DISPLAY_AER_FULL) || defined(CONFIG_DISPLAY_AER_BRIEF)
  479. print_83xx_arb_event(rsr & RSR_BMRS);
  480. #endif
  481. puts("\n");
  482. return 0;
  483. }