Thread (22 messages) 22 messages, 7 authors, 2011-11-29

Re: [PATCH 3/6] powerpc/85xx: separate MPIC handling code

From: Dmitry Eremin-Solenikov <hidden>
Date: 2011-11-17 18:44:02

On 11/17/2011 10:30 PM, Lee Nipper wrote:
On Thu, Nov 17, 2011 at 11:56 AM, Dmitry Eremin-Solenikov
[off-list ref]  wrote:
quoted
All mpc85xx boards deal with MPIC initialization in more or less the
same way. The only difrerences are some flags (WANTS_RESET,
BROKEN_FRR_NIRQS, SINGLE_DEST_CPU), and some bugs like leaking device
node counter, etc. To minimize problems, switch all boards to use one
single instance of code.

Signed-off-by: Dmitry Eremin-Solenikov<redacted>
<snip>
quoted
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_common.c b/arch/powerpc/platforms/85xx/mpc85xx_common.c
index fe40668..7579e24 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_common.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_common.c
@@ -7,6 +7,9 @@
  */
  #include<linux/of_platform.h>

+#include<asm/machdep.h>
+#include<asm/mpic.h>
+
  #include<sysdev/cpm2_pic.h>

  #include "mpc85xx.h"
@@ -63,3 +66,43 @@ void __init mpc85xx_cpm2_pic_init(void)
        irq_set_chained_handler(irq, cpm2_cascade);
  }
  #endif
+
+
+void __init mpc85xx_init_mpic(bool reset, bool broken_frr, bool singledest)
+{
+       struct mpic *mpic;
+       struct resource r;
+       struct device_node *np = NULL;
+       unsigned int flags = MPIC_PRIMARY | MPIC_BIG_ENDIAN |
+                               MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU;
since parameters broken_frr and singledest are used later,
flags should probably be just:

             unsigned int flags = MPIC_PRIMARY | MPIC_BIG_ENDIAN;
Yes, forgot about this when cleaning up. Sorry.
quoted
+
+       np = of_find_node_by_type(np, "open-pic");
+
+       if (np == NULL) {
+               printk(KERN_ERR "Could not find open-pic node\n");
+               return;
+       }
+
+       if (of_address_to_resource(np, 0,&r)) {
+               printk(KERN_ERR "Failed to map mpic register space\n");
+               of_node_put(np);
+               return;
+       }
+
+       if (reset)
+               flags |= MPIC_WANTS_RESET;
+       if (broken_frr)
+               flags |= MPIC_BROKEN_FRR_NIRQS;
+       if (singledest)
+               flags |= MPIC_SINGLE_DEST_CPU;
+       if (ppc_md.get_irq == mpic_get_coreint_irq)
+               flags |= MPIC_ENABLE_COREINT;
+
+       mpic = mpic_alloc(np, r.start, flags, 0, 256, " OpenPIC  ");
+       BUG_ON(mpic == NULL);
+
+       /* Return the mpic node */
+       of_node_put(np);
+
+       mpic_init(mpic);
+}
<snip>
quoted
--
1.7.7.1

-- 
With best wishes
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help