Merge tag 'ipvs-for-v4.4' of https://git.kernel.org/pub/scm/linux/kernel/git/horms...
[linux-2.6-block.git] / arch / arm / mach-iop33x / irq.c
CommitLineData
1da177e4 1/*
c852ac80 2 * arch/arm/mach-iop33x/irq.c
1da177e4
LT
3 *
4 * Generic IOP331 IRQ handling functionality
5 *
6 * Author: Dave Jiang <dave.jiang@intel.com>
7 * Copyright (C) 2003 Intel Corp.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
1da177e4 12 */
c852ac80 13
1da177e4
LT
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <linux/list.h>
1da177e4
LT
17#include <asm/mach/irq.h>
18#include <asm/irq.h>
a09e64fb 19#include <mach/hardware.h>
1da177e4
LT
20#include <asm/mach-types.h>
21
c852ac80
LB
22static u32 iop33x_mask0;
23static u32 iop33x_mask1;
1da177e4 24
d73d8011 25static void intctl0_write(u32 val)
1da177e4 26{
c852ac80 27 asm volatile("mcr p6, 0, %0, c0, c0, 0" : : "r" (val));
1da177e4
LT
28}
29
d73d8011 30static void intctl1_write(u32 val)
1da177e4 31{
c852ac80 32 asm volatile("mcr p6, 0, %0, c1, c0, 0" : : "r" (val));
1da177e4
LT
33}
34
d73d8011 35static void intstr0_write(u32 val)
1da177e4 36{
c852ac80 37 asm volatile("mcr p6, 0, %0, c2, c0, 0" : : "r" (val));
1da177e4
LT
38}
39
d73d8011 40static void intstr1_write(u32 val)
1da177e4 41{
c852ac80 42 asm volatile("mcr p6, 0, %0, c3, c0, 0" : : "r" (val));
1da177e4
LT
43}
44
d73d8011 45static void intbase_write(u32 val)
7412b10f 46{
7412b10f 47 asm volatile("mcr p6, 0, %0, c12, c0, 0" : : "r" (val));
7412b10f
LB
48}
49
d73d8011 50static void intsize_write(u32 val)
7412b10f 51{
7412b10f 52 asm volatile("mcr p6, 0, %0, c13, c0, 0" : : "r" (val));
7412b10f
LB
53}
54
1da177e4 55static void
a0ad2a7e 56iop33x_irq_mask1 (struct irq_data *d)
1da177e4 57{
a0ad2a7e 58 iop33x_mask0 &= ~(1 << d->irq);
c852ac80 59 intctl0_write(iop33x_mask0);
1da177e4
LT
60}
61
62static void
a0ad2a7e 63iop33x_irq_mask2 (struct irq_data *d)
1da177e4 64{
a0ad2a7e 65 iop33x_mask1 &= ~(1 << (d->irq - 32));
c852ac80 66 intctl1_write(iop33x_mask1);
1da177e4
LT
67}
68
69static void
a0ad2a7e 70iop33x_irq_unmask1(struct irq_data *d)
1da177e4 71{
a0ad2a7e 72 iop33x_mask0 |= 1 << d->irq;
c852ac80 73 intctl0_write(iop33x_mask0);
1da177e4
LT
74}
75
76static void
a0ad2a7e 77iop33x_irq_unmask2(struct irq_data *d)
1da177e4 78{
a0ad2a7e 79 iop33x_mask1 |= (1 << (d->irq - 32));
c852ac80 80 intctl1_write(iop33x_mask1);
1da177e4
LT
81}
82
c852ac80 83struct irq_chip iop33x_irqchip1 = {
a0ad2a7e
LB
84 .name = "IOP33x-1",
85 .irq_ack = iop33x_irq_mask1,
86 .irq_mask = iop33x_irq_mask1,
87 .irq_unmask = iop33x_irq_unmask1,
1da177e4
LT
88};
89
c852ac80 90struct irq_chip iop33x_irqchip2 = {
a0ad2a7e
LB
91 .name = "IOP33x-2",
92 .irq_ack = iop33x_irq_mask2,
93 .irq_mask = iop33x_irq_mask2,
94 .irq_unmask = iop33x_irq_unmask2,
1da177e4
LT
95};
96
c852ac80 97void __init iop33x_init_irq(void)
1da177e4 98{
c852ac80 99 int i;
1da177e4 100
588ef769
DW
101 iop_init_cp6_handler();
102
c852ac80
LB
103 intctl0_write(0);
104 intctl1_write(0);
105 intstr0_write(0);
106 intstr1_write(0);
7412b10f
LB
107 intbase_write(0);
108 intsize_write(1);
c852ac80 109 if (machine_is_iq80331())
7e9740b1 110 *IOP3XX_PCIIRSR = 0x0f;
1da177e4 111
c852ac80 112 for (i = 0; i < NR_IRQS; i++) {
f38c02f3
TG
113 irq_set_chip_and_handler(i,
114 (i < 32) ? &iop33x_irqchip1 : &iop33x_irqchip2,
115 handle_level_irq);
e8d36d5d 116 irq_clear_status_flags(i, IRQ_NOREQUEST | IRQ_NOPROBE);
1da177e4
LT
117 }
118}