OMAP: Add new function to check wether there is irq pending
[linux-ginger.git] / arch / sh / boards / mach-systemh / irq.c
blob986a0e71d22004b7e56b89427a25f80aba00a362
1 /*
2 * linux/arch/sh/boards/renesas/systemh/irq.c
4 * Copyright (C) 2000 Kazumoto Kojima
6 * Hitachi SystemH Support.
8 * Modified for 7751 SystemH by
9 * Jonathan Short.
12 #include <linux/init.h>
13 #include <linux/irq.h>
14 #include <linux/interrupt.h>
15 #include <linux/io.h>
17 #include <mach/systemh7751.h>
18 #include <asm/smc37c93x.h>
20 /* address of external interrupt mask register
21 * address must be set prior to use these (maybe in init_XXX_irq())
22 * XXX : is it better to use .config than specifying it in code? */
23 static unsigned long *systemh_irq_mask_register = (unsigned long *)0xB3F10004;
24 static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000;
26 /* forward declaration */
27 static void enable_systemh_irq(unsigned int irq);
28 static void disable_systemh_irq(unsigned int irq);
29 static void mask_and_ack_systemh(unsigned int);
31 static struct irq_chip systemh_irq_type = {
32 .name = " SystemH Register",
33 .unmask = enable_systemh_irq,
34 .mask = disable_systemh_irq,
35 .ack = mask_and_ack_systemh,
38 static void disable_systemh_irq(unsigned int irq)
40 if (systemh_irq_mask_register) {
41 unsigned long val, mask = 0x01 << 1;
43 /* Clear the "irq"th bit in the mask and set it in the request */
44 val = ctrl_inl((unsigned long)systemh_irq_mask_register);
45 val &= ~mask;
46 ctrl_outl(val, (unsigned long)systemh_irq_mask_register);
48 val = ctrl_inl((unsigned long)systemh_irq_request_register);
49 val |= mask;
50 ctrl_outl(val, (unsigned long)systemh_irq_request_register);
54 static void enable_systemh_irq(unsigned int irq)
56 if (systemh_irq_mask_register) {
57 unsigned long val, mask = 0x01 << 1;
59 /* Set "irq"th bit in the mask register */
60 val = ctrl_inl((unsigned long)systemh_irq_mask_register);
61 val |= mask;
62 ctrl_outl(val, (unsigned long)systemh_irq_mask_register);
66 static void mask_and_ack_systemh(unsigned int irq)
68 disable_systemh_irq(irq);
71 void make_systemh_irq(unsigned int irq)
73 disable_irq_nosync(irq);
74 set_irq_chip_and_handler(irq, &systemh_irq_type, handle_level_irq);
75 disable_systemh_irq(irq);