aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sh/intc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-30 03:09:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-30 03:09:17 -0400
commitf52b69f86e27903d6896ed5fa7cd280fec8de532 (patch)
tree0b213c61386153800afb459ca33e091bdec94570 /drivers/sh/intc
parent2f7fa1be66dce77608330c5eb918d6360b5525f2 (diff)
parentb7e68d6876dfbab087bc3859211a9efc74cbe30c (diff)
Merge tag 'sh-for-linus' of git://github.com/pmundt/linux-sh
Pull SuperH updates from Paul Mundt. * tag 'sh-for-linus' of git://github.com/pmundt/linux-sh: (25 commits) sh: Support I/O space swapping where needed. sh: use set_current_blocked() and block_sigmask() sh: no need to reset handler if SA_ONESHOT sh: intc: Fix up section mismatch for intc_ack_data sh: select ARCH_DISCARD_MEMBLOCK. sh: Consolidate duplicate _32/_64 unistd definitions. sh: ecovec: switch SDHI controllers to card polling sh: Avoid exporting unimplemented syscalls. sh: add platform_device for RSPI in setup-sh7757 SH: pci-sh7780: enable big-endian operation. serial: sh-sci: fix a race of DMA submit_tx on transfer sh: dma: Collect up CHCR of SH7763, SH7764, SH7780 and SH7785 sh: dma: Collect up CHCR of SH7723 and SH7730 sh/next: Fix build fail by asm/system.h in asm/bitops.h arch/sh/drivers/dma/{dma-g2,dmabrg}.c: ensure arguments to request_irq and free_irq are compatible sh: cpufreq: Wire up scaling_available_freqs support. sh: cpufreq: notify about rate rounding fallback. sh: cpufreq: Support CPU clock frequency table. sh: cpufreq: struct device lookup from CPU topology. sh: cpufreq: percpu struct clk accounting. ...
Diffstat (limited to 'drivers/sh/intc')
-rw-r--r--drivers/sh/intc/chip.c37
-rw-r--r--drivers/sh/intc/core.c11
-rw-r--r--drivers/sh/intc/handle.c5
-rw-r--r--drivers/sh/intc/internals.h9
4 files changed, 27 insertions, 35 deletions
diff --git a/drivers/sh/intc/chip.c b/drivers/sh/intc/chip.c
index 7b246efa94ea..012df2676a26 100644
--- a/drivers/sh/intc/chip.c
+++ b/drivers/sh/intc/chip.c
@@ -2,13 +2,14 @@
2 * IRQ chip definitions for INTC IRQs. 2 * IRQ chip definitions for INTC IRQs.
3 * 3 *
4 * Copyright (C) 2007, 2008 Magnus Damm 4 * Copyright (C) 2007, 2008 Magnus Damm
5 * Copyright (C) 2009, 2010 Paul Mundt 5 * Copyright (C) 2009 - 2012 Paul Mundt
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General Public 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 8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details. 9 * for more details.
10 */ 10 */
11#include <linux/cpumask.h> 11#include <linux/cpumask.h>
12#include <linux/bsearch.h>
12#include <linux/io.h> 13#include <linux/io.h>
13#include "internals.h" 14#include "internals.h"
14 15
@@ -58,11 +59,6 @@ static void intc_disable(struct irq_data *data)
58 } 59 }
59} 60}
60 61
61static int intc_set_wake(struct irq_data *data, unsigned int on)
62{
63 return 0; /* allow wakeup, but setup hardware in intc_suspend() */
64}
65
66#ifdef CONFIG_SMP 62#ifdef CONFIG_SMP
67/* 63/*
68 * This is held with the irq desc lock held, so we don't require any 64 * This is held with the irq desc lock held, so we don't require any
@@ -78,7 +74,7 @@ static int intc_set_affinity(struct irq_data *data,
78 74
79 cpumask_copy(data->affinity, cpumask); 75 cpumask_copy(data->affinity, cpumask);
80 76
81 return 0; 77 return IRQ_SET_MASK_OK_NOCOPY;
82} 78}
83#endif 79#endif
84 80
@@ -122,28 +118,12 @@ static struct intc_handle_int *intc_find_irq(struct intc_handle_int *hp,
122 unsigned int nr_hp, 118 unsigned int nr_hp,
123 unsigned int irq) 119 unsigned int irq)
124{ 120{
125 int i; 121 struct intc_handle_int key;
126
127 /*
128 * this doesn't scale well, but...
129 *
130 * this function should only be used for cerain uncommon
131 * operations such as intc_set_priority() and intc_set_type()
132 * and in those rare cases performance doesn't matter that much.
133 * keeping the memory footprint low is more important.
134 *
135 * one rather simple way to speed this up and still keep the
136 * memory footprint down is to make sure the array is sorted
137 * and then perform a bisect to lookup the irq.
138 */
139 for (i = 0; i < nr_hp; i++) {
140 if ((hp + i)->irq != irq)
141 continue;
142 122
143 return hp + i; 123 key.irq = irq;
144 } 124 key.handle = 0;
145 125
146 return NULL; 126 return bsearch(&key, hp, nr_hp, sizeof(*hp), intc_handle_int_cmp);
147} 127}
148 128
149int intc_set_priority(unsigned int irq, unsigned int prio) 129int intc_set_priority(unsigned int irq, unsigned int prio)
@@ -223,10 +203,9 @@ struct irq_chip intc_irq_chip = {
223 .irq_mask_ack = intc_mask_ack, 203 .irq_mask_ack = intc_mask_ack,
224 .irq_enable = intc_enable, 204 .irq_enable = intc_enable,
225 .irq_disable = intc_disable, 205 .irq_disable = intc_disable,
226 .irq_shutdown = intc_disable,
227 .irq_set_type = intc_set_type, 206 .irq_set_type = intc_set_type,
228 .irq_set_wake = intc_set_wake,
229#ifdef CONFIG_SMP 207#ifdef CONFIG_SMP
230 .irq_set_affinity = intc_set_affinity, 208 .irq_set_affinity = intc_set_affinity,
231#endif 209#endif
210 .flags = IRQCHIP_SKIP_SET_WAKE,
232}; 211};
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index 2fde8970dfd0..7e562ccb6997 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -2,7 +2,7 @@
2 * Shared interrupt handling code for IPR and INTC2 types of IRQs. 2 * Shared interrupt handling code for IPR and INTC2 types of IRQs.
3 * 3 *
4 * Copyright (C) 2007, 2008 Magnus Damm 4 * Copyright (C) 2007, 2008 Magnus Damm
5 * Copyright (C) 2009, 2010 Paul Mundt 5 * Copyright (C) 2009 - 2012 Paul Mundt
6 * 6 *
7 * Based on intc2.c and ipr.c 7 * Based on intc2.c and ipr.c
8 * 8 *
@@ -31,11 +31,12 @@
31#include <linux/spinlock.h> 31#include <linux/spinlock.h>
32#include <linux/radix-tree.h> 32#include <linux/radix-tree.h>
33#include <linux/export.h> 33#include <linux/export.h>
34#include <linux/sort.h>
34#include "internals.h" 35#include "internals.h"
35 36
36LIST_HEAD(intc_list); 37LIST_HEAD(intc_list);
37DEFINE_RAW_SPINLOCK(intc_big_lock); 38DEFINE_RAW_SPINLOCK(intc_big_lock);
38unsigned int nr_intc_controllers; 39static unsigned int nr_intc_controllers;
39 40
40/* 41/*
41 * Default priority level 42 * Default priority level
@@ -267,6 +268,9 @@ int __init register_intc_controller(struct intc_desc *desc)
267 k += save_reg(d, k, hw->prio_regs[i].set_reg, smp); 268 k += save_reg(d, k, hw->prio_regs[i].set_reg, smp);
268 k += save_reg(d, k, hw->prio_regs[i].clr_reg, smp); 269 k += save_reg(d, k, hw->prio_regs[i].clr_reg, smp);
269 } 270 }
271
272 sort(d->prio, hw->nr_prio_regs, sizeof(*d->prio),
273 intc_handle_int_cmp, NULL);
270 } 274 }
271 275
272 if (hw->sense_regs) { 276 if (hw->sense_regs) {
@@ -277,6 +281,9 @@ int __init register_intc_controller(struct intc_desc *desc)
277 281
278 for (i = 0; i < hw->nr_sense_regs; i++) 282 for (i = 0; i < hw->nr_sense_regs; i++)
279 k += save_reg(d, k, hw->sense_regs[i].reg, 0); 283 k += save_reg(d, k, hw->sense_regs[i].reg, 0);
284
285 sort(d->sense, hw->nr_sense_regs, sizeof(*d->sense),
286 intc_handle_int_cmp, NULL);
280 } 287 }
281 288
282 if (hw->subgroups) 289 if (hw->subgroups)
diff --git a/drivers/sh/intc/handle.c b/drivers/sh/intc/handle.c
index f461d5300b81..7863a44918a2 100644
--- a/drivers/sh/intc/handle.c
+++ b/drivers/sh/intc/handle.c
@@ -172,9 +172,8 @@ intc_get_prio_handle(struct intc_desc *desc, struct intc_desc_int *d,
172 return 0; 172 return 0;
173} 173}
174 174
175static unsigned int __init intc_ack_data(struct intc_desc *desc, 175static unsigned int intc_ack_data(struct intc_desc *desc,
176 struct intc_desc_int *d, 176 struct intc_desc_int *d, intc_enum enum_id)
177 intc_enum enum_id)
178{ 177{
179 struct intc_mask_reg *mr = desc->hw.ack_regs; 178 struct intc_mask_reg *mr = desc->hw.ack_regs;
180 unsigned int i, j, fn, mode; 179 unsigned int i, j, fn, mode;
diff --git a/drivers/sh/intc/internals.h b/drivers/sh/intc/internals.h
index b0e9155ff739..f034a979a16f 100644
--- a/drivers/sh/intc/internals.h
+++ b/drivers/sh/intc/internals.h
@@ -108,6 +108,14 @@ static inline void activate_irq(int irq)
108#endif 108#endif
109} 109}
110 110
111static inline int intc_handle_int_cmp(const void *a, const void *b)
112{
113 const struct intc_handle_int *_a = a;
114 const struct intc_handle_int *_b = b;
115
116 return _a->irq - _b->irq;
117}
118
111/* access.c */ 119/* access.c */
112extern unsigned long 120extern unsigned long
113(*intc_reg_fns[])(unsigned long addr, unsigned long h, unsigned long data); 121(*intc_reg_fns[])(unsigned long addr, unsigned long h, unsigned long data);
@@ -157,7 +165,6 @@ void _intc_enable(struct irq_data *data, unsigned long handle);
157/* core.c */ 165/* core.c */
158extern struct list_head intc_list; 166extern struct list_head intc_list;
159extern raw_spinlock_t intc_big_lock; 167extern raw_spinlock_t intc_big_lock;
160extern unsigned int nr_intc_controllers;
161extern struct bus_type intc_subsys; 168extern struct bus_type intc_subsys;
162 169
163unsigned int intc_get_dfl_prio_level(void); 170unsigned int intc_get_dfl_prio_level(void);