Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
[powerpc.git] / arch / sh / kernel / setup.c
index 36d86f9..98802ab 100644 (file)
@@ -1,14 +1,11 @@
 /*
- *  linux/arch/sh/kernel/setup.c
+ * arch/sh/kernel/setup.c
  *
- *  Copyright (C) 1999  Niibe Yutaka
- *  Copyright (C) 2002, 2003  Paul Mundt
- */
-
-/*
  * This file handles the architecture-dependent parts of initialization
+ *
+ *  Copyright (C) 1999  Niibe Yutaka
+ *  Copyright (C) 2002 - 2006 Paul Mundt
  */
-
 #include <linux/screen_info.h>
 #include <linux/ioport.h>
 #include <linux/init.h>
@@ -75,7 +72,7 @@ static struct sh_machine_vector* __init get_mv_byname(const char* name);
 #define RAMDISK_PROMPT_FLAG            0x8000
 #define RAMDISK_LOAD_FLAG              0x4000
 
-static char command_line[COMMAND_LINE_SIZE] = { 0, };
+static char __initdata command_line[COMMAND_LINE_SIZE] = { 0, };
 
 static struct resource code_resource = { .name = "Kernel code", };
 static struct resource data_resource = { .name = "Kernel data", };
@@ -84,15 +81,14 @@ unsigned long memory_start, memory_end;
 
 static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
                                  struct sh_machine_vector** mvp,
-                                 unsigned long *mv_io_base,
-                                 int *mv_mmio_enable)
+                                 unsigned long *mv_io_base)
 {
        char c = ' ', *to = command_line, *from = COMMAND_LINE;
        int len = 0;
 
        /* Save unparsed command line copy for /proc/cmdline */
-       memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
-       saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
+       memcpy(boot_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
+       boot_command_line[COMMAND_LINE_SIZE-1] = '\0';
 
        memory_start = (unsigned long)PAGE_OFFSET+__MEMORY_START;
        memory_end = memory_start + __MEMORY_SIZE;
@@ -112,23 +108,6 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
                        }
                }
 
-#ifdef CONFIG_EARLY_PRINTK
-               if (c == ' ' && !memcmp(from, "earlyprintk=", 12)) {
-                       char *ep_end;
-
-                       if (to != command_line)
-                               to--;
-
-                       from += 12;
-                       ep_end = strchr(from, ' ');
-
-                       setup_early_printk(from);
-                       printk("early console enabled\n");
-
-                       from = ep_end;
-               }
-#endif
-
                if (c == ' ' && !memcmp(from, "sh_mv=", 6)) {
                        char* mv_end;
                        char* mv_comma;
@@ -145,7 +124,6 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
                                int ints[3];
                                get_options(mv_comma+1, ARRAY_SIZE(ints), ints);
                                *mv_io_base = ints[1];
-                               *mv_mmio_enable = ints[2];
                                mv_len = mv_comma - from;
                        } else {
                                mv_len = mv_end - from;
@@ -158,6 +136,7 @@ static inline void parse_cmdline (char ** cmdline_p, char mv_name[MV_NAME_SIZE],
 
                        *mvp = get_mv_byname(mv_name);
                }
+
                c = *(from++);
                if (!c)
                        break;
@@ -177,9 +156,8 @@ static int __init sh_mv_setup(char **cmdline_p)
        struct sh_machine_vector *mv = NULL;
        char mv_name[MV_NAME_SIZE] = "";
        unsigned long mv_io_base = 0;
-       int mv_mmio_enable = 0;
 
-       parse_cmdline(cmdline_p, mv_name, &mv, &mv_io_base, &mv_mmio_enable);
+       parse_cmdline(cmdline_p, mv_name, &mv, &mv_io_base);
 
 #ifdef CONFIG_SH_UNKNOWN
        if (mv == NULL) {
@@ -258,6 +236,7 @@ void __init setup_arch(char **cmdline_p)
 
        sh_mv_setup(cmdline_p);
 
+
        /*
         * Find the highest page frame number we have available
         */
@@ -305,6 +284,7 @@ void __init setup_arch(char **cmdline_p)
                                  PFN_PHYS(pages));
        }
 
