aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/irqchip/spear-shirq.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2014-06-19 17:34:44 -0400
committerJason Cooper <jason@lakedaemon.net>2014-06-24 08:38:45 -0400
commit1b0a76c146adce782ddb8e71f01729f5f3671c66 (patch)
tree23784da1ee2ed66bcf7d1da893e4f5c1846d4c6c /drivers/irqchip/spear-shirq.c
parentf07e42f96f06dca3f9f897b956d83aec165ee693 (diff)
irqchip: spear_shirq: Simplify register access code
The extra register data structure is pointless. Move the offsets of the status and the mask register into the shirq block structure. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lkml.kernel.org/r/20140619212713.923306179@linutronix.de Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'drivers/irqchip/spear-shirq.c')
-rw-r--r--drivers/irqchip/spear-shirq.c61
1 files changed, 16 insertions, 45 deletions
diff --git a/drivers/irqchip/spear-shirq.c b/drivers/irqchip/spear-shirq.c
index 169ef9a385d0..9c145a7cb056 100644
--- a/drivers/irqchip/spear-shirq.c
+++ b/drivers/irqchip/spear-shirq.c
@@ -27,24 +27,11 @@
27#include "irqchip.h" 27#include "irqchip.h"
28 28
29/* 29/*
30 * struct shirq_regs: shared irq register configuration
31 *
32 * enb_reg: enable register offset
33 * reset_to_enb: val 1 indicates, we need to clear bit for enabling interrupt
34 * status_reg: status register offset
35 * status_reg_mask: status register valid mask
36 */
37struct shirq_regs {
38 u32 enb_reg;
39 u32 reset_to_enb;
40 u32 status_reg;
41};
42
43/*
44 * struct spear_shirq: shared irq structure 30 * struct spear_shirq: shared irq structure
45 * 31 *
46 * base: Base register address 32 * base: Base register address
47 * regs: Register configuration for shared irq block 33 * status_reg: Status register offset for chained interrupt handler
34 * mask_reg: Mask register offset for irq chip
48 * mask: Mask to apply to the status register 35 * mask: Mask to apply to the status register
49 * virq_base: Base virtual interrupt number 36 * virq_base: Base virtual interrupt number
50 * nr_irqs: Number of interrupts handled by this block 37 * nr_irqs: Number of interrupts handled by this block
@@ -54,7 +41,8 @@ struct shirq_regs {
54 */ 41 */
55struct spear_shirq { 42struct spear_shirq {
56 void __iomem *base; 43 void __iomem *base;
57 struct shirq_regs regs; 44 u32 status_reg;
45 u32 mask_reg;
58 u32 mask; 46 u32 mask;
59 u32 virq_base; 47 u32 virq_base;
60 u32 nr_irqs; 48 u32 nr_irqs;
@@ -72,7 +60,7 @@ static void shirq_irq_mask(struct irq_data *d)
72{ 60{
73 struct spear_shirq *shirq = irq_data_get_irq_chip_data(d); 61 struct spear_shirq *shirq = irq_data_get_irq_chip_data(d);
74 u32 val, shift = d->irq - shirq->virq_base + shirq->offset; 62 u32 val, shift = d->irq - shirq->virq_base + shirq->offset;
75 u32 __iomem *reg = shirq->base + shirq->regs.enb_reg; 63 u32 __iomem *reg = shirq->base + shirq->mask_reg;
76 64
77 raw_spin_lock(&shirq_lock); 65 raw_spin_lock(&shirq_lock);
78 val = readl(reg) & ~(0x1 << shift); 66 val = readl(reg) & ~(0x1 << shift);
@@ -84,7 +72,7 @@ static void shirq_irq_unmask(struct irq_data *d)
84{ 72{
85 struct spear_shirq *shirq = irq_data_get_irq_chip_data(d); 73 struct spear_shirq *shirq = irq_data_get_irq_chip_data(d);
86 u32 val, shift = d->irq - shirq->virq_base + shirq->offset; 74 u32 val, shift = d->irq - shirq->virq_base + shirq->offset;
87 u32 __iomem *reg = shirq->base + shirq->regs.enb_reg; 75 u32 __iomem *reg = shirq->base + shirq->mask_reg;
88 76
89 raw_spin_lock(&shirq_lock); 77 raw_spin_lock(&shirq_lock);
90 val = readl(reg) | (0x1 << shift); 78 val = readl(reg) | (0x1 << shift);
@@ -103,10 +91,8 @@ static struct spear_shirq spear300_shirq_ras1 = {
103 .nr_irqs = 9, 91 .nr_irqs = 9,
104 .mask = ((0x1 << 9) - 1) << 0, 92 .mask = ((0x1 << 9) - 1) << 0,
105 .irq_chip = &shirq_chip, 93 .irq_chip = &shirq_chip,
106 .regs = { 94 .status_reg = SPEAR300_INT_STS_MASK_REG,
107 .enb_reg = SPEAR300_INT_ENB_MASK_REG, 95 .mask_reg = SPEAR300_INT_ENB_MASK_REG,
108 .status_reg = SPEAR300_INT_STS_MASK_REG,
109 },
110}; 96};
111 97
112static struct spear_shirq *spear300_shirq_blocks[] = { 98static struct spear_shirq *spear300_shirq_blocks[] = {
@@ -121,9 +107,7 @@ static struct spear_shirq spear310_shirq_ras1 = {
121 .nr_irqs = 8, 107 .nr_irqs = 8,
122 .mask = ((0x1 << 8) - 1) << 0, 108 .mask = ((0x1 << 8) - 1) << 0,
123 .irq_chip = &dummy_irq_chip, 109 .irq_chip = &dummy_irq_chip,
124 .regs = { 110 .status_reg = SPEAR310_INT_STS_MASK_REG,
125 .status_reg = SPEAR310_INT_STS_MASK_REG,
126 },
127}; 111};
128 112
129static struct spear_shirq spear310_shirq_ras2 = { 113static struct spear_shirq spear310_shirq_ras2 = {
@@ -131,10 +115,7 @@ static struct spear_shirq spear310_shirq_ras2 = {
131 .nr_irqs = 5, 115 .nr_irqs = 5,
132 .mask = ((0x1 << 5) - 1) << 8, 116 .mask = ((0x1 << 5) - 1) << 8,
133 .irq_chip = &dummy_irq_chip, 117 .irq_chip = &dummy_irq_chip,
134 .regs = { 118 .status_reg = SPEAR310_INT_STS_MASK_REG,
135 .enb_reg = -1,
136 .status_reg = SPEAR310_INT_STS_MASK_REG,
137 },
138}; 119};
139 120
140static struct spear_shirq spear310_shirq_ras3 = { 121static struct spear_shirq spear310_shirq_ras3 = {
@@ -142,9 +123,7 @@ static struct spear_shirq spear310_shirq_ras3 = {
142 .nr_irqs = 1, 123 .nr_irqs = 1,
143 .mask = ((0x1 << 1) - 1) << 13, 124 .mask = ((0x1 << 1) - 1) << 13,
144 .irq_chip = &dummy_irq_chip, 125 .irq_chip = &dummy_irq_chip,
145 .regs = { 126 .status_reg = SPEAR310_INT_STS_MASK_REG,
146 .status_reg = SPEAR310_INT_STS_MASK_REG,
147 },
148}; 127};
149 128
150static struct spear_shirq spear310_shirq_intrcomm_ras = { 129static struct spear_shirq spear310_shirq_intrcomm_ras = {
@@ -152,9 +131,7 @@ static struct spear_shirq spear310_shirq_intrcomm_ras = {
152 .nr_irqs = 3, 131 .nr_irqs = 3,
153 .mask = ((0x1 << 3) - 1) << 14, 132 .mask = ((0x1 << 3) - 1) << 14,
154 .irq_chip = &dummy_irq_chip, 133 .irq_chip = &dummy_irq_chip,
155 .regs = { 134 .status_reg = SPEAR310_INT_STS_MASK_REG,
156 .status_reg = SPEAR310_INT_STS_MASK_REG,
157 },
158}; 135};
159 136
160static struct spear_shirq *spear310_shirq_blocks[] = { 137static struct spear_shirq *spear310_shirq_blocks[] = {
@@ -180,9 +157,7 @@ static struct spear_shirq spear320_shirq_ras1 = {
180 .nr_irqs = 3, 157 .nr_irqs = 3,
181 .mask = ((0x1 << 3) - 1) << 7, 158 .mask = ((0x1 << 3) - 1) << 7,
182 .irq_chip = &dummy_irq_chip, 159 .irq_chip = &dummy_irq_chip,
183 .regs = { 160 .status_reg = SPEAR320_INT_STS_MASK_REG,
184 .status_reg = SPEAR320_INT_STS_MASK_REG,
185 },
186}; 161};
187 162
188static struct spear_shirq spear320_shirq_ras2 = { 163static struct spear_shirq spear320_shirq_ras2 = {
@@ -190,9 +165,7 @@ static struct spear_shirq spear320_shirq_ras2 = {
190 .nr_irqs = 1, 165 .nr_irqs = 1,
191 .mask = ((0x1 << 1) - 1) << 10, 166 .mask = ((0x1 << 1) - 1) << 10,
192 .irq_chip = &dummy_irq_chip, 167 .irq_chip = &dummy_irq_chip,
193 .regs = { 168 .status_reg = SPEAR320_INT_STS_MASK_REG,
194 .status_reg = SPEAR320_INT_STS_MASK_REG,
195 },
196}; 169};
197 170
198static struct spear_shirq spear320_shirq_intrcomm_ras = { 171static struct spear_shirq spear320_shirq_intrcomm_ras = {
@@ -200,9 +173,7 @@ static struct spear_shirq spear320_shirq_intrcomm_ras = {
200 .nr_irqs = 11, 173 .nr_irqs = 11,
201 .mask = ((0x1 << 11) - 1) << 11, 174 .mask = ((0x1 << 11) - 1) << 11,
202 .irq_chip = &dummy_irq_chip, 175 .irq_chip = &dummy_irq_chip,
203 .regs = { 176 .status_reg = SPEAR320_INT_STS_MASK_REG,
204 .status_reg = SPEAR320_INT_STS_MASK_REG,
205 },
206}; 177};
207 178
208static struct spear_shirq *spear320_shirq_blocks[] = { 179static struct spear_shirq *spear320_shirq_blocks[] = {
@@ -217,7 +188,7 @@ static void shirq_handler(unsigned irq, struct irq_desc *desc)
217 struct spear_shirq *shirq = irq_get_handler_data(irq); 188 struct spear_shirq *shirq = irq_get_handler_data(irq);
218 u32 pend; 189 u32 pend;
219 190
220 pend = readl(shirq->base + shirq->regs.status_reg) & shirq->mask; 191 pend = readl(shirq->base + shirq->status_reg) & shirq->mask;
221 pend >>= shirq->offset; 192 pend >>= shirq->offset;
222 193
223 while (pend) { 194 while (pend) {