aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/vlynq
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/vlynq')
-rw-r--r--drivers/vlynq/vlynq.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/drivers/vlynq/vlynq.c b/drivers/vlynq/vlynq.c
index f885c868a04d..aa250cebecd2 100644
--- a/drivers/vlynq/vlynq.c
+++ b/drivers/vlynq/vlynq.c
@@ -135,40 +135,40 @@ static void vlynq_reset(struct vlynq_device *dev)
135 msleep(5); 135 msleep(5);
136} 136}
137 137
138static void vlynq_irq_unmask(unsigned int irq) 138static void vlynq_irq_unmask(struct irq_data *d)
139{ 139{
140 u32 val; 140 struct vlynq_device *dev = irq_data_get_irq_chip_data(d);
141 struct vlynq_device *dev = get_irq_chip_data(irq);
142 int virq; 141 int virq;
142 u32 val;
143 143
144 BUG_ON(!dev); 144 BUG_ON(!dev);
145 virq = irq - dev->irq_start; 145 virq = d->irq - dev->irq_start;
146 val = readl(&dev->remote->int_device[virq >> 2]); 146 val = readl(&dev->remote->int_device[virq >> 2]);
147 val |= (VINT_ENABLE | virq) << VINT_OFFSET(virq); 147 val |= (VINT_ENABLE | virq) << VINT_OFFSET(virq);
148 writel(val, &dev->remote->int_device[virq >> 2]); 148 writel(val, &dev->remote->int_device[virq >> 2]);
149} 149}
150 150
151static void vlynq_irq_mask(unsigned int irq) 151static void vlynq_irq_mask(struct irq_data *d)
152{ 152{
153 u32 val; 153 struct vlynq_device *dev = irq_data_get_irq_chip_data(d);
154 struct vlynq_device *dev = get_irq_chip_data(irq);
155 int virq; 154 int virq;
155 u32 val;
156 156
157 BUG_ON(!dev); 157 BUG_ON(!dev);
158 virq = irq - dev->irq_start; 158 virq = d->irq - dev->irq_start;
159 val = readl(&dev->remote->int_device[virq >> 2]); 159 val = readl(&dev->remote->int_device[virq >> 2]);
160 val &= ~(VINT_ENABLE << VINT_OFFSET(virq)); 160 val &= ~(VINT_ENABLE << VINT_OFFSET(virq));
161 writel(val, &dev->remote->int_device[virq >> 2]); 161 writel(val, &dev->remote->int_device[virq >> 2]);
162} 162}
163 163
164static int vlynq_irq_type(unsigned int irq, unsigned int flow_type) 164static int vlynq_irq_type(struct irq_data *d, unsigned int flow_type)
165{ 165{
166 u32 val; 166 struct vlynq_device *dev = irq_data_get_irq_chip_data(d);
167 struct vlynq_device *dev = get_irq_chip_data(irq);
168 int virq; 167 int virq;
168 u32 val;
169 169
170 BUG_ON(!dev); 170 BUG_ON(!dev);
171 virq = irq - dev->irq_start; 171 virq = d->irq - dev->irq_start;
172 val = readl(&dev->remote->int_device[virq >> 2]); 172 val = readl(&dev->remote->int_device[virq >> 2]);
173 switch (flow_type & IRQ_TYPE_SENSE_MASK) { 173 switch (flow_type & IRQ_TYPE_SENSE_MASK) {
174 case IRQ_TYPE_EDGE_RISING: 174 case IRQ_TYPE_EDGE_RISING:
@@ -192,10 +192,9 @@ static int vlynq_irq_type(unsigned int irq, unsigned int flow_type)
192 return 0; 192 return 0;
193} 193}
194 194
195static void vlynq_local_ack(unsigned int irq) 195static void vlynq_local_ack(struct irq_data *d)
196{ 196{
197 struct vlynq_device *dev = get_irq_chip_data(irq); 197 struct vlynq_device *dev = irq_data_get_irq_chip_data(d);
198
199 u32 status = readl(&dev->local->status); 198 u32 status = readl(&dev->local->status);
200 199
201 pr_debug("%s: local status: 0x%08x\n", 200 pr_debug("%s: local status: 0x%08x\n",
@@ -203,10 +202,9 @@ static void vlynq_local_ack(unsigned int irq)
203 writel(status, &dev->local->status); 202 writel(status, &dev->local->status);
204} 203}
205 204
206static void vlynq_remote_ack(unsigned int irq) 205static void vlynq_remote_ack(struct irq_data *d)
207{ 206{
208 struct vlynq_device *dev = get_irq_chip_data(irq); 207 struct vlynq_device *dev = irq_data_get_irq_chip_data(d);
209
210 u32 status = readl(&dev->remote->status); 208 u32 status = readl(&dev->remote->status);
211 209
212 pr_debug("%s: remote status: 0x%08x\n", 210 pr_debug("%s: remote status: 0x%08x\n",
@@ -238,23 +236,23 @@ static irqreturn_t vlynq_irq(int irq, void *dev_id)
238 236
239static struct irq_chip vlynq_irq_chip = { 237static struct irq_chip vlynq_irq_chip = {
240 .name = "vlynq", 238 .name = "vlynq",
241 .unmask = vlynq_irq_unmask, 239 .irq_unmask = vlynq_irq_unmask,
242 .mask = vlynq_irq_mask, 240 .irq_mask = vlynq_irq_mask,
243 .set_type = vlynq_irq_type, 241 .irq_set_type = vlynq_irq_type,
244}; 242};
245 243
246static struct irq_chip vlynq_local_chip = { 244static struct irq_chip vlynq_local_chip = {
247 .name = "vlynq local error", 245 .name = "vlynq local error",
248 .unmask = vlynq_irq_unmask, 246 .irq_unmask = vlynq_irq_unmask,
249 .mask = vlynq_irq_mask, 247 .irq_mask = vlynq_irq_mask,
250 .ack = vlynq_local_ack, 248 .irq_ack = vlynq_local_ack,
251}; 249};
252 250
253static struct irq_chip vlynq_remote_chip = { 251static struct irq_chip vlynq_remote_chip = {
254 .name = "vlynq local error", 252 .name = "vlynq local error",
255 .unmask = vlynq_irq_unmask, 253 .irq_unmask = vlynq_irq_unmask,
256 .mask = vlynq_irq_mask, 254 .irq_mask = vlynq_irq_mask,
257 .ack = vlynq_remote_ack, 255 .irq_ack = vlynq_remote_ack,
258}; 256};
259 257
260static int vlynq_setup_irq(struct vlynq_device *dev) 258static int vlynq_setup_irq(struct vlynq_device *dev)
@@ -291,17 +289,17 @@ static int vlynq_setup_irq(struct vlynq_device *dev)
291 for (i = dev->irq_start; i <= dev->irq_end; i++) { 289 for (i = dev->irq_start; i <= dev->irq_end; i++) {
292 virq = i - dev->irq_start; 290 virq = i - dev->irq_start;
293 if (virq == dev->local_irq) { 291 if (virq == dev->local_irq) {
294 set_irq_chip_and_handler(i, &vlynq_local_chip, 292 irq_set_chip_and_handler(i, &vlynq_local_chip,
295 handle_level_irq); 293 handle_level_irq);
296 set_irq_chip_data(i, dev); 294 irq_set_chip_data(i, dev);
297 } else if (virq == dev->remote_irq) { 295 } else if (virq == dev->remote_irq) {
298 set_irq_chip_and_handler(i, &vlynq_remote_chip, 296 irq_set_chip_and_handler(i, &vlynq_remote_chip,
299 handle_level_irq); 297 handle_level_irq);
300 set_irq_chip_data(i, dev); 298 irq_set_chip_data(i, dev);
301 } else { 299 } else {
302 set_irq_chip_and_handler(i, &vlynq_irq_chip, 300 irq_set_chip_and_handler(i, &vlynq_irq_chip,
303 handle_simple_irq); 301 handle_simple_irq);
304 set_irq_chip_data(i, dev); 302 irq_set_chip_data(i, dev);
305 writel(0, &dev->remote->int_device[virq >> 2]); 303 writel(0, &dev->remote->int_device[virq >> 2]);
306 } 304 }
307 } 305 }