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/config.h>
13 #include <linux/init.h>
14 #include <linux/irq.h>
16 #include <linux/hdreg.h>
17 #include <linux/ide.h>
19 #include <asm/mach/7751systemh.h>
20 #include <asm/smc37c93x.h>
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? */
25 static unsigned long *systemh_irq_mask_register
= (unsigned long *)0xB3F10004;
26 static unsigned long *systemh_irq_request_register
= (unsigned long *)0xB3F10000;
28 /* forward declaration */
29 static unsigned int startup_systemh_irq(unsigned int irq
);
30 static void shutdown_systemh_irq(unsigned int irq
);
31 static void enable_systemh_irq(unsigned int irq
);
32 static void disable_systemh_irq(unsigned int irq
);
33 static void mask_and_ack_systemh(unsigned int);
34 static void end_systemh_irq(unsigned int irq
);
36 /* hw_interrupt_type */
37 static struct hw_interrupt_type systemh_irq_type
= {
47 static unsigned int startup_systemh_irq(unsigned int irq
)
49 enable_systemh_irq(irq
);
50 return 0; /* never anything pending */
53 static void shutdown_systemh_irq(unsigned int irq
)
55 disable_systemh_irq(irq
);
58 static void disable_systemh_irq(unsigned int irq
)
60 if (systemh_irq_mask_register
) {
62 unsigned long val
, mask
= 0x01 << 1;
64 /* Clear the "irq"th bit in the mask and set it in the request */
65 local_irq_save(flags
);
67 val
= ctrl_inl((unsigned long)systemh_irq_mask_register
);
69 ctrl_outl(val
, (unsigned long)systemh_irq_mask_register
);
71 val
= ctrl_inl((unsigned long)systemh_irq_request_register
);
73 ctrl_outl(val
, (unsigned long)systemh_irq_request_register
);
75 local_irq_restore(flags
);
79 static void enable_systemh_irq(unsigned int irq
)
81 if (systemh_irq_mask_register
) {
83 unsigned long val
, mask
= 0x01 << 1;
85 /* Set "irq"th bit in the mask register */
86 local_irq_save(flags
);
87 val
= ctrl_inl((unsigned long)systemh_irq_mask_register
);
89 ctrl_outl(val
, (unsigned long)systemh_irq_mask_register
);
90 local_irq_restore(flags
);
94 static void mask_and_ack_systemh(unsigned int irq
)
96 disable_systemh_irq(irq
);
99 static void end_systemh_irq(unsigned int irq
)
101 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
|IRQ_INPROGRESS
)))
102 enable_systemh_irq(irq
);
105 void make_systemh_irq(unsigned int irq
)
107 disable_irq_nosync(irq
);
108 irq_desc
[irq
].handler
= &systemh_irq_type
;
109 disable_systemh_irq(irq
);