]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - arch/sh/boards/renesas/hs7751rvoip/irq.c
Remove obsolete #include <linux/config.h>
[mirror_ubuntu-jammy-kernel.git] / arch / sh / boards / renesas / hs7751rvoip / irq.c
CommitLineData
1da177e4
LT
1/*
2 * linux/arch/sh/boards/renesas/hs7751rvoip/irq.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Renesas Technology Sales HS7751RVoIP Support.
7 *
8 * Modified for HS7751RVoIP by
9 * Atom Create Engineering Co., Ltd. 2002.
10 * Lineo uSolutions, Inc. 2003.
11 */
12
1da177e4
LT
13#include <linux/init.h>
14#include <linux/irq.h>
15#include <asm/io.h>
16#include <asm/irq.h>
17#include <asm/hs7751rvoip/hs7751rvoip.h>
18
19static int mask_pos[] = {8, 9, 10, 11, 12, 13, 0, 1, 2, 3, 4, 5, 6, 7};
20
21static void enable_hs7751rvoip_irq(unsigned int irq);
22static void disable_hs7751rvoip_irq(unsigned int irq);
23
24/* shutdown is same as "disable" */
25#define shutdown_hs7751rvoip_irq disable_hs7751rvoip_irq
26
27static void ack_hs7751rvoip_irq(unsigned int irq);
28static void end_hs7751rvoip_irq(unsigned int irq);
29
30static unsigned int startup_hs7751rvoip_irq(unsigned int irq)
31{
32 enable_hs7751rvoip_irq(irq);
33 return 0; /* never anything pending */
34}
35
36static void disable_hs7751rvoip_irq(unsigned int irq)
37{
38 unsigned long flags;
39 unsigned short val;
40 unsigned short mask = 0xffff ^ (0x0001 << mask_pos[irq]);
41
42 /* Set the priority in IPR to 0 */
43 local_irq_save(flags);
44 val = ctrl_inw(IRLCNTR3);
45 val &= mask;
46 ctrl_outw(val, IRLCNTR3);
47 local_irq_restore(flags);
48}
49
50static void enable_hs7751rvoip_irq(unsigned int irq)
51{
52 unsigned long flags;
53 unsigned short val;
54 unsigned short value = (0x0001 << mask_pos[irq]);
55
56 /* Set priority in IPR back to original value */
57 local_irq_save(flags);
58 val = ctrl_inw(IRLCNTR3);
59 val |= value;
60 ctrl_outw(val, IRLCNTR3);
61 local_irq_restore(flags);
62}
63
64static void ack_hs7751rvoip_irq(unsigned int irq)
65{
66 disable_hs7751rvoip_irq(irq);
67}
68
69static void end_hs7751rvoip_irq(unsigned int irq)
70{
71 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
72 enable_hs7751rvoip_irq(irq);
73}
74
75static struct hw_interrupt_type hs7751rvoip_irq_type = {
08d0fd07
TG
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,
1da177e4
LT
83};
84
85static void make_hs7751rvoip_irq(unsigned int irq)
86{
87 disable_irq_nosync(irq);
d1bef4ed 88 irq_desc[irq].chip = &hs7751rvoip_irq_type;
1da177e4
LT
89 disable_hs7751rvoip_irq(irq);
90}
91
92/*
93 * Initialize IRQ setting
94 */
95void __init init_hs7751rvoip_IRQ(void)
96{
97 int i;
98
99 /* IRL0=ON HOOK1
100 * IRL1=OFF HOOK1
101 * IRL2=ON HOOK2
102 * IRL3=OFF HOOK2
103 * IRL4=Ringing Detection
104 * IRL5=CODEC
105 * IRL6=Ethernet
106 * IRL7=Ethernet Hub
107 * IRL8=USB Communication
108 * IRL9=USB Connection
109 * IRL10=USB DMA
110 * IRL11=CF Card
111 * IRL12=PCMCIA
112 * IRL13=PCI Slot
113 */
114 ctrl_outw(0x9876, IRLCNTR1);
115 ctrl_outw(0xdcba, IRLCNTR2);
116 ctrl_outw(0x0050, IRLCNTR4);
117 ctrl_outw(0x4321, IRLCNTR5);
118
119 for (i=0; i<14; i++)
120 make_hs7751rvoip_irq(i);
121}