diff options
Diffstat (limited to 'arch/sh/boards')
-rw-r--r-- | arch/sh/boards/mach-sdk7786/Makefile | 2 | ||||
-rw-r--r-- | arch/sh/boards/mach-sdk7786/irq.c | 48 | ||||
-rw-r--r-- | arch/sh/boards/mach-sdk7786/setup.c | 40 |
3 files changed, 52 insertions, 38 deletions
diff --git a/arch/sh/boards/mach-sdk7786/Makefile b/arch/sh/boards/mach-sdk7786/Makefile index 50c8065deaa0..a29f19e85b63 100644 --- a/arch/sh/boards/mach-sdk7786/Makefile +++ b/arch/sh/boards/mach-sdk7786/Makefile | |||
@@ -1 +1 @@ | |||
obj-y := setup.o fpga.o | obj-y := setup.o fpga.o irq.o | ||
diff --git a/arch/sh/boards/mach-sdk7786/irq.c b/arch/sh/boards/mach-sdk7786/irq.c new file mode 100644 index 000000000000..46943a0da5b7 --- /dev/null +++ b/arch/sh/boards/mach-sdk7786/irq.c | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * SDK7786 FPGA IRQ Controller Support. | ||
3 | * | ||
4 | * Copyright (C) 2010 Matt Fleming | ||
5 | * Copyright (C) 2010 Paul Mundt | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | #include <linux/irq.h> | ||
12 | #include <mach/fpga.h> | ||
13 | #include <mach/irq.h> | ||
14 | |||
15 | enum { | ||
16 | ATA_IRQ_BIT = 1, | ||
17 | SPI_BUSY_BIT = 2, | ||
18 | LIRQ5_BIT = 3, | ||
19 | LIRQ6_BIT = 4, | ||
20 | LIRQ7_BIT = 5, | ||
21 | LIRQ8_BIT = 6, | ||
22 | KEY_IRQ_BIT = 7, | ||
23 | PEN_IRQ_BIT = 8, | ||
24 | ETH_IRQ_BIT = 9, | ||
25 | RTC_ALARM_BIT = 10, | ||
26 | CRYSTAL_FAIL_BIT = 12, | ||
27 | ETH_PME_BIT = 14, | ||
28 | }; | ||
29 | |||
30 | void __init sdk7786_init_irq(void) | ||
31 | { | ||
32 | unsigned int tmp; | ||
33 | |||
34 | /* Enable priority encoding for all IRLs */ | ||
35 | fpga_write_reg(fpga_read_reg(INTMSR) | 0x0303, INTMSR); | ||
36 | |||
37 | /* Clear FPGA interrupt status registers */ | ||
38 | fpga_write_reg(0x0000, INTASR); | ||
39 | fpga_write_reg(0x0000, INTBSR); | ||
40 | |||
41 | /* Unmask FPGA interrupts */ | ||
42 | tmp = fpga_read_reg(INTAMR); | ||
43 | tmp &= ~(1 << ETH_IRQ_BIT); | ||
44 | fpga_write_reg(tmp, INTAMR); | ||
45 | |||
46 | plat_irq_setup_pins(IRQ_MODE_IRL7654_MASK); | ||
47 | plat_irq_setup_pins(IRQ_MODE_IRL3210_MASK); | ||
48 | } | ||
diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c index 8dbbdea9c983..3c3c9a38cfda 100644 --- a/arch/sh/boards/mach-sdk7786/setup.c +++ b/arch/sh/boards/mach-sdk7786/setup.c | |||
@@ -15,10 +15,11 @@ | |||
15 | #include <linux/i2c.h> | 15 | #include <linux/i2c.h> |
16 | #include <linux/irq.h> | 16 | #include <linux/irq.h> |
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <mach/fpga.h> | ||
19 | #include <mach/irq.h> | ||
18 | #include <asm/machvec.h> | 20 | #include <asm/machvec.h> |
19 | #include <asm/heartbeat.h> | 21 | #include <asm/heartbeat.h> |
20 | #include <asm/sizes.h> | 22 | #include <asm/sizes.h> |
21 | #include <mach/fpga.h> | ||
22 | 23 | ||
23 | static struct resource heartbeat_resource = { | 24 | static struct resource heartbeat_resource = { |
24 | .start = 0x07fff8b0, | 25 | .start = 0x07fff8b0, |
@@ -132,41 +133,6 @@ static int __init sdk7786_devices_setup(void) | |||
132 | } | 133 | } |
133 | __initcall(sdk7786_devices_setup); | 134 | __initcall(sdk7786_devices_setup); |
134 | 135 | ||
135 | enum { | ||
136 | ATA_IRQ_BIT = 1, | ||
137 | SPI_BUSY_BIT = 2, | ||
138 | LIRQ5_BIT = 3, | ||
139 | LIRQ6_BIT = 4, | ||
140 | LIRQ7_BIT = 5, | ||
141 | LIRQ8_BIT = 6, | ||
142 | KEY_IRQ_BIT = 7, | ||
143 | PEN_IRQ_BIT = 8, | ||
144 | ETH_IRQ_BIT = 9, | ||
145 | RTC_ALARM_BIT = 10, | ||
146 | CRYSTAL_FAIL_BIT = 12, | ||
147 | ETH_PME_BIT = 14, | ||
148 | }; | ||
149 | |||
150 | static void __init init_sdk7786_IRQ(void) | ||
151 | { | ||
152 | unsigned int tmp; | ||
153 | |||
154 | /* Enable priority encoding for all IRLs */ | ||
155 | fpga_write_reg(fpga_read_reg(INTMSR) | 0x0303, INTMSR); | ||
156 | |||
157 | /* Clear FPGA interrupt status registers */ | ||
158 | fpga_write_reg(0x0000, INTASR); | ||
159 | fpga_write_reg(0x0000, INTBSR); | ||
160 | |||
161 | /* Unmask FPGA interrupts */ | ||
162 | tmp = fpga_read_reg(INTAMR); | ||
163 | tmp &= ~(1 << ETH_IRQ_BIT); | ||
164 | fpga_write_reg(tmp, INTAMR); | ||
165 | |||
166 | plat_irq_setup_pins(IRQ_MODE_IRL7654_MASK); | ||
167 | plat_irq_setup_pins(IRQ_MODE_IRL3210_MASK); | ||
168 | } | ||
169 | |||
170 | static int sdk7786_mode_pins(void) | 136 | static int sdk7786_mode_pins(void) |
171 | { | 137 | { |
172 | return fpga_read_reg(MODSWR); | 138 | return fpga_read_reg(MODSWR); |
@@ -211,5 +177,5 @@ static struct sh_machine_vector mv_sdk7786 __initmv = { | |||
211 | .mv_setup = sdk7786_setup, | 177 | .mv_setup = sdk7786_setup, |
212 | .mv_mode_pins = sdk7786_mode_pins, | 178 | .mv_mode_pins = sdk7786_mode_pins, |
213 | .mv_clk_init = sdk7786_clk_init, | 179 | .mv_clk_init = sdk7786_clk_init, |
214 | .mv_init_irq = init_sdk7786_IRQ, | 180 | .mv_init_irq = sdk7786_init_irq, |
215 | }; | 181 | }; |