diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-02 12:03:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-02 12:03:55 -0400 |
commit | a7726350e06401929eac0aa0677a5467106565fc (patch) | |
tree | e189513e5014bdfccd73a3af731a6b57733743fa /drivers/irqchip | |
parent | 4d26aa305414dbb33b3c32fb205b68004cda8ffc (diff) | |
parent | afcf7924ecab726dab0227188783c4a40d9f0eec (diff) |
Merge tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanup from Olof Johansson:
"Here is a collection of cleanup patches. Among the pieces that stand
out are:
- The deletion of h720x platforms
- Split of at91 non-dt platforms to their own Kconfig file to keep
them separate
- General cleanups and refactoring of i.MX and MXS platforms
- Some restructuring of clock tables for OMAP
- Convertion of PMC driver for Tegra to dt-only
- Some renames of sunxi -> sun4i (Allwinner A10)
- ... plus a bunch of other stuff that I haven't mentioned"
* tag 'cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (119 commits)
ARM: i.MX: remove unused ARCH_* configs
ARM i.MX53: remove platform ahci support
ARM: sunxi: Rework the restart code
irqchip: sunxi: Rename sunxi to sun4i
irqchip: sunxi: Make use of the IRQCHIP_DECLARE macro
clocksource: sunxi: Rename sunxi to sun4i
clocksource: sunxi: make use of CLKSRC_OF
clocksource: sunxi: Cleanup the timer code
ARM: at91: remove trailing semicolon from macros
ARM: at91/setup: fix trivial typos
ARM: EXYNOS: remove "config EXYNOS_DEV_DRM"
ARM: EXYNOS: change the name of USB ohci header
ARM: SAMSUNG: Remove unnecessary code for dma
ARM: S3C24XX: Remove unused GPIO drive strength register definitions
ARM: OMAP4+: PM: Restore CPU power state to ON with clockdomain force wakeup method
ARM: S3C24XX: Removed unneeded dependency on CPU_S3C2412
ARM: S3C24XX: Removed unneeded dependency on CPU_S3C2410
ARM: S3C24XX: Removed unneeded dependency on ARCH_S3C24XX for boards
ARM: SAMSUNG: Fix typo "CONFIG_SAMSUNG_DEV_RTC"
ARM: S5P64X0: Fix typo "CONFIG_S5P64X0_SETUP_SDHCI"
...
Diffstat (limited to 'drivers/irqchip')
-rw-r--r-- | drivers/irqchip/Makefile | 3 | ||||
-rw-r--r-- | drivers/irqchip/exynos-combiner.c | 1 | ||||
-rw-r--r-- | drivers/irqchip/irq-gic.c | 36 | ||||
-rw-r--r-- | drivers/irqchip/irq-mxs.c | 121 | ||||
-rw-r--r-- | drivers/irqchip/irq-sun4i.c | 149 | ||||
-rw-r--r-- | drivers/irqchip/irq-sunxi.c | 151 | ||||
-rw-r--r-- | drivers/irqchip/irq-vic.c | 3 |
7 files changed, 300 insertions, 164 deletions
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 98e3b87bdf1b..d5e119ca9425 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile | |||
@@ -2,9 +2,10 @@ obj-$(CONFIG_IRQCHIP) += irqchip.o | |||
2 | 2 | ||
3 | obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o | 3 | obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o |
4 | obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o | 4 | obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o |
5 | obj-$(CONFIG_ARCH_MXS) += irq-mxs.o | ||
5 | obj-$(CONFIG_METAG) += irq-metag-ext.o | 6 | obj-$(CONFIG_METAG) += irq-metag-ext.o |
6 | obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o | 7 | obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o |
7 | obj-$(CONFIG_ARCH_SUNXI) += irq-sunxi.o | 8 | obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o |
8 | obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o | 9 | obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o |
9 | obj-$(CONFIG_ARM_GIC) += irq-gic.o | 10 | obj-$(CONFIG_ARM_GIC) += irq-gic.o |
10 | obj-$(CONFIG_ARM_VIC) += irq-vic.o | 11 | obj-$(CONFIG_ARM_VIC) += irq-vic.o |
diff --git a/drivers/irqchip/exynos-combiner.c b/drivers/irqchip/exynos-combiner.c index 04d86a9803f4..6a5201351507 100644 --- a/drivers/irqchip/exynos-combiner.c +++ b/drivers/irqchip/exynos-combiner.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | #include <linux/irqdomain.h> | 15 | #include <linux/irqdomain.h> |
16 | #include <linux/irqchip/chained_irq.h> | ||
16 | #include <linux/of_address.h> | 17 | #include <linux/of_address.h> |
17 | #include <linux/of_irq.h> | 18 | #include <linux/of_irq.h> |
18 | #include <asm/mach/irq.h> | 19 | #include <asm/mach/irq.h> |
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index fc6aebf1e4b2..1760ceb68b7b 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/list.h> | 29 | #include <linux/list.h> |
30 | #include <linux/smp.h> | 30 | #include <linux/smp.h> |
31 | #include <linux/cpu.h> | ||
31 | #include <linux/cpu_pm.h> | 32 | #include <linux/cpu_pm.h> |
32 | #include <linux/cpumask.h> | 33 | #include <linux/cpumask.h> |
33 | #include <linux/io.h> | 34 | #include <linux/io.h> |
@@ -38,12 +39,12 @@ | |||
38 | #include <linux/interrupt.h> | 39 | #include <linux/interrupt.h> |
39 | #include <linux/percpu.h> | 40 | #include <linux/percpu.h> |
40 | #include <linux/slab.h> | 41 | #include <linux/slab.h> |
42 | #include <linux/irqchip/chained_irq.h> | ||
41 | #include <linux/irqchip/arm-gic.h> | 43 | #include <linux/irqchip/arm-gic.h> |
42 | 44 | ||
43 | #include <asm/irq.h> | 45 | #include <asm/irq.h> |
44 | #include <asm/exception.h> | 46 | #include <asm/exception.h> |
45 | #include <asm/smp_plat.h> | 47 | #include <asm/smp_plat.h> |
46 | #include <asm/mach/irq.h> | ||
47 | 48 | ||
48 | #include "irqchip.h" | 49 | #include "irqchip.h" |
49 | 50 | ||
@@ -127,7 +128,7 @@ static inline void gic_set_base_accessor(struct gic_chip_data *data, | |||
127 | #else | 128 | #else |
128 | #define gic_data_dist_base(d) ((d)->dist_base.common_base) | 129 | #define gic_data_dist_base(d) ((d)->dist_base.common_base) |
129 | #define gic_data_cpu_base(d) ((d)->cpu_base.common_base) | 130 | #define gic_data_cpu_base(d) ((d)->cpu_base.common_base) |
130 | #define gic_set_base_accessor(d,f) | 131 | #define gic_set_base_accessor(d, f) |
131 | #endif | 132 | #endif |
132 | 133 | ||
133 | static inline void __iomem *gic_dist_base(struct irq_data *d) | 134 | static inline void __iomem *gic_dist_base(struct irq_data *d) |
@@ -324,7 +325,7 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc) | |||
324 | 325 | ||
325 | cascade_irq = irq_find_mapping(chip_data->domain, gic_irq); | 326 | cascade_irq = irq_find_mapping(chip_data->domain, gic_irq); |
326 | if (unlikely(gic_irq < 32 || gic_irq > 1020)) | 327 | if (unlikely(gic_irq < 32 || gic_irq > 1020)) |
327 | do_bad_IRQ(cascade_irq, desc); | 328 | handle_bad_irq(cascade_irq, desc); |
328 | else | 329 | else |
329 | generic_handle_irq(cascade_irq); | 330 | generic_handle_irq(cascade_irq); |
330 | 331 | ||
@@ -700,6 +701,25 @@ static int gic_irq_domain_xlate(struct irq_domain *d, | |||
700 | return 0; | 701 | return 0; |
701 | } | 702 | } |
702 | 703 | ||
704 | #ifdef CONFIG_SMP | ||
705 | static int __cpuinit gic_secondary_init(struct notifier_block *nfb, | ||
706 | unsigned long action, void *hcpu) | ||
707 | { | ||
708 | if (action == CPU_STARTING) | ||
709 | gic_cpu_init(&gic_data[0]); | ||
710 | return NOTIFY_OK; | ||
711 | } | ||
712 | |||
713 | /* | ||
714 | * Notifier for enabling the GIC CPU interface. Set an arbitrarily high | ||
715 | * priority because the GIC needs to be up before the ARM generic timers. | ||
716 | */ | ||
717 | static struct notifier_block __cpuinitdata gic_cpu_notifier = { | ||
718 | .notifier_call = gic_secondary_init, | ||
719 | .priority = 100, | ||
720 | }; | ||
721 | #endif | ||
722 | |||
703 | const struct irq_domain_ops gic_irq_domain_ops = { | 723 | const struct irq_domain_ops gic_irq_domain_ops = { |
704 | .map = gic_irq_domain_map, | 724 | .map = gic_irq_domain_map, |
705 | .xlate = gic_irq_domain_xlate, | 725 | .xlate = gic_irq_domain_xlate, |
@@ -790,6 +810,7 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start, | |||
790 | 810 | ||
791 | #ifdef CONFIG_SMP | 811 | #ifdef CONFIG_SMP |
792 | set_smp_cross_call(gic_raise_softirq); | 812 | set_smp_cross_call(gic_raise_softirq); |
813 | register_cpu_notifier(&gic_cpu_notifier); | ||
793 | #endif | 814 | #endif |
794 | 815 | ||
795 | set_handle_irq(gic_handle_irq); | 816 | set_handle_irq(gic_handle_irq); |
@@ -800,15 +821,8 @@ void __init gic_init_bases(unsigned int gic_nr, int irq_start, | |||
800 | gic_pm_init(gic); | 821 | gic_pm_init(gic); |
801 | } | 822 | } |
802 | 823 | ||
803 | void __cpuinit gic_secondary_init(unsigned int gic_nr) | ||
804 | { | ||
805 | BUG_ON(gic_nr >= MAX_GIC_NR); | ||
806 | |||
807 | gic_cpu_init(&gic_data[gic_nr]); | ||
808 | } | ||
809 | |||
810 | #ifdef CONFIG_OF | 824 | #ifdef CONFIG_OF |
811 | static int gic_cnt __initdata = 0; | 825 | static int gic_cnt __initdata; |
812 | 826 | ||
813 | int __init gic_of_init(struct device_node *node, struct device_node *parent) | 827 | int __init gic_of_init(struct device_node *node, struct device_node *parent) |
814 | { | 828 | { |
diff --git a/drivers/irqchip/irq-mxs.c b/drivers/irqchip/irq-mxs.c new file mode 100644 index 000000000000..29889bbdcc6d --- /dev/null +++ b/drivers/irqchip/irq-mxs.c | |||
@@ -0,0 +1,121 @@ | |||
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/irqdomain.h> | ||
23 | #include <linux/io.h> | ||
24 | #include <linux/of.h> | ||
25 | #include <linux/of_address.h> | ||
26 | #include <linux/of_irq.h> | ||
27 | #include <linux/stmp_device.h> | ||
28 | #include <asm/exception.h> | ||
29 | |||
30 | #include "irqchip.h" | ||
31 | |||
32 | #define HW_ICOLL_VECTOR 0x0000 | ||
33 | #define HW_ICOLL_LEVELACK 0x0010 | ||
34 | #define HW_ICOLL_CTRL 0x0020 | ||
35 | #define HW_ICOLL_STAT_OFFSET 0x0070 | ||
36 | #define HW_ICOLL_INTERRUPTn_SET(n) (0x0124 + (n) * 0x10) | ||
37 | #define HW_ICOLL_INTERRUPTn_CLR(n) (0x0128 + (n) * 0x10) | ||
38 | #define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004 | ||
39 | #define BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 0x1 | ||
40 | |||
41 | #define ICOLL_NUM_IRQS 128 | ||
42 | |||
43 | static void __iomem *icoll_base; | ||
44 | static struct irq_domain *icoll_domain; | ||
45 | |||
46 | static void icoll_ack_irq(struct irq_data *d) | ||
47 | { | ||
48 | /* | ||
49 | * The Interrupt Collector is able to prioritize irqs. | ||
50 | * Currently only level 0 is used. So acking can use | ||
51 | * BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 unconditionally. | ||
52 | */ | ||
53 | __raw_writel(BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0, | ||
54 | icoll_base + HW_ICOLL_LEVELACK); | ||
55 | } | ||
56 | |||
57 | static void icoll_mask_irq(struct irq_data *d) | ||
58 | { | ||
59 | __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, | ||
60 | icoll_base + HW_ICOLL_INTERRUPTn_CLR(d->hwirq)); | ||
61 | } | ||
62 | |||
63 | static void icoll_unmask_irq(struct irq_data *d) | ||
64 | { | ||
65 | __raw_writel(BM_ICOLL_INTERRUPTn_ENABLE, | ||
66 | icoll_base + HW_ICOLL_INTERRUPTn_SET(d->hwirq)); | ||
67 | } | ||
68 | |||
69 | static struct irq_chip mxs_icoll_chip = { | ||
70 | .irq_ack = icoll_ack_irq, | ||
71 | .irq_mask = icoll_mask_irq, | ||
72 | .irq_unmask = icoll_unmask_irq, | ||
73 | }; | ||
74 | |||
75 | asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs) | ||
76 | { | ||
77 | u32 irqnr; | ||
78 | |||
79 | do { | ||
80 | irqnr = __raw_readl(icoll_base + HW_ICOLL_STAT_OFFSET); | ||
81 | if (irqnr != 0x7f) { | ||
82 | __raw_writel(irqnr, icoll_base + HW_ICOLL_VECTOR); | ||
83 | irqnr = irq_find_mapping(icoll_domain, irqnr); | ||
84 | handle_IRQ(irqnr, regs); | ||
85 | continue; | ||
86 | } | ||
87 | break; | ||
88 | } while (1); | ||
89 | } | ||
90 | |||
91 | static int icoll_irq_domain_map(struct irq_domain *d, unsigned int virq, | ||
92 | irq_hw_number_t hw) | ||
93 | { | ||
94 | irq_set_chip_and_handler(virq, &mxs_icoll_chip, handle_level_irq); | ||
95 | set_irq_flags(virq, IRQF_VALID); | ||
96 | |||
97 | return 0; | ||
98 | } | ||
99 | |||
100 | static struct irq_domain_ops icoll_irq_domain_ops = { | ||
101 | .map = icoll_irq_domain_map, | ||
102 | .xlate = irq_domain_xlate_onecell, | ||
103 | }; | ||
104 | |||
105 | static void __init icoll_of_init(struct device_node *np, | ||
106 | struct device_node *interrupt_parent) | ||
107 | { | ||
108 | icoll_base = of_iomap(np, 0); | ||
109 | WARN_ON(!icoll_base); | ||
110 | |||
111 | /* | ||
112 | * Interrupt Collector reset, which initializes the priority | ||
113 | * for each irq to level 0. | ||
114 | */ | ||
115 | stmp_reset_block(icoll_base + HW_ICOLL_CTRL); | ||
116 | |||
117 | icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS, | ||
118 | &icoll_irq_domain_ops, NULL); | ||
119 | WARN_ON(!icoll_domain); | ||
120 | } | ||
121 | IRQCHIP_DECLARE(mxs, "fsl,icoll", icoll_of_init); | ||
diff --git a/drivers/irqchip/irq-sun4i.c b/drivers/irqchip/irq-sun4i.c new file mode 100644 index 000000000000..b66d4ae06898 --- /dev/null +++ b/drivers/irqchip/irq-sun4i.c | |||
@@ -0,0 +1,149 @@ | |||
1 | /* | ||
2 | * Allwinner A1X SoCs IRQ chip driver. | ||
3 | * | ||
4 | * Copyright (C) 2012 Maxime Ripard | ||
5 | * | ||
6 | * Maxime Ripard <maxime.ripard@free-electrons.com> | ||
7 | * | ||
8 | * Based on code from | ||
9 | * Allwinner Technology Co., Ltd. <www.allwinnertech.com> | ||
10 | * Benn Huang <benn@allwinnertech.com> | ||
11 | * | ||
12 | * This file is licensed under the terms of the GNU General Public | ||
13 | * License version 2. This program is licensed "as is" without any | ||
14 | * warranty of any kind, whether express or implied. | ||
15 | */ | ||
16 | |||
17 | #include <linux/io.h> | ||
18 | #include <linux/irq.h> | ||
19 | #include <linux/of.h> | ||
20 | #include <linux/of_address.h> | ||
21 | #include <linux/of_irq.h> | ||
22 | |||
23 | #include <asm/exception.h> | ||
24 | #include <asm/mach/irq.h> | ||
25 | |||
26 | #include "irqchip.h" | ||
27 | |||
28 | #define SUN4I_IRQ_VECTOR_REG 0x00 | ||
29 | #define SUN4I_IRQ_PROTECTION_REG 0x08 | ||
30 | #define SUN4I_IRQ_NMI_CTRL_REG 0x0c | ||
31 | #define SUN4I_IRQ_PENDING_REG(x) (0x10 + 0x4 * x) | ||
32 | #define SUN4I_IRQ_FIQ_PENDING_REG(x) (0x20 + 0x4 * x) | ||
33 | #define SUN4I_IRQ_ENABLE_REG(x) (0x40 + 0x4 * x) | ||
34 | #define SUN4I_IRQ_MASK_REG(x) (0x50 + 0x4 * x) | ||
35 | |||
36 | static void __iomem *sun4i_irq_base; | ||
37 | static struct irq_domain *sun4i_irq_domain; | ||
38 | |||
39 | static asmlinkage void __exception_irq_entry sun4i_handle_irq(struct pt_regs *regs); | ||
40 | |||
41 | void sun4i_irq_ack(struct irq_data *irqd) | ||
42 | { | ||
43 | unsigned int irq = irqd_to_hwirq(irqd); | ||
44 | unsigned int irq_off = irq % 32; | ||
45 | int reg = irq / 32; | ||
46 | u32 val; | ||
47 | |||
48 | val = readl(sun4i_irq_base + SUN4I_IRQ_PENDING_REG(reg)); | ||
49 | writel(val | (1 << irq_off), | ||
50 | sun4i_irq_base + SUN4I_IRQ_PENDING_REG(reg)); | ||
51 | } | ||
52 | |||
53 | static void sun4i_irq_mask(struct irq_data *irqd) | ||
54 | { | ||
55 | unsigned int irq = irqd_to_hwirq(irqd); | ||
56 | unsigned int irq_off = irq % 32; | ||
57 | int reg = irq / 32; | ||
58 | u32 val; | ||
59 | |||
60 | val = readl(sun4i_irq_base + SUN4I_IRQ_ENABLE_REG(reg)); | ||
61 | writel(val & ~(1 << irq_off), | ||
62 | sun4i_irq_base + SUN4I_IRQ_ENABLE_REG(reg)); | ||
63 | } | ||
64 | |||
65 | static void sun4i_irq_unmask(struct irq_data *irqd) | ||
66 | { | ||
67 | unsigned int irq = irqd_to_hwirq(irqd); | ||
68 | unsigned int irq_off = irq % 32; | ||
69 | int reg = irq / 32; | ||
70 | u32 val; | ||
71 | |||
72 | val = readl(sun4i_irq_base + SUN4I_IRQ_ENABLE_REG(reg)); | ||
73 | writel(val | (1 << irq_off), | ||
74 | sun4i_irq_base + SUN4I_IRQ_ENABLE_REG(reg)); | ||
75 | } | ||
76 | |||
77 | static struct irq_chip sun4i_irq_chip = { | ||
78 | .name = "sun4i_irq", | ||
79 | .irq_ack = sun4i_irq_ack, | ||
80 | .irq_mask = sun4i_irq_mask, | ||
81 | .irq_unmask = sun4i_irq_unmask, | ||
82 | }; | ||
83 | |||
84 | static int sun4i_irq_map(struct irq_domain *d, unsigned int virq, | ||
85 | irq_hw_number_t hw) | ||
86 | { | ||
87 | irq_set_chip_and_handler(virq, &sun4i_irq_chip, | ||
88 | handle_level_irq); | ||
89 | set_irq_flags(virq, IRQF_VALID | IRQF_PROBE); | ||
90 | |||
91 | return 0; | ||
92 | } | ||
93 | |||
94 | static struct irq_domain_ops sun4i_irq_ops = { | ||
95 | .map = sun4i_irq_map, | ||
96 | .xlate = irq_domain_xlate_onecell, | ||
97 | }; | ||
98 | |||
99 | static int __init sun4i_of_init(struct device_node *node, | ||
100 | struct device_node *parent) | ||
101 | { | ||
102 | sun4i_irq_base = of_iomap(node, 0); | ||
103 | if (!sun4i_irq_base) | ||
104 | panic("%s: unable to map IC registers\n", | ||
105 | node->full_name); | ||
106 | |||
107 | /* Disable all interrupts */ | ||
108 | writel(0, sun4i_irq_base + SUN4I_IRQ_ENABLE_REG(0)); | ||
109 | writel(0, sun4i_irq_base + SUN4I_IRQ_ENABLE_REG(1)); | ||
110 | writel(0, sun4i_irq_base + SUN4I_IRQ_ENABLE_REG(2)); | ||
111 | |||
112 | /* Mask all the interrupts */ | ||
113 | writel(0, sun4i_irq_base + SUN4I_IRQ_MASK_REG(0)); | ||
114 | writel(0, sun4i_irq_base + SUN4I_IRQ_MASK_REG(1)); | ||
115 | writel(0, sun4i_irq_base + SUN4I_IRQ_MASK_REG(2)); | ||
116 | |||
117 | /* Clear all the pending interrupts */ | ||
118 | writel(0xffffffff, sun4i_irq_base + SUN4I_IRQ_PENDING_REG(0)); | ||
119 | writel(0xffffffff, sun4i_irq_base + SUN4I_IRQ_PENDING_REG(1)); | ||
120 | writel(0xffffffff, sun4i_irq_base + SUN4I_IRQ_PENDING_REG(2)); | ||
121 | |||
122 | /* Enable protection mode */ | ||
123 | writel(0x01, sun4i_irq_base + SUN4I_IRQ_PROTECTION_REG); | ||
124 | |||
125 | /* Configure the external interrupt source type */ | ||
126 | writel(0x00, sun4i_irq_base + SUN4I_IRQ_NMI_CTRL_REG); | ||
127 | |||
128 | sun4i_irq_domain = irq_domain_add_linear(node, 3 * 32, | ||
129 | &sun4i_irq_ops, NULL); | ||
130 | if (!sun4i_irq_domain) | ||
131 | panic("%s: unable to create IRQ domain\n", node->full_name); | ||
132 | |||
133 | set_handle_irq(sun4i_handle_irq); | ||
134 | |||
135 | return 0; | ||
136 | } | ||
137 | IRQCHIP_DECLARE(allwinner_sun4i_ic, "allwinner,sun4i-ic", sun4i_of_init); | ||
138 | |||
139 | static asmlinkage void __exception_irq_entry sun4i_handle_irq(struct pt_regs *regs) | ||
140 | { | ||
141 | u32 irq, hwirq; | ||
142 | |||
143 | hwirq = readl(sun4i_irq_base + SUN4I_IRQ_VECTOR_REG) >> 2; | ||
144 | while (hwirq != 0) { | ||
145 | irq = irq_find_mapping(sun4i_irq_domain, hwirq); | ||
146 | handle_IRQ(irq, regs); | ||
147 | hwirq = readl(sun4i_irq_base + SUN4I_IRQ_VECTOR_REG) >> 2; | ||
148 | } | ||
149 | } | ||
diff --git a/drivers/irqchip/irq-sunxi.c b/drivers/irqchip/irq-sunxi.c deleted file mode 100644 index 10974fa42653..000000000000 --- a/drivers/irqchip/irq-sunxi.c +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
1 | /* | ||
2 | * Allwinner A1X SoCs IRQ chip driver. | ||
3 | * | ||
4 | * Copyright (C) 2012 Maxime Ripard | ||
5 | * | ||
6 | * Maxime Ripard <maxime.ripard@free-electrons.com> | ||
7 | * | ||
8 | * Based on code from | ||
9 | * Allwinner Technology Co., Ltd. <www.allwinnertech.com> | ||
10 | * Benn Huang <benn@allwinnertech.com> | ||
11 | * | ||
12 | * This file is licensed under the terms of the GNU General Public | ||
13 | * License version 2. This program is licensed "as is" without any | ||
14 | * warranty of any kind, whether express or implied. | ||
15 | */ | ||
16 | |||
17 | #include <linux/io.h> | ||
18 | #include <linux/irq.h> | ||
19 | #include <linux/of.h> | ||
20 | #include <linux/of_address.h> | ||
21 | #include <linux/of_irq.h> | ||
22 | |||
23 | #include <linux/irqchip/sunxi.h> | ||
24 | |||
25 | #define SUNXI_IRQ_VECTOR_REG 0x00 | ||
26 | #define SUNXI_IRQ_PROTECTION_REG 0x08 | ||
27 | #define SUNXI_IRQ_NMI_CTRL_REG 0x0c | ||
28 | #define SUNXI_IRQ_PENDING_REG(x) (0x10 + 0x4 * x) | ||
29 | #define SUNXI_IRQ_FIQ_PENDING_REG(x) (0x20 + 0x4 * x) | ||
30 | #define SUNXI_IRQ_ENABLE_REG(x) (0x40 + 0x4 * x) | ||
31 | #define SUNXI_IRQ_MASK_REG(x) (0x50 + 0x4 * x) | ||
32 | |||
33 | static void __iomem *sunxi_irq_base; | ||
34 | static struct irq_domain *sunxi_irq_domain; | ||
35 | |||
36 | void sunxi_irq_ack(struct irq_data *irqd) | ||
37 | { | ||
38 | unsigned int irq = irqd_to_hwirq(irqd); | ||
39 | unsigned int irq_off = irq % 32; | ||
40 | int reg = irq / 32; | ||
41 | u32 val; | ||
42 | |||
43 | val = readl(sunxi_irq_base + SUNXI_IRQ_PENDING_REG(reg)); | ||
44 | writel(val | (1 << irq_off), | ||
45 | sunxi_irq_base + SUNXI_IRQ_PENDING_REG(reg)); | ||
46 | } | ||
47 | |||
48 | static void sunxi_irq_mask(struct irq_data *irqd) | ||
49 | { | ||
50 | unsigned int irq = irqd_to_hwirq(irqd); | ||
51 | unsigned int irq_off = irq % 32; | ||
52 | int reg = irq / 32; | ||
53 | u32 val; | ||
54 | |||
55 | val = readl(sunxi_irq_base + SUNXI_IRQ_ENABLE_REG(reg)); | ||
56 | writel(val & ~(1 << irq_off), | ||
57 | sunxi_irq_base + SUNXI_IRQ_ENABLE_REG(reg)); | ||
58 | } | ||
59 | |||
60 | static void sunxi_irq_unmask(struct irq_data *irqd) | ||
61 | { | ||
62 | unsigned int irq = irqd_to_hwirq(irqd); | ||
63 | unsigned int irq_off = irq % 32; | ||
64 | int reg = irq / 32; | ||
65 | u32 val; | ||
66 | |||
67 | val = readl(sunxi_irq_base + SUNXI_IRQ_ENABLE_REG(reg)); | ||
68 | writel(val | (1 << irq_off), | ||
69 | sunxi_irq_base + SUNXI_IRQ_ENABLE_REG(reg)); | ||
70 | } | ||
71 | |||
72 | static struct irq_chip sunxi_irq_chip = { | ||
73 | .name = "sunxi_irq", | ||
74 | .irq_ack = sunxi_irq_ack, | ||
75 | .irq_mask = sunxi_irq_mask, | ||
76 | .irq_unmask = sunxi_irq_unmask, | ||
77 | }; | ||
78 | |||
79 | static int sunxi_irq_map(struct irq_domain *d, unsigned int virq, | ||
80 | irq_hw_number_t hw) | ||
81 | { | ||
82 | irq_set_chip_and_handler(virq, &sunxi_irq_chip, | ||
83 | handle_level_irq); | ||
84 | set_irq_flags(virq, IRQF_VALID | IRQF_PROBE); | ||
85 | |||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | static struct irq_domain_ops sunxi_irq_ops = { | ||
90 | .map = sunxi_irq_map, | ||
91 | .xlate = irq_domain_xlate_onecell, | ||
92 | }; | ||
93 | |||
94 | static int __init sunxi_of_init(struct device_node *node, | ||
95 | struct device_node *parent) | ||
96 | { | ||
97 | sunxi_irq_base = of_iomap(node, 0); | ||
98 | if (!sunxi_irq_base) | ||
99 | panic("%s: unable to map IC registers\n", | ||
100 | node->full_name); | ||
101 | |||
102 | /* Disable all interrupts */ | ||
103 | writel(0, sunxi_irq_base + SUNXI_IRQ_ENABLE_REG(0)); | ||
104 | writel(0, sunxi_irq_base + SUNXI_IRQ_ENABLE_REG(1)); | ||
105 | writel(0, sunxi_irq_base + SUNXI_IRQ_ENABLE_REG(2)); | ||
106 | |||
107 | /* Mask all the interrupts */ | ||
108 | writel(0, sunxi_irq_base + SUNXI_IRQ_MASK_REG(0)); | ||
109 | writel(0, sunxi_irq_base + SUNXI_IRQ_MASK_REG(1)); | ||
110 | writel(0, sunxi_irq_base + SUNXI_IRQ_MASK_REG(2)); | ||
111 | |||
112 | /* Clear all the pending interrupts */ | ||
113 | writel(0xffffffff, sunxi_irq_base + SUNXI_IRQ_PENDING_REG(0)); | ||
114 | writel(0xffffffff, sunxi_irq_base + SUNXI_IRQ_PENDING_REG(1)); | ||
115 | writel(0xffffffff, sunxi_irq_base + SUNXI_IRQ_PENDING_REG(2)); | ||
116 | |||
117 | /* Enable protection mode */ | ||
118 | writel(0x01, sunxi_irq_base + SUNXI_IRQ_PROTECTION_REG); | ||
119 | |||
120 | /* Configure the external interrupt source type */ | ||
121 | writel(0x00, sunxi_irq_base + SUNXI_IRQ_NMI_CTRL_REG); | ||
122 | |||
123 | sunxi_irq_domain = irq_domain_add_linear(node, 3 * 32, | ||
124 | &sunxi_irq_ops, NULL); | ||
125 | if (!sunxi_irq_domain) | ||
126 | panic("%s: unable to create IRQ domain\n", node->full_name); | ||
127 | |||
128 | return 0; | ||
129 | } | ||
130 | |||
131 | static struct of_device_id sunxi_irq_dt_ids[] __initconst = { | ||
132 | { .compatible = "allwinner,sunxi-ic", .data = sunxi_of_init }, | ||
133 | { } | ||
134 | }; | ||
135 | |||
136 | void __init sunxi_init_irq(void) | ||
137 | { | ||
138 | of_irq_init(sunxi_irq_dt_ids); | ||
139 | } | ||
140 | |||
141 | asmlinkage void __exception_irq_entry sunxi_handle_irq(struct pt_regs *regs) | ||
142 | { | ||
143 | u32 irq, hwirq; | ||
144 | |||
145 | hwirq = readl(sunxi_irq_base + SUNXI_IRQ_VECTOR_REG) >> 2; | ||
146 | while (hwirq != 0) { | ||
147 | irq = irq_find_mapping(sunxi_irq_domain, hwirq); | ||
148 | handle_IRQ(irq, regs); | ||
149 | hwirq = readl(sunxi_irq_base + SUNXI_IRQ_VECTOR_REG) >> 2; | ||
150 | } | ||
151 | } | ||
diff --git a/drivers/irqchip/irq-vic.c b/drivers/irqchip/irq-vic.c index 3cf97aaebe40..884d11c7355f 100644 --- a/drivers/irqchip/irq-vic.c +++ b/drivers/irqchip/irq-vic.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/list.h> | 24 | #include <linux/list.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/irq.h> | ||
26 | #include <linux/irqdomain.h> | 27 | #include <linux/irqdomain.h> |
27 | #include <linux/of.h> | 28 | #include <linux/of.h> |
28 | #include <linux/of_address.h> | 29 | #include <linux/of_address.h> |
@@ -33,7 +34,7 @@ | |||
33 | #include <linux/irqchip/arm-vic.h> | 34 | #include <linux/irqchip/arm-vic.h> |
34 | 35 | ||
35 | #include <asm/exception.h> | 36 | #include <asm/exception.h> |
36 | #include <asm/mach/irq.h> | 37 | #include <asm/irq.h> |
37 | 38 | ||
38 | #include "irqchip.h" | 39 | #include "irqchip.h" |
39 | 40 | ||