[PATCH 3/6] powerpc/85xx: separate MPIC handling code
Dmitry Eremin-Solenikov
dbaryshkov at gmail.com
Fri Nov 18 05:43:35 EST 2011
On 11/17/2011 10:30 PM, Lee Nipper wrote:
> On Thu, Nov 17, 2011 at 11:56 AM, Dmitry Eremin-Solenikov
> <dbaryshkov at gmail.com> wrote:
>> 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<dbaryshkov at gmail.com>
>
> <snip>
>
>> 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.
>
>> +
>> + 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>
>
>> --
>> 1.7.7.1
--
With best wishes
Dmitry
More information about the Linuxppc-dev
mailing list