blob: cfc46314e7d98c7da15d3507d3e3313f85591156 [file] [log] [blame]
Kuninori Morimotoaaf91282018-12-28 00:31:46 -08001// SPDX-License-Identifier: GPL-2.0
Paul Mundt7d170b12009-05-08 17:41:59 +09002/*
3 * Copyright (C) 2003 Richard Curnow, SuperH UK Limited
Paul Mundt7d170b12009-05-08 17:41:59 +09004 */
5
6#include <linux/kernel.h>
7#include <linux/io.h>
8#include <cpu/registers.h>
9
10/* THIS IS A PHYSICAL ADDRESS */
11#define HDSP2534_ADDR (0x04002100)
12
13static void poor_mans_delay(void)
14{
15 int i;
16
17 for (i = 0; i < 2500000; i++)
18 cpu_relax();
19}
20
21static void show_value(unsigned long x)
22{
23 int i;
24 unsigned nibble;
25 for (i = 0; i < 8; i++) {
26 nibble = ((x >> (i * 4)) & 0xf);
27
28 __raw_writeb(nibble + ((nibble > 9) ? 55 : 48),
29 HDSP2534_ADDR + 0xe0 + ((7 - i) << 2));
30 }
31}
32
33void
34panic_handler(unsigned long panicPC, unsigned long panicSSR,
35 unsigned long panicEXPEVT)
36{
37 while (1) {
38 /* This piece of code displays the PC on the LED display */
39 show_value(panicPC);
40 poor_mans_delay();
41 show_value(panicSSR);
42 poor_mans_delay();
43 show_value(panicEXPEVT);
44 poor_mans_delay();
45 }
46}