]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - arch/powerpc/platforms/powermac/setup.c
[PATCH] powerpc: Experimental support for new G5 Macs (#2)
[mirror_ubuntu-bionic-kernel.git] / arch / powerpc / platforms / powermac / setup.c
index da0cb165dfc601c8a7608aee4f12f245b4d5fe04..1daa5a06e9ea479161219962d494b21f9e7ed86a 100644 (file)
@@ -60,6 +60,7 @@
 #include <asm/system.h>
 #include <asm/pgtable.h>
 #include <asm/io.h>
+#include <asm/kexec.h>
 #include <asm/pci-bridge.h>
 #include <asm/ohare.h>
 #include <asm/mediabay.h>
@@ -74,7 +75,8 @@
 #include <asm/iommu.h>
 #include <asm/smu.h>
 #include <asm/pmc.h>
-#include <asm/mpic.h>
+#include <asm/lmb.h>
+#include <asm/udbg.h>
 
 #include "pmac.h"
 
@@ -192,21 +194,6 @@ static void pmac_show_cpuinfo(struct seq_file *m)
                   pmac_newworld ? "NewWorld" : "OldWorld");
 }
 
-static void pmac_show_percpuinfo(struct seq_file *m, int i)
-{
-#ifdef CONFIG_CPU_FREQ_PMAC
-       extern unsigned int pmac_get_one_cpufreq(int i);
-       unsigned int freq = pmac_get_one_cpufreq(i);
-       if (freq != 0) {
-               seq_printf(m, "clock\t\t: %dMHz\n", freq/1000);
-               return;
-       }
-#endif /* CONFIG_CPU_FREQ_PMAC */
-#ifdef CONFIG_PPC32
-       of_show_percpuinfo(m, i);
-#endif
-}
-
 #ifndef CONFIG_ADB_CUDA
 int find_via_cuda(void)
 {
@@ -225,7 +212,7 @@ int find_via_pmu(void)
                return 0;
        printk("WARNING ! Your machine is PMU-based but your kernel\n");
        printk("          wasn't compiled with CONFIG_ADB_PMU option !\n");
-       return;
+       return 0;
 }
 #endif
 
@@ -293,7 +280,7 @@ static void __init l2cr_init(void)
 
 void __init pmac_setup_arch(void)
 {
-       struct device_node *cpu;
+       struct device_node *cpu, *ic;
        int *fp;
        unsigned long pvr;
 
@@ -319,6 +306,14 @@ void __init pmac_setup_arch(void)
                of_node_put(cpu);
        }
 
+       /* See if newworld or oldworld */
+       for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; )
+               if (get_property(ic, "interrupt-controller", NULL))
+                       break;
+       pmac_newworld = (ic != NULL);
+       if (ic)
+               of_node_put(ic);
+
        /* Lookup PCI hosts */
        pmac_pci_init();
 
@@ -327,16 +322,6 @@ void __init pmac_setup_arch(void)
        l2cr_init();
 #endif /* CONFIG_PPC32 */
 
-#ifdef CONFIG_PPC64
-       /* Probe motherboard chipset */
-       /* this is done earlier in setup_arch for 32-bit */
-       pmac_feature_init();
-
-       /* We can NAP */
-       powersave_nap = 1;
-       printk(KERN_INFO "Using native/NAP idle loop\n");
-#endif
-
 #ifdef CONFIG_KGDB
        zs_kgdb_hook(0);
 #endif
@@ -345,7 +330,7 @@ void __init pmac_setup_arch(void)
        find_via_pmu();
        smu_init();
 
-#ifdef CONFIG_NVRAM
+#if defined(CONFIG_NVRAM) || defined(CONFIG_PPC64)
        pmac_nvram_init();
 #endif
 
@@ -360,7 +345,7 @@ void __init pmac_setup_arch(void)
 
 #ifdef CONFIG_SMP
        /* Check for Core99 */
-       if (find_devices("uni-n") || find_devices("u3"))
+       if (find_devices("uni-n") || find_devices("u3") || find_devices("u4"))
                smp_ops = &core99_smp_ops;
 #ifdef CONFIG_PPC32
        else
@@ -627,35 +612,37 @@ static void __init pmac_init_early(void)
         * and call ioremap
         */
        hpte_init_native();
+#endif
 
