2 * linux/arch/sh/boards/systemh/irq.c
4 * Copyright (C) 2000 Kazumoto Kojima
6 * Hitachi SystemH Support.
8 * Modified for 7751 SystemH by
12 #include <linux/init.h>
13 #include <linux/irq.h>
15 #include <linux/hdreg.h>
16 #include <linux/ide.h>
18 #include <asm/mach/7751systemh.h>
19 #include <asm/smc37c93x.h>
21 /* address of external interrupt mask register
22 * address must be set prior to use these (maybe in init_XXX_irq())
23 * XXX : is it better to use .config than specifying it in code? */
24 static unsigned long *systemh_irq_mask_register = (unsigned long *)0xB3F10004;
25 static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000;
27 /* forward declaration */
28 static unsigned int startup_systemh_irq(unsigned int irq);
29 static void shutdown_systemh_irq(unsigned int irq);
30 static void enable_systemh_irq(unsigned int irq);
31 static void disable_systemh_irq(unsigned int irq);
32 static void mask_and_ack_systemh(unsigned int);
33 static void end_systemh_irq(unsigned int irq);
35 /* hw_interrupt_type */
36 static struct hw_interrupt_type systemh_irq_type = {
37 .typename = " SystemH Register",
38 .startup = startup_systemh_irq,
39 .shutdown = shutdown_systemh_irq,
40 .enable = enable_systemh_irq,
41 .disable = disable_systemh_irq,
42 .ack = mask_and_ack_systemh,
43 .end = end_systemh_irq
46 static unsigned int startup_systemh_irq(unsigned int irq)
48 enable_systemh_irq(irq);
49 return 0; /* never anything pending */
52 static void shutdown_systemh_irq(unsigned int irq)
54 disable_systemh_irq(irq);
57 static void disable_systemh_irq(unsigned int irq)
59 if (systemh_irq_mask_register) {
61 unsigned long val, mask = 0x01 << 1;
63 /* Clear the "irq"th bit in the mask and set it in the request */
64 local_irq_save(flags);
66 val = ctrl_inl((unsigned long)systemh_irq_mask_register);
68 ctrl_outl(val, (unsigned long)systemh_irq_mask_register);
70 val = ctrl_inl((unsigned long)systemh_irq_request_register);
72 ctrl_outl(val, (unsigned long)systemh_irq_request_register);
74 local_irq_restore(flags);
78 static void enable_systemh_irq(unsigned int irq)
80 if (systemh_irq_mask_register) {
82 unsigned long val, mask = 0x01 << 1;
84 /* Set "irq"th bit in the mask register */
85 local_irq_save(flags);
86 val = ctrl_inl((unsigned long)systemh_irq_mask_register);
88 ctrl_outl(val, (unsigned long)systemh_irq_mask_register);
89 local_irq_restore(flags);
93 static void mask_and_ack_systemh(unsigned int irq)
95 disable_systemh_irq(irq);
98 static void end_systemh_irq(unsigned int irq)
100 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
101 enable_systemh_irq(irq);
104 void make_systemh_irq(unsigned int irq)
106 disable_irq_nosync(irq);
107 irq_desc[irq].chip = &systemh_irq_type;
108 disable_systemh_irq(irq);