Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 1 | /* |
| 2 | * U-boot - ints.c Interrupt related routines |
| 3 | * |
Aubrey Li | 314d22f | 2007-04-05 18:31:18 +0800 | [diff] [blame] | 4 | * Copyright (c) 2005-2007 Analog Devices Inc. |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 5 | * |
| 6 | * This file is based on ints.c |
| 7 | * |
| 8 | * Apr18 2003, Changed by HuTao to support interrupt cascading for Blackfin |
| 9 | * drivers |
| 10 | * |
| 11 | * Copyright 1996 Roman Zippel |
| 12 | * Copyright 1999 D. Jeff Dionne <jeff@uclinux.org> |
| 13 | * Copyright 2000-2001 Lineo, Inc. D. Jefff Dionne <jeff@lineo.ca> |
| 14 | * Copyright 2002 Arcturus Networks Inc. MaTed <mated@sympatico.ca> |
| 15 | * Copyright 2003 Metrowerks/Motorola |
| 16 | * |
| 17 | * (C) Copyright 2000-2004 |
| 18 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 19 | * |
| 20 | * See file CREDITS for list of people who contributed to this |
| 21 | * project. |
| 22 | * |
| 23 | * This program is free software; you can redistribute it and/or |
| 24 | * modify it under the terms of the GNU General Public License as |
| 25 | * published by the Free Software Foundation; either version 2 of |
| 26 | * the License, or (at your option) any later version. |
| 27 | * |
| 28 | * This program is distributed in the hope that it will be useful, |
| 29 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 30 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 31 | * GNU General Public License for more details. |
| 32 | * |
| 33 | * You should have received a copy of the GNU General Public License |
| 34 | * along with this program; if not, write to the Free Software |
Aubrey Li | 314d22f | 2007-04-05 18:31:18 +0800 | [diff] [blame] | 35 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
| 36 | * MA 02110-1301 USA |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 37 | */ |
| 38 | |
| 39 | #include <common.h> |
| 40 | #include <linux/stddef.h> |
| 41 | #include <asm/system.h> |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 42 | #include <asm/traps.h> |
| 43 | #include <asm/io.h> |
| 44 | #include <asm/errno.h> |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 45 | #include <asm/blackfin.h> |
| 46 | #include "cpu.h" |
| 47 | |
| 48 | void blackfin_irq_panic(int reason, struct pt_regs *regs) |
| 49 | { |
| 50 | printf("\n\nException: IRQ 0x%x entered\n", reason); |
| 51 | printf("code=[0x%x], ", (unsigned int)(regs->seqstat & 0x3f)); |
| 52 | printf("stack frame=0x%x, ", (unsigned int)regs); |
| 53 | printf("bad PC=0x%04x\n", (unsigned int)regs->pc); |
| 54 | dump(regs); |
| 55 | printf("Unhandled IRQ or exceptions!\n"); |
| 56 | printf("Please reset the board \n"); |
| 57 | } |
| 58 | |
| 59 | void blackfin_init_IRQ(void) |
| 60 | { |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 61 | *(unsigned volatile long *)(SIC_IMASK) = 0; |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 62 | #ifndef CONFIG_KGDB |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 63 | *(unsigned volatile long *)(EVT1) = 0x0; |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 64 | #endif |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 65 | *(unsigned volatile long *)(EVT2) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 66 | (unsigned volatile long)evt_nmi; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 67 | *(unsigned volatile long *)(EVT3) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 68 | (unsigned volatile long)trap; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 69 | *(unsigned volatile long *)(EVT5) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 70 | (unsigned volatile long)evt_ivhw; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 71 | *(unsigned volatile long *)(EVT0) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 72 | (unsigned volatile long)evt_rst; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 73 | *(unsigned volatile long *)(EVT6) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 74 | (unsigned volatile long)evt_timer; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 75 | *(unsigned volatile long *)(EVT7) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 76 | (unsigned volatile long)evt_evt7; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 77 | *(unsigned volatile long *)(EVT8) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 78 | (unsigned volatile long)evt_evt8; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 79 | *(unsigned volatile long *)(EVT9) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 80 | (unsigned volatile long)evt_evt9; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 81 | *(unsigned volatile long *)(EVT10) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 82 | (unsigned volatile long)evt_evt10; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 83 | *(unsigned volatile long *)(EVT11) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 84 | (unsigned volatile long)evt_evt11; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 85 | *(unsigned volatile long *)(EVT12) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 86 | (unsigned volatile long)evt_evt12; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 87 | *(unsigned volatile long *)(EVT13) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 88 | (unsigned volatile long)evt_evt13; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 89 | *(unsigned volatile long *)(EVT14) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 90 | (unsigned volatile long)evt_system_call; |
Mike Frysinger | 66c4cf4 | 2008-02-04 19:26:55 -0500 | [diff] [blame] | 91 | *(unsigned volatile long *)(EVT15) = |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 92 | (unsigned volatile long)evt_soft_int1; |
| 93 | *(volatile unsigned long *)ILAT = 0; |
| 94 | asm("csync;"); |
Aubrey Li | 10ebdd9 | 2007-03-19 01:24:52 +0800 | [diff] [blame] | 95 | *(volatile unsigned long *)IMASK = 0xffbf; |
| 96 | asm("csync;"); |
| 97 | } |
| 98 | |
| 99 | void exception_handle(void) |
| 100 | { |
| 101 | #if defined (CONFIG_PANIC_HANG) |
| 102 | display_excp(); |
| 103 | #else |
| 104 | udelay(100000); /* allow messages to go out */ |
| 105 | do_reset(NULL, 0, 0, NULL); |
| 106 | #endif |
| 107 | } |
| 108 | |
| 109 | void display_excp(void) |
| 110 | { |
| 111 | printf("Exception!\n"); |
| 112 | } |