aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev
diff options
context:
space:
mode:
authorKyle Moffett <Kyle.D.Moffett@boeing.com>2011-12-02 01:28:06 -0500
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-12-06 21:43:08 -0500
commitc51242e7080d2265761de309cdea222d7e27bdfe (patch)
tree3a485e889b8f9680c5b244c651acd0af7c1621b7 /arch/powerpc/sysdev
parentc579bc766a84a57c31d7b41276ffa9545a34ee1b (diff)
powerpc/mpic: Cache the device-tree node in "struct mpic"
Store the node pointer in the MPIC during initialization so that all of the later operational code can just reuse the cached pointer. Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r--arch/powerpc/sysdev/mpic.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 3240bbabc2f9..76110608543a 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -315,26 +315,25 @@ static void _mpic_map_mmio(struct mpic *mpic, phys_addr_t phys_addr,
315} 315}
316 316
317#ifdef CONFIG_PPC_DCR 317#ifdef CONFIG_PPC_DCR
318static void _mpic_map_dcr(struct mpic *mpic, struct device_node *node, 318static void _mpic_map_dcr(struct mpic *mpic, struct mpic_reg_bank *rb,
319 struct mpic_reg_bank *rb,
320 unsigned int offset, unsigned int size) 319 unsigned int offset, unsigned int size)
321{ 320{
322 phys_addr_t phys_addr = dcr_resource_start(node, 0); 321 phys_addr_t phys_addr = dcr_resource_start(mpic->node, 0);
323 rb->dhost = dcr_map(mpic->node, phys_addr + offset, size); 322 rb->dhost = dcr_map(mpic->node, phys_addr + offset, size);
324 BUG_ON(!DCR_MAP_OK(rb->dhost)); 323 BUG_ON(!DCR_MAP_OK(rb->dhost));
325} 324}
326 325
327static inline void mpic_map(struct mpic *mpic, struct device_node *node, 326static inline void mpic_map(struct mpic *mpic,
328 phys_addr_t phys_addr, struct mpic_reg_bank *rb, 327 phys_addr_t phys_addr, struct mpic_reg_bank *rb,
329 unsigned int offset, unsigned int size) 328 unsigned int offset, unsigned int size)
330{ 329{
331 if (mpic->flags & MPIC_USES_DCR) 330 if (mpic->flags & MPIC_USES_DCR)
332 _mpic_map_dcr(mpic, node, rb, offset, size); 331 _mpic_map_dcr(mpic, rb, offset, size);
333 else 332 else
334 _mpic_map_mmio(mpic, phys_addr, rb, offset, size); 333 _mpic_map_mmio(mpic, phys_addr, rb, offset, size);
335} 334}
336#else /* CONFIG_PPC_DCR */ 335#else /* CONFIG_PPC_DCR */
337#define mpic_map(m,n,p,b,o,s) _mpic_map_mmio(m,p,b,o,s) 336#define mpic_map(m,p,b,o,s) _mpic_map_mmio(m,p,b,o,s)
338#endif /* !CONFIG_PPC_DCR */ 337#endif /* !CONFIG_PPC_DCR */
339 338
340 339
@@ -1172,6 +1171,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1172 goto err_of_node_put; 1171 goto err_of_node_put;
1173 1172
1174 mpic->name = name; 1173 mpic->name = name;
1174 mpic->node = node;
1175 mpic->paddr = phys_addr; 1175 mpic->paddr = phys_addr;
1176 1176
1177 mpic->hc_irq = mpic_irq_chip; 1177 mpic->hc_irq = mpic_irq_chip;
@@ -1218,13 +1218,13 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1218 mpic->spurious_vec = intvec_top; 1218 mpic->spurious_vec = intvec_top;
1219 1219
1220 /* Check for "big-endian" in device-tree */ 1220 /* Check for "big-endian" in device-tree */
1221 if (of_get_property(node, "big-endian", NULL) != NULL) 1221 if (of_get_property(mpic->node, "big-endian", NULL) != NULL)
1222 mpic->flags |= MPIC_BIG_ENDIAN; 1222 mpic->flags |= MPIC_BIG_ENDIAN;
1223 if (of_device_is_compatible(node, "fsl,mpic")) 1223 if (of_device_is_compatible(mpic->node, "fsl,mpic"))
1224 mpic->flags |= MPIC_FSL; 1224 mpic->flags |= MPIC_FSL;
1225 1225
1226 /* Look for protected sources */ 1226 /* Look for protected sources */
1227 psrc = of_get_property(node, "protected-sources", &psize); 1227 psrc = of_get_property(mpic->node, "protected-sources", &psize);
1228 if (psrc) { 1228 if (psrc) {
1229 /* Allocate a bitmap with one bit per interrupt */ 1229 /* Allocate a bitmap with one bit per interrupt */
1230 unsigned int mapsize = BITS_TO_LONGS(intvec_top + 1); 1230 unsigned int mapsize = BITS_TO_LONGS(intvec_top + 1);
@@ -1259,15 +1259,15 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1259#endif 1259#endif
1260 1260
1261 /* Map the global registers */ 1261 /* Map the global registers */
1262 mpic_map(mpic, node, mpic->paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000); 1262 mpic_map(mpic, mpic->paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
1263 mpic_map(mpic, node, mpic->paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000); 1263 mpic_map(mpic, mpic->paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
1264 1264
1265 /* Reset */ 1265 /* Reset */
1266 1266
1267 /* When using a device-node, reset requests are only honored if the MPIC 1267 /* When using a device-node, reset requests are only honored if the MPIC
1268 * is allowed to reset. 1268 * is allowed to reset.
1269 */ 1269 */
1270 if (of_get_property(node, "pic-no-reset", NULL)) 1270 if (of_get_property(mpic->node, "pic-no-reset", NULL))
1271 mpic->flags |= MPIC_NO_RESET; 1271 mpic->flags |= MPIC_NO_RESET;
1272 1272
1273 if ((flags & MPIC_WANTS_RESET) && !(mpic->flags & MPIC_NO_RESET)) { 1273 if ((flags & MPIC_WANTS_RESET) && !(mpic->flags & MPIC_NO_RESET)) {
@@ -1315,7 +1315,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1315 for_each_possible_cpu(i) { 1315 for_each_possible_cpu(i) {
1316 unsigned int cpu = get_hard_smp_processor_id(i); 1316 unsigned int cpu = get_hard_smp_processor_id(i);
1317 1317
1318 mpic_map(mpic, node, mpic->paddr, &mpic->cpuregs[cpu], 1318 mpic_map(mpic, mpic->paddr, &mpic->cpuregs[cpu],
1319 MPIC_INFO(CPU_BASE) + cpu * MPIC_INFO(CPU_STRIDE), 1319 MPIC_INFO(CPU_BASE) + cpu * MPIC_INFO(CPU_STRIDE),
1320 0x1000); 1320 0x1000);
1321 } 1321 }
@@ -1323,13 +1323,13 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1323 /* Initialize main ISU if none provided */ 1323 /* Initialize main ISU if none provided */
1324 if (mpic->isu_size == 0) { 1324 if (mpic->isu_size == 0) {
1325 mpic->isu_size = mpic->num_sources; 1325 mpic->isu_size = mpic->num_sources;
1326 mpic_map(mpic, node, mpic->paddr, &mpic->isus[0], 1326 mpic_map(mpic, mpic->paddr, &mpic->isus[0],
1327 MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size); 1327 MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
1328 } 1328 }
1329 mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1); 1329 mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1);
1330 mpic->isu_mask = (1 << mpic->isu_shift) - 1; 1330 mpic->isu_mask = (1 << mpic->isu_shift) - 1;
1331 1331
1332 mpic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, 1332 mpic->irqhost = irq_alloc_host(mpic->node, IRQ_HOST_MAP_LINEAR,
1333 isu_size ? isu_size : mpic->num_sources, 1333 isu_size ? isu_size : mpic->num_sources,
1334 &mpic_host_ops, 1334 &mpic_host_ops,
1335 flags & MPIC_LARGE_VECTORS ? 2048 : 256); 1335 flags & MPIC_LARGE_VECTORS ? 2048 : 256);
@@ -1372,7 +1372,6 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1372 irq_set_default_host(mpic->irqhost); 1372 irq_set_default_host(mpic->irqhost);
1373 } 1373 }
1374 1374
1375 of_node_put(node);
1376 return mpic; 1375 return mpic;
1377 1376
1378err_of_node_put: 1377err_of_node_put:
@@ -1387,7 +1386,7 @@ void __init mpic_assign_isu(struct mpic *mpic, unsigned int isu_num,
1387 1386
1388 BUG_ON(isu_num >= MPIC_MAX_ISU); 1387 BUG_ON(isu_num >= MPIC_MAX_ISU);
1389 1388
1390 mpic_map(mpic, mpic->irqhost->of_node, 1389 mpic_map(mpic,
1391 paddr, &mpic->isus[isu_num], 0, 1390 paddr, &mpic->isus[isu_num], 0,
1392 MPIC_INFO(IRQ_STRIDE) * mpic->isu_size); 1391 MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
1393 1392