powerpc: Consolidate mpic_alloc() OF address translation
authorKyle Moffett <Kyle.D.Moffett@boeing.com>
Fri, 2 Dec 2011 06:27:59 +0000 (06:27 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 7 Dec 2011 02:43:06 +0000 (13:43 +1100)
Instead of using the open-coded "reg" property lookup and address
translation in mpic_alloc(), directly call of_address_to_resource().
This includes various workarounds for special cases which the naive
of_address_translate() does not.

Afterwards it is possible to remove the copiously copy-pasted calls to
of_address_translate() from the 85xx/86xx/powermac platforms.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
20 files changed:
arch/powerpc/platforms/85xx/corenet_ds.c
arch/powerpc/platforms/85xx/ksi8560.c
arch/powerpc/platforms/85xx/mpc8536_ds.c
arch/powerpc/platforms/85xx/mpc85xx_ads.c
arch/powerpc/platforms/85xx/mpc85xx_cds.c
arch/powerpc/platforms/85xx/mpc85xx_ds.c
arch/powerpc/platforms/85xx/mpc85xx_mds.c
arch/powerpc/platforms/85xx/mpc85xx_rdb.c
arch/powerpc/platforms/85xx/p1010rdb.c
arch/powerpc/platforms/85xx/p1022_ds.c
arch/powerpc/platforms/85xx/p1023_rds.c
arch/powerpc/platforms/85xx/sbc8548.c
arch/powerpc/platforms/85xx/sbc8560.c
arch/powerpc/platforms/85xx/socrates.c
arch/powerpc/platforms/85xx/stx_gp3.c
arch/powerpc/platforms/85xx/tqm85xx.c
arch/powerpc/platforms/85xx/xes_mpc85xx.c
arch/powerpc/platforms/86xx/pic.c
arch/powerpc/platforms/powermac/pic.c
arch/powerpc/sysdev/mpic.c

index 30528219b27454a77d14a3f9533ce90da6b452b1..5b1c577199bf48a984e0d88081254598eee50d41 100644 (file)
@@ -36,7 +36,6 @@
 void __init corenet_ds_pic_init(void)
 {
        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;
@@ -48,16 +47,10 @@ void __init corenet_ds_pic_init(void)
                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 (ppc_md.get_irq == mpic_get_coreint_irq)
                flags |= MPIC_ENABLE_COREINT;
 
-       mpic = mpic_alloc(np, r.start, flags, 0, 256, " OpenPIC  ");
+       mpic = mpic_alloc(np, 0, flags, 0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
 
        mpic_init(mpic);
index 0f3e6883265744e7faec9230cb444e37344b3d71..3403b0e0143b89d544d101719e689f6640669253 100644 (file)
@@ -58,7 +58,6 @@ static void machine_restart(char *cmd)
 static void __init ksi8560_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np;
 
        np = of_find_node_by_type(NULL, "open-pic");
@@ -68,13 +67,7 @@ static void __init ksi8560_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Could not map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
index 9ee6455c2f1e64bf9c5090c12e72a23e8d676299..5c20b28568b051efbe58dc15f2cbf1ee8ef25da5 100644 (file)
@@ -37,7 +37,6 @@
 void __init mpc8536_ds_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np;
 
        np = of_find_node_by_type(NULL, "open-pic");
@@ -46,13 +45,7 @@ void __init mpc8536_ds_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Failed to map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                          MPIC_PRIMARY | MPIC_WANTS_RESET |
                          MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
                        0, 256, " OpenPIC  ");
index 986554b74d3ff7341eddf69144e8688bbb3d6d33..4c1e9b67ac531e3f8bdea36f4bd5725a97a95ed7 100644 (file)
@@ -51,7 +51,6 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
 static void __init mpc85xx_ads_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np = NULL;
 
        np = of_find_node_by_type(np, "open-pic");
@@ -60,13 +59,7 @@ static void __init mpc85xx_ads_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Could not map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
index d993b66f1abf638de6eb3e8bfa802a766bbf8061..62b90c3596992bef1996dcf4ecce9e6295e1ec28 100644 (file)
@@ -188,7 +188,6 @@ static struct irqaction mpc85xxcds_8259_irqaction = {
 static void __init mpc85xx_cds_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np = NULL;
 
        np = of_find_node_by_type(np, "open-pic");
@@ -198,13 +197,7 @@ static void __init mpc85xx_cds_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Failed to map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
index 3f66631103c040e9d36efb17cd0de24926915da9..4fc6b801c552b3ba62544ab2f05bc7f6c6e2abf2 100644 (file)
@@ -63,7 +63,6 @@ static void mpc85xx_8259_cascade(unsigned int irq, struct irq_desc *desc)
 void __init mpc85xx_ds_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np;
 #ifdef CONFIG_PPC_I8259
        struct device_node *cascade_node = NULL;
@@ -77,20 +76,14 @@ void __init mpc85xx_ds_pic_init(void)
                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 (of_flat_dt_is_compatible(root, "fsl,MPC8572DS-CAMP")) {
-               mpic = mpic_alloc(np, r.start,
+               mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY |
                        MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
                        MPIC_SINGLE_DEST_CPU,
                        0, 256, " OpenPIC  ");
        } else {
-               mpic = mpic_alloc(np, r.start,
+               mpic = mpic_alloc(np, 0,
                          MPIC_PRIMARY | MPIC_WANTS_RESET |
                          MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
                          MPIC_SINGLE_DEST_CPU,
index 813b5d3a435f5f24d8239578580c1c2be5f83755..74b6da2e0876d8143ff0b754bd8ee3db664231a2 100644 (file)
@@ -435,20 +435,13 @@ machine_arch_initcall(p1021_mds, swiotlb_setup_bus_notifier);
 static void __init mpc85xx_mds_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np = NULL;
 
        np = of_find_node_by_type(NULL, "open-pic");
        if (!np)
                return;
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Failed to map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
                        MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
                        0, 256, " OpenPIC  ");
index b1ca429a51587f650878207ebe36178092c0b39b..2b299eba3670b408a73e18e2ac48402a03fa76ca 100644 (file)
@@ -45,7 +45,6 @@
 void __init mpc85xx_rdb_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np;
        unsigned long root = of_get_flat_dt_root();
 
@@ -55,20 +54,14 @@ void __init mpc85xx_rdb_pic_init(void)
                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 (of_flat_dt_is_compatible(root, "fsl,MPC85XXRDB-CAMP")) {
-               mpic = mpic_alloc(np, r.start,
+               mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY |
                        MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
                        MPIC_SINGLE_DEST_CPU,
                        0, 256, " OpenPIC  ");
        } else {
-               mpic = mpic_alloc(np, r.start,
+               mpic = mpic_alloc(np, 0,
                  MPIC_PRIMARY | MPIC_WANTS_RESET |
                  MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
                  MPIC_SINGLE_DEST_CPU,
index 2f479f88c1a00679db744b39b864f1cca3c39088..dff49e83ba6b68dce3af99e1ed1aa996228305b0 100644 (file)
@@ -33,7 +33,6 @@
 void __init p1010_rdb_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np;
 
        np = of_find_node_by_type(NULL, "open-pic");
@@ -42,13 +41,7 @@ void __init p1010_rdb_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Failed to map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start, MPIC_PRIMARY | MPIC_WANTS_RESET |
+       mpic = mpic_alloc(np, 0, MPIC_PRIMARY | MPIC_WANTS_RESET |
          MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
          0, 256, " OpenPIC  ");
 
index 8d5c22bfdd2e2e27c0c995621cf3e2c6ed6e50d3..6d684c2979af2a860abb98118ca83538eafa4799 100644 (file)
@@ -242,7 +242,6 @@ p1022ds_valid_monitor_port(enum fsl_diu_monitor_port port)
 void __init p1022_ds_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np;
 
        np = of_find_node_by_type(NULL, "open-pic");
@@ -251,13 +250,7 @@ void __init p1022_ds_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               pr_err("Failed to map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                MPIC_PRIMARY | MPIC_WANTS_RESET |
                MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
                MPIC_SINGLE_DEST_CPU,
index 57c3e0f32e9d4537b578f9535d29278f09b0e6b5..df7ccf688218bb069ff661ccdbea8f47b952ca1a 100644 (file)
@@ -94,7 +94,6 @@ machine_device_initcall(p1023_rds, mpc85xx_common_publish_devices);
 static void __init mpc85xx_rds_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np = NULL;
 
        np = of_find_node_by_type(NULL, "open-pic");
@@ -103,13 +102,7 @@ static void __init mpc85xx_rds_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Failed to map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN |
                MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU,
                0, 256, " OpenPIC  ");
index 845ed3b89462a7ec991717a0a8f886e3196aa489..5e16025a755e8b152fa1f831d81da33f478fd124 100644 (file)
@@ -55,7 +55,6 @@ static int sbc_rev;
 static void __init sbc8548_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np = NULL;
 
        np = of_find_node_by_type(np, "open-pic");
@@ -65,13 +64,7 @@ static void __init sbc8548_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Failed to map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
index e9a7ed228d73a3543356f3ecc138647083d39681..97f00dec0d93610ae7ab21351abe7ec1ecb118f9 100644 (file)
@@ -42,7 +42,6 @@
 static void __init sbc8560_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np = NULL;
 
        np = of_find_node_by_type(np, "open-pic");
@@ -51,13 +50,7 @@ static void __init sbc8560_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Could not map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
index fec496ad79c0f54016078c0f7cbccbfa15d83ca1..e87e75cdb94021d6cf42c157b5f07bcb4a2c73f1 100644 (file)
@@ -47,7 +47,6 @@
 static void __init socrates_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np;
 
        np = of_find_node_by_type(NULL, "open-pic");
@@ -56,13 +55,7 @@ static void __init socrates_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Could not map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
index b44c936c26537ff6888a84167deeaa7ec8c38905..060d51480758b27198a6cf5e2fb8fd48f198d9b6 100644 (file)
@@ -49,7 +49,6 @@
 static void __init stx_gp3_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np;
 
        np = of_find_node_by_type(NULL, "open-pic");
@@ -58,13 +57,7 @@ static void __init stx_gp3_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Could not map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
index 2418bf8d074bafdeab96ed012befab375d923a4d..a46b9fc662050fb8122f010ba5cb1fd402482473 100644 (file)
@@ -47,7 +47,6 @@
 static void __init tqm85xx_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np;
 
        np = of_find_node_by_type(NULL, "open-pic");
@@ -56,13 +55,7 @@ static void __init tqm85xx_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Could not map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
                        0, 256, " OpenPIC  ");
        BUG_ON(mpic == NULL);
index daf9bef63de49b12b98437467006c1f2e4f4e591..2be5e4de1882bef76e9d2789de373a58a9d469fe 100644 (file)
@@ -44,7 +44,6 @@
 void __init xes_mpc85xx_pic_init(void)
 {
        struct mpic *mpic;
-       struct resource r;
        struct device_node *np;
 
        np = of_find_node_by_type(NULL, "open-pic");
@@ -53,13 +52,7 @@ void __init xes_mpc85xx_pic_init(void)
                return;
        }
 
-       if (of_address_to_resource(np, 0, &r)) {
-               printk(KERN_ERR "Failed to map mpic register space\n");
-               of_node_put(np);
-               return;
-       }
-
-       mpic = mpic_alloc(np, r.start,
+       mpic = mpic_alloc(np, 0,
                          MPIC_PRIMARY | MPIC_WANTS_RESET |
                          MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
                        0, 256, " OpenPIC  ");
index 8ef8960abda6d53ccd17193ab5722ab700a2d231..f85c8f0aa96614c99a4d1ab8c716eda8c7606cb0 100644 (file)
@@ -33,7 +33,6 @@ void __init mpc86xx_init_irq(void)
 {
        struct mpic *mpic;
        struct device_node *np;
-       struct resource res;
 #ifdef CONFIG_PPC_I8259
        struct device_node *cascade_node = NULL;
        int cascade_irq;
@@ -43,9 +42,8 @@ void __init mpc86xx_init_irq(void)
        np = of_find_node_by_type(NULL, "open-pic");
        if (np == NULL)
                return;
-       of_address_to_resource(np, 0, &res);
 
-       mpic = mpic_alloc(np, res.start,
+       mpic = mpic_alloc(np, 0,
                        MPIC_PRIMARY | MPIC_WANTS_RESET |
                        MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
                        MPIC_SINGLE_DEST_CPU,
index 901bfbddc3ddcecea0e1d0dc35082ebb9d98d6ef..78456fd4416ef7bf49a333b56955c08b40fd8b4d 100644 (file)
@@ -498,14 +498,8 @@ static struct mpic * __init pmac_setup_one_mpic(struct device_node *np,
                                                int master)
 {
        const char *name = master ? " MPIC 1   " : " MPIC 2   ";
-       struct resource r;
        struct mpic *mpic;
        unsigned int flags = master ? MPIC_PRIMARY : 0;
-       int rc;
-
-       rc = of_address_to_resource(np, 0, &r);
-       if (rc)
-               return NULL;
 
        pmac_call_feature(PMAC_FTR_ENABLE_MPIC, np, 0, 0);
 
@@ -519,7 +513,7 @@ static struct mpic * __init pmac_setup_one_mpic(struct device_node *np,
        if (master && (flags & MPIC_BIG_ENDIAN))
                flags |= MPIC_U3_HT_IRQS;
 
-       mpic = mpic_alloc(np, r.start, flags, 0, 0, name);
+       mpic = mpic_alloc(np, 0, flags, 0, 0, name);
        if (mpic == NULL)
                return NULL;
 
index b3fa3d7d4ab6c7012247d2b92af44ee2ed317a7f..8f24c6e8f535d2f79ad1dabda5d37575871b9730 100644 (file)
@@ -1142,7 +1142,24 @@ struct mpic * __init mpic_alloc(struct device_node *node,
        const char      *vers;
        int             i;
        int             intvec_top;
-       u64             paddr = phys_addr;
+
+       /*
+        * If no phyiscal address was specified then all of the phyiscal
+        * addressing parameters must come from the device-tree.
+        */
+       if (!phys_addr) {
+               BUG_ON(!node);
+
+               /* Check if it is DCR-based */
+               if (of_get_property(node, "dcr-reg", NULL)) {
+                       flags |= MPIC_USES_DCR;
+               } else {
+                       struct resource r;
+                       if (of_address_to_resource(node, 0, &r))
+                               return NULL;
+                       phys_addr = r.start;
+               }
+       }
 
        mpic = kzalloc(sizeof(struct mpic), GFP_KERNEL);
        if (mpic == NULL)
@@ -1224,35 +1241,25 @@ struct mpic * __init mpic_alloc(struct device_node *node,
 #endif
 
        /* default register type */
-       mpic->reg_type = (flags & MPIC_BIG_ENDIAN) ?
-               mpic_access_mmio_be : mpic_access_mmio_le;
-
-       /* If no physical address is passed in, a device-node is mandatory */
-       BUG_ON(paddr == 0 && node == NULL);
+       if (flags & MPIC_BIG_ENDIAN)
+               mpic->reg_type = mpic_access_mmio_be;
+       else
+               mpic->reg_type = mpic_access_mmio_le;
 
-       /* If no physical address passed in, check if it's dcr based */
-       if (paddr == 0 && of_get_property(node, "dcr-reg", NULL) != NULL) {
+       /*
+        * An MPIC with a "dcr-reg" property must be accessed that way, but
+        * only if the kernel includes DCR support.
+        */
 #ifdef CONFIG_PPC_DCR
-               mpic->flags |= MPIC_USES_DCR;
+       if (flags & MPIC_USES_DCR)
                mpic->reg_type = mpic_access_dcr;
 #else
-               BUG();
-#endif /* CONFIG_PPC_DCR */
-       }
-
-       /* If the MPIC is not DCR based, and no physical address was passed
-        * in, try to obtain one
-        */
-       if (paddr == 0 && !(mpic->flags & MPIC_USES_DCR)) {
-               const u32 *reg = of_get_property(node, "reg", NULL);
-               BUG_ON(reg == NULL);
-               paddr = of_translate_address(node, reg);
-               BUG_ON(paddr == OF_BAD_ADDR);
-       }
+       BUG_ON(flags & MPIC_USES_DCR);
+#endif
 
        /* Map the global registers */
-       mpic_map(mpic, node, paddr, &mpic->gregs, MPIC_INFO(GREG_BASE), 0x1000);
-       mpic_map(mpic, node, paddr, &mpic->tmregs, MPIC_INFO(TIMER_BASE), 0x1000);
+       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);
 
        /* Reset */
 
@@ -1307,7 +1314,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, paddr, &mpic->cpuregs[cpu],
+               mpic_map(mpic, node, phys_addr, &mpic->cpuregs[cpu],
                         MPIC_INFO(CPU_BASE) + cpu * MPIC_INFO(CPU_STRIDE),
                         0x1000);
        }
@@ -1315,7 +1322,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, paddr, &mpic->isus[0],
+               mpic_map(mpic, node, phys_addr, &mpic->isus[0],
                         MPIC_INFO(IRQ_BASE), MPIC_INFO(IRQ_STRIDE) * mpic->isu_size);
        }
        mpic->isu_shift = 1 + __ilog2(mpic->isu_size - 1);
@@ -1347,7 +1354,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)paddr, num_possible_cpus());
+              name, vers, (unsigned long long)phys_addr, num_possible_cpus());
        printk(KERN_INFO "mpic: ISU size: %d, shift: %d, mask: %x\n",
               mpic->isu_size, mpic->isu_shift, mpic->isu_mask);