Skip to content

Commit

Permalink
powerpc/mpic: Search for open-pic device-tree node if NULL
Browse files Browse the repository at this point in the history
Almost all PowerPC platforms use a standard "open-pic" device node so
the mpic_alloc() function now accepts NULL for the device-node.  This
will cause it to perform a default search with of_find_matching_node().

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Kyle Moffett authored and Benjamin Herrenschmidt committed Dec 7, 2011
1 parent e7a9867 commit 996983b
Show file tree
Hide file tree
Showing 23 changed files with 58 additions and 244 deletions.
10 changes: 1 addition & 9 deletions arch/powerpc/platforms/85xx/corenet_ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,13 @@
void __init corenet_ds_pic_init(void)
{
struct mpic *mpic;
struct device_node *np = NULL;
unsigned int flags = MPIC_PRIMARY | MPIC_BIG_ENDIAN |
MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU;

np = of_find_node_by_type(np, "open-pic");

if (np == NULL) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

if (ppc_md.get_irq == mpic_get_coreint_irq)
flags |= MPIC_ENABLE_COREINT;

mpic = mpic_alloc(np, 0, flags, 0, 256, " OpenPIC ");
mpic = mpic_alloc(NULL, 0, flags, 0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);

mpic_init(mpic);
Expand Down
14 changes: 1 addition & 13 deletions arch/powerpc/platforms/85xx/ksi8560.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,10 @@ static void machine_restart(char *cmd)

static void __init ksi8560_pic_init(void)
{
struct mpic *mpic;
struct device_node *np;

np = of_find_node_by_type(NULL, "open-pic");

if (np == NULL) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0,
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);
of_node_put(np);

mpic_init(mpic);

mpc85xx_cpm2_pic_init();
Expand Down
13 changes: 1 addition & 12 deletions arch/powerpc/platforms/85xx/mpc8536_ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,11 @@

void __init mpc8536_ds_pic_init(void)
{
struct mpic *mpic;
struct device_node *np;

np = of_find_node_by_type(NULL, "open-pic");
if (np == NULL) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0,
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET |
MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);
of_node_put(np);

mpic_init(mpic);
}

Expand Down
13 changes: 1 addition & 12 deletions arch/powerpc/platforms/85xx/mpc85xx_ads.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,10 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,

static void __init mpc85xx_ads_pic_init(void)
{
struct mpic *mpic;
struct device_node *np = NULL;

np = of_find_node_by_type(np, "open-pic");
if (!np) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0,
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);
of_node_put(np);

mpic_init(mpic);

mpc85xx_cpm2_pic_init();
Expand Down
15 changes: 1 addition & 14 deletions arch/powerpc/platforms/85xx/mpc85xx_cds.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,23 +188,10 @@ static struct irqaction mpc85xxcds_8259_irqaction = {
static void __init mpc85xx_cds_pic_init(void)
{
struct mpic *mpic;
struct device_node *np = NULL;

np = of_find_node_by_type(np, "open-pic");

if (np == NULL) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0,
mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);

/* Return the mpic node */
of_node_put(np);

mpic_init(mpic);
}

Expand Down
14 changes: 3 additions & 11 deletions arch/powerpc/platforms/85xx/mpc85xx_ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,36 +63,28 @@ static void mpc85xx_8259_cascade(unsigned int irq, struct irq_desc *desc)
void __init mpc85xx_ds_pic_init(void)
{
struct mpic *mpic;
struct device_node *np;
#ifdef CONFIG_PPC_I8259
struct device_node *np;
struct device_node *cascade_node = NULL;
int cascade_irq;
#endif
unsigned long root = of_get_flat_dt_root();

np = of_find_node_by_type(NULL, "open-pic");
if (np == NULL) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) {
mpic = mpic_alloc(np, 0,
mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY |
MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
MPIC_SINGLE_DEST_CPU,
0, 256, " OpenPIC ");
} else {
mpic = mpic_alloc(np, 0,
mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET |
MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
MPIC_SINGLE_DEST_CPU,
0, 256, " OpenPIC ");
}

BUG_ON(mpic == NULL);
of_node_put(np);

mpic_init(mpic);

#ifdef CONFIG_PPC_I8259
Expand Down
10 changes: 1 addition & 9 deletions arch/powerpc/platforms/85xx/mpc85xx_mds.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,11 @@ machine_arch_initcall(p1021_mds, swiotlb_setup_bus_notifier);

