From 38884dabbe6a86feb5d9763cd160083f85b1848b Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Sun, 27 Nov 2011 16:32:05 +0100 Subject: remove irq support fragments We never had interrupt support in barebox and we have no plans to add interrupt support. Even if we do I doubt the current fragments of irq support are helpful, so remove them. Signed-off-by: Sascha Hauer --- arch/nios2/cpu/Makefile | 1 - arch/nios2/cpu/cpu.c | 3 - arch/nios2/cpu/exceptions.S | 9 --- arch/nios2/cpu/interrupts.c | 140 -------------------------------------------- 4 files changed, 153 deletions(-) delete mode 100644 arch/nios2/cpu/interrupts.c (limited to 'arch/nios2/cpu') diff --git a/arch/nios2/cpu/Makefile b/arch/nios2/cpu/Makefile index f15c7217d1..0b59ec57c1 100644 --- a/arch/nios2/cpu/Makefile +++ b/arch/nios2/cpu/Makefile @@ -1,6 +1,5 @@ obj-y += start.o obj-y += exceptions.o obj-y += cpu.o -obj-$(CONFIG_USE_IRQ) += interrupts.o obj-y += traps.o extra-y += barebox.lds diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c index 102b12e06f..44ddf3ccd3 100644 --- a/arch/nios2/cpu/cpu.c +++ b/arch/nios2/cpu/cpu.c @@ -26,9 +26,6 @@ void __noreturn reset_cpu(ulong ignored) { -#ifdef CONFIG_USE_IRQ - disable_interrupts(); -#endif /* indirect call to go beyond 256MB limitation of toolchain */ nios2_callr(RESET_ADDR); diff --git a/arch/nios2/cpu/exceptions.S b/arch/nios2/cpu/exceptions.S index 8e024cefa3..402e5afd29 100644 --- a/arch/nios2/cpu/exceptions.S +++ b/arch/nios2/cpu/exceptions.S @@ -82,16 +82,7 @@ _exception: rdctl et, ipending beq et, r0, 0f -#ifdef CONFIG_USE_IRQ - - /* HARDWARE INTERRUPT: Call interrupt handler */ - movhi r3, %hi(external_interrupt) - ori r3, r3, %lo(external_interrupt) - mov r4, sp /* ptr to regs */ - callr r3 -#else br _exception_return -#endif /* Return address fixup: execution resumes by re-issue of * interrupted instruction at ea-4 (ea == r29). Here we do diff --git a/arch/nios2/cpu/interrupts.c b/arch/nios2/cpu/interrupts.c deleted file mode 100644 index f443bfdec5..0000000000 --- a/arch/nios2/cpu/interrupts.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * (C) Copyright 2000-2002 - * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * (C) Copyright 2004, Psyent Corporation - * Scott McNutt - * - * 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., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -/****************************************************************************/ - -struct irq_action { - interrupt_handler_t *handler; - void *arg; - int count; -}; - -static struct irq_action vecs[32]; - -/****************************************************************************/ - -int disable_interrupts(void) -{ - int val = rdctl(CTL_STATUS); - wrctl(CTL_STATUS, val & ~STATUS_IE); - return val & STATUS_IE; -} - -void enable_interrupts(void) -{ - int val = rdctl(CTL_STATUS); - wrctl(CTL_STATUS, val | STATUS_IE); -} - -void external_interrupt(struct pt_regs *regs) -{ - unsigned irqs; - struct irq_action *act; - - /* Evaluate only irqs that are both enabled AND pending */ - irqs = rdctl(CTL_IENABLE) & rdctl(CTL_IPENDING); - act = vecs; - - /* Assume (as does the Nios2 HAL) that bit 0 is highest - * priority. NOTE: There is ALWAYS a handler assigned - * (the default if no other). - */ - while (irqs) { - if (irqs & 1) { - act->handler(act->arg); - act->count++; - } - irqs >>= 1; - act++; - } - -} - -static void def_hdlr(void *arg) -{ - unsigned irqs = rdctl(CTL_IENABLE); - - /* Disable the individual interrupt -- with gratuitous - * warning. - */ - irqs &= ~(1 << (int)arg); - wrctl(CTL_IENABLE, irqs); - printf("WARNING: Disabling unhandled interrupt: %d\n", - (int)arg); -} - -/*************************************************************************/ -void irq_install_handler(int irq, interrupt_handler_t *hdlr, void *arg) -{ - int flag; - struct irq_action *act; - unsigned ena = rdctl(CTL_IENABLE); - - if ((irq < 0) || (irq > 31)) - return; - act = &vecs[irq]; - - flag = disable_interrupts(); - if (hdlr) { - act->handler = hdlr; - act->arg = arg; - ena |= (1 << irq); /* enable */ - } else { - act->handler = def_hdlr; - act->arg = (void *)irq; - ena &= ~(1 << irq); /* disable */ - } - wrctl(CTL_IENABLE, ena); - - if (flag) - enable_interrupts(); -} - - -int interrupt_init(void) -{ - int i; - - /* Assign the default handler to all */ - for (i = 0; i < 32; i++) { - vecs[i].handler = def_hdlr; - vecs[i].arg = (void *)i; - vecs[i].count = 0; - } - - enable_interrupts(); - return 0; -} - -- cgit v1.2.3