2 * linux/arch/sh/boards/renesas/hs7751rvoip/irq.c
4 * Copyright (C) 2000 Kazumoto Kojima
6 * Renesas Technology Sales HS7751RVoIP Support.
8 * Modified for HS7751RVoIP by
9 * Atom Create Engineering Co., Ltd. 2002.
10 * Lineo uSolutions, Inc. 2003.
13 #include <linux/config.h>
14 #include <linux/init.h>
15 #include <linux/irq.h>
18 #include <asm/hs7751rvoip/hs7751rvoip.h>
20 static int mask_pos
[] = {8, 9, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7};
22 static void enable_hs7751rvoip_irq(unsigned int irq
);
23 static void disable_hs7751rvoip_irq(unsigned int irq
);
25 /* shutdown is same as "disable" */
26 #define shutdown_hs7751rvoip_irq disable_hs7751rvoip_irq
28 static void ack_hs7751rvoip_irq(unsigned int irq
);
29 static void end_hs7751rvoip_irq(unsigned int irq
);
31 static unsigned int startup_hs7751rvoip_irq(unsigned int irq
)
33 enable_hs7751rvoip_irq(irq
);
34 return 0; /* never anything pending */
37 static void disable_hs7751rvoip_irq(unsigned int irq
)
41 unsigned short mask
= 0xffff ^ (0x0001 << mask_pos
[irq
]);
43 /* Set the priority in IPR to 0 */
44 local_irq_save(flags
);
45 val
= ctrl_inw(IRLCNTR3
);
47 ctrl_outw(val
, IRLCNTR3
);
48 local_irq_restore(flags
);
51 static void enable_hs7751rvoip_irq(unsigned int irq
)
55 unsigned short value
= (0x0001 << mask_pos
[irq
]);
57 /* Set priority in IPR back to original value */
58 local_irq_save(flags
);
59 val
= ctrl_inw(IRLCNTR3
);
61 ctrl_outw(val
, IRLCNTR3
);
62 local_irq_restore(flags
);
65 static void ack_hs7751rvoip_irq(unsigned int irq
)
67 disable_hs7751rvoip_irq(irq
);
70 static void end_hs7751rvoip_irq(unsigned int irq
)
72 if (!(irq_desc
[irq
].status
& (IRQ_DISABLED
|IRQ_INPROGRESS
)))
73 enable_hs7751rvoip_irq(irq
);
76 static struct hw_interrupt_type hs7751rvoip_irq_type
= {
78 startup_hs7751rvoip_irq
,
79 shutdown_hs7751rvoip_irq
,
80 enable_hs7751rvoip_irq
,
81 disable_hs7751rvoip_irq
,
86 static void make_hs7751rvoip_irq(unsigned int irq
)
88 disable_irq_nosync(irq
);
89 irq_desc
[irq
].handler
= &hs7751rvoip_irq_type
;
90 disable_hs7751rvoip_irq(irq
);
94 * Initialize IRQ setting
96 void __init
init_hs7751rvoip_IRQ(void)
104 * IRL4=Ringing Detection
108 * IRL8=USB Communication
109 * IRL9=USB Connection
115 ctrl_outw(0x9876, IRLCNTR1
);
116 ctrl_outw(0xdcba, IRLCNTR2
);
117 ctrl_outw(0x0050, IRLCNTR4
);
118 ctrl_outw(0x4321, IRLCNTR5
);
121 make_hs7751rvoip_irq(i
);