static void __init mpc85xx_mds_pic_init(void)
{
struct mpic *mpic;
struct device_node *np = NULL;

np = of_find_node_by_type(NULL, "open-pic");
if (!np)
return;

mpic = mpic_alloc(np, 0,
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);
of_node_put(np);

mpic_init(mpic);
mpc85xx_mds_qeic_init();
Expand Down
14 changes: 2 additions & 12 deletions arch/powerpc/platforms/85xx/mpc85xx_rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,24 @@
void __init mpc85xx_rdb_pic_init(void)
{
struct mpic *mpic;
struct device_node *np;
unsigned long root = of_get_flat_dt_root();

np = of_find_node_by_type(NULL, "open-pic");
if (np == NULL) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

if (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
mpic = mpic_alloc(np, 0,
mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY |
MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
MPIC_SINGLE_DEST_CPU,
0, 256, " OpenPIC ");
} else {
mpic = mpic_alloc(np, 0,
mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET |
MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
MPIC_SINGLE_DEST_CPU,
0, 256, " OpenPIC ");
}

BUG_ON(mpic == NULL);
of_node_put(np);

mpic_init(mpic);

}

/*
Expand Down
12 changes: 2 additions & 10 deletions arch/powerpc/platforms/85xx/p1010rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,8 @@

void __init p1010_rdb_pic_init(void)
{
struct mpic *mpic;
struct device_node *np;

np = of_find_node_by_type(NULL, "open-pic");
if (np == NULL) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0, MPIC_PRIMARY | MPIC_WANTS_RESET |
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET |
MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
0, 256, " OpenPIC ");

Expand Down
14 changes: 1 addition & 13 deletions arch/powerpc/platforms/85xx/p1022_ds.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,24 +241,12 @@ p1022ds_valid_monitor_port(enum fsl_diu_monitor_port port)

void __init p1022_ds_pic_init(void)
{
struct mpic *mpic;
struct device_node *np;

np = of_find_node_by_type(NULL, "open-pic");
if (!np) {
pr_err("Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0,
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET |
MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
MPIC_SINGLE_DEST_CPU,
0, 256, " OpenPIC ");

BUG_ON(mpic == NULL);
of_node_put(np);

mpic_init(mpic);
}

Expand Down
11 changes: 1 addition & 10 deletions arch/powerpc/platforms/85xx/p1023_rds.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,7 @@ machine_device_initcall(p1023_rds, mpc85xx_common_publish_devices);

static void __init mpc85xx_rds_pic_init(void)
{
struct mpic *mpic;
struct device_node *np = NULL;

np = of_find_node_by_type(NULL, "open-pic");
if (!np) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0,
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
0, 256, " OpenPIC ");
Expand Down
16 changes: 1 addition & 15 deletions arch/powerpc/platforms/85xx/sbc8548.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,10 @@ static int sbc_rev;

static void __init sbc8548_pic_init(void)
{
struct mpic *mpic;
struct device_node *np = NULL;

np = of_find_node_by_type(np, "open-pic");

if (np == NULL) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0,
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);

/* Return the mpic node */
of_node_put(np);

mpic_init(mpic);
}

Expand Down
13 changes: 1 addition & 12 deletions arch/powerpc/platforms/85xx/sbc8560.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,10 @@

static void __init sbc8560_pic_init(void)
{
struct mpic *mpic;
struct device_node *np = NULL;

np = of_find_node_by_type(np, "open-pic");
if (!np) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0,
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);
of_node_put(np);

mpic_init(mpic);

mpc85xx_cpm2_pic_init();
Expand Down
11 changes: 1 addition & 10 deletions arch/powerpc/platforms/85xx/socrates.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,12 @@

static void __init socrates_pic_init(void)
{
struct mpic *mpic;
struct device_node *np;

np = of_find_node_by_type(NULL, "open-pic");
if (!np) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0,
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);
of_node_put(np);

mpic_init(mpic);

np = of_find_compatible_node(NULL, NULL, "abb,socrates-fpga-pic");
Expand Down
13 changes: 1 addition & 12 deletions arch/powerpc/platforms/85xx/stx_gp3.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,10 @@

static void __init stx_gp3_pic_init(void)
{
struct mpic *mpic;
struct device_node *np;

np = of_find_node_by_type(NULL, "open-pic");
if (!np) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0,
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);
of_node_put(np);

mpic_init(mpic);

mpc85xx_cpm2_pic_init();
Expand Down
13 changes: 1 addition & 12 deletions arch/powerpc/platforms/85xx/tqm85xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,10 @@

static void __init tqm85xx_pic_init(void)
{
struct mpic *mpic;
struct device_node *np;

np = of_find_node_by_type(NULL, "open-pic");
if (!np) {
printk(KERN_ERR "Could not find open-pic node\n");
return;
}

mpic = mpic_alloc(np, 0,
struct mpic *mpic = mpic_alloc(NULL, 0,
MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
0, 256, " OpenPIC ");
BUG_ON(mpic == NULL);
of_node_put(np);

mpic_init(mpic);

mpc85xx_cpm2_pic_init();
Expand Down
Loading

0 comments on commit 996983b

Please sign in to comment.