aboutsummaryrefslogtreecommitdiff
path: root/arch/sh/boards/landisk/irq.c
diff options
context:
space:
mode:
authorkogiidena <kogiidena@eggplant.ddo.jp>2006-09-27 14:53:35 +0900
committerPaul Mundt <lethal@linux-sh.org>2006-09-27 14:53:35 +0900
commit94c0fa520cc169ccf661e9c03b5b95f74d1520b8 (patch)
tree2fc73ea11df222998a363083e03ef6c9e8066b28 /arch/sh/boards/landisk/irq.c
parent634bf4f69b925950ddb09ef99ad7516a449a4333 (diff)
downloadlinux-2.6.34-ux500-94c0fa520cc169ccf661e9c03b5b95f74d1520b8.tar.gz
sh: landisk board support.
This adds support for the I-O DATA Landisk. Signed-off-by: kogiidena <kogiidena@eggplant.ddo.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/landisk/irq.c')
-rw-r--r--arch/sh/boards/landisk/irq.c105
1 files changed, 105 insertions, 0 deletions
diff --git a/arch/sh/boards/landisk/irq.c b/arch/sh/boards/landisk/irq.c
new file mode 100644
index 00000000000..1dcc3feb7a4
--- /dev/null
+++ b/arch/sh/boards/landisk/irq.c
@@ -0,0 +1,105 @@
+/*
+ * arch/sh/boards/landisk/irq.c
+ *
+ * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
+ * Based largely on io_se.c.
+ *
+ * I/O routine for I-O Data Device, Inc. LANDISK.
+ *
+ * Initial version only to support LAN access; some
+ * placeholder code from io_landisk.c left in with the
+ * expectation of later SuperIO and PCMCIA access.
+ */
+/*
+ * modified by kogiidena
+ * 2005.03.03
+ */
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/landisk/iodata_landisk.h>
+
+static void enable_landisk_irq(unsigned int irq);
+static void disable_landisk_irq(unsigned int irq);
+
+/* shutdown is same as "disable" */
+#define shutdown_landisk_irq disable_landisk_irq
+
+static void ack_landisk_irq(unsigned int irq);
+static void end_landisk_irq(unsigned int irq);
+
+static unsigned int startup_landisk_irq(unsigned int irq)
+{
+ enable_landisk_irq(irq);
+ return 0; /* never anything pending */
+}
+
+static void disable_landisk_irq(unsigned int irq)
+{
+ unsigned long flags;
+ unsigned char val;
+ unsigned char mask = 0xff ^ (0x01 << (irq - 5));
+
+ /* Set the priority in IPR to 0 */
+ local_irq_save(flags);
+ val = ctrl_inb(PA_IMASK);
+ val &= mask;
+ ctrl_outb(val, PA_IMASK);
+ local_irq_restore(flags);
+}
+
+static void enable_landisk_irq(unsigned int irq)
+{
+ unsigned long flags;
+ unsigned char val;
+ unsigned char value = (0x01 << (irq - 5));
+
+ /* Set priority in IPR back to original value */
+ local_irq_save(flags);
+ val = ctrl_inb(PA_IMASK);
+ val |= value;
+ ctrl_outb(val, PA_IMASK);
+ local_irq_restore(flags);
+}
+
+static void ack_landisk_irq(unsigned int irq)
+{
+ disable_landisk_irq(irq);
+}
+
+static void end_landisk_irq(unsigned int irq)
+{
+ if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
+ enable_landisk_irq(irq);
+}
+
+static struct hw_interrupt_type landisk_irq_type = {
+ .typename = "LANDISK IRQ",
+ .startup = startup_landisk_irq,
+ .shutdown = shutdown_landisk_irq,
+ .enable = enable_landisk_irq,
+ .disable = disable_landisk_irq,
+ .ack = ack_landisk_irq,
+ .end = end_landisk_irq
+};
+
+static void make_landisk_irq(unsigned int irq)
+{
+ disable_irq_nosync(irq);
+ irq_desc[irq].handler = &landisk_irq_type;
+ disable_landisk_irq(irq);
+}
+
+/*
+ * Initialize IRQ setting
+ */
+void __init init_landisk_IRQ(void)
+{
+ int i;
+
+ for (i = 5; i < 14; i++)
+ make_landisk_irq(i);
+}