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 | |
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')
-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 | ||||
-rw-r--r-- | arch/mips/emma/markeins/Makefile | 13 | ||||
-rw-r--r-- | arch/mips/emma/markeins/irq.c | 132 | ||||
-rw-r--r-- | arch/mips/emma/markeins/irq_markeins.c | 158 | ||||
-rw-r--r-- | arch/mips/emma/markeins/led.c | 60 | ||||
-rw-r--r-- | arch/mips/emma/markeins/platform.c | 191 | ||||
-rw-r--r-- | arch/mips/emma/markeins/setup.c | 135 |
10 files changed, 985 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 | } | ||
diff --git a/arch/mips/emma/markeins/Makefile b/arch/mips/emma/markeins/Makefile new file mode 100644 index 000000000000..3c8b864f7bc5 --- /dev/null +++ b/arch/mips/emma/markeins/Makefile | |||
@@ -0,0 +1,13 @@ | |||
1 | # | ||
2 | # arch/mips/emma2rh/markeins/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_markeins.o setup.o led.o platform.o | ||
diff --git a/arch/mips/emma/markeins/irq.c b/arch/mips/emma/markeins/irq.c new file mode 100644 index 000000000000..6bcf6a06367a --- /dev/null +++ b/arch/mips/emma/markeins/irq.c | |||
@@ -0,0 +1,132 @@ | |||
1 | /* | ||
2 | * arch/mips/emma2rh/markeins/irq.c | ||
3 | * This file defines the irq handler for EMMA2RH. | ||
4 | * | ||
5 | * Copyright (C) NEC Electronics Corporation 2004-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 | #include <linux/ptrace.h> | ||
30 | #include <linux/delay.h> | ||
31 | |||
32 | #include <asm/irq_cpu.h> | ||
33 | #include <asm/system.h> | ||
34 | #include <asm/mipsregs.h> | ||
35 | #include <asm/debug.h> | ||
36 | #include <asm/addrspace.h> | ||
37 | #include <asm/bootinfo.h> | ||
38 | |||
39 | #include <asm/emma2rh/emma2rh.h> | ||
40 | |||
41 | /* | ||
42 | * IRQ mapping | ||
43 | * | ||
44 | * 0-7: 8 CPU interrupts | ||
45 | * 0 - software interrupt 0 | ||
46 | * 1 - software interrupt 1 | ||
47 | * 2 - most Vrc5477 interrupts are routed to this pin | ||
48 | * 3 - (optional) some other interrupts routed to this pin for debugg | ||
49 | * 4 - not used | ||
50 | * 5 - not used | ||
51 | * 6 - not used | ||
52 | * 7 - cpu timer (used by default) | ||
53 | * | ||
54 | */ | ||
55 | |||
56 | extern void emma2rh_sw_irq_init(u32 base); | ||
57 | extern void emma2rh_gpio_irq_init(u32 base); | ||
58 | extern void emma2rh_irq_init(u32 base); | ||
59 | extern void emma2rh_irq_dispatch(void); | ||
60 | |||
61 | static struct irqaction irq_cascade = { | ||
62 | .handler = no_action, | ||
63 | .flags = 0, | ||
64 | .mask = CPU_MASK_NONE, | ||
65 | .name = "cascade", | ||
66 | .dev_id = NULL, | ||
67 | .next = NULL, | ||
68 | }; | ||
69 | |||
70 | void __init arch_init_irq(void) | ||
71 | { | ||
72 | u32 reg; | ||
73 | |||
74 | db_run(printk("markeins_irq_setup invoked.\n")); | ||
75 | |||
76 | /* by default, interrupts are disabled. */ | ||
77 | emma2rh_out32(EMMA2RH_BHIF_INT_EN_0, 0); | ||
78 | emma2rh_out32(EMMA2RH_BHIF_INT_EN_1, 0); | ||
79 | emma2rh_out32(EMMA2RH_BHIF_INT_EN_2, 0); | ||
80 | emma2rh_out32(EMMA2RH_BHIF_INT1_EN_0, 0); | ||
81 | emma2rh_out32(EMMA2RH_BHIF_INT1_EN_1, 0); | ||
82 | emma2rh_out32(EMMA2RH_BHIF_INT1_EN_2, 0); | ||
83 | emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, 0); | ||
84 | |||
85 | clear_c0_status(0xff00); | ||
86 | set_c0_status(0x0400); | ||
87 | |||
88 | #define GPIO_PCI (0xf<<15) | ||
89 | /* setup GPIO interrupt for PCI interface */ | ||
90 | /* direction input */ | ||
91 | reg = emma2rh_in32(EMMA2RH_GPIO_DIR); | ||
92 | emma2rh_out32(EMMA2RH_GPIO_DIR, reg & ~GPIO_PCI); | ||
93 | /* disable interrupt */ | ||
94 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); | ||
95 | emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg & ~GPIO_PCI); | ||
96 | /* level triggerd */ | ||
97 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MODE); | ||
98 | emma2rh_out32(EMMA2RH_GPIO_INT_MODE, reg | GPIO_PCI); | ||
99 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_CND_A); | ||
100 | emma2rh_out32(EMMA2RH_GPIO_INT_CND_A, reg & (~GPIO_PCI)); | ||
101 | /* interrupt clear */ | ||
102 | emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~GPIO_PCI); | ||
103 | |||
104 | /* init all controllers */ | ||
105 | emma2rh_irq_init(EMMA2RH_IRQ_BASE); | ||
106 | emma2rh_sw_irq_init(EMMA2RH_SW_IRQ_BASE); | ||
107 | emma2rh_gpio_irq_init(EMMA2RH_GPIO_IRQ_BASE); | ||
108 | mips_cpu_irq_init(); | ||
109 | |||
110 | /* setup cascade interrupts */ | ||
111 | setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_SW_CASCADE, &irq_cascade); | ||
112 | setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_GPIO_CASCADE, &irq_cascade); | ||
113 | setup_irq(CPU_IRQ_BASE + CPU_EMMA2RH_CASCADE, &irq_cascade); | ||
114 | } | ||
115 | |||
116 | asmlinkage void plat_irq_dispatch(void) | ||
117 | { | ||
118 | unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; | ||
119 | |||
120 | if (pending & STATUSF_IP7) | ||
121 | do_IRQ(CPU_IRQ_BASE + 7); | ||
122 | else if (pending & STATUSF_IP2) | ||
123 | emma2rh_irq_dispatch(); | ||
124 | else if (pending & STATUSF_IP1) | ||
125 | do_IRQ(CPU_IRQ_BASE + 1); | ||
126 | else if (pending & STATUSF_IP0) | ||
127 | do_IRQ(CPU_IRQ_BASE + 0); | ||
128 | else | ||
129 | spurious_interrupt(); | ||
130 | } | ||
131 | |||
132 | |||
diff --git a/arch/mips/emma/markeins/irq_markeins.c b/arch/mips/emma/markeins/irq_markeins.c new file mode 100644 index 000000000000..fba5c156f472 --- /dev/null +++ b/arch/mips/emma/markeins/irq_markeins.c | |||
@@ -0,0 +1,158 @@ | |||
1 | /* | ||
2 | * arch/mips/emma2rh/markeins/irq_markeins.c | ||
3 | * This file defines the irq handler for Mark-eins. | ||
4 | * | ||
5 | * Copyright (C) NEC Electronics Corporation 2004-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 | #include <linux/interrupt.h> | ||
26 | #include <linux/irq.h> | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/ptrace.h> | ||
29 | |||
30 | #include <asm/debug.h> | ||
31 | #include <asm/emma2rh/emma2rh.h> | ||
32 | |||
33 | static int emma2rh_sw_irq_base = -1; | ||
34 | static int emma2rh_gpio_irq_base = -1; | ||
35 | |||
36 | void ll_emma2rh_sw_irq_enable(int reg); | ||
37 | void ll_emma2rh_sw_irq_disable(int reg); | ||
38 | void ll_emma2rh_gpio_irq_enable(int reg); | ||
39 | void ll_emma2rh_gpio_irq_disable(int reg); | ||
40 | |||
41 | static void emma2rh_sw_irq_enable(unsigned int irq) | ||
42 | { | ||
43 | ll_emma2rh_sw_irq_enable(irq - emma2rh_sw_irq_base); | ||
44 | } | ||
45 | |||
46 | static void emma2rh_sw_irq_disable(unsigned int irq) | ||
47 | { | ||
48 | ll_emma2rh_sw_irq_disable(irq - emma2rh_sw_irq_base); | ||
49 | } | ||
50 | |||
51 | struct irq_chip emma2rh_sw_irq_controller = { | ||
52 | .name = "emma2rh_sw_irq", | ||
53 | .ack = emma2rh_sw_irq_disable, | ||
54 | .mask = emma2rh_sw_irq_disable, | ||
55 | .mask_ack = emma2rh_sw_irq_disable, | ||
56 | .unmask = emma2rh_sw_irq_enable, | ||
57 | }; | ||
58 | |||
59 | void emma2rh_sw_irq_init(u32 irq_base) | ||
60 | { | ||
61 | u32 i; | ||
62 | |||
63 | for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_SW; i++) | ||
64 | set_irq_chip_and_handler(i, &emma2rh_sw_irq_controller, | ||
65 | handle_level_irq); | ||
66 | |||
67 | emma2rh_sw_irq_base = irq_base; | ||
68 | } | ||
69 | |||
70 | void ll_emma2rh_sw_irq_enable(int irq) | ||
71 | { | ||
72 | u32 reg; | ||
73 | |||
74 | db_assert(irq >= 0); | ||
75 | db_assert(irq < NUM_EMMA2RH_IRQ_SW); | ||
76 | |||
77 | reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); | ||
78 | reg |= 1 << irq; | ||
79 | emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg); | ||
80 | } | ||
81 | |||
82 | void ll_emma2rh_sw_irq_disable(int irq) | ||
83 | { | ||
84 | u32 reg; | ||
85 | |||
86 | db_assert(irq >= 0); | ||
87 | db_assert(irq < 32); | ||
88 | |||
89 | reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); | ||
90 | reg &= ~(1 << irq); | ||
91 | emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg); | ||
92 | } | ||
93 | |||
94 | static void emma2rh_gpio_irq_enable(unsigned int irq) | ||
95 | { | ||
96 | ll_emma2rh_gpio_irq_enable(irq - emma2rh_gpio_irq_base); | ||
97 | } | ||
98 | |||
99 | static void emma2rh_gpio_irq_disable(unsigned int irq) | ||
100 | { | ||
101 | ll_emma2rh_gpio_irq_disable(irq - emma2rh_gpio_irq_base); | ||
102 | } | ||
103 | |||
104 | static void emma2rh_gpio_irq_ack(unsigned int irq) | ||
105 | { | ||
106 | irq -= emma2rh_gpio_irq_base; | ||
107 | emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq)); | ||
108 | ll_emma2rh_gpio_irq_disable(irq); | ||
109 | } | ||
110 | |||
111 | static void emma2rh_gpio_irq_end(unsigned int irq) | ||
112 | { | ||
113 | if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) | ||
114 | ll_emma2rh_gpio_irq_enable(irq - emma2rh_gpio_irq_base); | ||
115 | } | ||
116 | |||
117 | struct irq_chip emma2rh_gpio_irq_controller = { | ||
118 | .name = "emma2rh_gpio_irq", | ||
119 | .ack = emma2rh_gpio_irq_ack, | ||
120 | .mask = emma2rh_gpio_irq_disable, | ||
121 | .mask_ack = emma2rh_gpio_irq_ack, | ||
122 | .unmask = emma2rh_gpio_irq_enable, | ||
123 | .end = emma2rh_gpio_irq_end, | ||
124 | }; | ||
125 | |||
126 | void emma2rh_gpio_irq_init(u32 irq_base) | ||
127 | { | ||
128 | u32 i; | ||
129 | |||
130 | for (i = irq_base; i < irq_base + NUM_EMMA2RH_IRQ_GPIO; i++) | ||
131 | set_irq_chip(i, &emma2rh_gpio_irq_controller); | ||
132 | |||
133 | emma2rh_gpio_irq_base = irq_base; | ||
134 | } | ||
135 | |||
136 | void ll_emma2rh_gpio_irq_enable(int irq) | ||
137 | { | ||
138 | u32 reg; | ||
139 | |||
140 | db_assert(irq >= 0); | ||
141 | db_assert(irq < NUM_EMMA2RH_IRQ_GPIO); | ||
142 | |||
143 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); | ||
144 | reg |= 1 << irq; | ||
145 | emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); | ||
146 | } | ||
147 | |||
148 | void ll_emma2rh_gpio_irq_disable(int irq) | ||
149 | { | ||
150 | u32 reg; | ||
151 | |||
152 | db_assert(irq >= 0); | ||
153 | db_assert(irq < NUM_EMMA2RH_IRQ_GPIO); | ||
154 | |||
155 | reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); | ||
156 | reg &= ~(1 << irq); | ||
157 | emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); | ||
158 | } | ||
diff --git a/arch/mips/emma/markeins/led.c b/arch/mips/emma/markeins/led.c new file mode 100644 index 000000000000..b65254c1bfe9 --- /dev/null +++ b/arch/mips/emma/markeins/led.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * arch/mips/emma2rh/markeins/led.c | ||
3 | * This file defines the led display for Mark-eins. | ||
4 | * | ||
5 | * Copyright (C) NEC Electronics Corporation 2004-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 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/types.h> | ||
23 | #include <linux/string.h> | ||
24 | #include <asm/emma2rh/emma2rh.h> | ||
25 | |||
26 | const unsigned long clear = 0x20202020; | ||
27 | |||
28 | #define LED_BASE 0xb1400038 | ||
29 | |||
30 | void markeins_led_clear(void) | ||
31 | { | ||
32 | emma2rh_out32(LED_BASE, clear); | ||
33 | emma2rh_out32(LED_BASE + 4, clear); | ||
34 | } | ||
35 | |||
36 | void markeins_led(const char *str) | ||
37 | { | ||
38 | int i; | ||
39 | int len = strlen(str); | ||
40 | |||
41 | markeins_led_clear(); | ||
42 | if (len > 8) | ||
43 | len = 8; | ||
44 | |||
45 | if (emma2rh_in32(0xb0000800) & (0x1 << 18)) | ||
46 | for (i = 0; i < len; i++) | ||
47 | emma2rh_out8(LED_BASE + i, str[i]); | ||
48 | else | ||
49 | for (i = 0; i < len; i++) | ||
50 | emma2rh_out8(LED_BASE + (i & 4) + (3 - (i & 3)), | ||
51 | str[i]); | ||
52 | } | ||
53 | |||
54 | void markeins_led_hex(u32 val) | ||
55 | { | ||
56 | char str[10]; | ||
57 | |||
58 | sprintf(str, "%08x", val); | ||
59 | markeins_led(str); | ||
60 | } | ||
diff --git a/arch/mips/emma/markeins/platform.c b/arch/mips/emma/markeins/platform.c new file mode 100644 index 000000000000..fb9cda253ab0 --- /dev/null +++ b/arch/mips/emma/markeins/platform.c | |||
@@ -0,0 +1,191 @@ | |||
1 | /* | ||
2 | * arch/mips/emma2rh/markeins/platofrm.c | ||
3 | * This file sets up platform devices for EMMA2RH Mark-eins. | ||
4 | * | ||
5 | * Copyright(C) MontaVista Software Inc, 2006 | ||
6 | * | ||
7 | * Author: dmitry pervushin <dpervushin@ru.mvista.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License as published by | ||
11 | * the Free Software Foundation; either version 2 of the License, or | ||
12 | * (at your option) any later version. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/types.h> | ||
26 | #include <linux/ioport.h> | ||
27 | #include <linux/serial_8250.h> | ||
28 | #include <linux/mtd/physmap.h> | ||
29 | |||
30 | #include <asm/cpu.h> | ||
31 | #include <asm/bootinfo.h> | ||
32 | #include <asm/addrspace.h> | ||
33 | #include <asm/time.h> | ||
34 | #include <asm/bcache.h> | ||
35 | #include <asm/irq.h> | ||
36 | #include <asm/reboot.h> | ||
37 | #include <asm/traps.h> | ||
38 | |||
39 | #include <asm/emma2rh/emma2rh.h> | ||
40 | |||
41 | |||
42 | #define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */ | ||
43 | |||
44 | static struct resource i2c_emma_resources_0[] = { | ||
45 | { | ||
46 | .name = NULL, | ||
47 | .start = EMMA2RH_IRQ_PIIC0, | ||
48 | .end = EMMA2RH_IRQ_PIIC0, | ||
49 | .flags = IORESOURCE_IRQ | ||
50 | }, { | ||
51 | .name = NULL, | ||
52 | .start = EMMA2RH_PIIC0_BASE, | ||
53 | .end = EMMA2RH_PIIC0_BASE + 0x1000, | ||
54 | .flags = 0 | ||
55 | }, | ||
56 | }; | ||
57 | |||
58 | struct resource i2c_emma_resources_1[] = { | ||
59 | { | ||
60 | .name = NULL, | ||
61 | .start = EMMA2RH_IRQ_PIIC1, | ||
62 | .end = EMMA2RH_IRQ_PIIC1, | ||
63 | .flags = IORESOURCE_IRQ | ||
64 | }, { | ||
65 | .name = NULL, | ||
66 | .start = EMMA2RH_PIIC1_BASE, | ||
67 | .end = EMMA2RH_PIIC1_BASE + 0x1000, | ||
68 | .flags = 0 | ||
69 | }, | ||
70 | }; | ||
71 | |||
72 | struct resource i2c_emma_resources_2[] = { | ||
73 | { | ||
74 | .name = NULL, | ||
75 | .start = EMMA2RH_IRQ_PIIC2, | ||
76 | .end = EMMA2RH_IRQ_PIIC2, | ||
77 | .flags = IORESOURCE_IRQ | ||
78 | }, { | ||
79 | .name = NULL, | ||
80 | .start = EMMA2RH_PIIC2_BASE, | ||
81 | .end = EMMA2RH_PIIC2_BASE + 0x1000, | ||
82 | .flags = 0 | ||
83 | }, | ||
84 | }; | ||
85 | |||
86 | struct platform_device i2c_emma_devices[] = { | ||
87 | [0] = { | ||
88 | .name = I2C_EMMA2RH, | ||
89 | .id = 0, | ||
90 | .resource = i2c_emma_resources_0, | ||
91 | .num_resources = ARRAY_SIZE(i2c_emma_resources_0), | ||
92 | }, | ||
93 | [1] = { | ||
94 | .name = I2C_EMMA2RH, | ||
95 | .id = 1, | ||
96 | .resource = i2c_emma_resources_1, | ||
97 | .num_resources = ARRAY_SIZE(i2c_emma_resources_1), | ||
98 | }, | ||
99 | [2] = { | ||
100 | .name = I2C_EMMA2RH, | ||
101 | .id = 2, | ||
102 | .resource = i2c_emma_resources_2, | ||
103 | .num_resources = ARRAY_SIZE(i2c_emma_resources_2), | ||
104 | }, | ||
105 | }; | ||
106 | |||
107 | #define EMMA2RH_SERIAL_CLOCK 18544000 | ||
108 | #define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | ||
109 | |||
110 | static struct plat_serial8250_port platform_serial_ports[] = { | ||
111 | [0] = { | ||
112 | .membase= (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3), | ||
113 | .irq = EMMA2RH_IRQ_PFUR0, | ||
114 | .uartclk = EMMA2RH_SERIAL_CLOCK, | ||
115 | .regshift = 4, | ||
116 | .iotype = UPIO_MEM, | ||
117 | .flags = EMMA2RH_SERIAL_FLAGS, | ||
118 | }, [1] = { | ||
119 | .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3), | ||
120 | .irq = EMMA2RH_IRQ_PFUR1, | ||
121 | .uartclk = EMMA2RH_SERIAL_CLOCK, | ||
122 | .regshift = 4, | ||
123 | .iotype = UPIO_MEM, | ||
124 | .flags = EMMA2RH_SERIAL_FLAGS, | ||
125 | }, [2] = { | ||
126 | .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR2_BASE + 3), | ||
127 | .irq = EMMA2RH_IRQ_PFUR2, | ||
128 | .uartclk = EMMA2RH_SERIAL_CLOCK, | ||
129 | .regshift = 4, | ||
130 | .iotype = UPIO_MEM, | ||
131 | .flags = EMMA2RH_SERIAL_FLAGS, | ||
132 | }, [3] = { | ||
133 | .flags = 0, | ||
134 | }, | ||
135 | }; | ||
136 | |||
137 | static struct platform_device serial_emma = { | ||
138 | .name = "serial8250", | ||
139 | .dev = { | ||
140 | .platform_data = &platform_serial_ports, | ||
141 | }, | ||
142 | }; | ||
143 | |||
144 | static struct platform_device *devices[] = { | ||
145 | &i2c_emma_devices[0], | ||
146 | &i2c_emma_devices[1], | ||
147 | &i2c_emma_devices[2], | ||
148 | &serial_emma, | ||
149 | }; | ||
150 | |||
151 | static struct mtd_partition markeins_parts[] = { | ||
152 | [0] = { | ||
153 | .name = "RootFS", | ||
154 | .offset = 0x00000000, | ||
155 | .size = 0x00c00000, | ||
156 | }, | ||
157 | [1] = { | ||
158 | .name = "boot code area", | ||
159 | .offset = MTDPART_OFS_APPEND, | ||
160 | .size = 0x00100000, | ||
161 | }, | ||
162 | [2] = { | ||
163 | .name = "kernel image", | ||
164 | .offset = MTDPART_OFS_APPEND, | ||
165 | .size = 0x00300000, | ||
166 | }, | ||
167 | [3] = { | ||
168 | .name = "RootFS2", | ||
169 | .offset = MTDPART_OFS_APPEND, | ||
170 | .size = 0x00c00000, | ||
171 | }, | ||
172 | [4] = { | ||
173 | .name = "boot code area2", | ||
174 | .offset = MTDPART_OFS_APPEND, | ||
175 | .size = 0x00100000, | ||
176 | }, | ||
177 | [5] = { | ||
178 | .name = "kernel image2", | ||
179 | .offset = MTDPART_OFS_APPEND, | ||
180 | .size = MTDPART_SIZ_FULL, | ||
181 | }, | ||
182 | }; | ||
183 | |||
184 | static int __init platform_devices_setup(void) | ||
185 | { | ||
186 | physmap_set_partitions(markeins_parts, ARRAY_SIZE(markeins_parts)); | ||
187 | return platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
188 | } | ||
189 | |||
190 | arch_initcall(platform_devices_setup); | ||
191 | |||
diff --git a/arch/mips/emma/markeins/setup.c b/arch/mips/emma/markeins/setup.c new file mode 100644 index 000000000000..b6a23ad539f8 --- /dev/null +++ b/arch/mips/emma/markeins/setup.c | |||
@@ -0,0 +1,135 @@ | |||
1 | /* | ||
2 | * arch/mips/emma2rh/markeins/setup.c | ||
3 | * This file is setup for EMMA2RH Mark-eins. | ||
4 | * | ||
5 | * Copyright (C) NEC Electronics Corporation 2004-2006 | ||
6 | * | ||
7 | * This file is based on the arch/mips/ddb5xxx/ddb5477/setup.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/kernel.h> | ||
27 | #include <linux/types.h> | ||
28 | |||
29 | #include <asm/time.h> | ||
30 | #include <asm/reboot.h> | ||
31 | |||
32 | #include <asm/emma2rh/emma2rh.h> | ||
33 | |||
34 | #define USE_CPU_COUNTER_TIMER /* whether we use cpu counter */ | ||
35 | |||
36 | extern void markeins_led(const char *); | ||
37 | |||
38 | static int bus_frequency = 0; | ||
39 | |||
40 | static void markeins_machine_restart(char *command) | ||
41 | { | ||
42 | static void (*back_to_prom) (void) = (void (*)(void))0xbfc00000; | ||
43 | |||
44 | printk("cannot EMMA2RH Mark-eins restart.\n"); | ||
45 | markeins_led("restart."); | ||
46 | back_to_prom(); | ||
47 | } | ||
48 | |||
49 | static void markeins_machine_halt(void) | ||
50 | { | ||
51 | printk("EMMA2RH Mark-eins halted.\n"); | ||
52 | markeins_led("halted."); | ||
53 | while (1) ; | ||
54 | } | ||
55 | |||
56 | static void markeins_machine_power_off(void) | ||
57 | { | ||
58 | printk("EMMA2RH Mark-eins halted. Please turn off the power.\n"); | ||
59 | markeins_led("poweroff."); | ||
60 | while (1) ; | ||
61 | } | ||
62 | |||
63 | static unsigned long __initdata emma2rh_clock[4] = { | ||
64 | 166500000, 187312500, 199800000, 210600000 | ||
65 | }; | ||
66 | |||
67 | static unsigned int __init detect_bus_frequency(unsigned long rtc_base) | ||
68 | { | ||
69 | u32 reg; | ||
70 | |||
71 | /* detect from boot strap */ | ||
72 | reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0); | ||
73 | reg = (reg >> 4) & 0x3; | ||
74 | |||
75 | return emma2rh_clock[reg]; | ||
76 | } | ||
77 | |||
78 | void __init plat_time_init(void) | ||
79 | { | ||
80 | u32 reg; | ||
81 | if (bus_frequency == 0) | ||
82 | bus_frequency = detect_bus_frequency(0); | ||
83 | |||
84 | reg = emma2rh_in32(EMMA2RH_BHIF_STRAP_0); | ||
85 | if ((reg & 0x3) == 0) | ||
86 | reg = (reg >> 6) & 0x3; | ||
87 | else { | ||
88 | reg = emma2rh_in32(EMMA2RH_BHIF_MAIN_CTRL); | ||
89 | reg = (reg >> 4) & 0x3; | ||
90 | } | ||
91 | mips_hpt_frequency = (bus_frequency * (4 + reg)) / 4 / 2; | ||
92 | } | ||
93 | |||
94 | static void markeins_board_init(void); | ||
95 | extern void markeins_irq_setup(void); | ||
96 | |||
97 | static void inline __init markeins_sio_setup(void) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | void __init plat_mem_setup(void) | ||
102 | { | ||
103 | /* initialize board - we don't trust the loader */ | ||
104 | markeins_board_init(); | ||
105 | |||
106 | set_io_port_base(KSEG1ADDR(EMMA2RH_PCI_IO_BASE)); | ||
107 | |||
108 | _machine_restart = markeins_machine_restart; | ||
109 | _machine_halt = markeins_machine_halt; | ||
110 | pm_power_off = markeins_machine_power_off; | ||
111 | |||
112 | /* setup resource limits */ | ||
113 | ioport_resource.start = EMMA2RH_PCI_IO_BASE; | ||
114 | ioport_resource.end = EMMA2RH_PCI_IO_BASE + EMMA2RH_PCI_IO_SIZE - 1; | ||
115 | iomem_resource.start = EMMA2RH_IO_BASE; | ||
116 | iomem_resource.end = EMMA2RH_ROM_BASE - 1; | ||
117 | |||
118 | /* Reboot on panic */ | ||
119 | panic_timeout = 180; | ||
120 | |||
121 | markeins_sio_setup(); | ||
122 | } | ||
123 | |||
124 | static void __init markeins_board_init(void) | ||
125 | { | ||
126 | u32 val; | ||
127 | |||
128 | val = emma2rh_in32(EMMA2RH_PBRD_INT_EN); /* open serial interrupts. */ | ||
129 | emma2rh_out32(EMMA2RH_PBRD_INT_EN, val | 0xaa); | ||
130 | val = emma2rh_in32(EMMA2RH_PBRD_CLKSEL); /* set serial clocks. */ | ||
131 | emma2rh_out32(EMMA2RH_PBRD_CLKSEL, val | 0x5); /* 18MHz */ | ||
132 | emma2rh_out32(EMMA2RH_PCI_CONTROL, 0); | ||
133 | |||
134 | markeins_led("MVL E2RH"); | ||
135 | } | ||