]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
powerpc/85xx: consolidate of_platform_bus_probe calls
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Thu, 17 Nov 2011 17:56:17 +0000 (21:56 +0400)
committerKumar Gala <galak@kernel.crashing.org>
Thu, 24 Nov 2011 08:01:41 +0000 (02:01 -0600)
85xx board files have a lot of duplication in *_publish_devices()/
*_declare_of_platform_devices() functions. Merge that into a single
function common to most of the boards.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
16 files changed:
arch/powerpc/platforms/85xx/ksi8560.c
arch/powerpc/platforms/85xx/mpc8536_ds.c
arch/powerpc/platforms/85xx/mpc85xx.h
arch/powerpc/platforms/85xx/mpc85xx_ads.c
arch/powerpc/platforms/85xx/mpc85xx_cds.c
arch/powerpc/platforms/85xx/mpc85xx_common.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/p1022_ds.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

index bf9b1e5f10f9398dd836f50854c9bcf288977309..0f3e6883265744e7faec9230cb444e37344b3d71 100644 (file)
@@ -190,22 +190,7 @@ static void ksi8560_show_cpuinfo(struct seq_file *m)
        seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
-       { .type = "soc", },
-       { .type = "simple-bus", },
-       { .name = "cpm", },
-       { .name = "localbus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init declare_of_platform_devices(void)
-{
-       of_platform_bus_probe(NULL, of_bus_ids, NULL);
-
-       return 0;
-}
-machine_device_initcall(ksi8560, declare_of_platform_devices);
+machine_device_initcall(ksi8560, mpc85xx_common_publish_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
index 6a4b2c1372f4adb4029964ed8b7904f48bc601a3..9ee6455c2f1e64bf9c5090c12e72a23e8d676299 100644 (file)
@@ -106,19 +106,7 @@ static void __init mpc8536_ds_setup_arch(void)
        printk("MPC8536 DS board from Freescale Semiconductor\n");
 }
 
-static struct of_device_id __initdata mpc8536_ds_ids[] = {
-       { .type = "soc", },
-       { .compatible = "soc", },
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init mpc8536_ds_publish_devices(void)
-{
-       return of_platform_bus_probe(NULL, mpc8536_ds_ids, NULL);
-}
-machine_device_initcall(mpc8536_ds, mpc8536_ds_publish_devices);
+machine_device_initcall(mpc8536_ds, mpc85xx_common_publish_devices);
 
 machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier);
 
index fa55e8b08505c6cd737621823f340f2fda74574d..2aa7c5dc2c7f6d1131e482a27d58ff2931fdf709 100644 (file)
@@ -1,5 +1,7 @@
 #ifndef MPC85xx_H
 #define MPC85xx_H
+extern int mpc85xx_common_publish_devices(void);
+
 #ifdef CONFIG_CPM2
 extern void mpc85xx_cpm2_pic_init(void);
 #else
index 8b8f7a20116676d3f21dccb2931a8864fcfcf13e..986554b74d3ff7341eddf69144e8688bbb3d6d33 100644 (file)
@@ -193,23 +193,7 @@ static void mpc85xx_ads_show_cpuinfo(struct seq_file *m)
        seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
-       { .name = "soc", },
-       { .type = "soc", },
-       { .name = "cpm", },
-       { .name = "localbus", },
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init declare_of_platform_devices(void)
-{
-       of_platform_bus_probe(NULL, of_bus_ids, NULL);
-
-       return 0;
-}
-machine_device_initcall(mpc85xx_ads, declare_of_platform_devices);
+machine_device_initcall(mpc85xx_ads, mpc85xx_common_publish_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
index 4f68bb7b381f85b0f40eec7c090a5352ad25e991..f24926b00451bda61565d5f4ab9ea5c7f3e49851 100644 (file)
@@ -332,19 +332,7 @@ static int __init mpc85xx_cds_probe(void)
         return of_flat_dt_is_compatible(root, "MPC85xxCDS");
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
-       { .type = "soc", },
-       { .compatible = "soc", },
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init declare_of_platform_devices(void)
-{
-       return of_platform_bus_probe(NULL, of_bus_ids, NULL);
-}
-machine_device_initcall(mpc85xx_cds, declare_of_platform_devices);
+machine_device_initcall(mpc85xx_cds, mpc85xx_common_publish_devices);
 
 define_machine(mpc85xx_cds) {
        .name           = "MPC85xx CDS",
index 49d781c369660bf725d350902cc9d567b2ad8af0..fe40668171052ae7414d5baf032d784f2b563d02 100644 (file)
 
 #include "mpc85xx.h"
 
+static struct of_device_id __initdata mpc85xx_common_ids[] = {
+       { .type = "soc", },
+       { .compatible = "soc", },
+       { .compatible = "simple-bus", },
+       { .name = "cpm", },
+       { .name = "localbus", },
+       { .compatible = "gianfar", },
+       { .compatible = "fsl,qe", },
+       { .compatible = "fsl,cpm2", },
+       {},
+};
+
+int __init mpc85xx_common_publish_devices(void)
+{
+       return of_platform_bus_probe(NULL, mpc85xx_common_ids, NULL);
+}
 #ifdef CONFIG_CPM2
 static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
 {
index 55075b966b622a839d5667e2ede03f28e1e14b57..2113120c5a7db96ac3a631a291437359e0a10032 100644 (file)
@@ -221,21 +221,9 @@ static int __init mpc8544_ds_probe(void)
        return 0;
 }
 
-static struct of_device_id __initdata mpc85xxds_ids[] = {
-       { .type = "soc", },
-       { .compatible = "soc", },
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init mpc85xxds_publish_devices(void)
-{
-       return of_platform_bus_probe(NULL, mpc85xxds_ids, NULL);
-}
-machine_device_initcall(mpc8544_ds, mpc85xxds_publish_devices);
-machine_device_initcall(mpc8572_ds, mpc85xxds_publish_devices);
-machine_device_initcall(p2020_ds, mpc85xxds_publish_devices);
+machine_device_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
+machine_device_initcall(mpc8572_ds, mpc85xx_common_publish_devices);
+machine_device_initcall(p2020_ds, mpc85xx_common_publish_devices);
 
 machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier);
 machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier);
index 9270da42b8bf4fe9497d389eaedbe37f058f9458..38cb473a52d973c31fa3bd5d2413010fe9e49e66 100644 (file)
@@ -160,25 +160,6 @@ extern void __init mpc85xx_smp_init(void);
 #endif
 
 #ifdef CONFIG_QUICC_ENGINE
-static struct of_device_id mpc85xx_qe_ids[] __initdata = {
-       { .type = "qe", },
-       { .compatible = "fsl,qe", },
-       { },
-};
-
-static void __init mpc85xx_publish_qe_devices(void)
-{
-       struct device_node *np;
-
-       np = of_find_compatible_node(NULL, NULL, "fsl,qe");
-       if (!of_device_is_available(np)) {
-               of_node_put(np);
-               return;
-       }
-
-       of_platform_bus_probe(NULL, mpc85xx_qe_ids, NULL);
-}
-
 static void __init mpc85xx_mds_reset_ucc_phys(void)
 {
        struct device_node *np;
@@ -349,7 +330,6 @@ static void __init mpc85xx_mds_qeic_init(void)
        of_node_put(np);
 }
 #else
-static void __init mpc85xx_publish_qe_devices(void) { }
 static void __init mpc85xx_mds_qe_init(void) { }
 static void __init mpc85xx_mds_qeic_init(void) { }
 #endif /* CONFIG_QUICC_ENGINE */
@@ -431,24 +411,12 @@ machine_arch_initcall(mpc8568_mds, board_fixups);
 machine_arch_initcall(mpc8569_mds, board_fixups);
 
 static struct of_device_id mpc85xx_ids[] = {
-       { .type = "soc", },
-       { .compatible = "soc", },
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
        { .compatible = "fsl,srio", },
        { .compatible = "fsl,mpc8548-guts", },
        { .compatible = "gpio-leds", },
        {},
 };
 
-static struct of_device_id p1021_ids[] = {
-       { .type = "soc", },
-       { .compatible = "soc", },
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
 static int __init mpc85xx_publish_devices(void)
 {
        if (machine_is(mpc8568_mds))
@@ -456,23 +424,15 @@ static int __init mpc85xx_publish_devices(void)
        if (machine_is(mpc8569_mds))
                simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio");
 
+       mpc85xx_common_publish_devices();
        of_platform_bus_probe(NULL, mpc85xx_ids, NULL);
-       mpc85xx_publish_qe_devices();
-
-       return 0;
-}
-
-static int __init p1021_publish_devices(void)
-{
-       of_platform_bus_probe(NULL, p1021_ids, NULL);
-       mpc85xx_publish_qe_devices();
 
        return 0;
 }
 
 machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices);
 machine_device_initcall(mpc8569_mds, mpc85xx_publish_devices);
-machine_device_initcall(p1021_mds, p1021_publish_devices);
+machine_device_initcall(p1021_mds, mpc85xx_common_publish_devices);
 
 machine_arch_initcall(mpc8568_mds, swiotlb_setup_bus_notifier);
 machine_arch_initcall(mpc8569_mds, swiotlb_setup_bus_notifier);
index 824d2b676d56a637a71943fc73f01d82d3ff17bb..9feccbbd4d96ce9998b4071543f7f528ecc1cfdb 100644 (file)
@@ -111,20 +111,8 @@ static void __init mpc85xx_rdb_setup_arch(void)
        printk(KERN_INFO "MPC85xx RDB board from Freescale Semiconductor\n");
 }
 
-static struct of_device_id __initdata mpc85xxrdb_ids[] = {
-       { .type = "soc", },
-       { .compatible = "soc", },
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init mpc85xxrdb_publish_devices(void)
-{
-       return of_platform_bus_probe(NULL, mpc85xxrdb_ids, NULL);
-}
-machine_device_initcall(p2020_rdb, mpc85xxrdb_publish_devices);
-machine_device_initcall(p1020_rdb, mpc85xxrdb_publish_devices);
+machine_device_initcall(p2020_rdb, mpc85xx_common_publish_devices);
+machine_device_initcall(p1020_rdb, mpc85xx_common_publish_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
index c75ec1c8ea6596b1e11cb99fb60d854614e941e1..2bf4342ab656b457834657e65dbefda40d1cf2cd 100644 (file)
@@ -327,10 +327,6 @@ static void __init p1022_ds_setup_arch(void)
 }
 
 static struct of_device_id __initdata p1022_ds_ids[] = {
-       { .type = "soc", },
-       { .compatible = "soc", },
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
        /* So that the DMA channel nodes can be probed individually: */
        { .compatible = "fsl,eloplus-dma", },
        {},
@@ -338,6 +334,7 @@ static struct of_device_id __initdata p1022_ds_ids[] = {
 
 static int __init p1022_ds_publish_devices(void)
 {
+       mpc85xx_common_publish_devices();
        return of_platform_bus_probe(NULL, p1022_ds_ids, NULL);
 }
 machine_device_initcall(p1022_ds, p1022_ds_publish_devices);
index 14632a971225c7b497f51e13c61c9bf2ce49db20..845ed3b89462a7ec991717a0a8f886e3196aa489 100644 (file)
@@ -48,6 +48,8 @@
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
 
+#include "mpc85xx.h"
+
 static int sbc_rev;
 
 static void __init sbc8548_pic_init(void)
@@ -149,21 +151,7 @@ static void sbc8548_show_cpuinfo(struct seq_file *m)
        seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
-       { .name = "soc", },
-       { .type = "soc", },
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init declare_of_platform_devices(void)
-{
-       of_platform_bus_probe(NULL, of_bus_ids, NULL);
-
-       return 0;
-}
-machine_device_initcall(sbc8548, declare_of_platform_devices);
+machine_device_initcall(sbc8548, mpc85xx_common_publish_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
index 43711f89577834285ea55b8f335234dff4925cab..e9a7ed228d73a3543356f3ecc138647083d39681 100644 (file)
@@ -180,23 +180,7 @@ static void sbc8560_show_cpuinfo(struct seq_file *m)
        seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
-       { .name = "soc", },
-       { .type = "soc", },
-       { .name = "cpm", },
-       { .name = "localbus", },
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init declare_of_platform_devices(void)
-{
-       of_platform_bus_probe(NULL, of_bus_ids, NULL);
-
-       return 0;
-}
-machine_device_initcall(sbc8560, declare_of_platform_devices);
+machine_device_initcall(sbc8560, mpc85xx_common_publish_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
index 9d0fc283c1a10b76dddaaac89567f0ae62c5f22d..fec496ad79c0f54016078c0f7cbccbfa15d83ca1 100644 (file)
@@ -97,17 +97,7 @@ static void __init socrates_setup_arch(void)
 #endif
 }
 
-static struct of_device_id __initdata socrates_of_bus_ids[] = {
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init socrates_publish_devices(void)
-{
-       return of_platform_bus_probe(NULL, socrates_of_bus_ids, NULL);
-}
-machine_device_initcall(socrates, socrates_publish_devices);
+machine_device_initcall(socrates, mpc85xx_common_publish_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
index d24192b708235fba7c04be9b53a4514b7c56224d..b44c936c26537ff6888a84167deeaa7ec8c38905 100644 (file)
@@ -113,19 +113,7 @@ static void stx_gp3_show_cpuinfo(struct seq_file *m)
        seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
 }
 
-static struct of_device_id __initdata of_bus_ids[] = {
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init declare_of_platform_devices(void)
-{
-       of_platform_bus_probe(NULL, of_bus_ids, NULL);
-
-       return 0;
-}
-machine_device_initcall(stx_gp3, declare_of_platform_devices);
+machine_device_initcall(stx_gp3, mpc85xx_common_publish_devices);
 
 /*
  * Called very early, device-tree isn't unflattened
index b9e53ccf114366545997de76c95e348e973148b2..2418bf8d074bafdeab96ed012befab375d923a4d 100644 (file)
@@ -142,19 +142,7 @@ static void __init tqm85xx_ti1520_fixup(struct pci_dev *pdev)
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520,
                tqm85xx_ti1520_fixup);
 
-static struct of_device_id __initdata of_bus_ids[] = {
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init declare_of_platform_devices(void)
-{
-       of_platform_bus_probe(NULL, of_bus_ids, NULL);
-
-       return 0;
-}
-machine_device_initcall(tqm85xx, declare_of_platform_devices);
+machine_device_initcall(tqm85xx, mpc85xx_common_publish_devices);
 
 static const char *board[] __initdata = {
        "tqc,tqm8540",
index ab7025a7e9a512ed9b5120de25e1ff74fc93f783..4632c1b27da78869c0136cc757089e7071f7d324 100644 (file)
@@ -179,21 +179,9 @@ static void __init xes_mpc85xx_setup_arch(void)
 #endif
 }
 
-static struct of_device_id __initdata xes_mpc85xx_ids[] = {
-       { .type = "soc", },
-       { .compatible = "soc", },
-       { .compatible = "simple-bus", },
-       { .compatible = "gianfar", },
-       {},
-};
-
-static int __init xes_mpc85xx_publish_devices(void)
-{
-       return of_platform_bus_probe(NULL, xes_mpc85xx_ids, NULL);
-}
-machine_device_initcall(xes_mpc8572, xes_mpc85xx_publish_devices);
-machine_device_initcall(xes_mpc8548, xes_mpc85xx_publish_devices);
-machine_device_initcall(xes_mpc8540, xes_mpc85xx_publish_devices);
+machine_device_initcall(xes_mpc8572, mpc85xx_common_publish_devices);
+machine_device_initcall(xes_mpc8548, mpc85xx_common_publish_devices);
+machine_device_initcall(xes_mpc8540, mpc85xx_common_publish_devices);
 
 /*
  * Called very early, device-tree isn't unflattened