aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/mpic.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2013-01-21 20:56:41 -0500
committerKumar Gala <galak@kernel.crashing.org>2013-02-15 15:13:22 -0500
commit7c509ee01496a170fe4329f076c334591b6f49d0 (patch)
tree02b3dd434f3e6c13293a4003fda86e5269e5ecc3 /arch/powerpc/sysdev/mpic.c
parent52c5affc545053d37c0b05224bbf70f5336caa20 (diff)
powerpc/mpic: allow coreint to be determined by MPIC version
This will be used by the qemu-e500 platform, as the MPIC version (and thus whether we have coreint) depends on how QEMU is configured. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/sysdev/mpic.c')
-rw-r--r--arch/powerpc/sysdev/mpic.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 66944255520d..d30e6a676c89 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1182,6 +1182,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1182 const char *vers; 1182 const char *vers;
1183 const u32 *psrc; 1183 const u32 *psrc;
1184 u32 last_irq; 1184 u32 last_irq;
1185 u32 fsl_version = 0;
1185 1186
1186 /* Default MPIC search parameters */ 1187 /* Default MPIC search parameters */
1187 static const struct of_device_id __initconst mpic_device_id[] = { 1188 static const struct of_device_id __initconst mpic_device_id[] = {
@@ -1314,7 +1315,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1314 mpic_map(mpic, mpic->paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000); 1315 mpic_map(mpic, mpic->paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
1315 1316
1316 if (mpic->flags & MPIC_FSL) { 1317 if (mpic->flags & MPIC_FSL) {
1317 u32 brr1, version; 1318 u32 brr1;
1318 int ret; 1319 int ret;
1319 1320
1320 /* 1321 /*
@@ -1327,7 +1328,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1327 1328
1328 brr1 = _mpic_read(mpic->reg_type, &mpic->thiscpuregs, 1329 brr1 = _mpic_read(mpic->reg_type, &mpic->thiscpuregs,
1329 MPIC_FSL_BRR1); 1330 MPIC_FSL_BRR1);
1330 version = brr1 & MPIC_FSL_BRR1_VER; 1331 fsl_version = brr1 & MPIC_FSL_BRR1_VER;
1331 1332
1332 /* Error interrupt mask register (EIMR) is required for 1333 /* Error interrupt mask register (EIMR) is required for
1333 * handling individual device error interrupts. EIMR 1334 * handling individual device error interrupts. EIMR
@@ -1342,11 +1343,30 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1342 * is the number of vectors which have been consumed by 1343 * is the number of vectors which have been consumed by
1343 * ipis and timer interrupts. 1344 * ipis and timer interrupts.
1344 */ 1345 */
1345 if (version >= 0x401) { 1346 if (fsl_version >= 0x401) {
1346 ret = mpic_setup_error_int(mpic, intvec_top - 12); 1347 ret = mpic_setup_error_int(mpic, intvec_top - 12);
1347 if (ret) 1348 if (ret)
1348 return NULL; 1349 return NULL;
1349 } 1350 }
1351
1352 }
1353
1354 /*
1355 * EPR is only available starting with v4.0. To support
1356 * platforms that don't know the MPIC version at compile-time,
1357 * such as qemu-e500, turn off coreint if this MPIC doesn't
1358 * support it. Note that we never enable it if it wasn't
1359 * requested in the first place.
1360 *
1361 * This is done outside the MPIC_FSL check, so that we
1362 * also disable coreint if the MPIC node doesn't have
1363 * an "fsl,mpic" compatible at all. This will be the case
1364 * with device trees generated by older versions of QEMU.
1365 * fsl_version will be zero if MPIC_FSL is not set.
1366 */
1367 if (fsl_version < 0x400 && (flags & MPIC_ENABLE_COREINT)) {
1368 WARN_ON(ppc_md.get_irq != mpic_get_coreint_irq);
1369 ppc_md.get_irq = mpic_get_irq;
1350 } 1370 }
1351 1371
1352 /* Reset */ 1372 /* Reset */