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/init.h>
14 #include <linux/irq.h>
17 #include <asm/hs7751rvoip/hs7751rvoip.h>
19 static int mask_pos[] = {8, 9, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7};
21 static void enable_hs7751rvoip_irq(unsigned int irq);
22 static void disable_hs7751rvoip_irq(unsigned int irq);
24 /* shutdown is same as "disable" */
25 #define shutdown_hs7751rvoip_irq disable_hs7751rvoip_irq
27 static void ack_hs7751rvoip_irq(unsigned int irq);
28 static void end_hs7751rvoip_irq(unsigned int irq);
30 static unsigned int startup_hs7751rvoip_irq(unsigned int irq)
32 enable_hs7751rvoip_irq(irq);
33 return 0; /* never anything pending */
36 static void disable_hs7751rvoip_irq(unsigned int irq)
40 unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]);
42 /* Set the priority in IPR to 0 */
43 local_irq_save(flags);
44 val = ctrl_inw(IRLCNTR3);
46 ctrl_outw(val, IRLCNTR3);
47 local_irq_restore(flags);
50 static void enable_hs7751rvoip_irq(unsigned int irq)
54 unsigned short value = (0x0001 << mask_pos[irq]);
56 /* Set priority in IPR back to original value */
57 local_irq_save(flags);
58 val = ctrl_inw(IRLCNTR3);
60 ctrl_outw(val, IRLCNTR3);
61 local_irq_restore(flags);
64 static void ack_hs7751rvoip_irq(unsigned int irq)
66 disable_hs7751rvoip_irq(irq);
69 static void end_hs7751rvoip_irq(unsigned int irq)
71 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
72 enable_hs7751rvoip_irq(irq);
75 static struct hw_interrupt_type hs7751rvoip_irq_type = {
76 .typename = "HS7751RVoIP IRQ",
77 .startup = startup_hs7751rvoip_irq,
78 .shutdown = shutdown_hs7751rvoip_irq,
79 .enable = enable_hs7751rvoip_irq,
80 .disable = disable_hs7751rvoip_irq,
81 .ack = ack_hs7751rvoip_irq,
82 .end = end_hs7751rvoip_irq,
85 static void make_hs7751rvoip_irq(unsigned int irq)
87 disable_irq_nosync(irq);
88 irq_desc[irq].chip = &hs7751rvoip_irq_type;
89 disable_hs7751rvoip_irq(irq);
93 * Initialize IRQ setting
95 void __init init_hs7751rvoip_IRQ(void)
103 * IRL4=Ringing Detection
107 * IRL8=USB Communication
108 * IRL9=USB Connection
114 ctrl_outw(0x9876, IRLCNTR1);
115 ctrl_outw(0xdcba, IRLCNTR2);
116 ctrl_outw(0x0050, IRLCNTR4);
117 ctrl_outw(0x4321, IRLCNTR5);
120 make_hs7751rvoip_irq(i);