-       /* Init SCC */
-       if (strstr(cmd_line, "sccdbg")) {
-               sccdbg = 1;
-               udbg_init_scc(NULL);
+       /* Enable early btext debug if requested */
+       if (strstr(cmd_line, "btextdbg")) {
+               udbg_adb_init_early();
+               register_early_udbg_console();
        }
 
+       /* Probe motherboard chipset */
+       pmac_feature_init();
+
+       /* We can NAP */
+       powersave_nap = 1;
+       printk(KERN_INFO "Using native/NAP idle loop\n");
+
+       /* Initialize debug stuff */
+       udbg_scc_init(!!strstr(cmd_line, "sccdbg"));
+       udbg_adb_init(!!strstr(cmd_line, "btextdbg"));
+
+#ifdef CONFIG_PPC64
        /* Setup interrupt mapping options */
        ppc64_interrupt_controller = IC_OPEN_PIC;
 
-       iommu_init_early_u3();
+       iommu_init_early_dart();
 #endif
 }
 
 static void __init pmac_progress(char *s, unsigned short hex)
 {
-#ifdef CONFIG_PPC64
-       if (sccdbg) {
-               udbg_puts(s);
-               udbg_puts("\n");
-               return;
-       }
-#endif
-#ifdef CONFIG_BOOTX_TEXT
-       if (boot_text_mapped) {
-               btext_drawstring(s);
-               btext_drawchar('\n');
-       }
-#endif /* CONFIG_BOOTX_TEXT */
+       udbg_puts(s);
+       udbg_puts("\n");
 }
 
 /*
@@ -669,7 +656,7 @@ static int pmac_check_legacy_ioport(unsigned int baseport)
 
 static int __init pmac_declare_of_platform_devices(void)
 {
-       struct device_node *np;
+       struct device_node *np, *npp;
 
        np = find_devices("uni-n");
        if (np) {
@@ -687,14 +674,16 @@ static int __init pmac_declare_of_platform_devices(void)
        if (np)
                of_platform_device_create(np, "platinum", NULL);
 
-       np = find_devices("u3");
-       if (np) {
-               for (np = np->child; np != NULL; np = np->sibling)
+       npp = of_find_node_by_name(NULL, "u3");
+       if (npp) {
+               for (np = NULL; (np = of_get_next_child(npp, np)) != NULL;) {
                        if (strncmp(np->name, "i2c", 3) == 0) {
-                               of_platform_device_create(np, "u3-i2c",
-                                                         NULL);
+                               of_platform_device_create(np, "u3-i2c", NULL);
+                               of_node_put(np);
                                break;
                        }
+               }
+               of_node_put(npp);
        }
         np = of_find_node_by_type(NULL, "smu");
         if (np) {
@@ -722,7 +711,7 @@ static int __init pmac_probe(int platform)
         * occupies having to be broken up so the DART itself is not
         * part of the cacheable linar mapping
         */
-       alloc_u3_dart_table();
+       alloc_dart_table();
 #endif
 
 #ifdef CONFIG_PMAC_SMU
@@ -738,15 +727,17 @@ static int __init pmac_probe(int platform)
 }
 
 #ifdef CONFIG_PPC64
-static int pmac_probe_mode(struct pci_bus *bus)
+/* Move that to pci.c */
+static int pmac_pci_probe_mode(struct pci_bus *bus)
 {
        struct device_node *node = bus->sysdata;
 
        /* We need to use normal PCI probing for the AGP bus,
-          since the device for the AGP bridge isn't in the tree. */
-       if (bus->self == NULL && device_is_compatible(node, "u3-agp"))
+        * since the device for the AGP bridge isn't in the tree.
+        */
+       if (bus->self == NULL && (device_is_compatible(node, "u3-agp") ||
+                                 device_is_compatible(node, "u4-pcie")))
                return PCI_PROBE_NORMAL;
-
        return PCI_PROBE_DEVTREE;
 }
 #endif
@@ -759,9 +750,8 @@ struct machdep_calls __initdata pmac_md = {
        .setup_arch             = pmac_setup_arch,
        .init_early             = pmac_init_early,
        .show_cpuinfo           = pmac_show_cpuinfo,
-       .show_percpuinfo        = pmac_show_percpuinfo,
        .init_IRQ               = pmac_pic_init,
-       .get_irq                = mpic_get_irq, /* changed later */
+       .get_irq                = NULL, /* changed later */
        .pcibios_fixup          = pmac_pcibios_fixup,
        .restart                = pmac_restart,
        .power_off              = pmac_power_off,
@@ -775,10 +765,15 @@ struct machdep_calls __initdata pmac_md = {
        .check_legacy_ioport    = pmac_check_legacy_ioport,
        .progress               = pmac_progress,
 #ifdef CONFIG_PPC64
-       .pci_probe_mode         = pmac_probe_mode,
+       .pci_probe_mode         = pmac_pci_probe_mode,
        .idle_loop              = native_idle,
        .enable_pmcs            = power4_enable_pmcs,
+#ifdef CONFIG_KEXEC
+       .machine_kexec          = default_machine_kexec,
+       .machine_kexec_prepare  = default_machine_kexec_prepare,
+       .machine_crash_shutdown = default_machine_crash_shutdown,
 #endif
+#endif /* CONFIG_PPC64 */
 #ifdef CONFIG_PPC32
        .pcibios_enable_device_hook = pmac_pci_enable_device_hook,
        .pcibios_after_init     = pmac_pcibios_after_init,