diff options
| author | Shawn Guo <shawn.guo@freescale.com> | 2010-12-18 08:39:28 -0500 |
|---|---|---|
| committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-12-20 04:37:56 -0500 |
| commit | 289569f902dc70fc42b8c7cab627f9d615a720f1 (patch) | |
| tree | 340b6c539191af749885f5339f5db981ccd78cb3 | |
| parent | 65d7d94405dcc1845ad2680eeb6af43ced74fdc4 (diff) | |
ARM: mxs: Add interrupt support
Add Interrupt Collector (ICOLL) support for MXS-based.
Signed-off-by: Shawn Guo <shawn.guo@freescale.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
| -rw-r--r-- | arch/arm/mach-mxs/icoll.c | 81 | ||||
| -rw-r--r-- | arch/arm/mach-mxs/include/mach/entry-macro.S | 41 |
2 files changed, 122 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/icoll.c b/arch/arm/mach-mxs/icoll.c new file mode 100644 index 000000000000..5dd43ba70058 --- /dev/null +++ b/arch/arm/mach-mxs/icoll.c | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License along | ||
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/kernel.h> | ||
| 20 | #include <linux/init.h> | ||
| 21 | #include <linux/irq.h> | ||
| 22 | #include <linux/io.h> | ||
| 23 | |||
| 24 | #include <mach/mxs.h> | ||
| 25 | #include <mach/common.h> | ||
| 26 | |||
| 27 | #define HW_ICOLL_VECTOR 0x0000 | ||
| 28 | #define HW_ICOLL_LEVELACK 0x0010 | ||
| 29 | #define HW_ICOLL_CTRL 0x0020 | ||
| 30 | #define HW_ICOLL_INTERRUPTn_SET(n) (0x0124 + (n) * 0x10) | ||
| 31 | #define HW_ICOLL_INTERRUPTn_CLR(n) (0x0128 + (n) * 0x10) | ||
| 32 | #define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004 | ||
| 33 | #define BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 0x1 | ||
| 34 | |||
| 35 | static void __iomem *icoll_base = MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR); | ||
| 36 | |||
| 37 | static void icoll_ack_irq(unsigned int irq) | ||
| 38 | { | ||
| 39 | /* | ||
| 40 | * The Interrupt Collector is able to prioritize irqs. | ||
| 41 | * Currently only level 0 is used. So acking can use | ||
| 42 | * BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 unconditionally. | ||
| 43 | */ | ||
| 44 | __raw_writel(BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0, | ||
| 45 | icoll_base + HW_ICOLL_LEVELACK); | ||
| 46 | } | ||
| 47 | |||
| 48 | static void icoll_mask_irq(unsigned int irq) | ||
| 49 | { | ||
| 50 | __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, | ||
| 51 | icoll_base + HW_ICOLL_INTERRUPTn_CLR(irq)); | ||
| 52 | } | ||
| 53 | |||
| 54 | static void icoll_unmask_irq(unsigned int irq) | ||
| 55 | { | ||
| 56 | __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, | ||
| 57 | icoll_base + HW_ICOLL_INTERRUPTn_SET(irq)); | ||
| 58 | } | ||
| 59 | |||
| 60 | static struct irq_chip mxs_icoll_chip = { | ||
| 61 | .ack = icoll_ack_irq, | ||
| 62 | .mask = icoll_mask_irq, | ||
| 63 | .unmask = icoll_unmask_irq, | ||
| 64 | }; | ||
| 65 | |||
| 66 | void __init icoll_init_irq(void) | ||
| 67 | { | ||
| 68 | int i; | ||
| 69 | |||
| 70 | /* | ||
| 71 | * Interrupt Collector reset, which initializes the priority | ||
| 72 | * for each irq to level 0. | ||
| 73 | */ | ||
| 74 | mxs_reset_block(icoll_base + HW_ICOLL_CTRL); | ||
| 75 | |||
| 76 | for (i = 0; i < MXS_INTERNAL_IRQS; i++) { | ||
| 77 | set_irq_chip(i, &mxs_icoll_chip); | ||
| 78 | set_irq_handler(i, handle_level_irq); | ||
| 79 | set_irq_flags(i, IRQF_VALID); | ||
| 80 | } | ||
| 81 | } | ||
diff --git a/arch/arm/mach-mxs/include/mach/entry-macro.S b/arch/arm/mach-mxs/include/mach/entry-macro.S new file mode 100644 index 000000000000..9f0da12e657a --- /dev/null +++ b/arch/arm/mach-mxs/include/mach/entry-macro.S | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | /* | ||
| 2 | * Low-level IRQ helper macros for Freescale MXS-based | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved. | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; either version 2 of the License, or | ||
| 9 | * (at your option) any later version. | ||
| 10 | * | ||
| 11 | * This program is distributed in the hope that it will be useful, | ||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License along | ||
| 17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
| 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 19 | */ | ||
| 20 | |||
| 21 | #include <mach/mxs.h> | ||
| 22 | |||
| 23 | #define MXS_ICOLL_VBASE MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR) | ||
| 24 | #define HW_ICOLL_STAT_OFFSET 0x70 | ||
| 25 | |||
| 26 | .macro disable_fiq | ||
| 27 | .endm | ||
| 28 | |||
| 29 | .macro get_irqnr_and_base, irqnr, irqstat, base, tmp | ||
| 30 | ldr \irqnr, [\base, #HW_ICOLL_STAT_OFFSET] | ||
| 31 | cmp \irqnr, #0x7F | ||
| 32 | strne \irqnr, [\base] | ||
| 33 | moveqs \irqnr, #0 | ||
| 34 | .endm | ||
| 35 | |||
| 36 | .macro get_irqnr_preamble, base, tmp | ||
| 37 | ldr \base, =MXS_ICOLL_VBASE | ||
| 38 | .endm | ||
| 39 | |||
| 40 | .macro arch_ret_to_user, tmp1, tmp2 | ||
| 41 | .endm | ||
