Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Setup pointers to hardware-dependent routines. | |
3 | * | |
4 | * This file is subject to the terms and conditions of the GNU General Public | |
5 | * License. See the file "COPYING" in the main directory of this archive | |
6 | * for more details. | |
7 | * | |
fcdb27ad | 8 | * Copyright (C) 1996, 97, 98, 2000, 03, 04, 06 Ralf Baechle (ralf@linux-mips.org) |
22df5bc5 | 9 | * Copyright (C) 2006,2007 Thomas Bogendoerfer (tsbogend@alpha.franken.de) |
1da177e4 | 10 | */ |
1da177e4 | 11 | #include <linux/eisa.h> |
1da177e4 | 12 | #include <linux/init.h> |
f9ded569 | 13 | #include <linux/export.h> |
1da177e4 LT |
14 | #include <linux/console.h> |
15 | #include <linux/fb.h> | |
894673ee | 16 | #include <linux/screen_info.h> |
1da177e4 | 17 | |
0e2794b0 | 18 | #ifdef CONFIG_FW_ARC |
2f56cfdd | 19 | #include <asm/fw/arc/types.h> |
1da177e4 | 20 | #include <asm/sgialib.h> |
4a0312fc TB |
21 | #endif |
22 | ||
0e2794b0 | 23 | #ifdef CONFIG_FW_SNIPROM |
231a35d3 TB |
24 | #include <asm/mipsprom.h> |
25 | #endif | |
26 | ||
27 | #include <asm/bootinfo.h> | |
8ff374b9 | 28 | #include <asm/cpu.h> |
1da177e4 | 29 | #include <asm/io.h> |
1da177e4 LT |
30 | #include <asm/reboot.h> |
31 | #include <asm/sni.h> | |
c066a32a TB |
32 | |
33 | unsigned int sni_brd_type; | |
231a35d3 | 34 | EXPORT_SYMBOL(sni_brd_type); |
1da177e4 LT |
35 | |
36 | extern void sni_machine_restart(char *command); | |
1da177e4 LT |
37 | extern void sni_machine_power_off(void); |
38 | ||
1da177e4 LT |
39 | static void __init sni_display_setup(void) |
40 | { | |
8a736ddf | 41 | #if defined(CONFIG_VGA_CONSOLE) && defined(CONFIG_FW_ARC) |
555624c0 | 42 | static struct screen_info si; |
1da177e4 LT |
43 | DISPLAY_STATUS *di; |
44 | ||
45 | di = ArcGetDisplayStatus(1); | |
46 | ||
47 | if (di) { | |
555624c0 AB |
48 | si.orig_x = di->CursorXPosition; |
49 | si.orig_y = di->CursorYPosition; | |
50 | si.orig_video_cols = di->CursorMaxXPosition; | |
51 | si.orig_video_lines = di->CursorMaxYPosition; | |
52 | si.orig_video_isVGA = VIDEO_TYPE_VGAC; | |
53 | si.orig_video_points = 16; | |
54 | ||
55 | vgacon_register_screen(&si); | |
1da177e4 LT |
56 | } |
57 | #endif | |
1da177e4 LT |
58 | } |
59 | ||
231a35d3 TB |
60 | static void __init sni_console_setup(void) |
61 | { | |
0e2794b0 | 62 | #ifndef CONFIG_FW_ARC |
231a35d3 TB |
63 | char *ctype; |
64 | char *cdev; | |
65 | char *baud; | |
66 | int port; | |
599a8945 | 67 | static char options[8] __initdata; |
231a35d3 TB |
68 | |
69 | cdev = prom_getenv("console_dev"); | |
70 | if (strncmp(cdev, "tty", 3) == 0) { | |
71 | ctype = prom_getenv("console"); | |
72 | switch (*ctype) { | |
73 | default: | |
74 | case 'l': | |
75 | port = 0; | |
76 | baud = prom_getenv("lbaud"); | |
77 | break; | |
78 | case 'r': | |
79 | port = 1; | |
80 | baud = prom_getenv("rbaud"); | |
81 | break; | |
82 | } | |
83 | if (baud) | |
84 | strcpy(options, baud); | |
85 | if (strncmp(cdev, "tty552", 6) == 0) | |
86 | add_preferred_console("ttyS", port, | |
87 | baud ? options : NULL); | |
88 | else | |
89 | add_preferred_console("ttySC", port, | |
90 | baud ? options : NULL); | |
91 | } | |
92 | #endif | |
93 | } | |
94 | ||
95 | #ifdef DEBUG | |
96 | static void __init sni_idprom_dump(void) | |
97 | { | |
98 | int i; | |
99 | ||
100 | pr_debug("SNI IDProm dump:\n"); | |
101 | for (i = 0; i < 256; i++) { | |
102 | if (i%16 == 0) | |
103 | pr_debug("%04x ", i); | |
104 | ||
105 | printk("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i)); | |
106 | ||
107 | if (i % 16 == 15) | |
108 | printk("\n"); | |
109 | } | |
110 | } | |
111 | #endif | |
1da177e4 | 112 | |
2925aba4 | 113 | void __init plat_mem_setup(void) |
1da177e4 | 114 | { |
231a35d3 TB |
115 | int cputype; |
116 | ||
1da177e4 | 117 | set_io_port_base(SNI_PORT_BASE); |
c066a32a | 118 | // ioport_resource.end = sni_io_resource.end; |
1da177e4 LT |
119 | |
120 | /* | |
121 | * Setup (E)ISA I/O memory access stuff | |
122 | */ | |
1da177e4 LT |
123 | #ifdef CONFIG_EISA |
124 | EISA_bus = 1; | |
125 | #endif | |
126 | ||
231a35d3 TB |
127 | sni_brd_type = *(unsigned char *)SNI_IDPROM_BRDTYPE; |
128 | cputype = *(unsigned char *)SNI_IDPROM_CPUTYPE; | |
129 | switch (sni_brd_type) { | |
130 | case SNI_BRD_TOWER_OASIC: | |
131 | switch (cputype) { | |
132 | case SNI_CPU_M8030: | |
133 | system_type = "RM400-330"; | |
134 | break; | |
135 | case SNI_CPU_M8031: | |
136 | system_type = "RM400-430"; | |
137 | break; | |
138 | case SNI_CPU_M8037: | |
139 | system_type = "RM400-530"; | |
140 | break; | |
141 | case SNI_CPU_M8034: | |
142 | system_type = "RM400-730"; | |
143 | break; | |
144 | default: | |
145 | system_type = "RM400-xxx"; | |
146 | break; | |
147 | } | |
148 | break; | |
149 | case SNI_BRD_MINITOWER: | |
150 | switch (cputype) { | |
151 | case SNI_CPU_M8021: | |
152 | case SNI_CPU_M8043: | |
153 | system_type = "RM400-120"; | |
154 | break; | |
155 | case SNI_CPU_M8040: | |
156 | system_type = "RM400-220"; | |
157 | break; | |
158 | case SNI_CPU_M8053: | |
159 | system_type = "RM400-225"; | |
160 | break; | |
161 | case SNI_CPU_M8050: | |
162 | system_type = "RM400-420"; | |
163 | break; | |
164 | default: | |
165 | system_type = "RM400-xxx"; | |
166 | break; | |
167 | } | |
168 | break; | |
169 | case SNI_BRD_PCI_TOWER: | |
170 | system_type = "RM400-Cxx"; | |
171 | break; | |
172 | case SNI_BRD_RM200: | |
173 | system_type = "RM200-xxx"; | |
174 | break; | |
175 | case SNI_BRD_PCI_MTOWER: | |
176 | system_type = "RM300-Cxx"; | |
177 | break; | |
178 | case SNI_BRD_PCI_DESKTOP: | |
8ff374b9 | 179 | switch (read_c0_prid() & PRID_IMP_MASK) { |
231a35d3 TB |
180 | case PRID_IMP_R4600: |
181 | case PRID_IMP_R4700: | |
182 | system_type = "RM200-C20"; | |
183 | break; | |
184 | case PRID_IMP_R5000: | |
185 | system_type = "RM200-C40"; | |
186 | break; | |
187 | default: | |
188 | system_type = "RM200-Cxx"; | |
189 | break; | |
190 | } | |
191 | break; | |
192 | case SNI_BRD_PCI_TOWER_CPLUS: | |
193 | system_type = "RM400-Exx"; | |
194 | break; | |
195 | case SNI_BRD_PCI_MTOWER_CPLUS: | |
196 | system_type = "RM300-Exx"; | |
197 | break; | |
198 | } | |
199 | pr_debug("Found SNI brdtype %02x name %s\n", sni_brd_type, system_type); | |
200 | ||
201 | #ifdef DEBUG | |
202 | sni_idprom_dump(); | |
203 | #endif | |
204 | ||
c066a32a TB |
205 | switch (sni_brd_type) { |
206 | case SNI_BRD_10: | |
207 | case SNI_BRD_10NEW: | |
208 | case SNI_BRD_TOWER_OASIC: | |
209 | case SNI_BRD_MINITOWER: | |
70342287 RB |
210 | sni_a20r_init(); |
211 | break; | |
c066a32a TB |
212 | |
213 | case SNI_BRD_PCI_TOWER: | |
214 | case SNI_BRD_PCI_TOWER_CPLUS: | |
70342287 | 215 | sni_pcit_init(); |
c066a32a TB |
216 | break; |
217 | ||
218 | case SNI_BRD_RM200: | |
70342287 RB |
219 | sni_rm200_init(); |
220 | break; | |
c066a32a TB |
221 | |
222 | case SNI_BRD_PCI_MTOWER: | |
223 | case SNI_BRD_PCI_DESKTOP: | |
224 | case SNI_BRD_PCI_MTOWER_CPLUS: | |
70342287 RB |
225 | sni_pcimt_init(); |
226 | break; | |
c066a32a | 227 | } |
1da177e4 LT |
228 | |
229 | _machine_restart = sni_machine_restart; | |
fcdb27ad | 230 | pm_power_off = sni_machine_power_off; |
1da177e4 LT |
231 | |
232 | sni_display_setup(); | |
231a35d3 | 233 | sni_console_setup(); |
1da177e4 | 234 | } |
22df5bc5 | 235 | |
231a35d3 | 236 | #ifdef CONFIG_PCI |
22df5bc5 TB |
237 | |
238 | #include <linux/pci.h> | |
239 | #include <video/vga.h> | |
240 | #include <video/cirrus.h> | |
241 | ||
28eb0e46 | 242 | static void quirk_cirrus_ram_size(struct pci_dev *dev) |
22df5bc5 TB |
243 | { |
244 | u16 cmd; | |
245 | ||
246 | /* | |
247 | * firmware doesn't set the ram size correct, so we | |
248 | * need to do it here, otherwise we get screen corruption | |
249 | * on older Cirrus chips | |
250 | */ | |
49a89efb | 251 | pci_read_config_word(dev, PCI_COMMAND, &cmd); |
22df5bc5 | 252 | if ((cmd & (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) |
70342287 RB |
253 | == (PCI_COMMAND_IO|PCI_COMMAND_MEMORY)) { |
254 | vga_wseq(NULL, CL_SEQR6, 0x12); /* unlock all extension registers */ | |
49a89efb | 255 | vga_wseq(NULL, CL_SEQRF, 0x18); |
22df5bc5 TB |
256 | } |
257 | } | |
258 | ||
259 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5434_8, | |
70342287 | 260 | quirk_cirrus_ram_size); |
22df5bc5 | 261 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5436, |
70342287 | 262 | quirk_cirrus_ram_size); |
22df5bc5 | 263 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CIRRUS, PCI_DEVICE_ID_CIRRUS_5446, |
70342287 | 264 | quirk_cirrus_ram_size); |
22df5bc5 | 265 | #endif |