powerpc: Get rid of ppc_md.init_early()
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 5 Jul 2016 05:04:06 +0000 (15:04 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 21 Jul 2016 09:07:26 +0000 (19:07 +1000)
It is now called right after platform probe, so the probe function
can just do the job.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
15 files changed:
arch/powerpc/include/asm/machdep.h
arch/powerpc/kernel/setup_32.c
arch/powerpc/kernel/setup_64.c
arch/powerpc/platforms/512x/mpc5121_ads.c
arch/powerpc/platforms/512x/mpc512x_generic.c
arch/powerpc/platforms/512x/pdm360ng.c
arch/powerpc/platforms/chrp/setup.c
arch/powerpc/platforms/embedded6xx/c2k.c
arch/powerpc/platforms/embedded6xx/gamecube.c
arch/powerpc/platforms/embedded6xx/wii.c
arch/powerpc/platforms/maple/setup.c
arch/powerpc/platforms/pasemi/setup.c
arch/powerpc/platforms/powermac/setup.c
arch/powerpc/platforms/powernv/setup.c
arch/powerpc/platforms/pseries/setup.c

index 5b2edf5ba1149bb5e251c81d868558bb099b9687..76f5398e7152e7e6a0e9d77c39e543d8f892c68a 100644 (file)
@@ -53,7 +53,6 @@ struct machdep_calls {
 
        int             (*probe)(void);
        void            (*setup_arch)(void); /* Optional, may be NULL */
-       void            (*init_early)(void);
        /* Optional, may be NULL. */
        void            (*show_cpuinfo)(struct seq_file *m);
        void            (*show_percpuinfo)(struct seq_file *m, int i);
index e7bb4e76896a0350b182bc861d6818db27d3d372..22347e87c354582f54b4781b76cfe137e79cb84c 100644 (file)
@@ -263,9 +263,6 @@ void __init setup_arch(char **cmdline_p)
 
        setup_power_save();
 
-       if (ppc_md.init_early)
-               ppc_md.init_early();
-
        find_legacy_serial_ports();
 
        smp_setup_cpu_maps();
index 883d527899a756a6e701f863f718180b2f15f883..8b9768a97387a3a27d3c7d646ff3b52b012e07c9 100644 (file)
@@ -511,14 +511,6 @@ void __init setup_system(void)
        /* Probe the machine type */
        probe_machine();
 
-       /*
-        * Do some platform specific early initializations, that includes
-        * setting up the hash table pointers. It also sets up some interrupt-mapping
-        * related options that will be used by finish_device_tree()
-        */
-       if (ppc_md.init_early)
-               ppc_md.init_early();
-
        /*
         * We can discover serial ports now since the above did setup the
         * hash table management for us, thus ioremap works. We do that early
index 4e03f04e3a1fe8838b0b0c7d0def37af4b2cdde9..f65d5033cdb09c62e1569f6085e194cad3913e95 100644 (file)
@@ -57,7 +57,12 @@ static void __init mpc5121_ads_init_IRQ(void)
  */
 static int __init mpc5121_ads_probe(void)
 {
-       return of_machine_is_compatible("fsl,mpc5121ads");
+       if (!of_machine_is_compatible("fsl,mpc5121ads"))
+               return 0;
+
+       mpc512x_init_early();
+
+       return 1;
 }
 
 define_machine(mpc5121_ads) {
@@ -65,7 +70,6 @@ define_machine(mpc5121_ads) {
        .probe                  = mpc5121_ads_probe,
        .setup_arch             = mpc5121_ads_setup_arch,
        .init                   = mpc512x_init,
-       .init_early             = mpc512x_init_early,
        .init_IRQ               = mpc5121_ads_init_IRQ,
        .get_irq                = ipic_get_irq,
        .calibrate_decr         = generic_calibrate_decr,
index 87eba1753088359e93c704c0fb82ae4f364875a1..bf884d3075e4a56f52ea32353b5ceed1f181cbf8 100644 (file)
@@ -38,14 +38,18 @@ static const char * const board[] __initconst = {
  */
 static int __init mpc512x_generic_probe(void)
 {
-       return of_device_compatible_match(of_root, board);
+       if (!of_device_compatible_match(of_root, board))
+               return 0;
+
+       mpc512x_init_early();
+
+       return 1;
 }
 
 define_machine(mpc512x_generic) {
        .name                   = "MPC512x generic",
        .probe                  = mpc512x_generic_probe,
        .init                   = mpc512x_init,
-       .init_early             = mpc512x_init_early,
        .setup_arch             = mpc512x_setup_arch,
        .init_IRQ               = mpc512x_init_IRQ,
        .get_irq                = ipic_get_irq,
index f9cad19a33ab407df9368876e2f185123c99abef..dc81f05e0bce436d862a24a07caa60473d79f0ef 100644 (file)
@@ -113,7 +113,12 @@ void __init pdm360ng_init(void)
 
 static int __init pdm360ng_probe(void)
 {
-       return of_machine_is_compatible("ifm,pdm360ng");
+       if (!of_machine_is_compatible("ifm,pdm360ng"))
+               return 0;
+
+       mpc512x_init_early();
+
+       return 1;
 }
 
 define_machine(pdm360ng) {
@@ -121,7 +126,6 @@ define_machine(pdm360ng) {
        .probe                  = pdm360ng_probe,
        .setup_arch             = mpc512x_setup_arch,
        .init                   = pdm360ng_init,
-       .init_early             = mpc512x_init_early,
        .init_IRQ               = mpc512x_init_IRQ,
        .get_irq                = ipic_get_irq,
        .calibrate_decr         = generic_calibrate_decr,
index c55002f01dc12e3e2697e1266ba80cd00b683901..bfb300633dfeae14a900f7afab1df314d43c7ece 100644 (file)
@@ -253,7 +253,7 @@ static void __noreturn briq_restart(char *cmd)
  * But unfortunately, the firmware does not connect /chosen/{stdin,stdout}
  * the the built-in serial node. Instead, a /failsafe node is created.
  */
-static __init void chrp_init_early(void)
+static __init void chrp_init(void)
 {
        struct device_node *node;
        const char *property;
@@ -587,6 +587,8 @@ static int __init chrp_probe(void)
 
        pm_power_off = rtas_power_off;
 
+       chrp_init();
+
        return 1;
 }
 
@@ -595,7 +597,6 @@ define_machine(chrp) {
        .probe                  = chrp_probe,
        .setup_arch             = chrp_setup_arch,
        .init                   = chrp_init2,
-       .init_early             = chrp_init_early,
        .show_cpuinfo           = chrp_show_cpuinfo,
        .init_IRQ               = chrp_init_IRQ,
        .restart                = rtas_restart,
index 7fef40edf04401c83f18109cc8b32e59f54fe018..d19e4e759597fc9106e5ab502aaf0296b8cc9ba5 100644 (file)
@@ -130,6 +130,9 @@ static int __init c2k_probe(void)
 
        _set_L2CR(0);
        _set_L2CR(L2CR_L2E | L2CR_L2PE | L2CR_L2I);
+
+       mv64x60_init_early();
+
        return 1;
 }
 
@@ -137,7 +140,6 @@ define_machine(c2k) {
        .name                   = "C2K",
        .probe                  = c2k_probe,
        .setup_arch             = c2k_setup_arch,
-       .init_early             = mv64x60_init_early,
        .show_cpuinfo           = c2k_show_cpuinfo,
        .init_IRQ               = mv64x60_init_irq,
        .get_irq                = mv64x60_get_irq,
index f5a837fa895199e7f43b6efc3054ce3157cd9311..36789cec957cac11a7a23e92fcf5cc5184c59aba 100644 (file)
@@ -54,11 +54,6 @@ static void __noreturn gamecube_halt(void)
        gamecube_restart(NULL);
 }
 
-static void __init gamecube_init_early(void)
-{
-       ug_udbg_init();
-}
-
 static int __init gamecube_probe(void)
 {
        if (!of_machine_is_compatible("nintendo,gamecube"))
@@ -66,6 +61,8 @@ static int __init gamecube_probe(void)
 
        pm_power_off = gamecube_power_off;
 
+       ug_udbg_init();
+
        return 1;
 }
 
@@ -77,7 +74,6 @@ static void gamecube_shutdown(void)
 define_machine(gamecube) {
        .name                   = "gamecube",
        .probe                  = gamecube_probe,
-       .init_early             = gamecube_init_early,
        .restart                = gamecube_restart,
        .halt                   = gamecube_halt,
        .init_IRQ               = flipper_pic_probe,
index fe3e769db263998fb6804d5692d9b29ed78c81d3..3fd683e40bc951ed0795e4a0b1b072936edfea1c 100644 (file)
@@ -192,11 +192,6 @@ static void __noreturn wii_halt(void)
        wii_spin();
 }
 
-static void __init wii_init_early(void)
-{
-       ug_udbg_init();
-}
-
 static void __init wii_pic_probe(void)
 {
        flipper_pic_probe();
@@ -210,6 +205,8 @@ static int __init wii_probe(void)
 
        pm_power_off = wii_power_off;
 
+       ug_udbg_init();
+
        return 1;
 }
 
@@ -222,7 +219,6 @@ static void wii_shutdown(void)
 define_machine(wii) {
        .name                   = "wii",
        .probe                  = wii_probe,
-       .init_early             = wii_init_early,
        .setup_arch             = wii_setup_arch,
        .restart                = wii_restart,
        .halt                   = wii_halt,
index d3d44cba661b48d007c307a8fbb897a127e9a009..3c30c7a4534ddc02cad6f760488c0c59482f00ba 100644 (file)
@@ -198,18 +198,6 @@ void __init maple_setup_arch(void)
        mmio_nvram_init();
 }
 
-/* 
- * Early initialization.
- */
-static void __init maple_init_early(void)
-{
-       DBG(" -> maple_init_early\n");
-
-       iommu_init_early_dart(&maple_pci_controller_ops);
-
-       DBG(" <- maple_init_early\n");
-}
-
 /*
  * This is almost identical to pSeries and CHRP. We need to make that
  * code generic at one point, with appropriate bits in the device-tree to
@@ -306,6 +294,8 @@ static int __init maple_probe(void)
 
        pm_power_off = maple_power_off;
 
+       iommu_init_early_dart(&maple_pci_controller_ops);
+
        return 1;
 }
 
@@ -313,7 +303,6 @@ define_machine(maple) {
        .name                   = "Maple",
        .probe                  = maple_probe,
        .setup_arch             = maple_setup_arch,
-       .init_early             = maple_init_early,
        .init_IRQ               = maple_init_IRQ,
        .pci_irq_fixup          = maple_pci_irq_fixup,
        .pci_get_legacy_ide_irq = maple_pci_get_legacy_ide_irq,
index ec810ddb10ee9e352767baabae0df6e8bf490877..e86c1bd08f1f6ef09472f92204058998fc8e16ed 100644 (file)
@@ -339,11 +339,6 @@ out:
        return !!(srr1 & 0x2);
 }
 
-static void __init pas_init_early(void)
-{
-       iommu_init_early_pasemi();
-}
-
 #ifdef CONFIG_PCMCIA
 static int pcmcia_notify(struct notifier_block *nb, unsigned long action,
                         void *data)
@@ -424,6 +419,8 @@ static int __init pas_probe(void)
            !of_machine_is_compatible("pasemi,pwrficient"))
                return 0;
 
+       iommu_init_early_pasemi();
+
        return 1;
 }
 
@@ -431,7 +428,6 @@ define_machine(pasemi) {
        .name                   = "PA Semi PWRficient",
        .probe                  = pas_probe,
        .setup_arch             = pas_setup_arch,
-       .init_early             = pas_init_early,
        .init_IRQ               = pas_init_IRQ,
        .get_irq                = mpic_get_irq,
        .restart                = pas_restart,
index 60ca40ac351950082b65db0efeccd3d5cf5dd200..3de4a7c85140bf99b31a0b4346c19d4858d21ac8 100644 (file)
@@ -452,7 +452,7 @@ pmac_halt(void)
 /* 
  * Early initialization.
  */
-static void __init pmac_init_early(void)
+static void __init pmac_init(void)
 {
        /* Enable early btext debug if requested */
        if (strstr(boot_command_line, "btextdbg")) {
@@ -603,6 +603,8 @@ static int __init pmac_probe(void)
 
        pm_power_off = pmac_power_off;
 
+       pmac_init();
+
        return 1;
 }
 
@@ -610,7 +612,6 @@ define_machine(powermac) {
        .name                   = "PowerMac",
        .probe                  = pmac_probe,
        .setup_arch             = pmac_setup_arch,
-       .init_early             = pmac_init_early,
        .show_cpuinfo           = pmac_show_cpuinfo,
        .init_IRQ               = pmac_pic_init,
        .get_irq                = NULL, /* changed later */
index 8865efa54e51d55c247bd98dd983d3c540f1e8df..efe8b6bb168b97961f3943f7e2038a9faae2f702 100644 (file)
@@ -58,7 +58,7 @@ static void __init pnv_setup_arch(void)
        /* XXX PMCS */
 }
 
-static void __init pnv_init_early(void)
+static void __init pnv_init(void)
 {
        /*
         * Initialize the LPC bus now so that legacy serial
@@ -276,6 +276,8 @@ static int __init pnv_probe(void)
 
        pr_debug("PowerNV detected !\n");
 
+       pnv_init();
+
        return 1;
 }
 
@@ -301,7 +303,6 @@ static unsigned long pnv_get_proc_freq(unsigned int cpu)
 define_machine(powernv) {
        .name                   = "PowerNV",
        .probe                  = pnv_probe,
-       .init_early             = pnv_init_early,
        .setup_arch             = pnv_setup_arch,
        .init_IRQ               = pnv_init_IRQ,
        .show_cpuinfo           = pnv_show_cpuinfo,
index 6988b9dc3d3b3914357e7eb5f0182b7e9e04bc43..4ffcaa6f867095cdcabfa51c9a206c0efd138f0c 100644 (file)
@@ -620,9 +620,9 @@ static void pSeries_cmo_feature_init(void)
 /*
  * Early initialization.  Relocation is on but do not reference unbolted pages
  */
-static void __init pSeries_init_early(void)
+static void __init pseries_init(void)
 {
-       pr_debug(" -> pSeries_init_early()\n");
+       pr_debug(" -> pseries_init()\n");
 
 #ifdef CONFIG_HVC_CONSOLE
        if (firmware_has_feature(FW_FEATURE_LPAR))
@@ -639,7 +639,7 @@ static void __init pSeries_init_early(void)
        pSeries_cmo_feature_init();
        iommu_init_early_pSeries();
 
-       pr_debug(" <- pSeries_init_early()\n");
+       pr_debug(" <- pseries_init()\n");
 }
 
 /**
@@ -691,6 +691,8 @@ static int __init pSeries_probe(void)
        pr_debug("Machine is%s LPAR !\n",
                 (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not");
 
+       pseries_init();
+
        return 1;
 }
 
@@ -709,7 +711,6 @@ define_machine(pseries) {
        .name                   = "pSeries",
        .probe                  = pSeries_probe,
        .setup_arch             = pSeries_setup_arch,
-       .init_early             = pSeries_init_early,
        .init_IRQ               = pseries_init_irq,
        .show_cpuinfo           = pSeries_show_cpuinfo,
        .log_error              = pSeries_log_error,