]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
powerpc/mpic: Save computed phys_addr for board-specific code
authorKyle Moffett <Kyle.D.Moffett@boeing.com>
Fri, 2 Dec 2011 06:28:01 +0000 (06:28 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 7 Dec 2011 02:43:07 +0000 (13:43 +1100)
The MPIC code can already perform an automatic OF address translation
step as part of mpic_alloc(), but several boards need to use that base
address when they perform mpic_assign_isu().

The easiest solution is to save the computed physical address into the
"struct mpic" for later use by the board code.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/include/asm/mpic.h
arch/powerpc/platforms/embedded6xx/holly.c
arch/powerpc/platforms/embedded6xx/linkstation.c
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
arch/powerpc/platforms/embedded6xx/storcenter.c
arch/powerpc/platforms/pasemi/setup.c
arch/powerpc/sysdev/mpic.c

index e6fae49e0b745ff75e7433bc5d2b1c7832ca820f..ba0b2046106eefb991c9b15072662865547615d7 100644 (file)
@@ -293,6 +293,9 @@ struct mpic
        /* Register access method */
        enum mpic_reg_type      reg_type;
 
+       /* The physical base address of the MPIC */
+       phys_addr_t paddr;
+
        /* The various ioremap'ed bases */
        struct mpic_reg_bank    gregs;
        struct mpic_reg_bank    tmregs;
index 2e9bcf6444c8dc9c59ad23a98fcd38c6c5f17d0e..d4fb41e29c351574366d77e19aa7a596c499eb3e 100644 (file)
@@ -148,7 +148,6 @@ static void __init holly_setup_arch(void)
 static void __init holly_init_IRQ(void)
 {
        struct mpic *mpic;
-       phys_addr_t mpic_paddr = 0;
        struct device_node *tsi_pic;
 #ifdef CONFIG_PCI
        unsigned int cascade_pci_irq;
@@ -157,20 +156,12 @@ static void __init holly_init_IRQ(void)
 #endif
 
        tsi_pic = of_find_node_by_type(NULL, "open-pic");
-       if (tsi_pic) {
-               unsigned int size;
-               const void *prop = of_get_property(tsi_pic, "reg", &size);
-               mpic_paddr = of_translate_address(tsi_pic, prop);
-       }
-
-       if (mpic_paddr == 0) {
+       if (!tsi_pic) {
                printk(KERN_ERR "%s: No tsi108 PIC found !\n", __func__);
                return;
        }
 
-       pr_debug("%s: tsi108 pic phys_addr = 0x%x\n", __func__, (u32) mpic_paddr);
-
-       mpic = mpic_alloc(tsi_pic, mpic_paddr,
+       mpic = mpic_alloc(tsi_pic, 0,
                        MPIC_PRIMARY | MPIC_BIG_ENDIAN | MPIC_WANTS_RESET |
                        MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108,
                        24,
@@ -179,7 +170,7 @@ static void __init holly_init_IRQ(void)
 
        BUG_ON(mpic == NULL);
 
-       mpic_assign_isu(mpic, 0, mpic_paddr + 0x100);
+       mpic_assign_isu(mpic, 0, mpic->paddr + 0x100);
 
        mpic_init(mpic);
 
index 244f997de79131790e312e445556da06fa6de74e..72b36850c5e37bad1f3672f29d91f0fce29c72f1 100644 (file)
@@ -82,28 +82,22 @@ static void __init linkstation_init_IRQ(void)
 {
        struct mpic *mpic;
        struct device_node *dnp;
-       const u32 *prop;
-       int size;
-       phys_addr_t paddr;
 
        dnp = of_find_node_by_type(NULL, "open-pic");
        if (dnp == NULL)
                return;
 
-       prop = of_get_property(dnp, "reg", &size);
-       paddr = (phys_addr_t)of_translate_address(dnp, prop);
-
-       mpic = mpic_alloc(dnp, paddr, MPIC_PRIMARY | MPIC_WANTS_RESET, 4, 32, " EPIC     ");
+       mpic = mpic_alloc(dnp, 0, MPIC_PRIMARY | MPIC_WANTS_RESET, 4, 32, " EPIC     ");
        BUG_ON(mpic == NULL);
 
        /* PCI IRQs */
-       mpic_assign_isu(mpic, 0, paddr + 0x10200);
+       mpic_assign_isu(mpic, 0, mpic->paddr + 0x10200);
 
        /* I2C */
-       mpic_assign_isu(mpic, 1, paddr + 0x11000);
+       mpic_assign_isu(mpic, 1, mpic->paddr + 0x11000);
 
        /* ttyS0, ttyS1 */
-       mpic_assign_isu(mpic, 2, paddr + 0x11100);
+       mpic_assign_isu(mpic, 2, mpic->paddr + 0x11100);
 
        mpic_init(mpic);
 }
index f8f33e16c6b616aec46a72233517038a8c2f47c3..c8ce204abd2d564261f2294a7115fe2f36240a33 100644 (file)
@@ -102,7 +102,6 @@ static void __init mpc7448_hpc2_setup_arch(void)
 static void __init mpc7448_hpc2_init_IRQ(void)
 {
        struct mpic *mpic;
-       phys_addr_t mpic_paddr = 0;
        struct device_node *tsi_pic;
 #ifdef CONFIG_PCI
        unsigned int cascade_pci_irq;
@@ -111,21 +110,12 @@ static void __init mpc7448_hpc2_init_IRQ(void)
 #endif
 
        tsi_pic = of_find_node_by_type(NULL, "open-pic");
-       if (tsi_pic) {
-               unsigned int size;
-               const void *prop = of_get_property(tsi_pic, "reg", &size);
-               mpic_paddr = of_translate_address(tsi_pic, prop);
-       }
-
-       if (mpic_paddr == 0) {
+       if (!tsi_pic) {
                printk("%s: No tsi108 PIC found !\n", __func__);
                return;
        }
 
-       DBG("%s: tsi108 pic phys_addr = 0x%x\n", __func__,
-           (u32) mpic_paddr);
-
-       mpic = mpic_alloc(tsi_pic, mpic_paddr,
+       mpic = mpic_alloc(tsi_pic, 0,
                        MPIC_PRIMARY | MPIC_BIG_ENDIAN | MPIC_WANTS_RESET |
                        MPIC_SPV_EOI | MPIC_NO_PTHROU_DIS | MPIC_REGSET_TSI108,
                        24,
@@ -134,7 +124,7 @@ static void __init mpc7448_hpc2_init_IRQ(void)
 
        BUG_ON(mpic == NULL);
 
-       mpic_assign_isu(mpic, 0, mpic_paddr + 0x100);
+       mpic_assign_isu(mpic, 0, mpic->paddr + 0x100);
 
        mpic_init(mpic);
 
index f1eebcae9bf0b7e353b1a3cbabc091b386553960..084f0fc706b71aa40f158827db1ab3d9b14e0909 100644 (file)
@@ -84,22 +84,12 @@ static void __init storcenter_init_IRQ(void)
 {
        struct mpic *mpic;
        struct device_node *dnp;
-       const void *prop;
-       int size;
-       phys_addr_t paddr;
 
        dnp = of_find_node_by_type(NULL, "open-pic");
        if (dnp == NULL)
                return;
 
-       prop = of_get_property(dnp, "reg", &size);
-       if (prop == NULL) {
-               of_node_put(dnp);
-               return;
-       }
-
-       paddr = (phys_addr_t)of_translate_address(dnp, prop);
-       mpic = mpic_alloc(dnp, paddr, MPIC_PRIMARY | MPIC_WANTS_RESET,
+       mpic = mpic_alloc(dnp, 0, MPIC_PRIMARY | MPIC_WANTS_RESET,
                        16, 32, " OpenPIC  ");
 
        of_node_put(dnp);
@@ -110,8 +100,8 @@ static void __init storcenter_init_IRQ(void)
         * 16 Serial Interrupts followed by 16 Internal Interrupts.
         * I2C is the second internal, so it is at 17, 0x11020.
         */
-       mpic_assign_isu(mpic, 0, paddr + 0x10200);
-       mpic_assign_isu(mpic, 1, paddr + 0x11000);
+       mpic_assign_isu(mpic, 0, mpic->paddr + 0x10200);
+       mpic_assign_isu(mpic, 1, mpic->paddr + 0x11000);
 
        mpic_init(mpic);
 }
index 6f35582105544396ca584f908e6cb2dbef548dfc..baf20a913827209533aabd2cd85ff3de9b6e4ae6 100644 (file)
@@ -234,7 +234,7 @@ static __init void pas_init_IRQ(void)
                          mpic_flags, 0, 0, "PASEMI-OPIC");
        BUG_ON(!mpic);
 
-       mpic_assign_isu(mpic, 0, openpic_addr + 0x10000);
+       mpic_assign_isu(mpic, 0, mpic->paddr + 0x10000);
        mpic_init(mpic);
        /* The NMI/MCK source needs to be prio 15 */
        if (nmiprop) {
index 59564dcaab146aa711259ad1f361068b8880997c..ef721c30f4799f701d2ae2be6806c806584bb5e0 100644 (file)
@@ -1164,6 +1164,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
                return NULL;
 
        mpic->name = name;
+       mpic->paddr = phys_addr;
 
        mpic->hc_irq = mpic_irq_chip;
        mpic->hc_irq.name = name;
@@ -1250,8 +1251,8 @@ struct mpic * __init mpic_alloc(struct device_node *node,
 #endif
 
        /* Map the global registers */
-       mpic_map(mpic, node, phys_addr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
-       mpic_map(mpic, node, phys_addr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
+       mpic_map(mpic, node, mpic->paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
+       mpic_map(mpic, node, mpic->paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
 
        /* Reset */
 
@@ -1306,7 +1307,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
        for_each_possible_cpu(i) {
                unsigned int cpu = get_hard_smp_processor_id(i);
 
-               mpic_map(mpic, node, phys_addr, &mpic->cpuregs[cpu],
+               mpic_map(mpic, node, mpic->paddr, &mpic->cpuregs[cpu],
                         MPIC_INFO(CPU_BASE) + cpu * MPIC_INFO(CPU_STRIDE),
                         0x1000);
        }
@@ -1314,7 +1315,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
        /* Initialize main ISU if none provided */
        if (mpic->isu_size == 0) {
                mpic->isu_size = mpic->num_sources;
-               mpic_map(mpic, node, phys_addr, &mpic->isus[0],
+               mpic_map(mpic, node, mpic->paddr, &mpic->isus[0],
                         MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
        }
        mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1);
@@ -1346,7 +1347,7 @@ struct mpic * __init mpic_alloc(struct device_node *node,
        }
        printk(KERN_INFO "mpic: Setting up MPIC \"%s\" version %s at %llx,"
               " max %d CPUs\n",
-              name, vers, (unsigned long long)phys_addr, num_possible_cpus());
+              name, vers, (unsigned long long)mpic->paddr, num_possible_cpus());
        printk(KERN_INFO "mpic: ISU size: %d, shift: %d, mask: %x\n",
               mpic->isu_size, mpic->isu_shift, mpic->isu_mask);