aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/cell/spider-pic.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2007-08-28 04:47:54 -0400
committerPaul Mackerras <paulus@samba.org>2007-09-13 11:33:20 -0400
commit52964f87c64e6c6ea671b5bf3030fb1494090a48 (patch)
tree2e20d81bc05b60b7108733daf5713ea640ad2477 /arch/powerpc/platforms/cell/spider-pic.c
parent0ae0b54565a8dcc2b98de694b998e765de15b713 (diff)
[POWERPC] Add an optional device_node pointer to the irq_host
The majority of irq_host implementations (3 out of 4) are associated with a device_node, and need to stash it somewhere. Rather than having it somewhere different for each host, add an optional device_node pointer to the irq_host structure. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms/cell/spider-pic.c')
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index 05f4b3d3d75..4309c2cbbeb 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -63,7 +63,6 @@ enum {
63 63
64struct spider_pic { 64struct spider_pic {
65 struct irq_host *host; 65 struct irq_host *host;
66 struct device_node *of_node;
67 void __iomem *regs; 66 void __iomem *regs;
68 unsigned int node_id; 67 unsigned int node_id;
69}; 68};
@@ -178,8 +177,7 @@ static struct irq_chip spider_pic = {
178 177
179static int spider_host_match(struct irq_host *h, struct device_node *node) 178static int spider_host_match(struct irq_host *h, struct device_node *node)
180{ 179{
181 struct spider_pic *pic = h->host_data; 180 return h->of_node == node;
182 return node == pic->of_node;
183} 181}
184 182
185static int spider_host_map(struct irq_host *h, unsigned int virq, 183static int spider_host_map(struct irq_host *h, unsigned int virq,
@@ -247,18 +245,18 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic)
247 * tree in case the device-tree is ever fixed 245 * tree in case the device-tree is ever fixed
248 */ 246 */
249 struct of_irq oirq; 247 struct of_irq oirq;
250 if (of_irq_map_one(pic->of_node, 0, &oirq) == 0) { 248 if (of_irq_map_one(pic->host->of_node, 0, &oirq) == 0) {
251 virq = irq_create_of_mapping(oirq.controller, oirq.specifier, 249 virq = irq_create_of_mapping(oirq.controller, oirq.specifier,
252 oirq.size); 250 oirq.size);
253 return virq; 251 return virq;
254 } 252 }
255 253
256 /* Now do the horrible hacks */ 254 /* Now do the horrible hacks */
257 tmp = of_get_property(pic->of_node, "#interrupt-cells", NULL); 255 tmp = of_get_property(pic->host->of_node, "#interrupt-cells", NULL);
258 if (tmp == NULL) 256 if (tmp == NULL)
259 return NO_IRQ; 257 return NO_IRQ;
260 intsize = *tmp; 258 intsize = *tmp;
261 imap = of_get_property(pic->of_node, "interrupt-map", &imaplen); 259 imap = of_get_property(pic->host->of_node, "interrupt-map", &imaplen);
262 if (imap == NULL || imaplen < (intsize + 1)) 260 if (imap == NULL || imaplen < (intsize + 1))
263 return NO_IRQ; 261 return NO_IRQ;
264 iic = of_find_node_by_phandle(imap[intsize]); 262 iic = of_find_node_by_phandle(imap[intsize]);
@@ -308,15 +306,13 @@ static void __init spider_init_one(struct device_node *of_node, int chip,
308 panic("spider_pic: can't map registers !"); 306 panic("spider_pic: can't map registers !");
309 307
310 /* Allocate a host */ 308 /* Allocate a host */
311 pic->host = irq_alloc_host(IRQ_HOST_MAP_LINEAR, SPIDER_SRC_COUNT, 309 pic->host = irq_alloc_host(of_node_get(of_node), IRQ_HOST_MAP_LINEAR,
312 &spider_host_ops, SPIDER_IRQ_INVALID); 310 SPIDER_SRC_COUNT, &spider_host_ops,
311 SPIDER_IRQ_INVALID);
313 if (pic->host == NULL) 312 if (pic->host == NULL)
314 panic("spider_pic: can't allocate irq host !"); 313 panic("spider_pic: can't allocate irq host !");
315 pic->host->host_data = pic; 314 pic->host->host_data = pic;
316 315
317 /* Fill out other bits */
318 pic->of_node = of_node_get(of_node);
319
320 /* Go through all sources and disable them */ 316 /* Go through all sources and disable them */
321 for (i = 0; i < SPIDER_SRC_COUNT; i++) { 317 for (i = 0; i < SPIDER_SRC_COUNT; i++) {
322 void __iomem *cfg = pic->regs + TIR_CFGA + 8 * i; 318 void __iomem *cfg = pic->regs + TIR_CFGA + 8 * i;