aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/renesas/systemh/irq.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sh/boards/renesas/systemh/irq.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/sh/boards/renesas/systemh/irq.c')
-rw-r--r--arch/sh/boards/renesas/systemh/irq.c111
1 files changed, 111 insertions, 0 deletions
diff --git a/arch/sh/boards/renesas/systemh/irq.c b/arch/sh/boards/renesas/systemh/irq.c
new file mode 100644
index 000000000000..5675a4134eee
--- /dev/null
+++ b/arch/sh/boards/renesas/systemh/irq.c
@@ -0,0 +1,111 @@
1/*
2 * linux/arch/sh/boards/systemh/irq.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SystemH Support.
7 *
8 * Modified for 7751 SystemH by
9 * Jonathan Short.
10 */
11
12#include <linux/config.h>
13#include <linux/init.h>
14#include <linux/irq.h>
15
16#include <linux/hdreg.h>
17#include <linux/ide.h>
18#include <asm/io.h>
19#include <asm/mach/7751systemh.h>
20#include <asm/smc37c93x.h>
21
22/* address of external interrupt mask register
23 * address must be set prior to use these (maybe in init_XXX_irq())
24 * XXX : is it better to use .config than specifying it in code? */
25static unsigned long *systemh_irq_mask_register = (unsigned long *)0xB3F10004;
26static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000;
27
28/* forward declaration */
29static unsigned int startup_systemh_irq(unsigned int irq);
30static void shutdown_systemh_irq(unsigned int irq);
31static void enable_systemh_irq(unsigned int irq);
32static void disable_systemh_irq(unsigned int irq);
33static void mask_and_ack_systemh(unsigned int);
34static void end_systemh_irq(unsigned int irq);
35
36/* hw_interrupt_type */
37static struct hw_interrupt_type systemh_irq_type = {
38 " SystemH Register",
39 startup_systemh_irq,
40 shutdown_systemh_irq,
41 enable_systemh_irq,
42 disable_systemh_irq,
43 mask_and_ack_systemh,
44 end_systemh_irq
45};
46
47static unsigned int startup_systemh_irq(unsigned int irq)
48{
49 enable_systemh_irq(irq);
50 return 0; /* never anything pending */
51}
52
53static void shutdown_systemh_irq(unsigned int irq)
54{
55 disable_systemh_irq(irq);
56}
57
58static void disable_systemh_irq(unsigned int irq)
59{
60 if (systemh_irq_mask_register) {
61 unsigned long flags;
62 unsigned long val, mask = 0x01 << 1;
63
64 /* Clear the "irq"th bit in the mask and set it in the request */
65 local_irq_save(flags);
66
67 val = ctrl_inl((unsigned long)systemh_irq_mask_register);
68 val &= ~mask;
69 ctrl_outl(val, (unsigned long)systemh_irq_mask_register);
70
71 val = ctrl_inl((unsigned long)systemh_irq_request_register);
72 val |= mask;
73 ctrl_outl(val, (unsigned long)systemh_irq_request_register);
74
75 local_irq_restore(flags);
76 }
77}
78
79static void enable_systemh_irq(unsigned int irq)
80{
81 if (systemh_irq_mask_register) {
82 unsigned long flags;
83 unsigned long val, mask = 0x01 << 1;
84
85 /* Set "irq"th bit in the mask register */
86 local_irq_save(flags);
87 val = ctrl_inl((unsigned long)systemh_irq_mask_register);
88 val |= mask;
89 ctrl_outl(val, (unsigned long)systemh_irq_mask_register);
90 local_irq_restore(flags);
91 }
92}
93
94static void mask_and_ack_systemh(unsigned int irq)
95{
96 disable_systemh_irq(irq);
97}
98
99static void end_systemh_irq(unsigned int irq)
100{
101 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
102 enable_systemh_irq(irq);
103}
104
105void make_systemh_irq(unsigned int irq)
106{
107 disable_irq_nosync(irq);
108 irq_desc[irq].handler = &systemh_irq_type;
109 disable_systemh_irq(irq);
110}
111