blob: 8e6d3d28fc63b39044b47d58c10d531700394f95 [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
Simon Glass40d9b242020-05-10 11:40:07 -06006#include <asm-offsets.h>
Eran Liberty9095d4a2005-07-28 10:08:46 -05007#include <mpc83xx.h>
Tom Rini4ddbade2022-05-25 12:16:03 -04008#include <system-constants.h>
Eran Liberty9095d4a2005-07-28 10:08:46 -05009#include <ioports.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060010#include <asm/global_data.h>
Vivek Mahajan288f7fb2009-05-25 17:23:16 +053011#include <asm/io.h>
Simon Glass156283f2017-03-28 10:27:27 -060012#include <asm/processor.h>
Heiko Schocher3b767732020-04-15 10:35:40 +020013#include <fsl_qe.h>
Kim Phillips328040a2009-09-25 18:19:44 -050014#ifdef CONFIG_USB_EHCI_FSL
Mateusz Kulikowski3add69e2016-03-31 23:12:23 +020015#include <usb/ehci-ci.h>
Vivek Mahajan288f7fb2009-05-25 17:23:16 +053016#endif
Simon Glassdbd79542020-05-10 11:40:11 -060017#include <linux/delay.h>
Heiko Schocher3b07a132020-02-03 10:23:53 +010018#ifdef CONFIG_QE
19#include <fsl_qe.h>
20#endif
Eran Liberty9095d4a2005-07-28 10:08:46 -050021
Mario Sixb47839c2019-01-21 09:17:58 +010022#include "lblaw/lblaw.h"
Mario Six1faf95d2019-01-21 09:18:03 +010023#include "elbc/elbc.h"
Mario Six636c1082019-01-21 09:18:11 +010024#include "sysio/sysio.h"
Mario Sixaa502542019-01-21 09:18:12 +010025#include "arbiter/arbiter.h"
Mario Sixf62074e2019-01-21 09:18:13 +010026#include "initreg/initreg.h"
Mario Sixb47839c2019-01-21 09:17:58 +010027
Wolfgang Denk6405a152006-03-31 18:32:53 +020028DECLARE_GLOBAL_DATA_PTR;
29
Dave Liue732e9c2006-11-03 12:11:15 -060030#ifdef CONFIG_QE
31extern qe_iop_conf_t qe_iop_conf_tab[];
32extern void qe_config_iopin(u8 port, u8 pin, int dir,
33 int open_drain, int assign);
Dave Liue732e9c2006-11-03 12:11:15 -060034
Heiko Schocher3b07a132020-02-03 10:23:53 +010035#if !defined(CONFIG_PINCTRL)
Dave Liue732e9c2006-11-03 12:11:15 -060036static void config_qe_ioports(void)
37{
38 u8 port, pin;
39 int dir, open_drain, assign;
40 int i;
41
42 for (i = 0; qe_iop_conf_tab[i].assign != QE_IOP_TAB_END; i++) {
43 port = qe_iop_conf_tab[i].port;
44 pin = qe_iop_conf_tab[i].pin;
45 dir = qe_iop_conf_tab[i].dir;
46 open_drain = qe_iop_conf_tab[i].open_drain;
47 assign = qe_iop_conf_tab[i].assign;
48 qe_config_iopin(port, pin, dir, open_drain, assign);
49 }
50}
51#endif
Heiko Schocher3b07a132020-02-03 10:23:53 +010052#endif
Dave Liue732e9c2006-11-03 12:11:15 -060053
Eran Liberty9095d4a2005-07-28 10:08:46 -050054/*
55 * Breathe some life into the CPU...
56 *
57 * Set up the memory map,
58 * initialize a bunch of registers,
59 * initialize the UPM's
60 */
61void cpu_init_f (volatile immap_t * im)
62{
Kim Phillips328040a2009-09-25 18:19:44 -050063 __be32 sccr_mask =
64#ifdef CONFIG_SYS_SCCR_ENCCM /* Encryption clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050065 SCCR_ENCCM |
Kim Phillips19a91de2008-01-16 12:06:16 -060066#endif
Kim Phillips328040a2009-09-25 18:19:44 -050067#ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050068 SCCR_PCICM |
Kim Phillips19a91de2008-01-16 12:06:16 -060069#endif
Ilya Yanoka4f3ed32010-09-17 23:41:47 +020070#ifdef CONFIG_SYS_SCCR_PCIEXP1CM /* PCIE1 clock mode */
71 SCCR_PCIEXP1CM |
72#endif
73#ifdef CONFIG_SYS_SCCR_PCIEXP2CM /* PCIE2 clock mode */
74 SCCR_PCIEXP2CM |
75#endif
Kim Phillips328040a2009-09-25 18:19:44 -050076#ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050077 SCCR_TSECCM |
Timur Tabi054838e2006-10-31 18:44:42 -060078#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050079#ifdef CFG_SYS_SCCR_TSEC1CM /* TSEC1 clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050080 SCCR_TSEC1CM |
Timur Tabi054838e2006-10-31 18:44:42 -060081#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050082#ifdef CFG_SYS_SCCR_TSEC2CM /* TSEC2 clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050083 SCCR_TSEC2CM |
Kumar Gala15c3f692007-02-27 23:51:42 -060084#endif
Kim Phillips328040a2009-09-25 18:19:44 -050085#ifdef CONFIG_SYS_SCCR_TSEC1ON /* TSEC1 clock switch */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050086 SCCR_TSEC1ON |
Timur Tabi0b2deff2007-07-03 13:04:34 -050087#endif
Kim Phillips328040a2009-09-25 18:19:44 -050088#ifdef CONFIG_SYS_SCCR_TSEC2ON /* TSEC2 clock switch */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050089 SCCR_TSEC2ON |
Timur Tabi0b2deff2007-07-03 13:04:34 -050090#endif
Kim Phillips328040a2009-09-25 18:19:44 -050091#ifdef CONFIG_SYS_SCCR_USBMPHCM /* USB MPH clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050092 SCCR_USBMPHCM |
Kumar Gala15c3f692007-02-27 23:51:42 -060093#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050094#ifdef CFG_SYS_SCCR_USBDRCM /* USB DR clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050095 SCCR_USBDRCM |
Kumar Gala15c3f692007-02-27 23:51:42 -060096#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -050097#ifdef CFG_SYS_SCCR_SATACM /* SATA controller clock mode */
Kim Phillips8d5fa6a2010-05-19 17:06:46 -050098 SCCR_SATACM |
Timur Tabi054838e2006-10-31 18:44:42 -060099#endif
Kim Phillips328040a2009-09-25 18:19:44 -0500100 0;
101 __be32 sccr_val =
102#ifdef CONFIG_SYS_SCCR_ENCCM /* Encryption clock mode */
103 (CONFIG_SYS_SCCR_ENCCM << SCCR_ENCCM_SHIFT) |
104#endif
105#ifdef CONFIG_SYS_SCCR_PCICM /* PCI & DMA clock mode */
106 (CONFIG_SYS_SCCR_PCICM << SCCR_PCICM_SHIFT) |
107#endif
Ilya Yanoka4f3ed32010-09-17 23:41:47 +0200108#ifdef CONFIG_SYS_SCCR_PCIEXP1CM /* PCIE1 clock mode */
109 (CONFIG_SYS_SCCR_PCIEXP1CM << SCCR_PCIEXP1CM_SHIFT) |
110#endif
111#ifdef CONFIG_SYS_SCCR_PCIEXP2CM /* PCIE2 clock mode */
112 (CONFIG_SYS_SCCR_PCIEXP2CM << SCCR_PCIEXP2CM_SHIFT) |
113#endif
Kim Phillips328040a2009-09-25 18:19:44 -0500114#ifdef CONFIG_SYS_SCCR_TSECCM /* all TSEC's clock mode */
115 (CONFIG_SYS_SCCR_TSECCM << SCCR_TSECCM_SHIFT) |
116#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500117#ifdef CFG_SYS_SCCR_TSEC1CM /* TSEC1 clock mode */
118 (CFG_SYS_SCCR_TSEC1CM << SCCR_TSEC1CM_SHIFT) |
Kim Phillips328040a2009-09-25 18:19:44 -0500119#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500120#ifdef CFG_SYS_SCCR_TSEC2CM /* TSEC2 clock mode */
121 (CFG_SYS_SCCR_TSEC2CM << SCCR_TSEC2CM_SHIFT) |
Kim Phillips328040a2009-09-25 18:19:44 -0500122#endif
123#ifdef CONFIG_SYS_SCCR_TSEC1ON /* TSEC1 clock switch */
124 (CONFIG_SYS_SCCR_TSEC1ON << SCCR_TSEC1ON_SHIFT) |
125#endif
126#ifdef CONFIG_SYS_SCCR_TSEC2ON /* TSEC2 clock switch */
127 (CONFIG_SYS_SCCR_TSEC2ON << SCCR_TSEC2ON_SHIFT) |
128#endif
129#ifdef CONFIG_SYS_SCCR_USBMPHCM /* USB MPH clock mode */
130 (CONFIG_SYS_SCCR_USBMPHCM << SCCR_USBMPHCM_SHIFT) |
131#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500132#ifdef CFG_SYS_SCCR_USBDRCM /* USB DR clock mode */
133 (CFG_SYS_SCCR_USBDRCM << SCCR_USBDRCM_SHIFT) |
Kim Phillips328040a2009-09-25 18:19:44 -0500134#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500135#ifdef CFG_SYS_SCCR_SATACM /* SATA controller clock mode */
136 (CFG_SYS_SCCR_SATACM << SCCR_SATACM_SHIFT) |
Kim Phillips328040a2009-09-25 18:19:44 -0500137#endif
138 0;
139
140 /* Pointer is writable since we allocated a register for it */
Tom Rini4ddbade2022-05-25 12:16:03 -0400141 gd = (gd_t *)SYS_INIT_SP_ADDR;
Kim Phillips328040a2009-09-25 18:19:44 -0500142
mario.six@gdsys.cc85df7b42017-01-17 08:33:48 +0100143 /* global data region was cleared in start.S */
Kim Phillips328040a2009-09-25 18:19:44 -0500144
145 /* system performance tweaking */
146 clrsetbits_be32(&im->arbiter.acr, acr_mask, acr_val);
147
148 clrsetbits_be32(&im->sysconf.spcr, spcr_mask, spcr_val);
149
150 clrsetbits_be32(&im->clk.sccr, sccr_mask, sccr_val);
Timur Tabi054838e2006-10-31 18:44:42 -0600151
Eran Liberty9095d4a2005-07-28 10:08:46 -0500152 /* RSR - Reset Status Register - clear all status (4.6.1.3) */
Simon Glass4d6eaa32012-12-13 20:48:56 +0000153 gd->arch.reset_status = __raw_readl(&im->reset.rsr);
Kim Phillips328040a2009-09-25 18:19:44 -0500154 __raw_writel(~(RSR_RES), &im->reset.rsr);
Eran Liberty9095d4a2005-07-28 10:08:46 -0500155
Nick Spence56fd3c22008-08-28 14:09:19 -0700156 /* AER - Arbiter Event Register - store status */
Simon Glass387a1f22012-12-13 20:48:57 +0000157 gd->arch.arbiter_event_attributes = __raw_readl(&im->arbiter.aeatr);
158 gd->arch.arbiter_event_address = __raw_readl(&im->arbiter.aeadr);
Nick Spence56fd3c22008-08-28 14:09:19 -0700159
Eran Liberty9095d4a2005-07-28 10:08:46 -0500160 /*
161 * RMR - Reset Mode Register
162 * contains checkstop reset enable (4.6.1.4)
163 */
Kim Phillips328040a2009-09-25 18:19:44 -0500164 __raw_writel(RMR_CSRE & (1<<RMR_CSRE_SHIFT), &im->reset.rmr);
Eran Liberty9095d4a2005-07-28 10:08:46 -0500165
Peter Korsgaard2a483ee2009-12-08 22:20:34 +0100166 /* LCRR - Clock Ratio Register (10.3.1.16)
167 * write, read, and isync per MPC8379ERM rev.1 CLKDEV field description
168 */
Becky Bruce0d4cee12010-06-17 11:37:20 -0500169 clrsetbits_be32(&im->im_lbc.lcrr, lcrr_mask, lcrr_val);
170 __raw_readl(&im->im_lbc.lcrr);
Peter Korsgaard2a483ee2009-12-08 22:20:34 +0100171 isync();
172
Kim Phillips328040a2009-09-25 18:19:44 -0500173 /* Enable Time Base & Decrementer ( so we will have udelay() )*/
174 setbits_be32(&im->sysconf.spcr, SPCR_TBEN);
Eran Liberty9095d4a2005-07-28 10:08:46 -0500175
176 /* System General Purpose Register */
Tom Rini6a5dccc2022-11-16 13:10:41 -0500177#ifdef CFG_SYS_SICRH
Mario Six0344f5e2019-01-21 09:17:27 +0100178#if defined(CONFIG_ARCH_MPC834X) || defined(CONFIG_ARCH_MPC8313)
Andre Schwarzcea66482008-06-23 11:40:56 +0200179 /* regarding to MPC34x manual rev.1 bits 28..29 must be preserved */
Tom Rini6a5dccc2022-11-16 13:10:41 -0500180 __raw_writel((im->sysconf.sicrh & 0x0000000C) | CFG_SYS_SICRH,
Kim Phillips328040a2009-09-25 18:19:44 -0500181 &im->sysconf.sicrh);
Andre Schwarzcea66482008-06-23 11:40:56 +0200182#else
Tom Rini6a5dccc2022-11-16 13:10:41 -0500183 __raw_writel(CFG_SYS_SICRH, &im->sysconf.sicrh);
Kumar Galae5221432006-01-11 11:12:57 -0600184#endif
Andre Schwarzcea66482008-06-23 11:40:56 +0200185#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500186#ifdef CFG_SYS_SICRL
187 __raw_writel(CFG_SYS_SICRL, &im->sysconf.sicrl);
Kumar Galae5221432006-01-11 11:12:57 -0600188#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500189#ifdef CFG_SYS_GPR1
190 __raw_writel(CFG_SYS_GPR1, &im->sysconf.gpr1);
Gerlando Falautofe201cb2012-10-10 22:13:08 +0000191#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500192#ifdef CFG_SYS_DDRCDR /* DDR control driver register */
193 __raw_writel(CFG_SYS_DDRCDR, &im->sysconf.ddrcdr);
Dave Liue740c462006-12-07 21:13:15 +0800194#endif
Tom Rini6a5dccc2022-11-16 13:10:41 -0500195#ifdef CFG_SYS_OBIR /* Output buffer impedance register */
196 __raw_writel(CFG_SYS_OBIR, &im->sysconf.obir);
Dave Liub19ecd32007-09-18 12:37:57 +0800197#endif
Dave Liue740c462006-12-07 21:13:15 +0800198
Heiko Schocher3b07a132020-02-03 10:23:53 +0100199#if !defined(CONFIG_PINCTRL)
Dave Liue732e9c2006-11-03 12:11:15 -0600200#ifdef CONFIG_QE
201 /* Config QE ioports */
202 config_qe_ioports();
203#endif
Heiko Schocher3b07a132020-02-03 10:23:53 +0100204#endif
205
Becky Bruce0d4cee12010-06-17 11:37:20 -0500206 /* Set up preliminary BR/OR regs */
207 init_early_memctl_regs();
Eran Liberty9095d4a2005-07-28 10:08:46 -0500208
Becky Bruce0d4cee12010-06-17 11:37:20 -0500209 /* Local Access window setup */
Tom Rini364d0022023-01-10 11:19:45 -0500210#if defined(CFG_SYS_LBLAWBAR0_PRELIM) && defined(CFG_SYS_LBLAWAR0_PRELIM)
211 im->sysconf.lblaw[0].bar = CFG_SYS_LBLAWBAR0_PRELIM;
212 im->sysconf.lblaw[0].ar = CFG_SYS_LBLAWAR0_PRELIM;
Eran Liberty9095d4a2005-07-28 10:08:46 -0500213#else
Tom Rini364d0022023-01-10 11:19:45 -0500214#error CFG_SYS_LBLAWBAR0_PRELIM & CFG_SYS_LBLAWAR0_PRELIM must be defined
Eran Liberty9095d4a2005-07-28 10:08:46 -0500215#endif
216
Tom Rini364d0022023-01-10 11:19:45 -0500217#if defined(CFG_SYS_LBLAWBAR1_PRELIM) && defined(CFG_SYS_LBLAWAR1_PRELIM)
218 im->sysconf.lblaw[1].bar = CFG_SYS_LBLAWBAR1_PRELIM;
219 im->sysconf.lblaw[1].ar = CFG_SYS_LBLAWAR1_PRELIM;
Eran Liberty9095d4a2005-07-28 10:08:46 -0500220#endif
Tom Rini364d0022023-01-10 11:19:45 -0500221#if defined(CFG_SYS_LBLAWBAR2_PRELIM) && defined(CFG_SYS_LBLAWAR2_PRELIM)
222 im->sysconf.lblaw[2].bar = CFG_SYS_LBLAWBAR2_PRELIM;
223 im->sysconf.lblaw[2].ar = CFG_SYS_LBLAWAR2_PRELIM;
Eran Liberty9095d4a2005-07-28 10:08:46 -0500224#endif
Tom Rini364d0022023-01-10 11:19:45 -0500225#if defined(CFG_SYS_LBLAWBAR3_PRELIM) && defined(CFG_SYS_LBLAWAR3_PRELIM)
226 im->sysconf.lblaw[3].bar = CFG_SYS_LBLAWBAR3_PRELIM;
227 im->sysconf.lblaw[3].ar = CFG_SYS_LBLAWAR3_PRELIM;
Eran Liberty9095d4a2005-07-28 10:08:46 -0500228#endif
Eran Liberty9095d4a2005-07-28 10:08:46 -0500229}
230
Eran Liberty9095d4a2005-07-28 10:08:46 -0500231int cpu_init_r (void)
232{
Dave Liue732e9c2006-11-03 12:11:15 -0600233#ifdef CONFIG_QE
Jean-Christophe PLAGNIOL-VILLARD03836942008-10-16 15:01:15 +0200234 uint qe_base = CONFIG_SYS_IMMR + 0x00100000; /* QE immr base */
Kim Phillips328040a2009-09-25 18:19:44 -0500235
Dave Liue732e9c2006-11-03 12:11:15 -0600236 qe_init(qe_base);
237 qe_reset();
238#endif
Eran Liberty9095d4a2005-07-28 10:08:46 -0500239 return 0;
240}
Dave Liuebd35f82007-06-25 10:41:56 +0800241
Nick Spence56fd3c22008-08-28 14:09:19 -0700242/*
243 * Print out the bus arbiter event
244 */
245#if defined(CONFIG_DISPLAY_AER_FULL)
246static int print_83xx_arb_event(int force)
247{
248 static char* event[] = {
249 "Address Time Out",
250 "Data Time Out",
251 "Address Only Transfer Type",
252 "External Control Word Transfer Type",
253 "Reserved Transfer Type",
254 "Transfer Error",
255 "reserved",
256 "reserved"
257 };
258 static char* master[] = {
259 "e300 Core Data Transaction",
260 "reserved",
261 "e300 Core Instruction Fetch",
262 "reserved",
263 "TSEC1",
264 "TSEC2",
265 "USB MPH",
266 "USB DR",
267 "Encryption Core",
268 "I2C Boot Sequencer",
269 "JTAG",
270 "reserved",
271 "eSDHC",
272 "PCI1",
273 "PCI2",
274 "DMA",
275 "QUICC Engine 00",
276 "QUICC Engine 01",
277 "QUICC Engine 10",
278 "QUICC Engine 11",
279 "reserved",
280 "reserved",
281 "reserved",
282 "reserved",
283 "SATA1",
284 "SATA2",
285 "SATA3",
286 "SATA4",
287 "reserved",
288 "PCI Express 1",
289 "PCI Express 2",
290 "TDM-DMAC"
291 };
292 static char *transfer[] = {
293 "Address-only, Clean Block",
294 "Address-only, lwarx reservation set",
295 "Single-beat or Burst write",
296 "reserved",
297 "Address-only, Flush Block",
298 "reserved",
299 "Burst write",
300 "reserved",
301 "Address-only, sync",
302 "Address-only, tlbsync",
303 "Single-beat or Burst read",
304 "Single-beat or Burst read",
305 "Address-only, Kill Block",
306 "Address-only, icbi",
307 "Burst read",
308 "reserved",
309 "Address-only, eieio",
310 "reserved",
311 "Single-beat write",
312 "reserved",
313 "ecowx - Illegal single-beat write",
314 "reserved",
315 "reserved",
316 "reserved",
317 "Address-only, TLB Invalidate",
318 "reserved",
319 "Single-beat or Burst read",
320 "reserved",
321 "eciwx - Illegal single-beat read",
322 "reserved",
323 "Burst read",
324 "reserved"
325 };
326
Simon Glass387a1f22012-12-13 20:48:57 +0000327 int etype = (gd->arch.arbiter_event_attributes & AEATR_EVENT)
Wolfgang Denkec7fbf52013-10-04 17:43:24 +0200328 >> AEATR_EVENT_SHIFT;
Simon Glass387a1f22012-12-13 20:48:57 +0000329 int mstr_id = (gd->arch.arbiter_event_attributes & AEATR_MSTR_ID)
Wolfgang Denkec7fbf52013-10-04 17:43:24 +0200330 >> AEATR_MSTR_ID_SHIFT;
Simon Glass387a1f22012-12-13 20:48:57 +0000331 int tbst = (gd->arch.arbiter_event_attributes & AEATR_TBST)
Wolfgang Denkec7fbf52013-10-04 17:43:24 +0200332 >> AEATR_TBST_SHIFT;
Simon Glass387a1f22012-12-13 20:48:57 +0000333 int tsize = (gd->arch.arbiter_event_attributes & AEATR_TSIZE)
Wolfgang Denkec7fbf52013-10-04 17:43:24 +0200334 >> AEATR_TSIZE_SHIFT;
Simon Glass387a1f22012-12-13 20:48:57 +0000335 int ttype = (gd->arch.arbiter_event_attributes & AEATR_TTYPE)
Wolfgang Denkec7fbf52013-10-04 17:43:24 +0200336 >> AEATR_TTYPE_SHIFT;
Nick Spence56fd3c22008-08-28 14:09:19 -0700337
Simon Glass387a1f22012-12-13 20:48:57 +0000338 if (!force && !gd->arch.arbiter_event_address)
Nick Spence56fd3c22008-08-28 14:09:19 -0700339 return 0;
340
341 puts("Arbiter Event Status:\n");
Simon Glass387a1f22012-12-13 20:48:57 +0000342 printf(" Event Address: 0x%08lX\n",
343 gd->arch.arbiter_event_address);
Nick Spence56fd3c22008-08-28 14:09:19 -0700344 printf(" Event Type: 0x%1x = %s\n", etype, event[etype]);
345 printf(" Master ID: 0x%02x = %s\n", mstr_id, master[mstr_id]);
346 printf(" Transfer Size: 0x%1x = %d bytes\n", (tbst<<3) | tsize,
347 tbst ? (tsize ? tsize : 8) : 16 + 8 * tsize);
348 printf(" Transfer Type: 0x%02x = %s\n", ttype, transfer[ttype]);
349
Simon Glass387a1f22012-12-13 20:48:57 +0000350 return gd->arch.arbiter_event_address;
Nick Spence56fd3c22008-08-28 14:09:19 -0700351}
352
353#elif defined(CONFIG_DISPLAY_AER_BRIEF)
354
355static int print_83xx_arb_event(int force)
356{
Simon Glass387a1f22012-12-13 20:48:57 +0000357 if (!force && !gd->arch.arbiter_event_address)
Nick Spence56fd3c22008-08-28 14:09:19 -0700358 return 0;
359
360 printf("Arbiter Event Status: AEATR=0x%08lX, AEADR=0x%08lX\n",
Simon Glass387a1f22012-12-13 20:48:57 +0000361 gd->arch.arbiter_event_attributes,
362 gd->arch.arbiter_event_address);
Nick Spence56fd3c22008-08-28 14:09:19 -0700363
Simon Glass387a1f22012-12-13 20:48:57 +0000364 return gd->arch.arbiter_event_address;
Nick Spence56fd3c22008-08-28 14:09:19 -0700365}
366#endif /* CONFIG_DISPLAY_AER_xxxx */
367
Mario Six28fbefa2018-08-06 10:23:45 +0200368#ifndef CONFIG_CPU_MPC83XX
Dave Liuebd35f82007-06-25 10:41:56 +0800369/*
370 * Figure out the cause of the reset
371 */
372int prt_83xx_rsr(void)
373{
374 static struct {
375 ulong mask;
376 char *desc;
377 } bits[] = {
378 {
379 RSR_SWSR, "Software Soft"}, {
380 RSR_SWHR, "Software Hard"}, {
381 RSR_JSRS, "JTAG Soft"}, {
382 RSR_CSHR, "Check Stop"}, {
383 RSR_SWRS, "Software Watchdog"}, {
384 RSR_BMRS, "Bus Monitor"}, {
385 RSR_SRS, "External/Internal Soft"}, {
386 RSR_HRS, "External/Internal Hard"}
387 };
Robert P. J. Day0c911592016-05-23 06:49:21 -0400388 static int n = ARRAY_SIZE(bits);
Simon Glass4d6eaa32012-12-13 20:48:56 +0000389 ulong rsr = gd->arch.reset_status;
Dave Liuebd35f82007-06-25 10:41:56 +0800390 int i;
391 char *sep;
392
393 puts("Reset Status:");
394
395 sep = " ";
396 for (i = 0; i < n; i++)
397 if (rsr & bits[i].mask) {
398 printf("%s%s", sep, bits[i].desc);
399 sep = ", ";
400 }
Nick Spence56fd3c22008-08-28 14:09:19 -0700401 puts("\n");
402
403#if defined(CONFIG_DISPLAY_AER_FULL) || defined(CONFIG_DISPLAY_AER_BRIEF)
404 print_83xx_arb_event(rsr & RSR_BMRS);
405#endif
406 puts("\n");
407
Dave Liuebd35f82007-06-25 10:41:56 +0800408 return 0;
409}
Mario Six28fbefa2018-08-06 10:23:45 +0200410#endif