cfc46314e7d98c7da15d3507d3e3313f85591156
[linux-2.6-microblaze.git] / arch / sh / boards / mach-cayman / panic.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) 2003  Richard Curnow, SuperH UK Limited
4  */
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
13 static void poor_mans_delay(void)
14 {
15         int i;
16
17         for (i = 0; i < 2500000; i++)
18                 cpu_relax();
19 }
20
21 static 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
33 void
34 panic_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 }