aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/mpic.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-12-12 01:44:46 -0500
committerPaul Mackerras <paulus@samba.org>2007-12-20 00:15:23 -0500
commit38958dd9113c19cd7a927009ae585bd5aba3295e (patch)
treee4762aae2cfda535679bf3145f7553fddbdf6f6e /arch/powerpc/sysdev/mpic.c
parent731e74c43d4e47daf327748128f1a3648e5d39a5 (diff)
[POWERPC] pasemi: Implement MSI support
Implement MSI support for PA Semi PWRficient platforms. MSI is done through a special range of sources on the openpic controller, and they're unfortunately breaking the usual concepts of how sources are programmed: * The source is calculated as 512 + the value written into the MSI register * The vector for this source is added to the source and reported through IACK This means that for simplicity, it makes much more sense to just set the vector to 0 for the source, since that's really the vector we expect to see from IACK. Also, the affinity/priority registers will affect 16 sources at a time. To avoid most (simple) users from being limited by this, allocate 16 sources per device but use only one. This means that there's a total of 32 sources. If we get usage scenarions that need more sources, the allocator should probably be revised to take an alignment argument and size, not just do natural alignment. Finally, since I'm already touching the MPIC names on pasemi, rename the base one from the somewhat odd " PAS-OPIC " to "PASEMI-OPIC". Signed-off-by: Olof Johansson <olof@lixom.net> Acked-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/sysdev/mpic.c')
-rw-r--r--arch/powerpc/sysdev/mpic.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 116173ab58ba..f74fe26b787e 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -841,6 +841,24 @@ int mpic_set_irq_type(unsigned int virq, unsigned int flow_type)
841 return 0; 841 return 0;
842} 842}
843 843
844void mpic_set_vector(unsigned int virq, unsigned int vector)
845{
846 struct mpic *mpic = mpic_from_irq(virq);
847 unsigned int src = mpic_irq_to_hw(virq);
848 unsigned int vecpri;
849
850 DBG("mpic: set_vector(mpic:@%p,virq:%d,src:%d,vector:0x%x)\n",
851 mpic, virq, src, vector);
852
853 if (src >= mpic->irq_count)
854 return;
855
856 vecpri = mpic_irq_read(src, MPIC_INFO(IRQ_VECTOR_PRI));
857 vecpri = vecpri & ~MPIC_INFO(VECPRI_VECTOR_MASK);
858 vecpri |= vector;
859 mpic_irq_write(src, MPIC_INFO(IRQ_VECTOR_PRI), vecpri);
860}
861
844static struct irq_chip mpic_irq_chip = { 862static struct irq_chip mpic_irq_chip = {
845 .mask = mpic_mask_irq, 863 .mask = mpic_mask_irq,
846 .unmask = mpic_unmask_irq, 864 .unmask = mpic_unmask_irq,
@@ -1229,6 +1247,8 @@ void __init mpic_init(struct mpic *mpic)
1229 mpic_u3msi_init(mpic); 1247 mpic_u3msi_init(mpic);
1230 } 1248 }
1231 1249
1250 mpic_pasemi_msi_init(mpic);
1251
1232 for (i = 0; i < mpic->num_sources; i++) { 1252 for (i = 0; i < mpic->num_sources; i++) {
1233 /* start with vector = source number, and masked */ 1253 /* start with vector = source number, and masked */
1234 u32 vecpri = MPIC_VECPRI_MASK | i | 1254 u32 vecpri = MPIC_VECPRI_MASK | i |