summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-01-20 15:23:54 +0900
committerPaul Mundt <lethal@linux-sh.org>2010-01-20 15:23:54 +0900
commit5f240718b475dcddee86b138b624f24c681dbb29 (patch)
tree22ef5b5cc9e515496a1e4cb987ae9d5d255ca31d
parentefd590d57a5edddabaaf4cfaf532c0f674193b81 (diff)
downloadlinux-3.10-5f240718b475dcddee86b138b624f24c681dbb29.tar.gz
linux-3.10-5f240718b475dcddee86b138b624f24c681dbb29.tar.bz2
linux-3.10-5f240718b475dcddee86b138b624f24c681dbb29.zip
sh: mach-sdk7786: Split out FPGA IRQ controller setup.
This moves out the FPGA IRQ controller setup code to its own file, in preparation for switching off of IRL mode and having it provide its own irq_chip. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r--arch/sh/boards/mach-sdk7786/Makefile2
-rw-r--r--arch/sh/boards/mach-sdk7786/irq.c48
-rw-r--r--arch/sh/boards/mach-sdk7786/setup.c40
-rw-r--r--arch/sh/include/mach-sdk7786/mach/irq.h7
4 files changed, 59 insertions, 38 deletions
diff --git a/arch/sh/boards/mach-sdk7786/Makefile b/arch/sh/boards/mach-sdk7786/Makefile
index 50c8065deaa..a29f19e85b6 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 00000000000..46943a0da5b
--- /dev/null
+++ b/arch/sh/boards/mach-sdk7786/irq.c
@@ -0,0 +1,48 @@
+/*
+ * SDK7786 FPGA IRQ Controller Support.
+ *
+ * Copyright (C) 2010 Matt Fleming
+ * Copyright (C) 2010 Paul Mundt
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/irq.h>
+#include <mach/fpga.h>
+#include <mach/irq.h>
+
+enum {
+ ATA_IRQ_BIT = 1,
+ SPI_BUSY_BIT = 2,
+ LIRQ5_BIT = 3,
+ LIRQ6_BIT = 4,
+ LIRQ7_BIT = 5,
+ LIRQ8_BIT = 6,
+ KEY_IRQ_BIT = 7,
+ PEN_IRQ_BIT = 8,
+ ETH_IRQ_BIT = 9,
+ RTC_ALARM_BIT = 10,
+ CRYSTAL_FAIL_BIT = 12,
+ ETH_PME_BIT = 14,
+};
+
+void __init sdk7786_init_irq(void)
+{
+ unsigned int tmp;
+
+ /* Enable priority encoding for all IRLs */
+ fpga_write_reg(fpga_read_reg(INTMSR) | 0x0303, INTMSR);
+
+ /* Clear FPGA interrupt status registers */
+ fpga_write_reg(0x0000, INTASR);
+ fpga_write_reg(0x0000, INTBSR);
+
+ /* Unmask FPGA interrupts */
+ tmp = fpga_read_reg(INTAMR);
+ tmp &= ~(1 << ETH_IRQ_BIT);
+ fpga_write_reg(tmp, INTAMR);
+
+ plat_irq_setup_pins(IRQ_MODE_IRL7654_MASK);
+ plat_irq_setup_pins(IRQ_MODE_IRL3210_MASK);
+}
diff --git a/arch/sh/boards/mach-sdk7786/setup.c b/arch/sh/boards/mach-sdk7786/setup.c
index 8dbbdea9c98..3c3c9a38cfd 100644
--- a/arch/sh/boards/mach-sdk7786/setup.c
+++ b/arch/sh/boards/mach-sdk7786/setup.c
@@ -15,10 +15,11 @@
#include <linux/i2c.h>
#include <linux/irq.h>
#include <linux/clk.h>
+#include <mach/fpga.h>
+#include <mach/irq.h>
#include <asm/machvec.h>
#include <asm/heartbeat.h>
#include <asm/sizes.h>
-#include <mach/fpga.h>
static struct resource heartbeat_resource = {
.start = 0x07fff8b0,
@@ -132,41 +133,6 @@ static int __init sdk7786_devices_setup(void)
}
__initcall(sdk7786_devices_setup);
-enum {
- ATA_IRQ_BIT = 1,
- SPI_BUSY_BIT = 2,
- LIRQ5_BIT = 3,
- LIRQ6_BIT = 4,
- LIRQ7_BIT = 5,
- LIRQ8_BIT = 6,
- KEY_IRQ_BIT = 7,
- PEN_IRQ_BIT = 8,
- ETH_IRQ_BIT = 9,
- RTC_ALARM_BIT = 10,
- CRYSTAL_FAIL_BIT = 12,
- ETH_PME_BIT = 14,
-};
-
-static void __init init_sdk7786_IRQ(void)
-{
- unsigned int tmp;
-
- /* Enable priority encoding for all IRLs */
- fpga_write_reg(fpga_read_reg(INTMSR) | 0x0303, INTMSR);
-
- /* Clear FPGA interrupt status registers */
- fpga_write_reg(0x0000, INTASR);
- fpga_write_reg(0x0000, INTBSR);
-
- /* Unmask FPGA interrupts */
- tmp = fpga_read_reg(INTAMR);
- tmp &= ~(1 << ETH_IRQ_BIT);
- fpga_write_reg(tmp, INTAMR);
-
- plat_irq_setup_pins(IRQ_MODE_IRL7654_MASK);
- plat_irq_setup_pins(IRQ_MODE_IRL3210_MASK);
-}
-
static int sdk7786_mode_pins(void)
{
return fpga_read_reg(MODSWR);
@@ -211,5 +177,5 @@ static struct sh_machine_vector mv_sdk7786 __initmv = {
.mv_setup = sdk7786_setup,
.mv_mode_pins = sdk7786_mode_pins,
.mv_clk_init = sdk7786_clk_init,
- .mv_init_irq = init_sdk7786_IRQ,
+ .mv_init_irq = sdk7786_init_irq,
};
diff --git a/arch/sh/include/mach-sdk7786/mach/irq.h b/arch/sh/include/mach-sdk7786/mach/irq.h
new file mode 100644
index 00000000000..0f584635e6e
--- /dev/null
+++ b/arch/sh/include/mach-sdk7786/mach/irq.h
@@ -0,0 +1,7 @@
+#ifndef __MACH_SDK7786_IRQ_H
+#define __MACH_SDK7786_IRQ_H
+
+/* arch/sh/boards/mach-sdk7786/irq.c */
+extern void sdk7786_init_irq(void);
+
+#endif /* __MACH_SDK7786_IRQ_H */