diff options
author | Shinya Kuribayashi <skuribay@ruby.dti.ne.jp> | 2008-10-23 12:29:16 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-10-27 12:18:29 -0400 |
commit | f27655e34171b0ae9ea5a0aadae894e817f0f875 (patch) | |
tree | 3375121c5b9db911d5b16e56e47c1871bd9db9c1 /arch/mips/emma/common | |
parent | cd741b604b94a4d5bebf2672626ffec7de44652c (diff) |
MIPS: EMMA: Move arch/mips/emma2rh/ into arch/mips/emma/
git mv arch/mips/{emma2rh,emma} and fixups Makefiles. We'll put all NEC
EMMA series based machines there in the future.
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/Makefile | 13 | ||||
-rw-r--r-- | arch/mips/emma/common/irq.c | 105 | ||||
-rw-r--r-- | arch/mips/emma/common/irq_emma2rh.c | 106 | ||||
-rw-r--r-- | arch/mips/emma/common/prom.c | 72 |
4 files changed, 296 insertions, 0 deletions
diff --git a/arch/mips/emma/common/Makefile b/arch/mips/emma/common/Makefile new file mode 100644 index 000000000000..cb0fd328c61f --- /dev/null +++ b/arch/mips/emma/common/Makefile | |||
@@ -0,0 +1,13 @@ | |||
1 | # | ||
2 | # arch/mips/emma2rh/common/Makefile | ||
3 | # Makefile for the common code of NEC EMMA2RH based board. | ||
4 | # | ||
5 | # Copyright (C) NEC Electronics Corporation 2005-2006 | ||
6 | # | ||
7 | # This program is free software; you can redistribute it and/or modify | ||
8 | # it under the terms of the GNU General Public License as published by | ||
9 | # the Free Software Foundation; either version 2 of the License, or | ||
10 | # (at your option) any later version. | ||
11 | # | ||
12 | |||
13 | obj-$(CONFIG_NEC_MARKEINS) += irq.o irq_emma2rh.o prom.o | ||
diff --git a/arch/mips/emma/common/irq.c b/arch/mips/emma/common/irq.c new file mode 100644 index 000000000000..91cbd959ab67 --- /dev/null +++ b/arch/mips/emma/common/irq.c | |||
@@ -0,0 +1,105 @@ | |||
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/emma2rh/emma2rh.h> | ||
36 | |||
37 | /* | ||
38 | * the first level int-handler will jump here if it is a emma2rh irq | ||
39 | */ | ||
40 | void 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 new file mode 100644 index 000000000000..96df37b77759 --- /dev/null +++ b/arch/mips/emma/common/irq_emma2rh.c | |||
@@ -0,0 +1,106 @@ | |||
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/emma2rh/emma2rh.h> | ||
40 | |||
41 | /* number of total irqs supported by EMMA2RH */ | ||
42 | #define NUM_EMMA2RH_IRQ 96 | ||
43 | |||
44 | static int emma2rh_irq_base = -1; | ||
45 | |||
46 | void ll_emma2rh_irq_enable(int); | ||
47 | void ll_emma2rh_irq_disable(int); | ||
48 | |||
49 | static void emma2rh_irq_enable(unsigned int irq) | ||
50 | { | ||
51 | ll_emma2rh_irq_enable(irq - emma2rh_irq_base); | ||
52 | } | ||
53 | |||
54 | static void emma2rh_irq_disable(unsigned int irq) | ||
55 | { | ||
56 | ll_emma2rh_irq_disable(irq - emma2rh_irq_base); | ||
57 | } | ||
58 | |||
59 | struct irq_chip emma2rh_irq_controller = { | ||
60 | .name = "emma2rh_irq", | ||
61 | .ack = emma2rh_irq_disable, | ||
62 | .mask = emma2rh_irq_disable, | ||
63 | .mask_ack = emma2rh_irq_disable, | ||
64 | .unmask = emma2rh_irq_enable, | ||
65 | }; | ||
66 | |||
67 | void emma2rh_irq_init(u32 irq_base) | ||
68 | { | ||
69 | u32 i; | ||
70 | |||
71 | for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ; i++) | ||
72 | set_irq_chip_and_handler(i, &emma2rh_irq_controller, | ||
73 | handle_level_irq); | ||
74 | |||
75 | emma2rh_irq_base = irq_base; | ||
76 | } | ||
77 | |||
78 | void ll_emma2rh_irq_enable(int emma2rh_irq) | ||
79 | { | ||
80 | u32 reg_value; | ||
81 | u32 reg_bitmask; | ||
82 | u32 reg_index; | ||
83 | |||
84 | reg_index = EMMA2RH_BHIF_INT_EN_0 | ||
85 | + (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) | ||
86 | * (emma2rh_irq / 32); | ||
87 | reg_value = emma2rh_in32(reg_index); | ||
88 | reg_bitmask = 0x1 << (emma2rh_irq % 32); | ||
89 | db_assert((reg_value & reg_bitmask) == 0); | ||
90 | emma2rh_out32(reg_index, reg_value | reg_bitmask); | ||
91 | } | ||
92 | |||
93 | void ll_emma2rh_irq_disable(int emma2rh_irq) | ||
94 | { | ||
95 | u32 reg_value; | ||
96 | u32 reg_bitmask; | ||
97 | u32 reg_index; | ||
98 | |||
99 | reg_index = EMMA2RH_BHIF_INT_EN_0 | ||
100 | + (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) | ||
101 | * (emma2rh_irq / 32); | ||
102 | reg_value = emma2rh_in32(reg_index); | ||
103 | reg_bitmask = 0x1 << (emma2rh_irq % 32); | ||
104 | db_assert((reg_value & reg_bitmask) != 0); | ||
105 | emma2rh_out32(reg_index, reg_value & ~reg_bitmask); | ||
106 | } | ||
diff --git a/arch/mips/emma/common/prom.c b/arch/mips/emma/common/prom.c new file mode 100644 index 000000000000..97bf29e755a0 --- /dev/null +++ b/arch/mips/emma/common/prom.c | |||
@@ -0,0 +1,72 @@ | |||
1 | /* | ||
2 | * arch/mips/emma2rh/common/prom.c | ||
3 | * This file is prom file. | ||
4 | * | ||
5 | * Copyright (C) NEC Electronics Corporation 2004-2006 | ||
6 | * | ||
7 | * This file is based on the arch/mips/ddb5xxx/common/prom.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/mm.h> | ||
27 | #include <linux/sched.h> | ||
28 | #include <linux/bootmem.h> | ||
29 | |||
30 | #include <asm/addrspace.h> | ||
31 | #include <asm/bootinfo.h> | ||
32 | #include <asm/emma2rh/emma2rh.h> | ||
33 | |||
34 | const char *get_system_type(void) | ||
35 | { | ||
36 | #ifdef CONFIG_NEC_MARKEINS | ||
37 | return "NEC EMMA2RH Mark-eins"; | ||
38 | #else | ||
39 | #error Unknown NEC board | ||
40 | #endif | ||
41 | } | ||
42 | |||
43 | /* [jsun@junsun.net] PMON passes arguments in C main() style */ | ||
44 | void __init prom_init(void) | ||
45 | { | ||
46 | int argc = fw_arg0; | ||
47 | char **arg = (char **)fw_arg1; | ||
48 | int i; | ||
49 | |||
50 | /* if user passes kernel args, ignore the default one */ | ||
51 | if (argc > 1) | ||
52 | arcs_cmdline[0] = '\0'; | ||
53 | |||
54 | /* arg[0] is "g", the rest is boot parameters */ | ||
55 | for (i = 1; i < argc; i++) { | ||
56 | if (strlen(arcs_cmdline) + strlen(arg[i] + 1) | ||
57 | >= sizeof(arcs_cmdline)) | ||
58 | break; | ||
59 | strcat(arcs_cmdline, arg[i]); | ||
60 | strcat(arcs_cmdline, " "); | ||
61 | } | ||
62 | |||
63 | #ifdef CONFIG_NEC_MARKEINS | ||
64 | add_memory_region(0, EMMA2RH_RAM_SIZE, BOOT_MEM_RAM); | ||
65 | #else | ||
66 | #error Unknown NEC board | ||
67 | #endif | ||
68 | } | ||
69 | |||
70 | void __init prom_free_prom_memory(void) | ||
71 | { | ||
72 | } | ||