cpu_init.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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 << ACR_PIPE_DEP_SHIFT) |
  63. #endif
  64. #ifdef CONFIG_SYS_ACR_RPTCNT /* Arbiter repeat count */
  65. (ACR_RPTCNT << ACR_RPTCNT_SHIFT) |
  66. #endif
  67. 0;
  68. __be32 acr_val =
  69. #ifdef CONFIG_SYS_ACR_PIPE_DEP /* Arbiter pipeline depth */
  70. (CONFIG_SYS_ACR_PIPE_DEP << ACR_PIPE_DEP_SHIFT) |
  71. #endif
  72. #ifdef CONFIG_SYS_ACR_RPTCNT /* Arbiter repeat count */
  73. (CONFIG_SYS_ACR_RPTCNT << ACR_RPTCNT_SHIFT) |
  74. #endif
  75. 0;
  76. __be32 spcr_mask =
  77. #ifdef CONFIG_SYS_SPCR_OPT /* Optimize transactions between CSB and other dev */
  78. (SPCR_OPT << SPCR_OPT_SHIFT) |
  79. #endif
  80. #ifdef CONFIG_SYS_SPCR_TSECEP /* all eTSEC's Emergency priority */
  81. (SPCR_TSECEP << SPCR_TSECEP_SHIFT) |
  82. #endif
  83. #ifdef CONFIG_SYS_SPCR_TSEC1EP /* TSEC1 Emergency priority */
  84. (SPCR_TSEC1EP << SPCR_TSEC1EP_SHIFT) |
  85. #endif
  86. #ifdef CONFIG_SYS_SPCR_TSEC2EP /* TSEC2 Emergency priority */
  87. (SPCR_TSEC2EP << SPCR_TSEC2EP_SHIFT) |
  88. #endif
  89. 0;
  90. __be32 spcr_val =
  91. #ifdef CONFIG_SYS_SPCR_OPT
  92. (CONFIG_SYS_SPCR_OPT << SPCR_OPT_SHIFT) |
  93. #endif
  94. #ifdef CONFIG_SYS_SPCR_TSECEP /* all eTSEC's Emergency priority */
  95. (CONFIG_SYS_SPCR_TSECEP << SPCR_TSECEP_SHIFT) |
  96. #endif
  97. #ifdef CONFIG_SYS_SPCR_TSEC1EP /* TSEC1 Emergency priority */
  98. (CONFIG_SYS_SPCR_TSEC1EP << SPCR_TSEC1EP_SHIFT) |
  99. #endif
  100. #ifdef CONFIG_SYS_SPCR_TSEC2EP /* TSEC2 Emergency priority */
  101. (CONFIG_SYS_SPCR_TSEC2EP << SPCR_TSEC2EP_SHIFT) |
  102. #endif
  103. 0;
  104. __be32 sccr_mask =
  105. #ifdef CONFIG_SYS_SCCR_ENCCM /* Encryption clock mode */
  106. (SCCR_ENCCM << SCCR_ENCCM_SHIFT) |
  107. #endif
  108. #ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
  109. (SCCR_PCICM << SCCR_PCICM_SHIFT) |
  110. #endif
  111. #ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
  112. (SCCR_TSECCM << SCCR_TSECCM_SHIFT) |
  113. #endif
  114. #ifdef CONFIG_SYS_SCCR_TSEC1CM /* TSEC1 clock mode */
  115. (SCCR_TSEC1CM << SCCR_TSEC1CM_SHIFT) |
  116. #endif
  117. #ifdef CONFIG_SYS_SCCR_TSEC2CM /* TSEC2 clock mode */
  118. (SCCR_TSEC2CM << SCCR_TSEC2CM_SHIFT) |
  119. #endif
  120. #ifdef CONFIG_SYS_SCCR_TSEC1ON /* TSEC1 clock switch */
  121. (SCCR_TSEC1ON << SCCR_TSEC1ON_SHIFT) |
  122. #endif
  123. #ifdef CONFIG_SYS_SCCR_TSEC2ON /* TSEC2 clock switch */
  124. (SCCR_TSEC2ON << SCCR_TSEC2ON_SHIFT) |
  125. #endif
  126. #ifdef CONFIG_SYS_SCCR_USBMPHCM /* USB MPH clock mode */
  127. (SCCR_USBMPHCM << SCCR_USBMPHCM_SHIFT) |
  128. #endif
  129. #ifdef CONFIG_SYS_SCCR_USBDRCM /* USB DR clock mode */
  130. (SCCR_USBDRCM << SCCR_USBDRCM_SHIFT) |
  131. #endif
  132. #ifdef CONFIG_SYS_SCCR_SATACM /* SATA controller clock mode */
  133. (SCCR_SATACM << SCCR_SATACM_SHIFT) |
  134. #endif
  135. 0;
  136. __be32 sccr_val =
  137. #ifdef CONFIG_SYS_SCCR_ENCCM /* Encryption clock mode */
  138. (CONFIG_SYS_SCCR_ENCCM << SCCR_ENCCM_SHIFT) |
  139. #endif
  140. #ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
  141. (CONFIG_SYS_SCCR_PCICM << SCCR_PCICM_SHIFT) |
  142. #endif
  143. #ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
  144. (CONFIG_SYS_SCCR_TSECCM << SCCR_TSECCM_SHIFT) |
  145. #endif
  146. #ifdef CONFIG_SYS_SCCR_TSEC1CM /* TSEC1 clock mode */
  147. (CONFIG_SYS_SCCR_TSEC1CM << SCCR_TSEC1CM_SHIFT) |
  148. #endif
  149. #ifdef CONFIG_SYS_SCCR_TSEC2CM /* TSEC2 clock mode */
  150. (CONFIG_SYS_SCCR_TSEC2CM << SCCR_TSEC2CM_SHIFT) |
  151. #endif
  152. #ifdef CONFIG_SYS_SCCR_TSEC1ON /* TSEC1 clock switch */
  153. (CONFIG_SYS_SCCR_TSEC1ON << SCCR_TSEC1ON_SHIFT) |
  154. #endif
  155. #ifdef CONFIG_SYS_SCCR_TSEC2ON /* TSEC2 clock switch */
  156. (CONFIG_SYS_SCCR_TSEC2ON << SCCR_TSEC2ON_SHIFT) |
  157. #endif
  158. #ifdef CONFIG_SYS_SCCR_USBMPHCM /* USB MPH clock mode */
  159. (CONFIG_SYS_SCCR_USBMPHCM << SCCR_USBMPHCM_SHIFT) |
  160. #endif
  161. #ifdef CONFIG_SYS_SCCR_USBDRCM /* USB DR clock mode */
  162. (CONFIG_SYS_SCCR_USBDRCM << SCCR_USBDRCM_SHIFT) |
  163. #endif
  164. #ifdef CONFIG_SYS_SCCR_SATACM /* SATA controller clock mode */
  165. (CONFIG_SYS_SCCR_SATACM << SCCR_SATACM_SHIFT) |
  166. #endif
  167. 0;
  168. /* Pointer is writable since we allocated a register for it */
  169. gd = (gd_t *) (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_GBL_DATA_OFFSET);
  170. /* Clear initial global data */
  171. memset ((void *) gd, 0, sizeof (gd_t));
  172. /* system performance tweaking */
  173. clrsetbits_be32(&im->arbiter.acr, acr_mask, acr_val);
  174. clrsetbits_be32(&im->sysconf.spcr, spcr_mask, spcr_val);
  175. clrsetbits_be32(&im->clk.sccr, sccr_mask, sccr_val);
  176. /* RSR - Reset Status Register - clear all status (4.6.1.3) */
  177. gd->reset_status = __raw_readl(&im->reset.rsr);
  178. __raw_writel(~(RSR_RES), &im->reset.rsr);
  179. /* AER - Arbiter Event Register - store status */
  180. gd->arbiter_event_attributes = __raw_readl(&im->arbiter.aeatr);
  181. gd->arbiter_event_address = __raw_readl(&im->arbiter.aeadr);
  182. /*
  183. * RMR - Reset Mode Register
  184. * contains checkstop reset enable (4.6.1.4)
  185. */
  186. __raw_writel(RMR_CSRE & (1<<RMR_CSRE_SHIFT), &im->reset.rmr);
  187. /* Enable Time Base & Decrementer ( so we will have udelay() )*/
  188. setbits_be32(&im->sysconf.spcr, SPCR_TBEN);
  189. /* System General Purpose Register */
  190. #ifdef CONFIG_SYS_SICRH
  191. #if defined(CONFIG_MPC834x) || defined(CONFIG_MPC8313)
  192. /* regarding to MPC34x manual rev.1 bits 28..29 must be preserved */
  193. __raw_writel((im->sysconf.sicrh & 0x0000000C) | CONFIG_SYS_SICRH,
  194. &im->sysconf.sicrh);
  195. #else
  196. __raw_writel(CONFIG_SYS_SICRH, &im->sysconf.sicrh);
  197. #endif
  198. #endif
  199. #ifdef CONFIG_SYS_SICRL
  200. __raw_writel(CONFIG_SYS_SICRL, &im->sysconf.sicrl);
  201. #endif
  202. #ifdef CONFIG_SYS_DDRCDR /* DDR control driver register */
  203. __raw_writel(CONFIG_SYS_DDRCDR, &im->sysconf.ddrcdr);
  204. #endif
  205. #ifdef CONFIG_SYS_OBIR /* Output buffer impedance register */
  206. __raw_writel(CONFIG_SYS_OBIR, &im->sysconf.obir);
  207. #endif
  208. #ifdef CONFIG_QE
  209. /* Config QE ioports */
  210. config_qe_ioports();
  211. #endif
  212. /*
  213. * Memory Controller:
  214. */
  215. /* Map banks 0 and 1 to the FLASH banks 0 and 1 at preliminary
  216. * addresses - these have to be modified later when FLASH size
  217. * has been determined
  218. */
  219. #if defined(CONFIG_SYS_BR0_PRELIM) \
  220. && defined(CONFIG_SYS_OR0_PRELIM) \
  221. && defined(CONFIG_SYS_LBLAWBAR0_PRELIM) \
  222. && defined(CONFIG_SYS_LBLAWAR0_PRELIM)
  223. im->lbus.bank[0].br = CONFIG_SYS_BR0_PRELIM;
  224. im->lbus.bank[0].or = CONFIG_SYS_OR0_PRELIM;
  225. im->sysconf.lblaw[0].bar = CONFIG_SYS_LBLAWBAR0_PRELIM;
  226. im->sysconf.lblaw[0].ar = CONFIG_SYS_LBLAWAR0_PRELIM;
  227. #else
  228. #error CONFIG_SYS_BR0_PRELIM, CONFIG_SYS_OR0_PRELIM, CONFIG_SYS_LBLAWBAR0_PRELIM & CONFIG_SYS_LBLAWAR0_PRELIM must be defined
  229. #endif
  230. #if defined(CONFIG_SYS_BR1_PRELIM) && defined(CONFIG_SYS_OR1_PRELIM)
  231. im->lbus.bank[1].br = CONFIG_SYS_BR1_PRELIM;
  232. im->lbus.bank[1].or = CONFIG_SYS_OR1_PRELIM;
  233. #endif
  234. #if defined(CONFIG_SYS_LBLAWBAR1_PRELIM) && defined(CONFIG_SYS_LBLAWAR1_PRELIM)
  235. im->sysconf.lblaw[1].bar = CONFIG_SYS_LBLAWBAR1_PRELIM;
  236. im->sysconf.lblaw[1].ar = CONFIG_SYS_LBLAWAR1_PRELIM;
  237. #endif
  238. #if defined(CONFIG_SYS_BR2_PRELIM) && defined(CONFIG_SYS_OR2_PRELIM)
  239. im->lbus.bank[2].br = CONFIG_SYS_BR2_PRELIM;
  240. im->lbus.bank[2].or = CONFIG_SYS_OR2_PRELIM;
  241. #endif
  242. #if defined(CONFIG_SYS_LBLAWBAR2_PRELIM) && defined(CONFIG_SYS_LBLAWAR2_PRELIM)
  243. im->sysconf.lblaw[2].bar = CONFIG_SYS_LBLAWBAR2_PRELIM;
  244. im->sysconf.lblaw[2].ar = CONFIG_SYS_LBLAWAR2_PRELIM;
  245. #endif
  246. #if defined(CONFIG_SYS_BR3_PRELIM) && defined(CONFIG_SYS_OR3_PRELIM)
  247. im->lbus.bank[3].br = CONFIG_SYS_BR3_PRELIM;
  248. im->lbus.bank[3].or = CONFIG_SYS_OR3_PRELIM;
  249. #endif
  250. #if defined(CONFIG_SYS_LBLAWBAR3_PRELIM) && defined(CONFIG_SYS_LBLAWAR3_PRELIM)
  251. im->sysconf.lblaw[3].bar = CONFIG_SYS_LBLAWBAR3_PRELIM;
  252. im->sysconf.lblaw[3].ar = CONFIG_SYS_LBLAWAR3_PRELIM;
  253. #endif
  254. #if defined(CONFIG_SYS_BR4_PRELIM) && defined(CONFIG_SYS_OR4_PRELIM)
  255. im->lbus.bank[4].br = CONFIG_SYS_BR4_PRELIM;
  256. im->lbus.bank[4].or = CONFIG_SYS_OR4_PRELIM;
  257. #endif
  258. #if defined(CONFIG_SYS_LBLAWBAR4_PRELIM) && defined(CONFIG_SYS_LBLAWAR4_PRELIM)
  259. im->sysconf.lblaw[4].bar = CONFIG_SYS_LBLAWBAR4_PRELIM;
  260. im->sysconf.lblaw[4].ar = CONFIG_SYS_LBLAWAR4_PRELIM;
  261. #endif
  262. #if defined(CONFIG_SYS_BR5_PRELIM) && defined(CONFIG_SYS_OR5_PRELIM)
  263. im->lbus.bank[5].br = CONFIG_SYS_BR5_PRELIM;
  264. im->lbus.bank[5].or = CONFIG_SYS_OR5_PRELIM;
  265. #endif
  266. #if defined(CONFIG_SYS_LBLAWBAR5_PRELIM) && defined(CONFIG_SYS_LBLAWAR5_PRELIM)
  267. im->sysconf.lblaw[5].bar = CONFIG_SYS_LBLAWBAR5_PRELIM;
  268. im->sysconf.lblaw[5].ar = CONFIG_SYS_LBLAWAR5_PRELIM;
  269. #endif
  270. #if defined(CONFIG_SYS_BR6_PRELIM) && defined(CONFIG_SYS_OR6_PRELIM)
  271. im->lbus.bank[6].br = CONFIG_SYS_BR6_PRELIM;
  272. im->lbus.bank[6].or = CONFIG_SYS_OR6_PRELIM;
  273. #endif
  274. #if defined(CONFIG_SYS_LBLAWBAR6_PRELIM) && defined(CONFIG_SYS_LBLAWAR6_PRELIM)
  275. im->sysconf.lblaw[6].bar = CONFIG_SYS_LBLAWBAR6_PRELIM;
  276. im->sysconf.lblaw[6].ar = CONFIG_SYS_LBLAWAR6_PRELIM;
  277. #endif
  278. #if defined(CONFIG_SYS_BR7_PRELIM) && defined(CONFIG_SYS_OR7_PRELIM)
  279. im->lbus.bank[7].br = CONFIG_SYS_BR7_PRELIM;
  280. im->lbus.bank[7].or = CONFIG_SYS_OR7_PRELIM;
  281. #endif
  282. #if defined(CONFIG_SYS_LBLAWBAR7_PRELIM) && defined(CONFIG_SYS_LBLAWAR7_PRELIM)
  283. im->sysconf.lblaw[7].bar = CONFIG_SYS_LBLAWBAR7_PRELIM;
  284. im->sysconf.lblaw[7].ar = CONFIG_SYS_LBLAWAR7_PRELIM;
  285. #endif
  286. #ifdef CONFIG_SYS_GPIO1_PRELIM
  287. im->gpio[0].dat = CONFIG_SYS_GPIO1_DAT;
  288. im->gpio[0].dir = CONFIG_SYS_GPIO1_DIR;
  289. #endif
  290. #ifdef CONFIG_SYS_GPIO2_PRELIM
  291. im->gpio[1].dat = CONFIG_SYS_GPIO2_DAT;
  292. im->gpio[1].dir = CONFIG_SYS_GPIO2_DIR;
  293. #endif
  294. #ifdef CONFIG_USB_EHCI_FSL
  295. #ifndef CONFIG_MPC834x
  296. uint32_t temp;
  297. struct usb_ehci *ehci = (struct usb_ehci *)CONFIG_SYS_MPC8xxx_USB_ADDR;
  298. /* Configure interface. */
  299. setbits_be32(&ehci->control, REFSEL_16MHZ | UTMI_PHY_EN);
  300. /* Wait for clock to stabilize */
  301. do {
  302. temp = __raw_readl(&ehci->control);
  303. udelay(1000);
  304. } while (!(temp & PHY_CLK_VALID));
  305. #endif
  306. #endif
  307. }
  308. int cpu_init_r (void)
  309. {
  310. volatile immap_t *im = (volatile immap_t *)CONFIG_SYS_IMMR;
  311. #ifdef CONFIG_QE
  312. uint qe_base = CONFIG_SYS_IMMR + 0x00100000; /* QE immr base */
  313. #endif
  314. __be32 lcrr_mask =
  315. #ifdef CONFIG_SYS_LCRR_DBYP /* PLL bypass */
  316. LCRR_DBYP |
  317. #endif
  318. #ifdef CONFIG_SYS_LCRR_EADC /* external address delay */
  319. LCRR_EADC |
  320. #endif
  321. #ifdef CONFIG_SYS_LCRR_CLKDIV /* system clock divider */
  322. LCRR_CLKDIV |
  323. #endif
  324. 0;
  325. __be32 lcrr_val =
  326. #ifdef CONFIG_SYS_LCRR_DBYP /* PLL bypass */
  327. CONFIG_SYS_LCRR_DBYP |
  328. #endif
  329. #ifdef CONFIG_SYS_LCRR_EADC
  330. CONFIG_SYS_LCRR_EADC |
  331. #endif
  332. #ifdef CONFIG_SYS_LCRR_CLKDIV /* system clock divider */
  333. CONFIG_SYS_LCRR_CLKDIV |
  334. #endif
  335. 0;
  336. /* LCRR - Clock Ratio Register (10.3.1.16)
  337. * write, read, and isync per MPC8379ERM rev.1 CLKDEV field description
  338. */
  339. clrsetbits_be32(&im->lbus.lcrr, lcrr_mask, lcrr_val);
  340. __raw_readl(&im->lbus.lcrr);
  341. isync();
  342. #ifdef CONFIG_QE
  343. qe_init(qe_base);
  344. qe_reset();
  345. #endif
  346. return 0;
  347. }
  348. /*
  349. * Print out the bus arbiter event
  350. */
  351. #if defined(CONFIG_DISPLAY_AER_FULL)
  352. static int print_83xx_arb_event(int force)
  353. {
  354. static char* event[] = {
  355. "Address Time Out",
  356. "Data Time Out",
  357. "Address Only Transfer Type",
  358. "External Control Word Transfer Type",
  359. "Reserved Transfer Type",
  360. "Transfer Error",
  361. "reserved",
  362. "reserved"
  363. };
  364. static char* master[] = {
  365. "e300 Core Data Transaction",
  366. "reserved",
  367. "e300 Core Instruction Fetch",
  368. "reserved",
  369. "TSEC1",
  370. "TSEC2",
  371. "USB MPH",
  372. "USB DR",
  373. "Encryption Core",
  374. "I2C Boot Sequencer",
  375. "JTAG",
  376. "reserved",
  377. "eSDHC",
  378. "PCI1",
  379. "PCI2",
  380. "DMA",
  381. "QUICC Engine 00",
  382. "QUICC Engine 01",
  383. "QUICC Engine 10",
  384. "QUICC Engine 11",
  385. "reserved",
  386. "reserved",
  387. "reserved",
  388. "reserved",
  389. "SATA1",
  390. "SATA2",
  391. "SATA3",
  392. "SATA4",
  393. "reserved",
  394. "PCI Express 1",
  395. "PCI Express 2",
  396. "TDM-DMAC"
  397. };
  398. static char *transfer[] = {
  399. "Address-only, Clean Block",
  400. "Address-only, lwarx reservation set",
  401. "Single-beat or Burst write",
  402. "reserved",
  403. "Address-only, Flush Block",
  404. "reserved",
  405. "Burst write",
  406. "reserved",
  407. "Address-only, sync",
  408. "Address-only, tlbsync",
  409. "Single-beat or Burst read",
  410. "Single-beat or Burst read",
  411. "Address-only, Kill Block",
  412. "Address-only, icbi",
  413. "Burst read",
  414. "reserved",
  415. "Address-only, eieio",
  416. "reserved",
  417. "Single-beat write",
  418. "reserved",
  419. "ecowx - Illegal single-beat write",
  420. "reserved",
  421. "reserved",
  422. "reserved",
  423. "Address-only, TLB Invalidate",
  424. "reserved",
  425. "Single-beat or Burst read",
  426. "reserved",
  427. "eciwx - Illegal single-beat read",
  428. "reserved",
  429. "Burst read",
  430. "reserved"
  431. };
  432. int etype = (gd->arbiter_event_attributes & AEATR_EVENT)
  433. >> AEATR_EVENT_SHIFT;
  434. int mstr_id = (gd->arbiter_event_attributes & AEATR_MSTR_ID)
  435. >> AEATR_MSTR_ID_SHIFT;
  436. int tbst = (gd->arbiter_event_attributes & AEATR_TBST)
  437. >> AEATR_TBST_SHIFT;
  438. int tsize = (gd->arbiter_event_attributes & AEATR_TSIZE)
  439. >> AEATR_TSIZE_SHIFT;
  440. int ttype = (gd->arbiter_event_attributes & AEATR_TTYPE)
  441. >> AEATR_TTYPE_SHIFT;
  442. if (!force && !gd->arbiter_event_address)
  443. return 0;
  444. puts("Arbiter Event Status:\n");
  445. printf(" Event Address: 0x%08lX\n", gd->arbiter_event_address);
  446. printf(" Event Type: 0x%1x = %s\n", etype, event[etype]);
  447. printf(" Master ID: 0x%02x = %s\n", mstr_id, master[mstr_id]);
  448. printf(" Transfer Size: 0x%1x = %d bytes\n", (tbst<<3) | tsize,
  449. tbst ? (tsize ? tsize : 8) : 16 + 8 * tsize);
  450. printf(" Transfer Type: 0x%02x = %s\n", ttype, transfer[ttype]);
  451. return gd->arbiter_event_address;
  452. }
  453. #elif defined(CONFIG_DISPLAY_AER_BRIEF)
  454. static int print_83xx_arb_event(int force)
  455. {
  456. if (!force && !gd->arbiter_event_address)
  457. return 0;
  458. printf("Arbiter Event Status: AEATR=0x%08lX, AEADR=0x%08lX\n",
  459. gd->arbiter_event_attributes, gd->arbiter_event_address);
  460. return gd->arbiter_event_address;
  461. }
  462. #endif /* CONFIG_DISPLAY_AER_xxxx */
  463. /*
  464. * Figure out the cause of the reset
  465. */
  466. int prt_83xx_rsr(void)
  467. {
  468. static struct {
  469. ulong mask;
  470. char *desc;
  471. } bits[] = {
  472. {
  473. RSR_SWSR, "Software Soft"}, {
  474. RSR_SWHR, "Software Hard"}, {
  475. RSR_JSRS, "JTAG Soft"}, {
  476. RSR_CSHR, "Check Stop"}, {
  477. RSR_SWRS, "Software Watchdog"}, {
  478. RSR_BMRS, "Bus Monitor"}, {
  479. RSR_SRS, "External/Internal Soft"}, {
  480. RSR_HRS, "External/Internal Hard"}
  481. };
  482. static int n = sizeof bits / sizeof bits[0];
  483. ulong rsr = gd->reset_status;
  484. int i;
  485. char *sep;
  486. puts("Reset Status:");
  487. sep = " ";
  488. for (i = 0; i < n; i++)
  489. if (rsr & bits[i].mask) {
  490. printf("%s%s", sep, bits[i].desc);
  491. sep = ", ";
  492. }
  493. puts("\n");
  494. #if defined(CONFIG_DISPLAY_AER_FULL) || defined(CONFIG_DISPLAY_AER_BRIEF)
  495. print_83xx_arb_event(rsr & RSR_BMRS);
  496. #endif
  497. puts("\n");
  498. return 0;
  499. }