summaryrefslogtreecommitdiffstats
path: root/cpu/bf561/ints.c
blob: 27a38a3493a07407f220616e80ba41f23cc77b59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
 * U-boot - ints.c Interrupt related routines
 *
 * Copyright (c) 2005-2007 Analog Devices Inc.
 *
 * This file is based on ints.c
 *
 * Apr18 2003, Changed by HuTao to support interrupt cascading for Blackfin
 *	drivers
 *
 * Copyright 1996 Roman Zippel
 * Copyright 1999 D. Jeff Dionne <jeff@uclinux.org>
 * Copyright 2000-2001 Lineo, Inc. D. Jefff Dionne <jeff@lineo.ca>
 * Copyright 2002 Arcturus Networks Inc. MaTed <mated@sympatico.ca>
 * Copyright 2003 Metrowerks/Motorola
 *
 * (C) Copyright 2000-2004
 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 *
 * See file CREDITS for list of people who contributed to this
 * project.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of
 * the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
 * MA 02110-1301 USA
 */

#include <common.h>
#include <linux/stddef.h>
#include <asm/system.h>
#include <asm/irq.h>
#include <asm/traps.h>
#include <asm/io.h>
#include <asm/errno.h>
#include <asm/machdep.h>
#include <asm/setup.h>
#include <asm/blackfin.h>
#include "cpu.h"

void blackfin_irq_panic(int reason, struct pt_regs *regs)
{
	printf("\n\nException: IRQ 0x%x entered\n", reason);
	printf("code=[0x%x], ", (unsigned int)(regs->seqstat & 0x3f));
	printf("stack frame=0x%x, ", (unsigned int)regs);
	printf("bad PC=0x%04x\n", (unsigned int)regs->pc);
	dump(regs);
	printf("Unhandled IRQ or exceptions!\n");
	printf("Please reset the board \n");
}

void blackfin_init_IRQ(void)
{
	*(unsigned volatile long *)(SIC_IMASK) = SIC_UNMASK_ALL;
	cli();
#ifndef CONFIG_KGDB
	*(unsigned volatile long *)(EVT_EMULATION_ADDR) = 0x0;
#endif
	*(unsigned volatile long *)(EVT_NMI_ADDR) =
	    (unsigned volatile long)evt_nmi;
	*(unsigned volatile long *)(EVT_EXCEPTION_ADDR) =
	    (unsigned volatile long)trap;
	*(unsigned volatile long *)(EVT_HARDWARE_ERROR_ADDR) =
	    (unsigned volatile long)evt_ivhw;
	*(unsigned volatile long *)(EVT_RESET_ADDR) =
	    (unsigned volatile long)evt_rst;
	*(unsigned volatile long *)(EVT_TIMER_ADDR) =
	    (unsigned volatile long)evt_timer;
	*(unsigned volatile long *)(EVT_IVG7_ADDR) =
	    (unsigned volatile long)evt_evt7;
	*(unsigned volatile long *)(EVT_IVG8_ADDR) =
	    (unsigned volatile long)evt_evt8;
	*(unsigned volatile long *)(EVT_IVG9_ADDR) =
	    (unsigned volatile long)evt_evt9;
	*(unsigned volatile long *)(EVT_IVG10_ADDR) =
	    (unsigned volatile long)evt_evt10;
	*(unsigned volatile long *)(EVT_IVG11_ADDR) =
	    (unsigned volatile long)evt_evt11;
	*(unsigned volatile long *)(EVT_IVG12_ADDR) =
	    (unsigned volatile long)evt_evt12;
	*(unsigned volatile long *)(EVT_IVG13_ADDR) =
	    (unsigned volatile long)evt_evt13;
	*(unsigned volatile long *)(EVT_IVG14_ADDR) =
	    (unsigned volatile long)evt_system_call;
	*(unsigned volatile long *)(EVT_IVG15_ADDR) =
	    (unsigned volatile long)evt_soft_int1;
	*(volatile unsigned long *)ILAT = 0;
	asm("csync;");
	sti();
	*(volatile unsigned long *)IMASK = 0xffbf;
	asm("csync;");
}

void exception_handle(void)
{
#if defined (CONFIG_PANIC_HANG)
	display_excp();
#else
	udelay(100000);		/* allow messages to go out */
	do_reset(NULL, 0, 0, NULL);
#endif
}

void display_excp(void)
{
	printf("Exception!\n");
}
OpenPOWER on IntegriCloud