| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | *	DEC I/O ASIC interrupts. | 
|  | 3 | * | 
|  | 4 | *	Copyright (c) 2002, 2003  Maciej W. Rozycki | 
|  | 5 | * | 
|  | 6 | *	This program is free software; you can redistribute it and/or | 
|  | 7 | *	modify it under the terms of the GNU General Public License | 
|  | 8 | *	as published by the Free Software Foundation; either version | 
|  | 9 | *	2 of the License, or (at your option) any later version. | 
|  | 10 | */ | 
|  | 11 |  | 
|  | 12 | #include <linux/init.h> | 
|  | 13 | #include <linux/irq.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/types.h> | 
|  | 15 |  | 
|  | 16 | #include <asm/dec/ioasic.h> | 
|  | 17 | #include <asm/dec/ioasic_addrs.h> | 
|  | 18 | #include <asm/dec/ioasic_ints.h> | 
|  | 19 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | static int ioasic_irq_base; | 
|  | 21 |  | 
| Thomas Gleixner | 009c200 | 2011-03-23 21:08:51 +0000 | [diff] [blame] | 22 | static void unmask_ioasic_irq(struct irq_data *d) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | { | 
|  | 24 | u32 simr; | 
|  | 25 |  | 
|  | 26 | simr = ioasic_read(IO_REG_SIMR); | 
| Thomas Gleixner | 009c200 | 2011-03-23 21:08:51 +0000 | [diff] [blame] | 27 | simr |= (1 << (d->irq - ioasic_irq_base)); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | ioasic_write(IO_REG_SIMR, simr); | 
|  | 29 | } | 
|  | 30 |  | 
| Thomas Gleixner | 009c200 | 2011-03-23 21:08:51 +0000 | [diff] [blame] | 31 | static void mask_ioasic_irq(struct irq_data *d) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | { | 
|  | 33 | u32 simr; | 
|  | 34 |  | 
|  | 35 | simr = ioasic_read(IO_REG_SIMR); | 
| Thomas Gleixner | 009c200 | 2011-03-23 21:08:51 +0000 | [diff] [blame] | 36 | simr &= ~(1 << (d->irq - ioasic_irq_base)); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | ioasic_write(IO_REG_SIMR, simr); | 
|  | 38 | } | 
|  | 39 |  | 
| Thomas Gleixner | 009c200 | 2011-03-23 21:08:51 +0000 | [diff] [blame] | 40 | static void ack_ioasic_irq(struct irq_data *d) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | { | 
| Thomas Gleixner | 009c200 | 2011-03-23 21:08:51 +0000 | [diff] [blame] | 42 | mask_ioasic_irq(d); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | fast_iob(); | 
|  | 44 | } | 
|  | 45 |  | 
| Ralf Baechle | 94dee17 | 2006-07-02 14:41:42 +0100 | [diff] [blame] | 46 | static struct irq_chip ioasic_irq_type = { | 
| Atsushi Nemoto | 70d21cd | 2007-01-15 00:07:25 +0900 | [diff] [blame] | 47 | .name = "IO-ASIC", | 
| Thomas Gleixner | 009c200 | 2011-03-23 21:08:51 +0000 | [diff] [blame] | 48 | .irq_ack = ack_ioasic_irq, | 
|  | 49 | .irq_mask = mask_ioasic_irq, | 
|  | 50 | .irq_mask_ack = ack_ioasic_irq, | 
|  | 51 | .irq_unmask = unmask_ioasic_irq, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | }; | 
|  | 53 |  | 
| Ralf Baechle | 94dee17 | 2006-07-02 14:41:42 +0100 | [diff] [blame] | 54 | static struct irq_chip ioasic_dma_irq_type = { | 
| Atsushi Nemoto | 70d21cd | 2007-01-15 00:07:25 +0900 | [diff] [blame] | 55 | .name = "IO-ASIC-DMA", | 
| Thomas Gleixner | 009c200 | 2011-03-23 21:08:51 +0000 | [diff] [blame] | 56 | .irq_ack = ack_ioasic_irq, | 
|  | 57 | .irq_mask = mask_ioasic_irq, | 
|  | 58 | .irq_mask_ack = ack_ioasic_irq, | 
|  | 59 | .irq_unmask = unmask_ioasic_irq, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | }; | 
|  | 61 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | void __init init_ioasic_irqs(int base) | 
|  | 63 | { | 
|  | 64 | int i; | 
|  | 65 |  | 
|  | 66 | /* Mask interrupts. */ | 
|  | 67 | ioasic_write(IO_REG_SIMR, 0); | 
|  | 68 | fast_iob(); | 
|  | 69 |  | 
| Atsushi Nemoto | 1603b5a | 2006-11-02 02:08:36 +0900 | [diff] [blame] | 70 | for (i = base; i < base + IO_INR_DMA; i++) | 
| Thomas Gleixner | e4ec798 | 2011-03-27 15:19:28 +0200 | [diff] [blame] | 71 | irq_set_chip_and_handler(i, &ioasic_irq_type, | 
| Atsushi Nemoto | 1417836 | 2006-11-14 01:13:18 +0900 | [diff] [blame] | 72 | handle_level_irq); | 
| Atsushi Nemoto | 1603b5a | 2006-11-02 02:08:36 +0900 | [diff] [blame] | 73 | for (; i < base + IO_IRQ_LINES; i++) | 
| Thomas Gleixner | e4ec798 | 2011-03-27 15:19:28 +0200 | [diff] [blame] | 74 | irq_set_chip(i, &ioasic_dma_irq_type); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 |  | 
|  | 76 | ioasic_irq_base = base; | 
|  | 77 | } |