blob: f2e7e655ca35dbc0e54356cb5f583bc0bb4a7fea [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/* arch/arm/mach-lh7a40x/irq-lh7a400.c
2 *
3 * Copyright (C) 2004 Coastal Environmental Systems
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * version 2 as published by the Free Software Foundation.
8 *
9 */
10
11#include <linux/init.h>
12#include <linux/module.h>
13#include <linux/interrupt.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070014
Russell Kinga09e64f2008-08-05 16:14:15 +010015#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070016#include <asm/irq.h>
17#include <asm/mach/irq.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010018#include <mach/irqs.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019
Russell King411ef7f2006-03-04 10:37:07 +000020#include "common.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
22 /* CPU IRQ handling */
23
Lennert Buytenhek3b7cff62010-11-29 10:34:58 +010024static void lh7a400_mask_irq(struct irq_data *d)
Linus Torvalds1da177e2005-04-16 15:20:36 -070025{
Lennert Buytenhek3b7cff62010-11-29 10:34:58 +010026 INTC_INTENC = (1 << d->irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070027}
28
Lennert Buytenhek3b7cff62010-11-29 10:34:58 +010029static void lh7a400_unmask_irq(struct irq_data *d)
Linus Torvalds1da177e2005-04-16 15:20:36 -070030{
Lennert Buytenhek3b7cff62010-11-29 10:34:58 +010031 INTC_INTENS = (1 << d->irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070032}
33
Lennert Buytenhek3b7cff62010-11-29 10:34:58 +010034static void lh7a400_ack_gpio_irq(struct irq_data *d)
Linus Torvalds1da177e2005-04-16 15:20:36 -070035{
Lennert Buytenhek3b7cff62010-11-29 10:34:58 +010036 GPIO_GPIOFEOI = (1 << IRQ_TO_GPIO (d->irq));
37 INTC_INTENC = (1 << d->irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070038}
39
David Brownell38c677c2006-08-01 22:26:25 +010040static struct irq_chip lh7a400_internal_chip = {
Lennert Buytenhek3b7cff62010-11-29 10:34:58 +010041 .name = "MPU",
42 .irq_ack = lh7a400_mask_irq, /* Level triggering -> mask is ack */
43 .irq_mask = lh7a400_mask_irq,
44 .irq_unmask = lh7a400_unmask_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -070045};
46
David Brownell38c677c2006-08-01 22:26:25 +010047static struct irq_chip lh7a400_gpio_chip = {
Lennert Buytenhek3b7cff62010-11-29 10:34:58 +010048 .name = "GPIO",
49 .irq_ack = lh7a400_ack_gpio_irq,
50 .irq_mask = lh7a400_mask_irq,
51 .irq_unmask = lh7a400_unmask_irq,
Linus Torvalds1da177e2005-04-16 15:20:36 -070052};
53
54
55 /* IRQ initialization */
56
57void __init lh7a400_init_irq (void)
58{
59 int irq;
60
61 INTC_INTENC = 0xffffffff; /* Disable all interrupts */
62 GPIO_GPIOFINTEN = 0x00; /* Disable all GPIOF interrupts */
63 barrier ();
64
65 for (irq = 0; irq < NR_IRQS; ++irq) {
66 switch (irq) {
67 case IRQ_GPIO0INTR:
68 case IRQ_GPIO1INTR:
69 case IRQ_GPIO2INTR:
70 case IRQ_GPIO3INTR:
71 case IRQ_GPIO4INTR:
72 case IRQ_GPIO5INTR:
73 case IRQ_GPIO6INTR:
74 case IRQ_GPIO7INTR:
75 set_irq_chip (irq, &lh7a400_gpio_chip);
Russell King10dd5ce2006-11-23 11:41:32 +000076 set_irq_handler (irq, handle_level_irq); /* OK default */
Linus Torvalds1da177e2005-04-16 15:20:36 -070077 break;
78 default:
79 set_irq_chip (irq, &lh7a400_internal_chip);
Russell King10dd5ce2006-11-23 11:41:32 +000080 set_irq_handler (irq, handle_level_irq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 }
82 set_irq_flags (irq, IRQF_VALID);
83 }
84
85 lh7a40x_init_board_irq ();
86
87/* *** FIXME: the LH7a400 does use FIQ interrupts in some cases. For
88 the time being, these are not initialized. */
89
90/* init_FIQ(); */
91}