blob: f5cb000de6bfff53a512168fd7601b507327c728 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Eran Liberty9095d4a2005-07-28 10:08:46 -05002/*
Vivek Mahajan288f7fb2009-05-25 17:23:16 +05303 * Copyright (C) 2004-2009 Freescale Semiconductor, Inc.
Eran Liberty9095d4a2005-07-28 10:08:46 -05004 */
5
6#include <common.h>
Simon Glass40d9b242020-05-10 11:40:07 -06007#include <asm-offsets.h>
Eran Liberty9095d4a2005-07-28 10:08:46 -05008#include <mpc83xx.h>
Tom Rini4ddbade2022-05-25 12:16:03 -04009#include <system-constants.h>
Eran Liberty9095d4a2005-07-28 10:08:46 -050010#include <ioports.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060011#include <asm/global_data.h>
Vivek Mahajan288f7fb2009-05-25 17:23:16 +053012#include <asm/io.h>
Simon Glass156283f2017-03-28 10:27:27 -060013#include <asm/processor.h>
Heiko Schocher3b767732020-04-15 10:35:40 +020014#include <fsl_qe.h>
Kim Phillips328040a2009-09-25 18:19:44 -050015#ifdef CONFIG_USB_EHCI_FSL
Mateusz Kulikowski3add69e2016-03-31 23:12:23 +020016#include <usb/ehci-ci.h>
Vivek Mahajan288f7fb2009-05-25 17:23:16 +053017#endif
Simon Glassdbd79542020-05-10 11:40:11 -060018#include <linux/delay.h>
Heiko Schocher3b07a132020-02-03 10:23:53 +010019#ifdef CONFIG_QE
20#include <fsl_qe.h>
21#endif
Eran Liberty9095d4a2005-07-28 10:08:46 -050022
Mario Sixb47839c2019-01-21 09:17:58 +010023#include "lblaw/lblaw.h"
Mario Six1faf95d2019-01-21 09:18:03 +010024#include "elbc/elbc.h"
Mario Six636c1082019-01-21 09:18:11 +010025#include "sysio/sysio.h"
Mario Sixaa502542019-01-21 09:18:12 +010026#include "arbiter/arbiter.h"
Mario Sixf62074e2019-01-21 09:18:13 +010027#include "initreg/initreg.h"
Mario Sixb47839c2019-01-21 09:17:58 +010028
Wolfgang Denk6405a152006-03-31 18:32:53 +020029DECLARE_GLOBAL_DATA_PTR;
30
Dave Liue732e9c2006-11-03 12:11:15 -060031#ifdef CONFIG_QE
32extern qe_iop_conf_t qe_iop_conf_tab[];
33extern void qe_config_iopin(u8 port, u8 pin, int dir,
34 int open_drain, int assign);
Dave Liue732e9c2006-11-03 12:11:15 -060035
Heiko Schocher3b07a132020-02-03 10:23:53 +010036#if !defined(CONFIG_PINCTRL)
Dave Liue732e9c2006-11-03 12:11:15 -060037static void config_qe_ioports(void)
38{
39 u8 port, pin;
40 int dir, open_drain, assign;
41 int i;
42
43 for (i = 0; qe_iop_conf_tab[i].assign != QE_IOP_TAB_END; i++) {
44 port = qe_iop_conf_tab[i].port;
45 pin = qe_iop_conf_tab[i].pin;
46 dir = qe_iop_conf_tab[i].dir;
47 open_drain = qe_iop_conf_tab[i].open_drain;
48 assign = qe_iop_conf_tab[i].assign;
49 qe_config_iopin(port, pin, dir, open_drain, assign);
50 }
51}
52#endif
Heiko Schocher3b07a132020-02-03 10:23:53 +010053#endif
Dave Liue732e9c2006-11-03 12:11:15 -060054
Eran Liberty9095d4a2005-07-28 10:08:46 -050055/*
56 * Breathe some life into the CPU...
57 *
58 * Set up the memory map,
59 * initialize a bunch of registers,
60 * initialize the UPM's
61 */
62void cpu_init_f (volatile immap_t * im)
63{
Kim Phillips328040a2009-09-25 18:19:44 -050064 __be32 sccr_mask =
65#ifdef CONFIG_SYS_SCCR_ENCCM /* Encryption clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050066 SCCR_ENCCM |
Kim Phillips19a91de2008-01-16 12:06:16 -060067#endif
Kim Phillips328040a2009-09-25 18:19:44 -050068#ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050069 SCCR_PCICM |
Kim Phillips19a91de2008-01-16 12:06:16 -060070#endif
Ilya Yanoka4f3ed32010-09-17 23:41:47 +020071#ifdef CONFIG_SYS_SCCR_PCIEXP1CM /* PCIE1 clock mode */
72 SCCR_PCIEXP1CM |
73#endif
74#ifdef CONFIG_SYS_SCCR_PCIEXP2CM /* PCIE2 clock mode */
75 SCCR_PCIEXP2CM |
76#endif
Kim Phillips328040a2009-09-25 18:19:44 -050077#ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050078 SCCR_TSECCM |
Timur Tabi054838e2006-10-31 18:44:42 -060079#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050080#ifdef CFG_SYS_SCCR_TSEC1CM /* TSEC1 clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050081 SCCR_TSEC1CM |
Timur Tabi054838e2006-10-31 18:44:42 -060082#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050083#ifdef CFG_SYS_SCCR_TSEC2CM /* TSEC2 clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050084 SCCR_TSEC2CM |
Kumar Gala15c3f692007-02-27 23:51:42 -060085#endif
Kim Phillips328040a2009-09-25 18:19:44 -050086#ifdef CONFIG_SYS_SCCR_TSEC1ON /* TSEC1 clock switch */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050087 SCCR_TSEC1ON |
Timur Tabi0b2deff2007-07-03 13:04:34 -050088#endif
Kim Phillips328040a2009-09-25 18:19:44 -050089#ifdef CONFIG_SYS_SCCR_TSEC2ON /* TSEC2 clock switch */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050090 SCCR_TSEC2ON |
Timur Tabi0b2deff2007-07-03 13:04:34 -050091#endif
Kim Phillips328040a2009-09-25 18:19:44 -050092#ifdef CONFIG_SYS_SCCR_USBMPHCM /* USB MPH clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050093 SCCR_USBMPHCM |
Kumar Gala15c3f692007-02-27 23:51:42 -060094#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050095#ifdef CFG_SYS_SCCR_USBDRCM /* USB DR clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050096 SCCR_USBDRCM |
Kumar Gala15c3f692007-02-27 23:51:42 -060097#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050098#ifdef CFG_SYS_SCCR_SATACM /* SATA controller clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050099 SCCR_SATACM |
Timur Tabi054838e2006-10-31 18:44:42 -0600100#endif
Kim Phillips328040a2009-09-25 18:19:44 -0500101 0;
102 __be32 sccr_val =
103#ifdef CONFIG_SYS_SCCR_ENCCM /* Encryption clock mode */
104 (CONFIG_SYS_SCCR_ENCCM << SCCR_ENCCM_SHIFT) |
105#endif
106#ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
107 (CONFIG_SYS_SCCR_PCICM << SCCR_PCICM_SHIFT) |
108#endif
Ilya Yanoka4f3ed32010-09-17 23:41:47 +0200109#ifdef CONFIG_SYS_SCCR_PCIEXP1CM /* PCIE1 clock mode */
110 (CONFIG_SYS_SCCR_PCIEXP1CM << SCCR_PCIEXP1CM_SHIFT) |
111#endif
112#ifdef CONFIG_SYS_SCCR_PCIEXP2CM /* PCIE2 clock mode */
113 (CONFIG_SYS_SCCR_PCIEXP2CM << SCCR_PCIEXP2CM_SHIFT) |
114#endif
Kim Phillips328040a2009-09-25 18:19:44 -0500115#ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
116 (CONFIG_SYS_SCCR_TSECCM << SCCR_TSECCM_SHIFT) |
117#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500118#ifdef CFG_SYS_SCCR_TSEC1CM /* TSEC1 clock mode */
119 (CFG_SYS_SCCR_TSEC1CM << SCCR_TSEC1CM_SHIFT) |
Kim Phillips328040a2009-09-25 18:19:44 -0500120#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500121#ifdef CFG_SYS_SCCR_TSEC2CM /* TSEC2 clock mode */
122 (CFG_SYS_SCCR_TSEC2CM << SCCR_TSEC2CM_SHIFT) |
Kim Phillips328040a2009-09-25 18:19:44 -0500123#endif
124#ifdef CONFIG_SYS_SCCR_TSEC1ON /* TSEC1 clock switch */
125 (CONFIG_SYS_SCCR_TSEC1ON << SCCR_TSEC1ON_SHIFT) |
126#endif
127#ifdef CONFIG_SYS_SCCR_TSEC2ON /* TSEC2 clock switch */
128 (CONFIG_SYS_SCCR_TSEC2ON << SCCR_TSEC2ON_SHIFT) |
129#endif
130#ifdef CONFIG_SYS_SCCR_USBMPHCM /* USB MPH clock mode */
131 (CONFIG_SYS_SCCR_USBMPHCM << SCCR_USBMPHCM_SHIFT) |
132#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500133#ifdef CFG_SYS_SCCR_USBDRCM /* USB DR clock mode */
134 (CFG_SYS_SCCR_USBDRCM << SCCR_USBDRCM_SHIFT) |
Kim Phillips328040a2009-09-25 18:19:44 -0500135#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500136#ifdef CFG_SYS_SCCR_SATACM /* SATA controller clock mode */
137 (CFG_SYS_SCCR_SATACM << SCCR_SATACM_SHIFT) |
Kim Phillips328040a2009-09-25 18:19:44 -0500138#endif
139 0;
140
141 /* Pointer is writable since we allocated a register for it */
Tom Rini4ddbade2022-05-25 12:16:03 -0400142 gd = (gd_t *)SYS_INIT_SP_ADDR;
Kim Phillips328040a2009-09-25 18:19:44 -0500143
mario.six@gdsys.cc85df7b42017-01-17 08:33:48 +0100144 /* global data region was cleared in start.S */
Kim Phillips328040a2009-09-25 18:19:44 -0500145
146 /* system performance tweaking */
147 clrsetbits_be32(&im->arbiter.acr, acr_mask, acr_val);
148
149 clrsetbits_be32(&im->sysconf.spcr, spcr_mask, spcr_val);
150
151 clrsetbits_be32(&im->clk.sccr, sccr_mask, sccr_val);
Timur Tabi054838e2006-10-31 18:44:42 -0600152
Eran Liberty9095d4a2005-07-28 10:08:46 -0500153 /* RSR - Reset Status Register - clear all status (4.6.1.3) */
Simon Glass4d6eaa32012-12-13 20:48:56 +0000154 gd->arch.reset_status = __raw_readl(&im->reset.rsr);
Kim Phillips328040a2009-09-25 18:19:44 -0500155 __raw_writel(~(RSR_RES), &im->reset.rsr);
Eran Liberty9095d4a2005-07-28 10:08:46 -0500156
Nick Spence56fd3c22008-08-28 14:09:19 -0700157 /* AER - Arbiter Event Register - store status */
Simon Glass387a1f22012-12-13 20:48:57 +0000158 gd->arch.arbiter_event_attributes = __raw_readl(&im->arbiter.aeatr);
159 gd->arch.arbiter_event_address = __raw_readl(&im->arbiter.aeadr);
Nick Spence56fd3c22008-08-28 14:09:19 -0700160
Eran Liberty9095d4a2005-07-28 10:08:46 -0500161 /*
162 * RMR - Reset Mode Register
163 * contains checkstop reset enable (4.6.1.4)
164 */
Kim Phillips328040a2009-09-25 18:19:44 -0500165 __raw_writel(RMR_CSRE & (1<<RMR_CSRE_SHIFT), &im->reset.rmr);
Eran Liberty9095d4a2005-07-28 10:08:46 -0500166
Peter Korsgaard2a483ee2009-12-08 22:20:34 +0100167 /* LCRR - Clock Ratio Register (10.3.1.16)
168 * write, read, and isync per MPC8379ERM rev.1 CLKDEV field description
169 */
Becky Bruce0d4cee12010-06-17 11:37:20 -0500170 clrsetbits_be32(&im->im_lbc.lcrr, lcrr_mask, lcrr_val);
171 __raw_readl(&im->im_lbc.lcrr);
Peter Korsgaard2a483ee2009-12-08 22:20:34 +0100172 isync();
173
Kim Phillips328040a2009-09-25 18:19:44 -0500174 /* Enable Time Base & Decrementer ( so we will have udelay() )*/
175 setbits_be32(&im->sysconf.spcr, SPCR_TBEN);
Eran Liberty9095d4a2005-07-28 10:08:46 -0500176
177 /* System General Purpose Register */
Tom Rini6a5dccc2022-11-16 13:10:41 -0500178#ifdef CFG_SYS_SICRH
Mario Six0344f5e2019-01-21 09:17:27 +0100179#if defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC8313)
Andre Schwarzcea66482008-06-23 11:40:56 +0200180 /* regarding to MPC34x manual rev.1 bits 28..29 must be preserved */
Tom Rini6a5dccc2022-11-16 13:10:41 -0500181 __raw_writel((im->sysconf.sicrh & 0x0000000C) | CFG_SYS_SICRH,
Kim Phillips328040a2009-09-25 18:19:44 -0500182 &im->sysconf.sicrh);
Andre Schwarzcea66482008-06-23 11:40:56 +0200183#else
Tom Rini6a5dccc2022-11-16 13:10:41 -0500184 __raw_writel(CFG_SYS_SICRH, &im->sysconf.sicrh);
Kumar Galae5221432006-01-11 11:12:57 -0600185#endif
Andre Schwarzcea66482008-06-23 11:40:56 +0200186#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500187#ifdef CFG_SYS_SICRL
188 __raw_writel(CFG_SYS_SICRL, &im->sysconf.sicrl);
Kumar Galae5221432006-01-11 11:12:57 -0600189#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500190#ifdef CFG_SYS_GPR1
191 __raw_writel(CFG_SYS_GPR1, &im->sysconf.gpr1);
Gerlando Falautofe201cb2012-10-10 22:13:08 +0000192#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500193#ifdef CFG_SYS_DDRCDR /* DDR control driver register */
194 __raw_writel(CFG_SYS_DDRCDR, &im->sysconf.ddrcdr);
Dave Liue740c462006-12-07 21:13:15 +0800195#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500196#ifdef CFG_SYS_OBIR /* Output buffer impedance register */
197 __raw_writel(CFG_SYS_OBIR, &im->sysconf.obir);
Dave Liub19ecd32007-09-18 12:37:57 +0800198#endif
Dave Liue740c462006-12-07 21:13:15 +0800199
Heiko Schocher3b07a132020-02-03 10:23:53 +0100200#if !defined(CONFIG_PINCTRL)
Dave Liue732e9c2006-11-03 12:11:15 -0600201#ifdef CONFIG_QE
202 /* Config QE ioports */
203 config_qe_ioports();
204#endif
Heiko Schocher3b07a132020-02-03 10:23:53 +0100205#endif
206
Becky Bruce0d4cee12010-06-17 11:37:20 -0500207 /* Set up preliminary BR/OR regs */
208 init_early_memctl_regs();
Eran Liberty9095d4a2005-07-28 10:08:46 -0500209
Becky Bruce0d4cee12010-06-17 11:37:20 -0500210 /* Local Access window setup */
Tom Rini364d0022023-01-10 11:19:45 -0500211#if defined(CFG_SYS_LBLAWBAR0_PRELIM) && defined(CFG_SYS_LBLAWAR0_PRELIM)
212 im->sysconf.lblaw[0].bar = CFG_SYS_LBLAWBAR0_PRELIM;
213 im->sysconf.lblaw[0].ar = CFG_SYS_LBLAWAR0_PRELIM;
Eran Liberty9095d4a2005-07-28 10:08:46 -0500214#else
Tom Rini364d0022023-01-10 11:19:45 -0500215#error CFG_SYS_LBLAWBAR0_PRELIM & CFG_SYS_LBLAWAR0_PRELIM must be defined
Eran Liberty9095d4a2005-07-28 10:08:46 -0500216#endif
217
Tom Rini364d0022023-01-10 11:19:45 -0500218#if defined(CFG_SYS_LBLAWBAR1_PRELIM) && defined(CFG_SYS_LBLAWAR1_PRELIM)
219 im->sysconf.lblaw[1].bar = CFG_SYS_LBLAWBAR1_PRELIM;
220 im->sysconf.lblaw[1].ar = CFG_SYS_LBLAWAR1_PRELIM;
Eran Liberty9095d4a2005-07-28 10:08:46 -0500221#endif
Tom Rini364d0022023-01-10 11:19:45 -0500222#if defined(CFG_SYS_LBLAWBAR2_PRELIM) && defined(CFG_SYS_LBLAWAR2_PRELIM)
223 im->sysconf.lblaw[2].bar = CFG_SYS_LBLAWBAR2_PRELIM;
224 im->sysconf.lblaw[2].ar = CFG_SYS_LBLAWAR2_PRELIM;
Eran Liberty9095d4a2005-07-28 10:08:46 -0500225#endif
Tom Rini364d0022023-01-10 11:19:45 -0500226#if defined(CFG_SYS_LBLAWBAR3_PRELIM) && defined(CFG_SYS_LBLAWAR3_PRELIM)
227 im->sysconf.lblaw[3].bar = CFG_SYS_LBLAWBAR3_PRELIM;
228 im->sysconf.lblaw[3].ar = CFG_SYS_LBLAWAR3_PRELIM;
Eran Liberty9095d4a2005-07-28 10:08:46 -0500229#endif
Eran Liberty9095d4a2005-07-28 10:08:46 -0500230}
231
Eran Liberty9095d4a2005-07-28 10:08:46 -0500232int cpu_init_r (void)
233{
Dave Liue732e9c2006-11-03 12:11:15 -0600234#ifdef CONFIG_QE
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200235 uint qe_base = CONFIG_SYS_IMMR + 0x00100000; /* QE immr base */
Kim Phillips328040a2009-09-25 18:19:44 -0500236
Dave Liue732e9c2006-11-03 12:11:15 -0600237 qe_init(qe_base);
238 qe_reset();
239#endif
Eran Liberty9095d4a2005-07-28 10:08:46 -0500240 return 0;
241}
Dave Liuebd35f82007-06-25 10:41:56 +0800242
Nick Spence56fd3c22008-08-28 14:09:19 -0700243/*
244 * Print out the bus arbiter event
245 */
246#if defined(CONFIG_DISPLAY_AER_FULL)
247static int print_83xx_arb_event(int force)
248{
249 static char* event[] = {
250 "Address Time Out",
251 "Data Time Out",
252 "Address Only Transfer Type",
253 "External Control Word Transfer Type",
254 "Reserved Transfer Type",
255 "Transfer Error",
256 "reserved",
257 "reserved"
258 };
259 static char* master[] = {
260 "e300 Core Data Transaction",
261 "reserved",
262 "e300 Core Instruction Fetch",
263 "reserved",
264 "TSEC1",
265 "TSEC2",
266 "USB MPH",
267 "USB DR",
268 "Encryption Core",
269 "I2C Boot Sequencer",
270 "JTAG",
271 "reserved",
272 "eSDHC",
273 "PCI1",
274 "PCI2",
275 "DMA",
276 "QUICC Engine 00",
277 "QUICC Engine 01",
278 "QUICC Engine 10",
279 "QUICC Engine 11",
280 "reserved",
281 "reserved",
282 "reserved",
283 "reserved",
284 "SATA1",
285 "SATA2",
286 "SATA3",
287 "SATA4",
288 "reserved",
289 "PCI Express 1",
290 "PCI Express 2",
291 "TDM-DMAC"
292 };
293 static char *transfer[] = {
294 "Address-only, Clean Block",
295 "Address-only, lwarx reservation set",
296 "Single-beat or Burst write",
297 "reserved",
298 "Address-only, Flush Block",
299 "reserved",
300 "Burst write",
301 "reserved",
302 "Address-only, sync",
303 "Address-only, tlbsync",
304 "Single-beat or Burst read",
305 "Single-beat or Burst read",
306 "Address-only, Kill Block",
307 "Address-only, icbi",
308 "Burst read",
309 "reserved",
310 "Address-only, eieio",
311 "reserved",
312 "Single-beat write",
313 "reserved",
314 "ecowx - Illegal single-beat write",
315 "reserved",
316 "reserved",
317 "reserved",
318 "Address-only, TLB Invalidate",
319 "reserved",
320 "Single-beat or Burst read",
321 "reserved",
322 "eciwx - Illegal single-beat read",
323 "reserved",
324 "Burst read",
325 "reserved"
326 };
327
Simon Glass387a1f22012-12-13 20:48:57 +0000328 int etype = (gd->arch.arbiter_event_attributes & AEATR_EVENT)
Wolfgang Denkec7fbf52013-10-04 17:43:24 +0200329 >> AEATR_EVENT_SHIFT;
Simon Glass387a1f22012-12-13 20:48:57 +0000330 int mstr_id = (gd->arch.arbiter_event_attributes & AEATR_MSTR_ID)
Wolfgang Denkec7fbf52013-10-04 17:43:24 +0200331 >> AEATR_MSTR_ID_SHIFT;
Simon Glass387a1f22012-12-13 20:48:57 +0000332 int tbst = (gd->arch.arbiter_event_attributes & AEATR_TBST)
Wolfgang Denkec7fbf52013-10-04 17:43:24 +0200333 >> AEATR_TBST_SHIFT;
Simon Glass387a1f22012-12-13 20:48:57 +0000334 int tsize = (gd->arch.arbiter_event_attributes & AEATR_TSIZE)
Wolfgang Denkec7fbf52013-10-04 17:43:24 +0200335 >> AEATR_TSIZE_SHIFT;
Simon Glass387a1f22012-12-13 20:48:57 +0000336 int ttype = (gd->arch.arbiter_event_attributes & AEATR_TTYPE)
Wolfgang Denkec7fbf52013-10-04 17:43:24 +0200337 >> AEATR_TTYPE_SHIFT;
Nick Spence56fd3c22008-08-28 14:09:19 -0700338
Simon Glass387a1f22012-12-13 20:48:57 +0000339 if (!force && !gd->arch.arbiter_event_address)
Nick Spence56fd3c22008-08-28 14:09:19 -0700340 return 0;
341
342 puts("Arbiter Event Status:\n");
Simon Glass387a1f22012-12-13 20:48:57 +0000343 printf(" Event Address: 0x%08lX\n",
344 gd->arch.arbiter_event_address);
Nick Spence56fd3c22008-08-28 14:09:19 -0700345 printf(" Event Type: 0x%1x = %s\n", etype, event[etype]);
346 printf(" Master ID: 0x%02x = %s\n", mstr_id, master[mstr_id]);
347 printf(" Transfer Size: 0x%1x = %d bytes\n", (tbst<<3) | tsize,
348 tbst ? (tsize ? tsize : 8) : 16 + 8 * tsize);
349 printf(" Transfer Type: 0x%02x = %s\n", ttype, transfer[ttype]);
350
Simon Glass387a1f22012-12-13 20:48:57 +0000351 return gd->arch.arbiter_event_address;
Nick Spence56fd3c22008-08-28 14:09:19 -0700352}
353
354#elif defined(CONFIG_DISPLAY_AER_BRIEF)
355
356static int print_83xx_arb_event(int force)
357{
Simon Glass387a1f22012-12-13 20:48:57 +0000358 if (!force && !gd->arch.arbiter_event_address)
Nick Spence56fd3c22008-08-28 14:09:19 -0700359 return 0;
360
361 printf("Arbiter Event Status: AEATR=0x%08lX, AEADR=0x%08lX\n",
Simon Glass387a1f22012-12-13 20:48:57 +0000362 gd->arch.arbiter_event_attributes,
363 gd->arch.arbiter_event_address);
Nick Spence56fd3c22008-08-28 14:09:19 -0700364
Simon Glass387a1f22012-12-13 20:48:57 +0000365 return gd->arch.arbiter_event_address;
Nick Spence56fd3c22008-08-28 14:09:19 -0700366}
367#endif /* CONFIG_DISPLAY_AER_xxxx */
368
Mario Six28fbefa2018-08-06 10:23:45 +0200369#ifndef CONFIG_CPU_MPC83XX
Dave Liuebd35f82007-06-25 10:41:56 +0800370/*
371 * Figure out the cause of the reset
372 */
373int prt_83xx_rsr(void)
374{
375 static struct {
376 ulong mask;
377 char *desc;
378 } bits[] = {
379 {
380 RSR_SWSR, "Software Soft"}, {
381 RSR_SWHR, "Software Hard"}, {
382 RSR_JSRS, "JTAG Soft"}, {
383 RSR_CSHR, "Check Stop"}, {
384 RSR_SWRS, "Software Watchdog"}, {
385 RSR_BMRS, "Bus Monitor"}, {
386 RSR_SRS, "External/Internal Soft"}, {
387 RSR_HRS, "External/Internal Hard"}
388 };
Robert P. J. Day0c911592016-05-23 06:49:21 -0400389 static int n = ARRAY_SIZE(bits);
Simon Glass4d6eaa32012-12-13 20:48:56 +0000390 ulong rsr = gd->arch.reset_status;
Dave Liuebd35f82007-06-25 10:41:56 +0800391 int i;
392 char *sep;
393
394 puts("Reset Status:");
395
396 sep = " ";
397 for (i = 0; i < n; i++)
398 if (rsr & bits[i].mask) {
399 printf("%s%s", sep, bits[i].desc);
400 sep = ", ";
401 }
Nick Spence56fd3c22008-08-28 14:09:19 -0700402 puts("\n");
403
404#if defined(CONFIG_DISPLAY_AER_FULL) || defined(CONFIG_DISPLAY_AER_BRIEF)
405 print_83xx_arb_event(rsr & RSR_BMRS);
406#endif
407 puts("\n");
408
Dave Liuebd35f82007-06-25 10:41:56 +0800409 return 0;
410}
Mario Six28fbefa2018-08-06 10:23:45 +0200411#endif