Commit 979934da authored by Yoichi Yuasa's avatar Yoichi Yuasa Committed by Linus Torvalds

[PATCH] mips: update IRQ handling for vr41xx

This patch has updated IRQ handling for vr41xx.
o added common IRQ dispatch
o changed IRQ number in int-handler.S
o added resource management to icu.c
Signed-off-by: default avatarYoichi Yuasa <yuasa@hh.iij4u.or.jp>
Cc: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 006cfb51
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# Makefile for common code of the NEC VR4100 series. # Makefile for common code of the NEC VR4100 series.
# #
obj-y += bcu.o cmu.o icu.o init.o int-handler.o pmu.o obj-y += bcu.o cmu.o icu.o init.o int-handler.o irq.o pmu.o
obj-$(CONFIG_VRC4173) += vrc4173.o obj-$(CONFIG_VRC4173) += vrc4173.o
EXTRA_AFLAGS := $(CFLAGS) EXTRA_AFLAGS := $(CFLAGS)
This diff is collapsed.
...@@ -71,24 +71,24 @@ ...@@ -71,24 +71,24 @@
andi t1, t0, CAUSEF_IP3 # check for Int1 andi t1, t0, CAUSEF_IP3 # check for Int1
bnez t1, handle_int bnez t1, handle_int
li a0, 1 li a0, 3
andi t1, t0, CAUSEF_IP4 # check for Int2 andi t1, t0, CAUSEF_IP4 # check for Int2
bnez t1, handle_int bnez t1, handle_int
li a0, 2 li a0, 4
andi t1, t0, CAUSEF_IP5 # check for Int3 andi t1, t0, CAUSEF_IP5 # check for Int3
bnez t1, handle_int bnez t1, handle_int
li a0, 3 li a0, 5
andi t1, t0, CAUSEF_IP6 # check for Int4 andi t1, t0, CAUSEF_IP6 # check for Int4
bnez t1, handle_int bnez t1, handle_int
li a0, 4 li a0, 6
1: 1:
andi t1, t0, CAUSEF_IP2 # check for Int0 andi t1, t0, CAUSEF_IP2 # check for Int0
bnez t1, handle_int bnez t1, handle_int
li a0, 0 li a0, 2
andi t1, t0, CAUSEF_IP0 # check for IP0 andi t1, t0, CAUSEF_IP0 # check for IP0
bnez t1, handle_irq bnez t1, handle_irq
......
/*
* Interrupt handing routines for NEC VR4100 series.
*
* Copyright (C) 2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
*
* 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 <linux/interrupt.h>
#include <linux/module.h>
#include <asm/irq_cpu.h>
#include <asm/system.h>
#include <asm/vr41xx/vr41xx.h>
typedef struct irq_cascade {
int (*get_irq)(unsigned int, struct pt_regs *);
} irq_cascade_t;
static irq_cascade_t irq_cascade[NR_IRQS] __cacheline_aligned;
static struct irqaction cascade_irqaction = {
.handler = no_action,
.mask = CPU_MASK_NONE,
.name = "cascade",
};
int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int, struct pt_regs *))
{
int retval = 0;
if (irq >= NR_IRQS)
return -EINVAL;
if (irq_cascade[irq].get_irq != NULL)
free_irq(irq, NULL);
irq_cascade[irq].get_irq = get_irq;
if (get_irq != NULL) {
retval = setup_irq(irq, &cascade_irqaction);
if (retval < 0)
irq_cascade[irq].get_irq = NULL;
}
return retval;
}
EXPORT_SYMBOL_GPL(cascade_irq);
asmlinkage void irq_dispatch(unsigned int irq, struct pt_regs *regs)
{
irq_cascade_t *cascade;
irq_desc_t *desc;
if (irq >= NR_IRQS) {
atomic_inc(&irq_err_count);
return;
}
cascade = irq_cascade + irq;
if (cascade->get_irq != NULL) {
unsigned int source_irq = irq;
desc = irq_desc + source_irq;
desc->handler->ack(source_irq);
irq = cascade->get_irq(irq, regs);
if (irq < 0)
atomic_inc(&irq_err_count);
else
irq_dispatch(irq, regs);
desc->handler->end(source_irq);
} else
do_IRQ(irq, regs);
}
extern asmlinkage void vr41xx_handle_interrupt(void);
void __init arch_init_irq(void)
{
mips_cpu_irq_init(MIPS_CPU_IRQ_BASE);
set_except_vector(0, vr41xx_handle_interrupt);
}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Copyright (C) 2001, 2002 Paul Mundt * Copyright (C) 2001, 2002 Paul Mundt
* Copyright (C) 2002 MontaVista Software, Inc. * Copyright (C) 2002 MontaVista Software, Inc.
* Copyright (C) 2002 TimeSys Corp. * Copyright (C) 2002 TimeSys Corp.
* Copyright (C) 2003-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> * Copyright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
* *
* This program is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License as published by the
...@@ -79,11 +79,11 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock); ...@@ -79,11 +79,11 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock);
#define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x)) #define MIPS_CPU_IRQ(x) (MIPS_CPU_IRQ_BASE + (x))
#define MIPS_SOFTINT0_IRQ MIPS_CPU_IRQ(0) #define MIPS_SOFTINT0_IRQ MIPS_CPU_IRQ(0)
#define MIPS_SOFTINT1_IRQ MIPS_CPU_IRQ(1) #define MIPS_SOFTINT1_IRQ MIPS_CPU_IRQ(1)
#define INT0_CASCADE_IRQ MIPS_CPU_IRQ(2) #define INT0_IRQ MIPS_CPU_IRQ(2)
#define INT1_CASCADE_IRQ MIPS_CPU_IRQ(3) #define INT1_IRQ MIPS_CPU_IRQ(3)
#define INT2_CASCADE_IRQ MIPS_CPU_IRQ(4) #define INT2_IRQ MIPS_CPU_IRQ(4)
#define INT3_CASCADE_IRQ MIPS_CPU_IRQ(5) #define INT3_IRQ MIPS_CPU_IRQ(5)
#define INT4_CASCADE_IRQ MIPS_CPU_IRQ(6) #define INT4_IRQ MIPS_CPU_IRQ(6)
#define TIMER_IRQ MIPS_CPU_IRQ(7) #define TIMER_IRQ MIPS_CPU_IRQ(7)
/* SYINT1 Interrupt Numbers */ /* SYINT1 Interrupt Numbers */
...@@ -97,7 +97,7 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock); ...@@ -97,7 +97,7 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock);
#define PIU_IRQ SYSINT1_IRQ(5) #define PIU_IRQ SYSINT1_IRQ(5)
#define AIU_IRQ SYSINT1_IRQ(6) #define AIU_IRQ SYSINT1_IRQ(6)
#define KIU_IRQ SYSINT1_IRQ(7) #define KIU_IRQ SYSINT1_IRQ(7)
#define GIUINT_CASCADE_IRQ SYSINT1_IRQ(8) #define GIUINT_IRQ SYSINT1_IRQ(8)
#define SIU_IRQ SYSINT1_IRQ(9) #define SIU_IRQ SYSINT1_IRQ(9)
#define BUSERR_IRQ SYSINT1_IRQ(10) #define BUSERR_IRQ SYSINT1_IRQ(10)
#define SOFTINT_IRQ SYSINT1_IRQ(11) #define SOFTINT_IRQ SYSINT1_IRQ(11)
...@@ -128,7 +128,7 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock); ...@@ -128,7 +128,7 @@ extern void vr41xx_mask_clock(vr41xx_clock_t clock);
#define GIU_IRQ_LAST GIU_IRQ(31) #define GIU_IRQ_LAST GIU_IRQ(31)
extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign); extern int vr41xx_set_intassign(unsigned int irq, unsigned char intassign);
extern int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq)); extern int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int, struct pt_regs *));
#define PIUINT_COMMAND 0x0040 #define PIUINT_COMMAND 0x0040
#define PIUINT_DATA 0x0020 #define PIUINT_DATA 0x0020
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment