Merge commit 'v2.6.29-rc4' into x86/cleanups
[linux-drm-fsl-dcu.git] / arch / x86 / mach-voyager / setup.c
1 /*
2  *      Machine specific setup for generic
3  */
4
5 #include <linux/init.h>
6 #include <linux/interrupt.h>
7 #include <asm/arch_hooks.h>
8 #include <asm/voyager.h>
9 #include <asm/e820.h>
10 #include <asm/io.h>
11 #include <asm/setup.h>
12 #include <asm/cpu.h>
13
14 void __init pre_intr_init_hook(void)
15 {
16         init_ISA_irqs();
17 }
18
19 /*
20  * IRQ2 is cascade interrupt to second interrupt controller
21  */
22 static struct irqaction irq2 = {
23         .handler = no_action,
24         .mask = CPU_MASK_NONE,
25         .name = "cascade",
26 };
27
28 void __init intr_init_hook(void)
29 {
30 #ifdef CONFIG_SMP
31         voyager_smp_intr_init();
32 #endif
33
34         setup_irq(2, &irq2);
35 }
36
37 static void voyager_disable_tsc(void)
38 {
39         /* Voyagers run their CPUs from independent clocks, so disable
40          * the TSC code because we can't sync them */
41         setup_clear_cpu_cap(X86_FEATURE_TSC);
42 }
43
44 void __init pre_setup_arch_hook(void)
45 {
46         voyager_disable_tsc();
47 }
48
49 void __init pre_time_init_hook(void)
50 {
51         voyager_disable_tsc();
52 }
53
54 void __init trap_init_hook(void)
55 {
56 }
57
58 static struct irqaction irq0 = {
59         .handler = timer_interrupt,
60         .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
61         .mask = CPU_MASK_NONE,
62         .name = "timer"
63 };
64
65 void __init time_init_hook(void)
66 {
67         irq0.mask = cpumask_of_cpu(safe_smp_processor_id());
68         setup_irq(0, &irq0);
69 }
70
71 /* Hook for machine specific memory setup. */
72
73 char *__init machine_specific_memory_setup(void)
74 {
75         char *who;
76         int new_nr;
77
78         who = "NOT VOYAGER";
79
80         if (voyager_level == 5) {
81                 __u32 addr, length;
82                 int i;
83
84                 who = "Voyager-SUS";
85
86                 e820.nr_map = 0;
87                 for (i = 0; voyager_memory_detect(i, &addr, &length); i++) {
88                         e820_add_region(addr, length, E820_RAM);
89                 }
90                 return who;
91         } else if (voyager_level == 4) {
92                 __u32 tom;
93                 __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT) << 8;
94                 /* select the DINO config space */
95                 outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT);
96                 /* Read DINO top of memory register */
97                 tom = ((inb(catbase + 0x4) & 0xf0) << 16)
98                     + ((inb(catbase + 0x5) & 0x7f) << 24);
99
100                 if (inb(catbase) != VOYAGER_DINO) {
101                         printk(KERN_ERR
102                                "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n");
103                         tom = (boot_params.screen_info.ext_mem_k) << 10;
104                 }
105                 who = "Voyager-TOM";
106                 e820_add_region(0, 0x9f000, E820_RAM);
107                 /* map from 1M to top of memory */
108                 e820_add_region(1 * 1024 * 1024, tom - 1 * 1024 * 1024,
109                                   E820_RAM);
110                 /* FIXME: Should check the ASICs to see if I need to
111                  * take out the 8M window.  Just do it at the moment
112                  * */
113                 e820_add_region(8 * 1024 * 1024, 8 * 1024 * 1024,
114                                   E820_RESERVED);
115                 return who;
116         }
117
118         return default_machine_specific_memory_setup();
119 }