Pull Kconfig into release branch
[pandora-kernel.git] / arch / powerpc / kernel / setup_32.c
index e569433..69ac257 100644 (file)
@@ -39,6 +39,8 @@
 #include <asm/nvram.h>
 #include <asm/xmon.h>
 #include <asm/time.h>
+#include <asm/serial.h>
+#include <asm/udbg.h>
 
 #include "setup.h"
 
 #include <asm/kgdb.h>
 #endif
 
-extern void platform_init(void);
 extern void bootx_init(unsigned long r4, unsigned long phys);
 
-extern void ppc6xx_idle(void);
-extern void power4_idle(void);
-
 boot_infos_t *boot_infos;
 struct ide_machdep_calls ppc_ide_md;
 
@@ -68,10 +66,6 @@ unsigned int DMA_MODE_WRITE;
 int have_of = 1;
 
 #ifdef CONFIG_PPC_MULTIPLATFORM
-extern void prep_init(void);
-extern void pmac_init(void);
-extern void chrp_init(void);
-
 dev_t boot_dev;
 #endif /* CONFIG_PPC_MULTIPLATFORM */
 
@@ -83,9 +77,6 @@ unsigned long SYSRQ_KEY = 0x54;
 unsigned long vgacon_remap_base;
 #endif
 
-struct machdep_calls ppc_md;
-EXPORT_SYMBOL(ppc_md);
-
 /*
  * These are used in binfmt_elf.c to put aux entries on the stack
  * for each elf executable being started.
@@ -109,7 +100,7 @@ unsigned long __init early_init(unsigned long dt_ptr)
 
        /* First zero the BSS -- use memset_io, some platforms don't have
         * caches on yet */
-       memset_io(PTRRELOC(&__bss_start), 0, _end - __bss_start);
+       memset_io((void __iomem *)PTRRELOC(&__bss_start), 0, _end - __bss_start);
 
        /*
         * Identify the CPU type and fix up code sections
@@ -121,48 +112,6 @@ unsigned long __init early_init(unsigned long dt_ptr)
        return KERNELBASE + offset;
 }
 
-#ifdef CONFIG_PPC_MULTIPLATFORM
-/*
- * The PPC_MULTIPLATFORM version of platform_init...
- */
-void __init platform_init(void)
-{
-       /* if we didn't get any bootinfo telling us what we are... */
-       if (_machine == 0) {
-               /* prep boot loader tells us if we're prep or not */
-               if ( *(unsigned long *)(KERNELBASE) == (0xdeadc0de) )
-                       _machine = _MACH_prep;
-       }
-
-#ifdef CONFIG_PPC_PREP
-       /* not much more to do here, if prep */
-       if (_machine == _MACH_prep) {
-               prep_init();
-               return;
-       }
-#endif
-
-#ifdef CONFIG_ADB
-       if (strstr(cmd_line, "adb_sync")) {
-               extern int __adb_probe_sync;
-               __adb_probe_sync = 1;
-       }
-#endif /* CONFIG_ADB */
-
-       switch (_machine) {
-#ifdef CONFIG_PPC_PMAC
-       case _MACH_Pmac:
-               pmac_init();
-               break;
-#endif
-#ifdef CONFIG_PPC_CHRP
-       case _MACH_chrp:
-               chrp_init();
-               break;
-#endif
-       }
-}
-#endif
 
 /*
  * Find out what kind of machine we're on and save any data we need
@@ -172,16 +121,28 @@ void __init platform_init(void)
  */
 void __init machine_init(unsigned long dt_ptr, unsigned long phys)
 {
+       /* If btext is enabled, we might have a BAT setup for early display,
+        * thus we do enable some very basic udbg output
+        */
+#ifdef CONFIG_BOOTX_TEXT
+       udbg_putc = btext_drawchar;
+#endif
+
+       /* Do some early initialization based on the flat device tree */
        early_init_devtree(__va(dt_ptr));
 
+       /* Check default command line */
 #ifdef CONFIG_CMDLINE
-       strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
+       if (cmd_line[0] == 0)
+               strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
 #endif /* CONFIG_CMDLINE */
 
-       platform_init();
+       probe_machine();
 
 #ifdef CONFIG_6xx
-       ppc_md.power_save = ppc6xx_idle;
+       if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
+           cpu_has_feature(CPU_FTR_CAN_NAP))
+               ppc_md.power_save = ppc6xx_idle;
 #endif
 
        if (ppc_md.progress)
@@ -259,9 +220,8 @@ int __init ppc_init(void)
        if ( ppc_md.progress ) ppc_md.progress("             ", 0xffff);
 
        /* register CPU devices */
-       for (i = 0; i < NR_CPUS; i++)
-               if (cpu_possible(i))
-                       register_cpu(&cpu_devices[i], i, NULL);
+       for_each_possible_cpu(i)
+               register_cpu(&cpu_devices[i], i, NULL);
 
        /* call platform init */
        if (ppc_md.init != NULL) {
@@ -282,25 +242,20 @@ void __init setup_arch(char **cmdline_p)
 
        unflatten_device_tree();
        check_for_initrd();
-       finish_device_tree();
 
-       smp_setup_cpu_maps();
+       if (ppc_md.init_early)
+               ppc_md.init_early();
 
-#ifdef CONFIG_BOOTX_TEXT
-       init_boot_display();
-#endif
+       find_legacy_serial_ports();
+       finish_device_tree();
 
-#ifdef CONFIG_PPC_PMAC
-       /* This could be called "early setup arch", it must be done
-        * now because xmon need it
-        */
-       if (_machine == _MACH_Pmac)
-               pmac_feature_init();    /* New cool way */
-#endif
+       smp_setup_cpu_maps();
 
 #ifdef CONFIG_XMON_DEFAULT
        xmon_init(1);
 #endif
+       /* Register early console */
+       register_early_udbg_console();
 
 #if defined(CONFIG_KGDB)
        if (ppc_md.kgdb_map_scc)
@@ -345,12 +300,6 @@ void __init setup_arch(char **cmdline_p)
        do_init_bootmem();
        if ( ppc_md.progress ) ppc_md.progress("setup_arch: bootmem", 0x3eab);
 
-#ifdef CONFIG_PPC_OCP
-       /* Initialize OCP device list */
-       ocp_early_init();
-       if ( ppc_md.progress ) ppc_md.progress("ocp: exit", 0x3eab);
-#endif
-
 #ifdef CONFIG_DUMMY_CONSOLE
        conswitchp = &dummy_con;
 #endif
@@ -359,7 +308,4 @@ void __init setup_arch(char **cmdline_p)
        if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
 
        paging_init();
-
-       /* this is for modules since _machine can be a define -- Cort */
-       ppc_md.ppc_machine = _machine;
 }