+
        /*
         * Reserve the kernel text and
         * Reserve the bootmem bitmap. We do this in two steps (first step
@@ -325,15 +305,18 @@ void __init setup_arch(char **cmdline_p)
        ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
        if (&__rd_start != &__rd_end) {
                LOADER_TYPE = 1;
-               INITRD_START = PHYSADDR((unsigned long)&__rd_start) - __MEMORY_START;
-               INITRD_SIZE = (unsigned long)&__rd_end - (unsigned long)&__rd_start;
+               INITRD_START = PHYSADDR((unsigned long)&__rd_start) -
+                                       __MEMORY_START;
+               INITRD_SIZE = (unsigned long)&__rd_end -
+                             (unsigned long)&__rd_start;
        }
 
        if (LOADER_TYPE && INITRD_START) {
                if (INITRD_START + INITRD_SIZE <= (max_low_pfn << PAGE_SHIFT)) {
-                       reserve_bootmem_node(NODE_DATA(0), INITRD_START+__MEMORY_START, INITRD_SIZE);
-                       initrd_start =
-                               INITRD_START ? INITRD_START + PAGE_OFFSET + __MEMORY_START : 0;
+                       reserve_bootmem_node(NODE_DATA(0), INITRD_START +
+                                               __MEMORY_START, INITRD_SIZE);
+                       initrd_start = INITRD_START + PAGE_OFFSET +
+                                       __MEMORY_START;
                        initrd_end = initrd_start + INITRD_SIZE;
                } else {
                        printk("initrd extends beyond end of memory "
@@ -392,6 +375,7 @@ static int __init topology_init(void)
 subsys_initcall(topology_init);
 
 static const char *cpu_name[] = {
+       [CPU_SH7206]    = "SH7206",     [CPU_SH7619]    = "SH7619",
        [CPU_SH7604]    = "SH7604",     [CPU_SH7300]    = "SH7300",
        [CPU_SH7705]    = "SH7705",     [CPU_SH7706]    = "SH7706",
        [CPU_SH7707]    = "SH7707",     [CPU_SH7708]    = "SH7708",
@@ -404,12 +388,13 @@ static const char *cpu_name[] = {
        [CPU_SH4_202]   = "SH4-202",    [CPU_SH4_501]   = "SH4-501",
        [CPU_SH7770]    = "SH7770",     [CPU_SH7780]    = "SH7780",
        [CPU_SH7781]    = "SH7781",     [CPU_SH7343]    = "SH7343",
+       [CPU_SH7785]    = "SH7785",     [CPU_SH7722]    = "SH7722",
        [CPU_SH_NONE]   = "Unknown"
 };
 
-const char *get_cpu_subtype(void)
+const char *get_cpu_subtype(struct sh_cpuinfo *c)
 {
-       return cpu_name[boot_cpu_data.type];
+       return cpu_name[c->type];
 }
 
 #ifdef CONFIG_PROC_FS
@@ -419,19 +404,19 @@ static const char *cpu_flags[] = {
        "ptea", "llsc", "l2", NULL
 };
 
-static void show_cpuflags(struct seq_file *m)
+static void show_cpuflags(struct seq_file *m, struct sh_cpuinfo *c)
 {
        unsigned long i;
 
        seq_printf(m, "cpu flags\t:");
 
-       if (!cpu_data->flags) {
+       if (!c->flags) {
                seq_printf(m, " %s\n", cpu_flags[0]);
                return;
        }
 
        for (i = 0; cpu_flags[i]; i++)
-               if ((cpu_data->flags & (1 << i)))
+               if ((c->flags & (1 << i)))
                        seq_printf(m, " %s", cpu_flags[i+1]);
 
        seq_printf(m, "\n");
@@ -453,16 +438,20 @@ static void show_cacheinfo(struct seq_file *m, const char *type,
  */
 static int show_cpuinfo(struct seq_file *m, void *v)
 {
-       unsigned int cpu = smp_processor_id();
+       struct sh_cpuinfo *c = v;
+       unsigned int cpu = c - cpu_data;
+
+       if (!cpu_online(cpu))
+               return 0;
 
-       if (!cpu && cpu_online(cpu))
+       if (cpu == 0)
                seq_printf(m, "machine\t\t: %s\n", get_system_type());
 
        seq_printf(m, "processor\t: %d\n", cpu);
        seq_printf(m, "cpu family\t: %s\n", init_utsname()->machine);
-       seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype());
+       seq_printf(m, "cpu type\t: %s\n", get_cpu_subtype(c));
 
-       show_cpuflags(m);
+       show_cpuflags(m, c);
 
        seq_printf(m, "cache type\t: ");
 
@@ -471,22 +460,22 @@ static int show_cpuinfo(struct seq_file *m, void *v)
         * unified cache on the SH-2 and SH-3, as well as the harvard
         * style cache on the SH-4.
         */
-       if (boot_cpu_data.icache.flags & SH_CACHE_COMBINED) {
+       if (c->icache.flags & SH_CACHE_COMBINED) {
                seq_printf(m, "unified\n");
-               show_cacheinfo(m, "cache", boot_cpu_data.icache);
+               show_cacheinfo(m, "cache", c->icache);
        } else {
                seq_printf(m, "split (harvard)\n");
-               show_cacheinfo(m, "icache", boot_cpu_data.icache);
-               show_cacheinfo(m, "dcache", boot_cpu_data.dcache);
+               show_cacheinfo(m, "icache", c->icache);
+               show_cacheinfo(m, "dcache", c->dcache);
        }
 
        /* Optional secondary cache */
-       if (boot_cpu_data.flags & CPU_HAS_L2_CACHE)
-               show_cacheinfo(m, "scache", boot_cpu_data.scache);
+       if (c->flags & CPU_HAS_L2_CACHE)
+               show_cacheinfo(m, "scache", c->scache);
 
        seq_printf(m, "bogomips\t: %lu.%02lu\n",
-                    boot_cpu_data.loops_per_jiffy/(500000/HZ),
-                    (boot_cpu_data.loops_per_jiffy/(5000/HZ)) % 100);
+                    c->loops_per_jiffy/(500000/HZ),
+                    (c->loops_per_jiffy/(5000/HZ)) % 100);
 
        return show_clocks(m);
 }