dmitry pervushin | 5cccd37 | 2009-04-23 12:24:13 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Freescale STMP37XX/STMP378X common interrupt handling code |
| 3 | * |
| 4 | * Author: Vladislav Buzov <vbuzov@embeddedalley.com> |
| 5 | * |
| 6 | * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved. |
| 7 | * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved. |
| 8 | */ |
| 9 | |
| 10 | /* |
| 11 | * The code contained herein is licensed under the GNU General Public |
| 12 | * License. You may obtain a copy of the GNU General Public License |
| 13 | * Version 2 or later at the following locations: |
| 14 | * |
| 15 | * http://www.opensource.org/licenses/gpl-license.html |
| 16 | * http://www.gnu.org/copyleft/gpl.html |
| 17 | */ |
| 18 | #include <linux/init.h> |
| 19 | #include <linux/interrupt.h> |
| 20 | #include <linux/delay.h> |
| 21 | #include <linux/irq.h> |
| 22 | #include <linux/sysdev.h> |
| 23 | |
| 24 | #include <mach/stmp3xxx.h> |
dmitry pervushin | 98f420b | 2009-05-31 13:32:11 +0100 | [diff] [blame] | 25 | #include <mach/platform.h> |
dmitry pervushin | 5cccd37 | 2009-04-23 12:24:13 +0100 | [diff] [blame] | 26 | #include <mach/regs-icoll.h> |
| 27 | |
| 28 | void __init stmp3xxx_init_irq(struct irq_chip *chip) |
| 29 | { |
dmitry pervushin | 98f420b | 2009-05-31 13:32:11 +0100 | [diff] [blame] | 30 | unsigned int i, lv; |
dmitry pervushin | 5cccd37 | 2009-04-23 12:24:13 +0100 | [diff] [blame] | 31 | |
| 32 | /* Reset the interrupt controller */ |
dmitry pervushin | 98f420b | 2009-05-31 13:32:11 +0100 | [diff] [blame] | 33 | stmp3xxx_reset_block(REGS_ICOLL_BASE + HW_ICOLL_CTRL, true); |
dmitry pervushin | 5cccd37 | 2009-04-23 12:24:13 +0100 | [diff] [blame] | 34 | |
| 35 | /* Disable all interrupts initially */ |
| 36 | for (i = 0; i < NR_REAL_IRQS; i++) { |
Lennert Buytenhek | 5b88128 | 2010-11-29 11:23:26 +0100 | [diff] [blame] | 37 | chip->irq_mask(irq_get_irq_data(i)); |
dmitry pervushin | 5cccd37 | 2009-04-23 12:24:13 +0100 | [diff] [blame] | 38 | set_irq_chip(i, chip); |
| 39 | set_irq_handler(i, handle_level_irq); |
| 40 | set_irq_flags(i, IRQF_VALID | IRQF_PROBE); |
| 41 | } |
| 42 | |
| 43 | /* Ensure vector is cleared */ |
dmitry pervushin | 98f420b | 2009-05-31 13:32:11 +0100 | [diff] [blame] | 44 | for (lv = 0; lv < 4; lv++) |
| 45 | __raw_writel(1 << lv, REGS_ICOLL_BASE + HW_ICOLL_LEVELACK); |
| 46 | __raw_writel(0, REGS_ICOLL_BASE + HW_ICOLL_VECTOR); |
dmitry pervushin | 5cccd37 | 2009-04-23 12:24:13 +0100 | [diff] [blame] | 47 | |
dmitry pervushin | 5cccd37 | 2009-04-23 12:24:13 +0100 | [diff] [blame] | 48 | /* Barrier */ |
dmitry pervushin | 98f420b | 2009-05-31 13:32:11 +0100 | [diff] [blame] | 49 | (void)__raw_readl(REGS_ICOLL_BASE + HW_ICOLL_STAT); |
dmitry pervushin | 5cccd37 | 2009-04-23 12:24:13 +0100 | [diff] [blame] | 50 | } |
| 51 | |