aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/emma/common
diff options
context:
space:
mode:
authorShinya Kuribayashi <skuribay@ruby.dti.ne.jp>2008-10-23 12:32:40 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-10-27 12:18:30 -0400
commit9ae9fd79af28d6488e97311a3b60379b59ff4c90 (patch)
tree3146a83f9d1245d0ab0448326cd97dd5db25589c /arch/mips/emma/common
parentfcb3cfe7f087fb27c35be911791883fb725055b1 (diff)
MIPS: EMMA: Fold arch/mips/emma/{common,markeins}/irq*.c into markeins/irq.c
Current EMMA2RH irq code is mess. Before cleaning it up, gather them in one place as a first step. Signed-off-by: Shinya Kuribayashi <shinya.kuribayashi@necel.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/emma/common')
-rw-r--r--arch/mips/emma/common/Makefile2
-rw-r--r--arch/mips/emma/common/irq.c105
-rw-r--r--arch/mips/emma/common/irq_emma2rh.c103
3 files changed, 1 insertions, 209 deletions
diff --git a/arch/mips/emma/common/Makefile b/arch/mips/emma/common/Makefile
index cb0fd328c61f..c392d28c1ef1 100644
--- a/arch/mips/emma/common/Makefile
+++ b/arch/mips/emma/common/Makefile
@@ -10,4 +10,4 @@
10# (at your option) any later version. 10# (at your option) any later version.
11# 11#
12 12
13obj-$(CONFIG_NEC_MARKEINS) += irq.o irq_emma2rh.o prom.o 13obj-$(CONFIG_NEC_MARKEINS) += prom.o
diff --git a/arch/mips/emma/common/irq.c b/arch/mips/emma/common/irq.c
deleted file mode 100644
index 4158f808aa8e..000000000000
--- a/arch/mips/emma/common/irq.c
+++ /dev/null
@@ -1,105 +0,0 @@
1/*
2 * arch/mips/emma2rh/common/irq.c
3 * This file is common irq dispatcher.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/irq.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25#include <linux/init.h>
26#include <linux/interrupt.h>
27#include <linux/irq.h>
28#include <linux/types.h>
29
30#include <asm/system.h>
31#include <asm/mipsregs.h>
32#include <asm/addrspace.h>
33#include <asm/bootinfo.h>
34
35#include <asm/emma/emma2rh.h>
36
37/*
38 * the first level int-handler will jump here if it is a emma2rh irq
39 */
40void emma2rh_irq_dispatch(void)
41{
42 u32 intStatus;
43 u32 bitmask;
44 u32 i;
45
46 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_0)
47 & emma2rh_in32(EMMA2RH_BHIF_INT_EN_0);
48
49#ifdef EMMA2RH_SW_CASCADE
50 if (intStatus &
51 (1 << ((EMMA2RH_SW_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) {
52 u32 swIntStatus;
53 swIntStatus = emma2rh_in32(EMMA2RH_BHIF_SW_INT)
54 & emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN);
55 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
56 if (swIntStatus & bitmask) {
57 do_IRQ(EMMA2RH_SW_IRQ_BASE + i);
58 return;
59 }
60 }
61 }
62#endif
63
64 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
65 if (intStatus & bitmask) {
66 do_IRQ(EMMA2RH_IRQ_BASE + i);
67 return;
68 }
69 }
70
71 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_1)
72 & emma2rh_in32(EMMA2RH_BHIF_INT_EN_1);
73
74#ifdef EMMA2RH_GPIO_CASCADE
75 if (intStatus &
76 (1 << ((EMMA2RH_GPIO_CASCADE - EMMA2RH_IRQ_INT0) & (32 - 1)))) {
77 u32 gpioIntStatus;
78 gpioIntStatus = emma2rh_in32(EMMA2RH_GPIO_INT_ST)
79 & emma2rh_in32(EMMA2RH_GPIO_INT_MASK);
80 for (i = 0, bitmask = 1; i < 32; i++, bitmask <<= 1) {
81 if (gpioIntStatus & bitmask) {
82 do_IRQ(EMMA2RH_GPIO_IRQ_BASE + i);
83 return;
84 }
85 }
86 }
87#endif
88
89 for (i = 32, bitmask = 1; i < 64; i++, bitmask <<= 1) {
90 if (intStatus & bitmask) {
91 do_IRQ(EMMA2RH_IRQ_BASE + i);
92 return;
93 }
94 }
95
96 intStatus = emma2rh_in32(EMMA2RH_BHIF_INT_ST_2)
97 & emma2rh_in32(EMMA2RH_BHIF_INT_EN_2);
98
99 for (i = 64, bitmask = 1; i < 96; i++, bitmask <<= 1) {
100 if (intStatus & bitmask) {
101 do_IRQ(EMMA2RH_IRQ_BASE + i);
102 return;
103 }
104 }
105}
diff --git a/arch/mips/emma/common/irq_emma2rh.c b/arch/mips/emma/common/irq_emma2rh.c
deleted file mode 100644
index 4f84fede4c4c..000000000000
--- a/arch/mips/emma/common/irq_emma2rh.c
+++ /dev/null
@@ -1,103 +0,0 @@
1/*
2 * arch/mips/emma2rh/common/irq_emma2rh.c
3 * This file defines the irq handler for EMMA2RH.
4 *
5 * Copyright (C) NEC Electronics Corporation 2005-2006
6 *
7 * This file is based on the arch/mips/ddb5xxx/ddb5477/irq_5477.c
8 *
9 * Copyright 2001 MontaVista Software Inc.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26/*
27 * EMMA2RH defines 64 IRQs.
28 *
29 * This file exports one function:
30 * emma2rh_irq_init(u32 irq_base);
31 */
32
33#include <linux/interrupt.h>
34#include <linux/types.h>
35#include <linux/ptrace.h>
36
37#include <asm/debug.h>
38
39#include <asm/emma/emma2rh.h>
40
41/* number of total irqs supported by EMMA2RH */
42#define NUM_EMMA2RH_IRQ 96
43
44void ll_emma2rh_irq_enable(int);
45void ll_emma2rh_irq_disable(int);
46
47static void emma2rh_irq_enable(unsigned int irq)
48{
49 ll_emma2rh_irq_enable(irq - EMMA2RH_IRQ_BASE);
50}
51
52static void emma2rh_irq_disable(unsigned int irq)
53{
54 ll_emma2rh_irq_disable(irq - EMMA2RH_IRQ_BASE);
55}
56
57struct irq_chip emma2rh_irq_controller = {
58 .name = "emma2rh_irq",
59 .ack = emma2rh_irq_disable,
60 .mask = emma2rh_irq_disable,
61 .mask_ack = emma2rh_irq_disable,
62 .unmask = emma2rh_irq_enable,
63};
64
65void emma2rh_irq_init(void)
66{
67 u32 i;
68
69 for (i = 0; i < NUM_EMMA2RH_IRQ; i++)
70 set_irq_chip_and_handler(EMMA2RH_IRQ_BASE + i,
71 &emma2rh_irq_controller,
72 handle_level_irq);
73}
74
75void ll_emma2rh_irq_enable(int emma2rh_irq)
76{
77 u32 reg_value;
78 u32 reg_bitmask;
79 u32 reg_index;
80
81 reg_index = EMMA2RH_BHIF_INT_EN_0
82 + (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0)
83 * (emma2rh_irq / 32);
84 reg_value = emma2rh_in32(reg_index);
85 reg_bitmask = 0x1 << (emma2rh_irq % 32);
86 db_assert((reg_value & reg_bitmask) == 0);
87 emma2rh_out32(reg_index, reg_value | reg_bitmask);
88}
89
90void ll_emma2rh_irq_disable(int emma2rh_irq)
91{
92 u32 reg_value;
93 u32 reg_bitmask;
94 u32 reg_index;
95
96 reg_index = EMMA2RH_BHIF_INT_EN_0
97 + (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0)
98 * (emma2rh_irq / 32);
99 reg_value = emma2rh_in32(reg_index);
100 reg_bitmask = 0x1 << (emma2rh_irq % 32);
101 db_assert((reg_value & reg_bitmask) != 0);
102 emma2rh_out32(reg_index, reg_value & ~reg_bitmask);
103}