diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-25 13:49:30 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-25 13:49:30 -0500 |
commit | 9b83d851a2bdd021e2135999e5bce3eb8fef94e6 (patch) | |
tree | b8703e813b1d8d66fb262cd757f54f3c05966d50 /drivers/irqchip | |
parent | 2d08cd0ef89a24f5eb6c6801c48cd06bca230d6d (diff) | |
parent | 9ed82c6866e2ab671935a75ea454047e8bddb177 (diff) |
Merge tag 'xtensa-next-20140123' of git://github.com/czankel/xtensa-linux
Pull Xtensa patches from Chris Zankel:
"The major changes are adding support for SMP for Xtensa, fixing and
cleaning up the ISS (simulator) network driver, and better support for
device trees"
* tag 'xtensa-next-20140123' of git://github.com/czankel/xtensa-linux: (40 commits)
xtensa: implement ndelay
xtensa: clean up udelay
xtensa: enable HAVE_PERF_EVENTS
xtensa: remap io area defined in device tree
xtensa: support default device tree buses
xtensa: initialize device tree clock sources
xtensa: xtfpga: fix definitions of platform devices
xtensa: standardize devicetree cpu compatible strings
xtensa: avoid duplicate of IO range definitions
xtensa: fix ATOMCTL register documentation
xtensa: Enable irqs after cpu is set online
xtensa: ISS: raise network polling rate to 10 times/sec
xtensa: remove unused XTENSA_ISS_NETWORK Kconfig parameter
xtensa: ISS: avoid simple_strtoul usage
xtensa: Switch to sched_clock_register()
xtensa: implement CPU hotplug
xtensa: add SMP support
xtensa: add MX irqchip
xtensa: clear timer IRQ unconditionally in its handler
xtensa: clean up do_interrupt/do_IRQ
...
Diffstat (limited to 'drivers/irqchip')
-rw-r--r-- | drivers/irqchip/Kconfig | 4 | ||||
-rw-r--r-- | drivers/irqchip/Makefile | 2 | ||||
-rw-r--r-- | drivers/irqchip/irq-xtensa-mx.c | 164 | ||||
-rw-r--r-- | drivers/irqchip/irq-xtensa-pic.c | 108 |
4 files changed, 278 insertions, 0 deletions
diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 940638ddc982..61ffdca96e25 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig | |||
@@ -65,3 +65,7 @@ config VERSATILE_FPGA_IRQ_NR | |||
65 | int | 65 | int |
66 | default 4 | 66 | default 4 |
67 | depends on VERSATILE_FPGA_IRQ | 67 | depends on VERSATILE_FPGA_IRQ |
68 | |||
69 | config XTENSA_MX | ||
70 | bool | ||
71 | select IRQ_DOMAIN | ||
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile index 6427323af4c3..86b484cb3ec2 100644 --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile | |||
@@ -23,3 +23,5 @@ obj-$(CONFIG_RENESAS_IRQC) += irq-renesas-irqc.o | |||
23 | obj-$(CONFIG_VERSATILE_FPGA_IRQ) += irq-versatile-fpga.o | 23 | obj-$(CONFIG_VERSATILE_FPGA_IRQ) += irq-versatile-fpga.o |
24 | obj-$(CONFIG_ARCH_VT8500) += irq-vt8500.o | 24 | obj-$(CONFIG_ARCH_VT8500) += irq-vt8500.o |
25 | obj-$(CONFIG_TB10X_IRQC) += irq-tb10x.o | 25 | obj-$(CONFIG_TB10X_IRQC) += irq-tb10x.o |
26 | obj-$(CONFIG_XTENSA) += irq-xtensa-pic.o | ||
27 | obj-$(CONFIG_XTENSA_MX) += irq-xtensa-mx.o | ||
diff --git a/drivers/irqchip/irq-xtensa-mx.c b/drivers/irqchip/irq-xtensa-mx.c new file mode 100644 index 000000000000..f693f1bc1348 --- /dev/null +++ b/drivers/irqchip/irq-xtensa-mx.c | |||
@@ -0,0 +1,164 @@ | |||
1 | /* | ||
2 | * Xtensa MX interrupt distributor | ||
3 | * | ||
4 | * Copyright (C) 2002 - 2013 Tensilica, Inc. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #include <linux/interrupt.h> | ||
12 | #include <linux/irqdomain.h> | ||
13 | #include <linux/irq.h> | ||
14 | #include <linux/of.h> | ||
15 | |||
16 | #include <asm/mxregs.h> | ||
17 | |||
18 | #include "irqchip.h" | ||
19 | |||
20 | #define HW_IRQ_IPI_COUNT 2 | ||
21 | #define HW_IRQ_MX_BASE 2 | ||
22 | #define HW_IRQ_EXTERN_BASE 3 | ||
23 | |||
24 | static DEFINE_PER_CPU(unsigned int, cached_irq_mask); | ||
25 | |||
26 | static int xtensa_mx_irq_map(struct irq_domain *d, unsigned int irq, | ||
27 | irq_hw_number_t hw) | ||
28 | { | ||
29 | if (hw < HW_IRQ_IPI_COUNT) { | ||
30 | struct irq_chip *irq_chip = d->host_data; | ||
31 | irq_set_chip_and_handler_name(irq, irq_chip, | ||
32 | handle_percpu_irq, "ipi"); | ||
33 | irq_set_status_flags(irq, IRQ_LEVEL); | ||
34 | return 0; | ||
35 | } | ||
36 | return xtensa_irq_map(d, irq, hw); | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | * Device Tree IRQ specifier translation function which works with one or | ||
41 | * two cell bindings. First cell value maps directly to the hwirq number. | ||
42 | * Second cell if present specifies whether hwirq number is external (1) or | ||
43 | * internal (0). | ||
44 | */ | ||
45 | static int xtensa_mx_irq_domain_xlate(struct irq_domain *d, | ||
46 | struct device_node *ctrlr, | ||
47 | const u32 *intspec, unsigned int intsize, | ||
48 | unsigned long *out_hwirq, unsigned int *out_type) | ||
49 | { | ||
50 | return xtensa_irq_domain_xlate(intspec, intsize, | ||
51 | intspec[0], intspec[0] + HW_IRQ_EXTERN_BASE, | ||
52 | out_hwirq, out_type); | ||
53 | } | ||
54 | |||
55 | static const struct irq_domain_ops xtensa_mx_irq_domain_ops = { | ||
56 | .xlate = xtensa_mx_irq_domain_xlate, | ||
57 | .map = xtensa_mx_irq_map, | ||
58 | }; | ||
59 | |||
60 | void secondary_init_irq(void) | ||
61 | { | ||
62 | __this_cpu_write(cached_irq_mask, | ||
63 | XCHAL_INTTYPE_MASK_EXTERN_EDGE | | ||
64 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL); | ||
65 | set_sr(XCHAL_INTTYPE_MASK_EXTERN_EDGE | | ||
66 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL, intenable); | ||
67 | } | ||
68 | |||
69 | static void xtensa_mx_irq_mask(struct irq_data *d) | ||
70 | { | ||
71 | unsigned int mask = 1u << d->hwirq; | ||
72 | |||
73 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | | ||
74 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { | ||
75 | set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) - | ||
76 | HW_IRQ_MX_BASE), MIENG); | ||
77 | } else { | ||
78 | mask = __this_cpu_read(cached_irq_mask) & ~mask; | ||
79 | __this_cpu_write(cached_irq_mask, mask); | ||
80 | set_sr(mask, intenable); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | static void xtensa_mx_irq_unmask(struct irq_data *d) | ||
85 | { | ||
86 | unsigned int mask = 1u << d->hwirq; | ||
87 | |||
88 | if (mask & (XCHAL_INTTYPE_MASK_EXTERN_EDGE | | ||
89 | XCHAL_INTTYPE_MASK_EXTERN_LEVEL)) { | ||
90 | set_er(1u << (xtensa_get_ext_irq_no(d->hwirq) - | ||
91 | HW_IRQ_MX_BASE), MIENGSET); | ||
92 | } else { | ||
93 | mask |= __this_cpu_read(cached_irq_mask); | ||
94 | __this_cpu_write(cached_irq_mask, mask); | ||
95 | set_sr(mask, intenable); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | static void xtensa_mx_irq_enable(struct irq_data *d) | ||
100 | { | ||
101 | variant_irq_enable(d->hwirq); | ||
102 | xtensa_mx_irq_unmask(d); | ||
103 | } | ||
104 | |||
105 | static void xtensa_mx_irq_disable(struct irq_data *d) | ||
106 | { | ||
107 | xtensa_mx_irq_mask(d); | ||
108 | variant_irq_disable(d->hwirq); | ||
109 | } | ||
110 | |||
111 | static void xtensa_mx_irq_ack(struct irq_data *d) | ||
112 | { | ||
113 | set_sr(1 << d->hwirq, intclear); | ||
114 | } | ||
115 | |||
116 | static int xtensa_mx_irq_retrigger(struct irq_data *d) | ||
117 | { | ||
118 | set_sr(1 << d->hwirq, intset); | ||
119 | return 1; | ||
120 | } | ||
121 | |||
122 | static int xtensa_mx_irq_set_affinity(struct irq_data *d, | ||
123 | const struct cpumask *dest, bool force) | ||
124 | { | ||
125 | unsigned mask = 1u << cpumask_any(dest); | ||
126 | |||
127 | set_er(mask, MIROUT(d->hwirq - HW_IRQ_MX_BASE)); | ||
128 | return 0; | ||
129 | |||
130 | } | ||
131 | |||
132 | static struct irq_chip xtensa_mx_irq_chip = { | ||
133 | .name = "xtensa-mx", | ||
134 | .irq_enable = xtensa_mx_irq_enable, | ||
135 | .irq_disable = xtensa_mx_irq_disable, | ||
136 | .irq_mask = xtensa_mx_irq_mask, | ||
137 | .irq_unmask = xtensa_mx_irq_unmask, | ||
138 | .irq_ack = xtensa_mx_irq_ack, | ||
139 | .irq_retrigger = xtensa_mx_irq_retrigger, | ||
140 | .irq_set_affinity = xtensa_mx_irq_set_affinity, | ||
141 | }; | ||
142 | |||
143 | int __init xtensa_mx_init_legacy(struct device_node *interrupt_parent) | ||
144 | { | ||
145 | struct irq_domain *root_domain = | ||
146 | irq_domain_add_legacy(NULL, NR_IRQS, 0, 0, | ||
147 | &xtensa_mx_irq_domain_ops, | ||
148 | &xtensa_mx_irq_chip); | ||
149 | irq_set_default_host(root_domain); | ||
150 | secondary_init_irq(); | ||
151 | return 0; | ||
152 | } | ||
153 | |||
154 | static int __init xtensa_mx_init(struct device_node *np, | ||
155 | struct device_node *interrupt_parent) | ||
156 | { | ||
157 | struct irq_domain *root_domain = | ||
158 | irq_domain_add_linear(np, NR_IRQS, &xtensa_mx_irq_domain_ops, | ||
159 | &xtensa_mx_irq_chip); | ||
160 | irq_set_default_host(root_domain); | ||
161 | secondary_init_irq(); | ||
162 | return 0; | ||
163 | } | ||
164 | IRQCHIP_DECLARE(xtensa_mx_irq_chip, "cdns,xtensa-mx", xtensa_mx_init); | ||
diff --git a/drivers/irqchip/irq-xtensa-pic.c b/drivers/irqchip/irq-xtensa-pic.c new file mode 100644 index 000000000000..7d71126d1ce5 --- /dev/null +++ b/drivers/irqchip/irq-xtensa-pic.c | |||
@@ -0,0 +1,108 @@ | |||
1 | /* | ||
2 | * Xtensa built-in interrupt controller | ||
3 | * | ||
4 | * Copyright (C) 2002 - 2013 Tensilica, Inc. | ||
5 | * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | * | ||
11 | * Chris Zankel <chris@zankel.net> | ||
12 | * Kevin Chea | ||
13 | */ | ||
14 | |||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/irqdomain.h> | ||
17 | #include <linux/irq.h> | ||
18 | #include <linux/of.h> | ||
19 | |||
20 | #include "irqchip.h" | ||
21 | |||
22 | unsigned int cached_irq_mask; | ||
23 | |||
24 | /* | ||
25 | * Device Tree IRQ specifier translation function which works with one or | ||
26 | * two cell bindings. First cell value maps directly to the hwirq number. | ||
27 | * Second cell if present specifies whether hwirq number is external (1) or | ||
28 | * internal (0). | ||
29 | */ | ||
30 | static int xtensa_pic_irq_domain_xlate(struct irq_domain *d, | ||
31 | struct device_node *ctrlr, | ||
32 | const u32 *intspec, unsigned int intsize, | ||
33 | unsigned long *out_hwirq, unsigned int *out_type) | ||
34 | { | ||
35 | return xtensa_irq_domain_xlate(intspec, intsize, | ||
36 | intspec[0], intspec[0], | ||
37 | out_hwirq, out_type); | ||
38 | } | ||
39 | |||
40 | static const struct irq_domain_ops xtensa_irq_domain_ops = { | ||
41 | .xlate = xtensa_pic_irq_domain_xlate, | ||
42 | .map = xtensa_irq_map, | ||
43 | }; | ||
44 | |||
45 | static void xtensa_irq_mask(struct irq_data *d) | ||
46 | { | ||
47 | cached_irq_mask &= ~(1 << d->hwirq); | ||
48 | set_sr(cached_irq_mask, intenable); | ||
49 | } | ||
50 | |||
51 | static void xtensa_irq_unmask(struct irq_data *d) | ||
52 | { | ||
53 | cached_irq_mask |= 1 << d->hwirq; | ||
54 | set_sr(cached_irq_mask, intenable); | ||
55 | } | ||
56 | |||
57 | static void xtensa_irq_enable(struct irq_data *d) | ||
58 | { | ||
59 | variant_irq_enable(d->hwirq); | ||
60 | xtensa_irq_unmask(d); | ||
61 | } | ||
62 | |||
63 | static void xtensa_irq_disable(struct irq_data *d) | ||
64 | { | ||
65 | xtensa_irq_mask(d); | ||
66 | variant_irq_disable(d->hwirq); | ||
67 | } | ||
68 | |||
69 | static void xtensa_irq_ack(struct irq_data *d) | ||
70 | { | ||
71 | set_sr(1 << d->hwirq, intclear); | ||
72 | } | ||
73 | |||
74 | static int xtensa_irq_retrigger(struct irq_data *d) | ||
75 | { | ||
76 | set_sr(1 << d->hwirq, intset); | ||
77 | return 1; | ||
78 | } | ||
79 | |||
80 | static struct irq_chip xtensa_irq_chip = { | ||
81 | .name = "xtensa", | ||
82 | .irq_enable = xtensa_irq_enable, | ||
83 | .irq_disable = xtensa_irq_disable, | ||
84 | .irq_mask = xtensa_irq_mask, | ||
85 | .irq_unmask = xtensa_irq_unmask, | ||
86 | .irq_ack = xtensa_irq_ack, | ||
87 | .irq_retrigger = xtensa_irq_retrigger, | ||
88 | }; | ||
89 | |||
90 | int __init xtensa_pic_init_legacy(struct device_node *interrupt_parent) | ||
91 | { | ||
92 | struct irq_domain *root_domain = | ||
93 | irq_domain_add_legacy(NULL, NR_IRQS, 0, 0, | ||
94 | &xtensa_irq_domain_ops, &xtensa_irq_chip); | ||
95 | irq_set_default_host(root_domain); | ||
96 | return 0; | ||
97 | } | ||
98 | |||
99 | static int __init xtensa_pic_init(struct device_node *np, | ||
100 | struct device_node *interrupt_parent) | ||
101 | { | ||
102 | struct irq_domain *root_domain = | ||
103 | irq_domain_add_linear(np, NR_IRQS, &xtensa_irq_domain_ops, | ||
104 | &xtensa_irq_chip); | ||
105 | irq_set_default_host(root_domain); | ||
106 | return 0; | ||
107 | } | ||
108 | IRQCHIP_DECLARE(xtensa_irq_chip, "cdns,xtensa-pic", xtensa_pic_init); | ||