nfsd4: typo logical vs bitwise negate for want_mask
[linux-btrfs-devel.git] / arch / arm / mach-tcc8k / irq.c
blob209fa5c65d4cee50bafa54e6a5d38b120472c33d
1 /*
2 * Copyright (C) Telechips, Inc.
3 * Copyright (C) 2009-2010 Hans J. Koch <hjk@linutronix.de>
5 * Licensed under the terms of the GNU GPL version 2.
6 */
8 #include <linux/init.h>
9 #include <linux/interrupt.h>
10 #include <linux/io.h>
12 #include <asm/irq.h>
13 #include <asm/mach/irq.h>
15 #include <mach/tcc8k-regs.h>
16 #include <mach/irqs.h>
18 #include "common.h"
20 /* Disable IRQ */
21 static void tcc8000_mask_ack_irq0(struct irq_data *d)
23 PIC0_IEN &= ~(1 << d->irq);
24 PIC0_CREQ |= (1 << d->irq);
27 static void tcc8000_mask_ack_irq1(struct irq_data *d)
29 PIC1_IEN &= ~(1 << (d->irq - 32));
30 PIC1_CREQ |= (1 << (d->irq - 32));
33 static void tcc8000_mask_irq0(struct irq_data *d)
35 PIC0_IEN &= ~(1 << d->irq);
38 static void tcc8000_mask_irq1(struct irq_data *d)
40 PIC1_IEN &= ~(1 << (d->irq - 32));
43 static void tcc8000_ack_irq0(struct irq_data *d)
45 PIC0_CREQ |= (1 << d->irq);
48 static void tcc8000_ack_irq1(struct irq_data *d)
50 PIC1_CREQ |= (1 << (d->irq - 32));
53 /* Enable IRQ */
54 static void tcc8000_unmask_irq0(struct irq_data *d)
56 PIC0_IEN |= (1 << d->irq);
57 PIC0_INTOEN |= (1 << d->irq);
60 static void tcc8000_unmask_irq1(struct irq_data *d)
62 PIC1_IEN |= (1 << (d->irq - 32));
63 PIC1_INTOEN |= (1 << (d->irq - 32));
66 static struct irq_chip tcc8000_irq_chip0 = {
67 .name = "tcc_irq0",
68 .irq_mask = tcc8000_mask_irq0,
69 .irq_ack = tcc8000_ack_irq0,
70 .irq_mask_ack = tcc8000_mask_ack_irq0,
71 .irq_unmask = tcc8000_unmask_irq0,
74 static struct irq_chip tcc8000_irq_chip1 = {
75 .name = "tcc_irq1",
76 .irq_mask = tcc8000_mask_irq1,
77 .irq_ack = tcc8000_ack_irq1,
78 .irq_mask_ack = tcc8000_mask_ack_irq1,
79 .irq_unmask = tcc8000_unmask_irq1,
82 void __init tcc8k_init_irq(void)
84 int irqno;
86 /* Mask and clear all interrupts */
87 PIC0_IEN = 0x00000000;
88 PIC0_CREQ = 0xffffffff;
89 PIC1_IEN = 0x00000000;
90 PIC1_CREQ = 0xffffffff;
92 PIC0_MEN0 = 0x00000003;
93 PIC1_MEN1 = 0x00000003;
94 PIC1_MEN = 0x00000003;
96 /* let all IRQs be level triggered */
97 PIC0_TMODE = 0xffffffff;
98 PIC1_TMODE = 0xffffffff;
99 /* all IRQs are IRQs (not FIQs) */
100 PIC0_IRQSEL = 0xffffffff;
101 PIC1_IRQSEL = 0xffffffff;
103 for (irqno = 0; irqno < NR_IRQS; irqno++) {
104 if (irqno < 32)
105 irq_set_chip(irqno, &tcc8000_irq_chip0);
106 else
107 irq_set_chip(irqno, &tcc8000_irq_chip1);
108 irq_set_handler(irqno, handle_level_irq);
109 set_irq_flags(irqno, IRQF_VALID);