diff options
author | Colin Cross <ccross@android.com> | 2011-05-01 18:26:51 -0400 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2011-05-11 11:04:16 -0400 |
commit | d1d8c666683cdbef18329ff8f3743ddaca8842ee (patch) | |
tree | 35196f7c5f7239821e00a0bc77730429f9370fdf /arch/arm/mach-tegra | |
parent | 4dda2d384bc69de260647c3b419967734a4de496 (diff) |
ARM: tegra: irq: Move legacy_irq.c into irq.c
Now that irq.c is just an interface layer between the gic
and legacy_irq.c, move the contents of legacy_irq.c into
irq.c.
Signed-off-by: Colin Cross <ccross@android.com>
Diffstat (limited to 'arch/arm/mach-tegra')
-rw-r--r-- | arch/arm/mach-tegra/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-tegra/include/mach/legacy_irq.h | 32 | ||||
-rw-r--r-- | arch/arm/mach-tegra/irq.c | 77 | ||||
-rw-r--r-- | arch/arm/mach-tegra/legacy_irq.c | 138 |
4 files changed, 66 insertions, 183 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index 1afe05038c27..823c703e573c 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile | |||
@@ -1,7 +1,7 @@ | |||
1 | obj-y += common.o | 1 | obj-y += common.o |
2 | obj-y += devices.o | 2 | obj-y += devices.o |
3 | obj-y += io.o | 3 | obj-y += io.o |
4 | obj-y += irq.o legacy_irq.o | 4 | obj-y += irq.o |
5 | obj-y += clock.o | 5 | obj-y += clock.o |
6 | obj-y += timer.o | 6 | obj-y += timer.o |
7 | obj-y += gpio.o | 7 | obj-y += gpio.o |
diff --git a/arch/arm/mach-tegra/include/mach/legacy_irq.h b/arch/arm/mach-tegra/include/mach/legacy_irq.h deleted file mode 100644 index 4c1f53543744..000000000000 --- a/arch/arm/mach-tegra/include/mach/legacy_irq.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/include/mach/legacy_irq.h | ||
3 | * | ||
4 | * Copyright (C) 2010 Google, Inc. | ||
5 | * Author: Colin Cross <ccross@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
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 | */ | ||
17 | |||
18 | #ifndef _ARCH_ARM_MACH_TEGRA_LEGARY_IRQ_H | ||
19 | #define _ARCH_ARM_MACH_TEGRA_LEGARY_IRQ_H | ||
20 | |||
21 | void tegra_legacy_mask_irq(unsigned int irq); | ||
22 | void tegra_legacy_unmask_irq(unsigned int irq); | ||
23 | void tegra_legacy_select_fiq(unsigned int irq, bool fiq); | ||
24 | void tegra_legacy_force_irq_set(unsigned int irq); | ||
25 | void tegra_legacy_force_irq_clr(unsigned int irq); | ||
26 | int tegra_legacy_force_irq_status(unsigned int irq); | ||
27 | void tegra_legacy_select_fiq(unsigned int irq, bool fiq); | ||
28 | unsigned long tegra_legacy_vfiq(int nr); | ||
29 | unsigned long tegra_legacy_class(int nr); | ||
30 | void tegra_init_legacy_irq(void); | ||
31 | |||
32 | #endif | ||
diff --git a/arch/arm/mach-tegra/irq.c b/arch/arm/mach-tegra/irq.c index 4fa7a37ea5e4..da1749108c7d 100644 --- a/arch/arm/mach-tegra/irq.c +++ b/arch/arm/mach-tegra/irq.c | |||
@@ -18,8 +18,6 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/delay.h> | ||
22 | #include <linux/init.h> | ||
23 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
24 | #include <linux/irq.h> | 22 | #include <linux/irq.h> |
25 | #include <linux/io.h> | 23 | #include <linux/io.h> |
@@ -27,40 +25,95 @@ | |||
27 | #include <asm/hardware/gic.h> | 25 | #include <asm/hardware/gic.h> |
28 | 26 | ||
29 | #include <mach/iomap.h> | 27 | #include <mach/iomap.h> |
30 | #include <mach/legacy_irq.h> | ||
31 | 28 | ||
32 | #include "board.h" | 29 | #include "board.h" |
33 | 30 | ||
31 | #define INT_SYS_NR (INT_GPIO_BASE - INT_PRI_BASE) | ||
32 | #define INT_SYS_SZ (INT_SEC_BASE - INT_PRI_BASE) | ||
33 | #define PPI_NR ((INT_SYS_NR+INT_SYS_SZ-1)/INT_SYS_SZ) | ||
34 | |||
35 | #define ICTLR_CPU_IEP_VFIQ 0x08 | ||
36 | #define ICTLR_CPU_IEP_FIR 0x14 | ||
37 | #define ICTLR_CPU_IEP_FIR_SET 0x18 | ||
38 | #define ICTLR_CPU_IEP_FIR_CLR 0x1c | ||
39 | |||
40 | #define ICTLR_CPU_IER 0x20 | ||
41 | #define ICTLR_CPU_IER_SET 0x24 | ||
42 | #define ICTLR_CPU_IER_CLR 0x28 | ||
43 | #define ICTLR_CPU_IEP_CLASS 0x2C | ||
44 | |||
45 | #define ICTLR_COP_IER 0x30 | ||
46 | #define ICTLR_COP_IER_SET 0x34 | ||
47 | #define ICTLR_COP_IER_CLR 0x38 | ||
48 | #define ICTLR_COP_IEP_CLASS 0x3c | ||
49 | |||
50 | #define NUM_ICTLRS 4 | ||
51 | #define FIRST_LEGACY_IRQ 32 | ||
52 | |||
53 | static void __iomem *ictlr_reg_base[] = { | ||
54 | IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE), | ||
55 | IO_ADDRESS(TEGRA_SECONDARY_ICTLR_BASE), | ||
56 | IO_ADDRESS(TEGRA_TERTIARY_ICTLR_BASE), | ||
57 | IO_ADDRESS(TEGRA_QUATERNARY_ICTLR_BASE), | ||
58 | }; | ||
59 | |||
60 | static inline void tegra_irq_write_mask(unsigned int irq, unsigned long reg) | ||
61 | { | ||
62 | void __iomem *base; | ||
63 | u32 mask; | ||
64 | |||
65 | BUG_ON(irq < FIRST_LEGACY_IRQ || | ||
66 | irq >= FIRST_LEGACY_IRQ + NUM_ICTLRS * 32); | ||
67 | |||
68 | base = ictlr_reg_base[(irq - FIRST_LEGACY_IRQ) / 32]; | ||
69 | mask = BIT((irq - FIRST_LEGACY_IRQ) % 32); | ||
70 | |||
71 | __raw_writel(mask, base + reg); | ||
72 | } | ||
73 | |||
34 | static void tegra_mask(struct irq_data *d) | 74 | static void tegra_mask(struct irq_data *d) |
35 | { | 75 | { |
36 | if (d->irq >= 32) | 76 | if (d->irq < FIRST_LEGACY_IRQ) |
37 | tegra_legacy_mask_irq(d->irq); | 77 | return; |
78 | |||
79 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_CLR); | ||
38 | } | 80 | } |
39 | 81 | ||
40 | static void tegra_unmask(struct irq_data *d) | 82 | static void tegra_unmask(struct irq_data *d) |
41 | { | 83 | { |
42 | if (d->irq >= 32) | 84 | if (d->irq < FIRST_LEGACY_IRQ) |
43 | tegra_legacy_unmask_irq(d->irq); | 85 | return; |
86 | |||
87 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IER_SET); | ||
44 | } | 88 | } |
45 | 89 | ||
46 | static void tegra_ack(struct irq_data *d) | 90 | static void tegra_ack(struct irq_data *d) |
47 | { | 91 | { |
48 | if (d->irq >= 32) | 92 | if (d->irq < FIRST_LEGACY_IRQ) |
49 | tegra_legacy_force_irq_clr(d->irq); | 93 | return; |
94 | |||
95 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_CLR); | ||
50 | } | 96 | } |
51 | 97 | ||
52 | static int tegra_retrigger(struct irq_data *d) | 98 | static int tegra_retrigger(struct irq_data *d) |
53 | { | 99 | { |
54 | if (d->irq < 32) | 100 | if (d->irq < FIRST_LEGACY_IRQ) |
55 | return 0; | 101 | return 0; |
56 | 102 | ||
57 | tegra_legacy_force_irq_set(d->irq); | 103 | tegra_irq_write_mask(d->irq, ICTLR_CPU_IEP_FIR_SET); |
104 | |||
58 | return 1; | 105 | return 1; |
59 | } | 106 | } |
60 | 107 | ||
61 | void __init tegra_init_irq(void) | 108 | void __init tegra_init_irq(void) |
62 | { | 109 | { |
63 | tegra_init_legacy_irq(); | 110 | int i; |
111 | |||
112 | for (i = 0; i < NUM_ICTLRS; i++) { | ||
113 | void __iomem *ictlr = ictlr_reg_base[i]; | ||
114 | writel(~0, ictlr + ICTLR_CPU_IER_CLR); | ||
115 | writel(0, ictlr + ICTLR_CPU_IEP_CLASS); | ||
116 | } | ||
64 | 117 | ||
65 | gic_arch_extn.irq_ack = tegra_ack; | 118 | gic_arch_extn.irq_ack = tegra_ack; |
66 | gic_arch_extn.irq_mask = tegra_mask; | 119 | gic_arch_extn.irq_mask = tegra_mask; |
diff --git a/arch/arm/mach-tegra/legacy_irq.c b/arch/arm/mach-tegra/legacy_irq.c deleted file mode 100644 index cb316699ffad..000000000000 --- a/arch/arm/mach-tegra/legacy_irq.c +++ /dev/null | |||
@@ -1,138 +0,0 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/legacy_irq.c | ||
3 | * | ||
4 | * Copyright (C) 2010 Google, Inc. | ||
5 | * Author: Colin Cross <ccross@android.com> | ||
6 | * | ||
7 | * This software is licensed under the terms of the GNU General Public | ||
8 | * License version 2, as published by the Free Software Foundation, and | ||
9 | * may be copied, distributed, and modified under those terms. | ||
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 | */ | ||
17 | |||
18 | #include <linux/io.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <mach/iomap.h> | ||
21 | #include <mach/irqs.h> | ||
22 | #include <mach/legacy_irq.h> | ||
23 | |||
24 | #define INT_SYS_NR (INT_GPIO_BASE - INT_PRI_BASE) | ||
25 | #define INT_SYS_SZ (INT_SEC_BASE - INT_PRI_BASE) | ||
26 | #define PPI_NR ((INT_SYS_NR+INT_SYS_SZ-1)/INT_SYS_SZ) | ||
27 | |||
28 | #define ICTLR_CPU_IEP_VFIQ 0x08 | ||
29 | #define ICTLR_CPU_IEP_FIR 0x14 | ||
30 | #define ICTLR_CPU_IEP_FIR_SET 0x18 | ||
31 | #define ICTLR_CPU_IEP_FIR_CLR 0x1c | ||
32 | |||
33 | #define ICTLR_CPU_IER 0x20 | ||
34 | #define ICTLR_CPU_IER_SET 0x24 | ||
35 | #define ICTLR_CPU_IER_CLR 0x28 | ||
36 | #define ICTLR_CPU_IEP_CLASS 0x2C | ||
37 | |||
38 | #define ICTLR_COP_IER 0x30 | ||
39 | #define ICTLR_COP_IER_SET 0x34 | ||
40 | #define ICTLR_COP_IER_CLR 0x38 | ||
41 | #define ICTLR_COP_IEP_CLASS 0x3c | ||
42 | |||
43 | #define NUM_ICTLRS 4 | ||
44 | |||
45 | static void __iomem *ictlr_reg_base[] = { | ||
46 | IO_ADDRESS(TEGRA_PRIMARY_ICTLR_BASE), | ||
47 | IO_ADDRESS(TEGRA_SECONDARY_ICTLR_BASE), | ||
48 | IO_ADDRESS(TEGRA_TERTIARY_ICTLR_BASE), | ||
49 | IO_ADDRESS(TEGRA_QUATERNARY_ICTLR_BASE), | ||
50 | }; | ||
51 | |||
52 | /* When going into deep sleep, the CPU is powered down, taking the GIC with it | ||
53 | In order to wake, the wake interrupts need to be enabled in the legacy | ||
54 | interrupt controller. */ | ||
55 | void tegra_legacy_unmask_irq(unsigned int irq) | ||
56 | { | ||
57 | void __iomem *base; | ||
58 | pr_debug("%s: %d\n", __func__, irq); | ||
59 | |||
60 | irq -= 32; | ||
61 | base = ictlr_reg_base[irq>>5]; | ||
62 | writel(1 << (irq & 31), base + ICTLR_CPU_IER_SET); | ||
63 | } | ||
64 | |||
65 | void tegra_legacy_mask_irq(unsigned int irq) | ||
66 | { | ||
67 | void __iomem *base; | ||
68 | pr_debug("%s: %d\n", __func__, irq); | ||
69 | |||
70 | irq -= 32; | ||
71 | base = ictlr_reg_base[irq>>5]; | ||
72 | writel(1 << (irq & 31), base + ICTLR_CPU_IER_CLR); | ||
73 | } | ||
74 | |||
75 | void tegra_legacy_force_irq_set(unsigned int irq) | ||
76 | { | ||
77 | void __iomem *base; | ||
78 | pr_debug("%s: %d\n", __func__, irq); | ||
79 | |||
80 | irq -= 32; | ||
81 | base = ictlr_reg_base[irq>>5]; | ||
82 | writel(1 << (irq & 31), base + ICTLR_CPU_IEP_FIR_SET); | ||
83 | } | ||
84 | |||
85 | void tegra_legacy_force_irq_clr(unsigned int irq) | ||
86 | { | ||
87 | void __iomem *base; | ||
88 | pr_debug("%s: %d\n", __func__, irq); | ||
89 | |||
90 | irq -= 32; | ||
91 | base = ictlr_reg_base[irq>>5]; | ||
92 | writel(1 << (irq & 31), base + ICTLR_CPU_IEP_FIR_CLR); | ||
93 | } | ||
94 | |||
95 | int tegra_legacy_force_irq_status(unsigned int irq) | ||
96 | { | ||
97 | void __iomem *base; | ||
98 | pr_debug("%s: %d\n", __func__, irq); | ||
99 | |||
100 | irq -= 32; | ||
101 | base = ictlr_reg_base[irq>>5]; | ||
102 | return !!(readl(base + ICTLR_CPU_IEP_FIR) & (1 << (irq & 31))); | ||
103 | } | ||
104 | |||
105 | void tegra_legacy_select_fiq(unsigned int irq, bool fiq) | ||
106 | { | ||
107 | void __iomem *base; | ||
108 | pr_debug("%s: %d\n", __func__, irq); | ||
109 | |||
110 | irq -= 32; | ||
111 | base = ictlr_reg_base[irq>>5]; | ||
112 | writel(fiq << (irq & 31), base + ICTLR_CPU_IEP_CLASS); | ||
113 | } | ||
114 | |||
115 | unsigned long tegra_legacy_vfiq(int nr) | ||
116 | { | ||
117 | void __iomem *base; | ||
118 | base = ictlr_reg_base[nr]; | ||
119 | return readl(base + ICTLR_CPU_IEP_VFIQ); | ||
120 | } | ||
121 | |||
122 | unsigned long tegra_legacy_class(int nr) | ||
123 | { | ||
124 | void __iomem *base; | ||
125 | base = ictlr_reg_base[nr]; | ||
126 | return readl(base + ICTLR_CPU_IEP_CLASS); | ||
127 | } | ||
128 | |||
129 | void tegra_init_legacy_irq(void) | ||
130 | { | ||
131 | int i; | ||
132 | |||
133 | for (i = 0; i < NUM_ICTLRS; i++) { | ||
134 | void __iomem *ictlr = ictlr_reg_base[i]; | ||
135 | writel(~0, ictlr + ICTLR_CPU_IER_CLR); | ||
136 | writel(0, ictlr + ICTLR_CPU_IEP_CLASS); | ||
137 | } | ||
138 | } | ||