m68k: set arch_gettimeoffset directly
[deliverable/linux.git] / arch / m68k / mac / config.c
CommitLineData
1da177e4
LT
1/*
2 * linux/arch/m68k/mac/config.c
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 */
8
9/*
10 * Miscellaneous linux stuff
11 */
12
1da177e4
LT
13#include <linux/module.h>
14#include <linux/types.h>
15#include <linux/mm.h>
16#include <linux/tty.h>
17#include <linux/console.h>
18#include <linux/interrupt.h>
19/* keyb */
20#include <linux/random.h>
21#include <linux/delay.h>
22/* keyb */
23#include <linux/init.h>
24#include <linux/vt_kern.h>
8852ecd9 25#include <linux/platform_device.h>
18814ee8
FT
26#include <linux/adb.h>
27#include <linux/cuda.h>
1da177e4
LT
28
29#define BOOTINFO_COMPAT_1_0
30#include <asm/setup.h>
31#include <asm/bootinfo.h>
32
1da177e4
LT
33#include <asm/io.h>
34#include <asm/irq.h>
35#include <asm/pgtable.h>
36#include <asm/rtc.h>
37#include <asm/machdep.h>
38
39#include <asm/macintosh.h>
40#include <asm/macints.h>
41#include <asm/machw.h>
42
43#include <asm/mac_iop.h>
44#include <asm/mac_via.h>
45#include <asm/mac_oss.h>
46#include <asm/mac_psc.h>
47
48/* Mac bootinfo struct */
1da177e4 49struct mac_booter_data mac_bi_data;
1da177e4 50
1da177e4 51/* The phys. video addr. - might be bogus on some machines */
8dfbdf4a 52static unsigned long mac_orig_videoaddr;
1da177e4
LT
53
54/* Mac specific timer functions */
c8d5ba18 55extern u32 mac_gettimeoffset(void);
6ff5801a
RZ
56extern int mac_hwclk(int, struct rtc_time *);
57extern int mac_set_clock_mmss(unsigned long);
1da177e4
LT
58extern void iop_preinit(void);
59extern void iop_init(void);
60extern void via_init(void);
40220c1a 61extern void via_init_clock(irq_handler_t func);
1da177e4
LT
62extern void via_flush_cache(void);
63extern void oss_init(void);
64extern void psc_init(void);
65extern void baboon_init(void);
66
67extern void mac_mksound(unsigned int, unsigned int);
68
1da177e4 69static void mac_get_model(char *str);
8dfbdf4a
AB
70static void mac_identify(void);
71static void mac_report_hardware(void);
1da177e4 72
93edd023
FT
73#ifdef CONFIG_EARLY_PRINTK
74asmlinkage void __init mac_early_print(const char *s, unsigned n);
75
76static void __init mac_early_cons_write(struct console *con,
77 const char *s, unsigned n)
78{
79 mac_early_print(s, n);
80}
81
82static struct console __initdata mac_early_cons = {
83 .name = "early",
84 .write = mac_early_cons_write,
85 .flags = CON_PRINTBUFFER | CON_BOOT,
86 .index = -1
87};
88
89int __init mac_unregister_early_cons(void)
90{
91 /* mac_early_print can't be used after init sections are discarded */
92 return unregister_console(&mac_early_cons);
93}
94
95late_initcall(mac_unregister_early_cons);
96#endif
97
66a3f820 98static void __init mac_sched_init(irq_handler_t vector)
1da177e4
LT
99{
100 via_init_clock(vector);
101}
102
1da177e4
LT
103/*
104 * Parse a Macintosh-specific record in the bootinfo
105 */
106
107int __init mac_parse_bootinfo(const struct bi_record *record)
108{
6ff5801a
RZ
109 int unknown = 0;
110 const u_long *data = record->data;
1da177e4 111
6ff5801a 112 switch (record->tag) {
1da177e4 113 case BI_MAC_MODEL:
6ff5801a
RZ
114 mac_bi_data.id = *data;
115 break;
1da177e4 116 case BI_MAC_VADDR:
6ff5801a
RZ
117 mac_bi_data.videoaddr = *data;
118 break;
1da177e4 119 case BI_MAC_VDEPTH:
6ff5801a
RZ
120 mac_bi_data.videodepth = *data;
121 break;
1da177e4 122 case BI_MAC_VROW:
6ff5801a
RZ
123 mac_bi_data.videorow = *data;
124 break;
1da177e4 125 case BI_MAC_VDIM:
6ff5801a
RZ
126 mac_bi_data.dimensions = *data;
127 break;
1da177e4 128 case BI_MAC_VLOGICAL:
6ff5801a
RZ
129 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
130 mac_orig_videoaddr = *data;
131 break;
1da177e4 132 case BI_MAC_SCCBASE:
6ff5801a
RZ
133 mac_bi_data.sccbase = *data;
134 break;
1da177e4 135 case BI_MAC_BTIME:
6ff5801a
RZ
136 mac_bi_data.boottime = *data;
137 break;
1da177e4 138 case BI_MAC_GMTBIAS:
6ff5801a
RZ
139 mac_bi_data.gmtbias = *data;
140 break;
1da177e4 141 case BI_MAC_MEMSIZE:
6ff5801a
RZ
142 mac_bi_data.memsize = *data;
143 break;
1da177e4 144 case BI_MAC_CPUID:
6ff5801a
RZ
145 mac_bi_data.cpuid = *data;
146 break;
147 case BI_MAC_ROMBASE:
148 mac_bi_data.rombase = *data;
149 break;
1da177e4 150 default:
6ff5801a
RZ
151 unknown = 1;
152 break;
153 }
154 return unknown;
1da177e4
LT
155}
156
157/*
158 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
159 * have to disable interrupts for this. Our IRQ handlers will crap
160 * themselves if they take an IRQ in 24bit mode!
161 */
162
163static void mac_cache_card_flush(int writeback)
164{
165 unsigned long flags;
6ff5801a 166
1da177e4
LT
167 local_irq_save(flags);
168 via_flush_cache();
169 local_irq_restore(flags);
170}
171
172void __init config_mac(void)
173{
6ff5801a 174 if (!MACH_IS_MAC)
b9b0d8b4 175 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!!\n");
1da177e4 176
6ff5801a
RZ
177 mach_sched_init = mac_sched_init;
178 mach_init_IRQ = mac_init_IRQ;
179 mach_get_model = mac_get_model;
c8d5ba18 180 arch_gettimeoffset = mac_gettimeoffset;
6ff5801a 181 mach_hwclk = mac_hwclk;
6ff5801a
RZ
182 mach_set_clock_mmss = mac_set_clock_mmss;
183 mach_reset = mac_reset;
184 mach_halt = mac_poweroff;
185 mach_power_off = mac_poweroff;
1da177e4 186 mach_max_dma_address = 0xffffffff;
1da177e4 187#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
6ff5801a 188 mach_beep = mac_mksound;
1da177e4
LT
189#endif
190
93edd023
FT
191#ifdef CONFIG_EARLY_PRINTK
192 register_console(&mac_early_cons);
193#endif
194
1da177e4
LT
195 /*
196 * Determine hardware present
197 */
198
199 mac_identify();
200 mac_report_hardware();
201
6ff5801a
RZ
202 /*
203 * AFAIK only the IIci takes a cache card. The IIfx has onboard
204 * cache ... someone needs to figure out how to tell if it's on or
205 * not.
206 */
1da177e4
LT
207
208 if (macintosh_config->ident == MAC_MODEL_IICI
6ff5801a 209 || macintosh_config->ident == MAC_MODEL_IIFX)
1da177e4 210 mach_l2_flush = mac_cache_card_flush;
1da177e4
LT
211}
212
213
214/*
53aac0ad 215 * Macintosh Table: hardcoded model configuration data.
1da177e4 216 *
53aac0ad
FT
217 * Much of this was defined by Alan, based on who knows what docs.
218 * I've added a lot more, and some of that was pure guesswork based
219 * on hardware pages present on the Mac web site. Possibly wildly
220 * inaccurate, so look here if a new Mac model won't run. Example: if
221 * a Mac crashes immediately after the VIA1 registers have been dumped
222 * to the screen, it probably died attempting to read DirB on a RBV.
608e287b 223 * Meaning it should have MAC_VIA_IICI here :-)
1da177e4
LT
224 */
225
226struct mac_model *macintosh_config;
227EXPORT_SYMBOL(macintosh_config);
228
6ff5801a 229static struct mac_model mac_data_table[] = {
1da177e4 230 /*
53aac0ad 231 * We'll pretend to be a Macintosh II, that's pretty safe.
1da177e4
LT
232 */
233
234 {
235 .ident = MAC_MODEL_II,
236 .name = "Unknown",
237 .adb_type = MAC_ADB_II,
238 .via_type = MAC_VIA_II,
239 .scsi_type = MAC_SCSI_OLD,
240 .scc_type = MAC_SCC_II,
7ad93b42 241 .nubus_type = MAC_NUBUS,
53aac0ad 242 .floppy_type = MAC_FLOPPY_IWM,
1da177e4
LT
243 },
244
245 /*
53aac0ad 246 * Original Mac II hardware
1da177e4
LT
247 */
248
249 {
250 .ident = MAC_MODEL_II,
251 .name = "II",
252 .adb_type = MAC_ADB_II,
253 .via_type = MAC_VIA_II,
254 .scsi_type = MAC_SCSI_OLD,
255 .scc_type = MAC_SCC_II,
7ad93b42 256 .nubus_type = MAC_NUBUS,
53aac0ad 257 .floppy_type = MAC_FLOPPY_IWM,
1da177e4
LT
258 }, {
259 .ident = MAC_MODEL_IIX,
260 .name = "IIx",
261 .adb_type = MAC_ADB_II,
262 .via_type = MAC_VIA_II,
263 .scsi_type = MAC_SCSI_OLD,
264 .scc_type = MAC_SCC_II,
7ad93b42 265 .nubus_type = MAC_NUBUS,
53aac0ad 266 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
267 }, {
268 .ident = MAC_MODEL_IICX,
269 .name = "IIcx",
270 .adb_type = MAC_ADB_II,
271 .via_type = MAC_VIA_II,
272 .scsi_type = MAC_SCSI_OLD,
273 .scc_type = MAC_SCC_II,
7ad93b42 274 .nubus_type = MAC_NUBUS,
53aac0ad 275 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
276 }, {
277 .ident = MAC_MODEL_SE30,
278 .name = "SE/30",
279 .adb_type = MAC_ADB_II,
280 .via_type = MAC_VIA_II,
281 .scsi_type = MAC_SCSI_OLD,
282 .scc_type = MAC_SCC_II,
7ad93b42 283 .nubus_type = MAC_NUBUS,
53aac0ad 284 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
285 },
286
287 /*
53aac0ad
FT
288 * Weirdified Mac II hardware - all subtly different. Gee thanks
289 * Apple. All these boxes seem to have VIA2 in a different place to
290 * the Mac II (+1A000 rather than +4000)
1da177e4
LT
291 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
292 */
293
294 {
295 .ident = MAC_MODEL_IICI,
296 .name = "IIci",
297 .adb_type = MAC_ADB_II,
608e287b 298 .via_type = MAC_VIA_IICI,
1da177e4
LT
299 .scsi_type = MAC_SCSI_OLD,
300 .scc_type = MAC_SCC_II,
7ad93b42 301 .nubus_type = MAC_NUBUS,
53aac0ad 302 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
303 }, {
304 .ident = MAC_MODEL_IIFX,
305 .name = "IIfx",
306 .adb_type = MAC_ADB_IOP,
608e287b 307 .via_type = MAC_VIA_IICI,
1da177e4
LT
308 .scsi_type = MAC_SCSI_OLD,
309 .scc_type = MAC_SCC_IOP,
7ad93b42 310 .nubus_type = MAC_NUBUS,
53aac0ad 311 .floppy_type = MAC_FLOPPY_SWIM_IOP,
1da177e4
LT
312 }, {
313 .ident = MAC_MODEL_IISI,
314 .name = "IIsi",
315 .adb_type = MAC_ADB_IISI,
608e287b 316 .via_type = MAC_VIA_IICI,
1da177e4
LT
317 .scsi_type = MAC_SCSI_OLD,
318 .scc_type = MAC_SCC_II,
7ad93b42 319 .nubus_type = MAC_NUBUS,
53aac0ad 320 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
321 }, {
322 .ident = MAC_MODEL_IIVI,
323 .name = "IIvi",
324 .adb_type = MAC_ADB_IISI,
608e287b 325 .via_type = MAC_VIA_IICI,
1da177e4
LT
326 .scsi_type = MAC_SCSI_OLD,
327 .scc_type = MAC_SCC_II,
7ad93b42 328 .nubus_type = MAC_NUBUS,
53aac0ad 329 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
330 }, {
331 .ident = MAC_MODEL_IIVX,
332 .name = "IIvx",
333 .adb_type = MAC_ADB_IISI,
608e287b 334 .via_type = MAC_VIA_IICI,
1da177e4
LT
335 .scsi_type = MAC_SCSI_OLD,
336 .scc_type = MAC_SCC_II,
7ad93b42 337 .nubus_type = MAC_NUBUS,
53aac0ad 338 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
339 },
340
341 /*
53aac0ad 342 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
1da177e4
LT
343 */
344
345 {
346 .ident = MAC_MODEL_CLII,
347 .name = "Classic II",
348 .adb_type = MAC_ADB_IISI,
608e287b 349 .via_type = MAC_VIA_IICI,
1da177e4
LT
350 .scsi_type = MAC_SCSI_OLD,
351 .scc_type = MAC_SCC_II,
7ad93b42 352 .nubus_type = MAC_NUBUS,
53aac0ad 353 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
354 }, {
355 .ident = MAC_MODEL_CCL,
356 .name = "Color Classic",
357 .adb_type = MAC_ADB_CUDA,
608e287b 358 .via_type = MAC_VIA_IICI,
1da177e4
LT
359 .scsi_type = MAC_SCSI_OLD,
360 .scc_type = MAC_SCC_II,
7ad93b42 361 .nubus_type = MAC_NUBUS,
53aac0ad 362 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1b460102
FT
363 }, {
364 .ident = MAC_MODEL_CCLII,
365 .name = "Color Classic II",
366 .adb_type = MAC_ADB_CUDA,
608e287b 367 .via_type = MAC_VIA_IICI,
1b460102
FT
368 .scsi_type = MAC_SCSI_OLD,
369 .scc_type = MAC_SCC_II,
370 .nubus_type = MAC_NUBUS,
371 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
7ad93b42 372 },
1da177e4
LT
373
374 /*
53aac0ad 375 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
1da177e4
LT
376 */
377
378 {
379 .ident = MAC_MODEL_LC,
380 .name = "LC",
381 .adb_type = MAC_ADB_IISI,
608e287b 382 .via_type = MAC_VIA_IICI,
1da177e4
LT
383 .scsi_type = MAC_SCSI_OLD,
384 .scc_type = MAC_SCC_II,
7ad93b42 385 .nubus_type = MAC_NUBUS,
53aac0ad 386 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
387 }, {
388 .ident = MAC_MODEL_LCII,
389 .name = "LC II",
390 .adb_type = MAC_ADB_IISI,
608e287b 391 .via_type = MAC_VIA_IICI,
1da177e4
LT
392 .scsi_type = MAC_SCSI_OLD,
393 .scc_type = MAC_SCC_II,
7ad93b42 394 .nubus_type = MAC_NUBUS,
53aac0ad 395 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
396 }, {
397 .ident = MAC_MODEL_LCIII,
398 .name = "LC III",
399 .adb_type = MAC_ADB_IISI,
608e287b 400 .via_type = MAC_VIA_IICI,
1da177e4
LT
401 .scsi_type = MAC_SCSI_OLD,
402 .scc_type = MAC_SCC_II,
7ad93b42 403 .nubus_type = MAC_NUBUS,
53aac0ad 404 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
405 },
406
407 /*
53aac0ad
FT
408 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
409 * differently as some of the stuff connected to VIA2 seems different.
410 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
411 * the 660AV and 840AV which use an AMD 79C940 (MACE).
412 * The 700, 900 and 950 have some I/O chips in the wrong place to
413 * confuse us. The 840AV has a SCSI location of its own (same as
414 * the 660AV).
1da177e4
LT
415 */
416
417 {
418 .ident = MAC_MODEL_Q605,
419 .name = "Quadra 605",
420 .adb_type = MAC_ADB_CUDA,
421 .via_type = MAC_VIA_QUADRA,
422 .scsi_type = MAC_SCSI_QUADRA,
423 .scc_type = MAC_SCC_QUADRA,
7ad93b42 424 .nubus_type = MAC_NUBUS,
53aac0ad 425 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
426 }, {
427 .ident = MAC_MODEL_Q605_ACC,
428 .name = "Quadra 605",
429 .adb_type = MAC_ADB_CUDA,
430 .via_type = MAC_VIA_QUADRA,
431 .scsi_type = MAC_SCSI_QUADRA,
432 .scc_type = MAC_SCC_QUADRA,
7ad93b42 433 .nubus_type = MAC_NUBUS,
53aac0ad 434 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
435 }, {
436 .ident = MAC_MODEL_Q610,
437 .name = "Quadra 610",
438 .adb_type = MAC_ADB_II,
439 .via_type = MAC_VIA_QUADRA,
440 .scsi_type = MAC_SCSI_QUADRA,
441 .scc_type = MAC_SCC_QUADRA,
442 .ether_type = MAC_ETHER_SONIC,
7ad93b42 443 .nubus_type = MAC_NUBUS,
53aac0ad 444 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
445 }, {
446 .ident = MAC_MODEL_Q630,
447 .name = "Quadra 630",
448 .adb_type = MAC_ADB_CUDA,
449 .via_type = MAC_VIA_QUADRA,
450 .scsi_type = MAC_SCSI_QUADRA,
451 .ide_type = MAC_IDE_QUADRA,
452 .scc_type = MAC_SCC_QUADRA,
453 .ether_type = MAC_ETHER_SONIC,
7ad93b42 454 .nubus_type = MAC_NUBUS,
53aac0ad 455 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
456 }, {
457 .ident = MAC_MODEL_Q650,
458 .name = "Quadra 650",
459 .adb_type = MAC_ADB_II,
460 .via_type = MAC_VIA_QUADRA,
461 .scsi_type = MAC_SCSI_QUADRA,
462 .scc_type = MAC_SCC_QUADRA,
463 .ether_type = MAC_ETHER_SONIC,
7ad93b42 464 .nubus_type = MAC_NUBUS,
53aac0ad 465 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4 466 },
53aac0ad 467 /* The Q700 does have a NS Sonic */
1da177e4
LT
468 {
469 .ident = MAC_MODEL_Q700,
470 .name = "Quadra 700",
471 .adb_type = MAC_ADB_II,
472 .via_type = MAC_VIA_QUADRA,
473 .scsi_type = MAC_SCSI_QUADRA2,
474 .scc_type = MAC_SCC_QUADRA,
475 .ether_type = MAC_ETHER_SONIC,
7ad93b42 476 .nubus_type = MAC_NUBUS,
53aac0ad 477 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
478 }, {
479 .ident = MAC_MODEL_Q800,
480 .name = "Quadra 800",
481 .adb_type = MAC_ADB_II,
482 .via_type = MAC_VIA_QUADRA,
483 .scsi_type = MAC_SCSI_QUADRA,
484 .scc_type = MAC_SCC_QUADRA,
485 .ether_type = MAC_ETHER_SONIC,
7ad93b42 486 .nubus_type = MAC_NUBUS,
53aac0ad 487 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
488 }, {
489 .ident = MAC_MODEL_Q840,
490 .name = "Quadra 840AV",
491 .adb_type = MAC_ADB_CUDA,
492 .via_type = MAC_VIA_QUADRA,
493 .scsi_type = MAC_SCSI_QUADRA3,
494 .scc_type = MAC_SCC_PSC,
495 .ether_type = MAC_ETHER_MACE,
7ad93b42 496 .nubus_type = MAC_NUBUS,
53aac0ad 497 .floppy_type = MAC_FLOPPY_AV,
1da177e4
LT
498 }, {
499 .ident = MAC_MODEL_Q900,
500 .name = "Quadra 900",
501 .adb_type = MAC_ADB_IOP,
502 .via_type = MAC_VIA_QUADRA,
503 .scsi_type = MAC_SCSI_QUADRA2,
504 .scc_type = MAC_SCC_IOP,
505 .ether_type = MAC_ETHER_SONIC,
7ad93b42 506 .nubus_type = MAC_NUBUS,
53aac0ad 507 .floppy_type = MAC_FLOPPY_SWIM_IOP,
1da177e4
LT
508 }, {
509 .ident = MAC_MODEL_Q950,
510 .name = "Quadra 950",
511 .adb_type = MAC_ADB_IOP,
512 .via_type = MAC_VIA_QUADRA,
513 .scsi_type = MAC_SCSI_QUADRA2,
514 .scc_type = MAC_SCC_IOP,
515 .ether_type = MAC_ETHER_SONIC,
7ad93b42 516 .nubus_type = MAC_NUBUS,
53aac0ad 517 .floppy_type = MAC_FLOPPY_SWIM_IOP,
1da177e4
LT
518 },
519
520 /*
53aac0ad 521 * Performa - more LC type machines
1da177e4
LT
522 */
523
524 {
525 .ident = MAC_MODEL_P460,
53aac0ad 526 .name = "Performa 460",
1da177e4 527 .adb_type = MAC_ADB_IISI,
608e287b 528 .via_type = MAC_VIA_IICI,
1da177e4
LT
529 .scsi_type = MAC_SCSI_OLD,
530 .scc_type = MAC_SCC_II,
7ad93b42 531 .nubus_type = MAC_NUBUS,
53aac0ad 532 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
533 }, {
534 .ident = MAC_MODEL_P475,
53aac0ad 535 .name = "Performa 475",
1da177e4
LT
536 .adb_type = MAC_ADB_CUDA,
537 .via_type = MAC_VIA_QUADRA,
538 .scsi_type = MAC_SCSI_QUADRA,
539 .scc_type = MAC_SCC_II,
7ad93b42 540 .nubus_type = MAC_NUBUS,
53aac0ad 541 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
542 }, {
543 .ident = MAC_MODEL_P475F,
53aac0ad 544 .name = "Performa 475",
1da177e4
LT
545 .adb_type = MAC_ADB_CUDA,
546 .via_type = MAC_VIA_QUADRA,
547 .scsi_type = MAC_SCSI_QUADRA,
548 .scc_type = MAC_SCC_II,
7ad93b42 549 .nubus_type = MAC_NUBUS,
53aac0ad 550 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
551 }, {
552 .ident = MAC_MODEL_P520,
53aac0ad 553 .name = "Performa 520",
1da177e4 554 .adb_type = MAC_ADB_CUDA,
608e287b 555 .via_type = MAC_VIA_IICI,
1da177e4
LT
556 .scsi_type = MAC_SCSI_OLD,
557 .scc_type = MAC_SCC_II,
7ad93b42 558 .nubus_type = MAC_NUBUS,
53aac0ad 559 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
560 }, {
561 .ident = MAC_MODEL_P550,
53aac0ad 562 .name = "Performa 550",
1da177e4 563 .adb_type = MAC_ADB_CUDA,
608e287b 564 .via_type = MAC_VIA_IICI,
1da177e4
LT
565 .scsi_type = MAC_SCSI_OLD,
566 .scc_type = MAC_SCC_II,
7ad93b42 567 .nubus_type = MAC_NUBUS,
53aac0ad 568 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4 569 },
53aac0ad 570 /* These have the comm slot, and therefore possibly SONIC ethernet */
1da177e4
LT
571 {
572 .ident = MAC_MODEL_P575,
573 .name = "Performa 575",
574 .adb_type = MAC_ADB_CUDA,
575 .via_type = MAC_VIA_QUADRA,
576 .scsi_type = MAC_SCSI_QUADRA,
577 .scc_type = MAC_SCC_II,
578 .ether_type = MAC_ETHER_SONIC,
7ad93b42 579 .nubus_type = MAC_NUBUS,
53aac0ad 580 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
581 }, {
582 .ident = MAC_MODEL_P588,
583 .name = "Performa 588",
584 .adb_type = MAC_ADB_CUDA,
585 .via_type = MAC_VIA_QUADRA,
586 .scsi_type = MAC_SCSI_QUADRA,
587 .ide_type = MAC_IDE_QUADRA,
588 .scc_type = MAC_SCC_II,
589 .ether_type = MAC_ETHER_SONIC,
7ad93b42 590 .nubus_type = MAC_NUBUS,
53aac0ad 591 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
592 }, {
593 .ident = MAC_MODEL_TV,
594 .name = "TV",
595 .adb_type = MAC_ADB_CUDA,
608e287b 596 .via_type = MAC_VIA_IICI,
1da177e4
LT
597 .scsi_type = MAC_SCSI_OLD,
598 .scc_type = MAC_SCC_II,
7ad93b42 599 .nubus_type = MAC_NUBUS,
53aac0ad 600 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
601 }, {
602 .ident = MAC_MODEL_P600,
603 .name = "Performa 600",
604 .adb_type = MAC_ADB_IISI,
608e287b 605 .via_type = MAC_VIA_IICI,
1da177e4
LT
606 .scsi_type = MAC_SCSI_OLD,
607 .scc_type = MAC_SCC_II,
7ad93b42 608 .nubus_type = MAC_NUBUS,
53aac0ad 609 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
610 },
611
612 /*
53aac0ad
FT
613 * Centris - just guessing again; maybe like Quadra.
614 * The C610 may or may not have SONIC. We probe to make sure.
1da177e4
LT
615 */
616
1da177e4
LT
617 {
618 .ident = MAC_MODEL_C610,
619 .name = "Centris 610",
620 .adb_type = MAC_ADB_II,
621 .via_type = MAC_VIA_QUADRA,
622 .scsi_type = MAC_SCSI_QUADRA,
623 .scc_type = MAC_SCC_QUADRA,
624 .ether_type = MAC_ETHER_SONIC,
7ad93b42 625 .nubus_type = MAC_NUBUS,
53aac0ad 626 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
627 }, {
628 .ident = MAC_MODEL_C650,
629 .name = "Centris 650",
630 .adb_type = MAC_ADB_II,
631 .via_type = MAC_VIA_QUADRA,
632 .scsi_type = MAC_SCSI_QUADRA,
633 .scc_type = MAC_SCC_QUADRA,
634 .ether_type = MAC_ETHER_SONIC,
7ad93b42 635 .nubus_type = MAC_NUBUS,
53aac0ad 636 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
1da177e4
LT
637 }, {
638 .ident = MAC_MODEL_C660,
639 .name = "Centris 660AV",
640 .adb_type = MAC_ADB_CUDA,
641 .via_type = MAC_VIA_QUADRA,
642 .scsi_type = MAC_SCSI_QUADRA3,
643 .scc_type = MAC_SCC_PSC,
644 .ether_type = MAC_ETHER_MACE,
7ad93b42 645 .nubus_type = MAC_NUBUS,
53aac0ad 646 .floppy_type = MAC_FLOPPY_AV,
1da177e4
LT
647 },
648
649 /*
650 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
651 * and a PMU (in two variations?) for ADB. Most of them use the
652 * Quadra-style VIAs. A few models also have IDE from hell.
653 */
654
655 {
656 .ident = MAC_MODEL_PB140,
657 .name = "PowerBook 140",
658 .adb_type = MAC_ADB_PB1,
659 .via_type = MAC_VIA_QUADRA,
660 .scsi_type = MAC_SCSI_OLD,
661 .scc_type = MAC_SCC_QUADRA,
7ad93b42 662 .nubus_type = MAC_NUBUS,
53aac0ad 663 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
664 }, {
665 .ident = MAC_MODEL_PB145,
666 .name = "PowerBook 145",
667 .adb_type = MAC_ADB_PB1,
668 .via_type = MAC_VIA_QUADRA,
669 .scsi_type = MAC_SCSI_OLD,
670 .scc_type = MAC_SCC_QUADRA,
7ad93b42 671 .nubus_type = MAC_NUBUS,
53aac0ad 672 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
673 }, {
674 .ident = MAC_MODEL_PB150,
675 .name = "PowerBook 150",
4107c459 676 .adb_type = MAC_ADB_PB2,
608e287b 677 .via_type = MAC_VIA_IICI,
1da177e4
LT
678 .scsi_type = MAC_SCSI_OLD,
679 .ide_type = MAC_IDE_PB,
680 .scc_type = MAC_SCC_QUADRA,
7ad93b42 681 .nubus_type = MAC_NUBUS,
53aac0ad 682 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
683 }, {
684 .ident = MAC_MODEL_PB160,
685 .name = "PowerBook 160",
686 .adb_type = MAC_ADB_PB1,
687 .via_type = MAC_VIA_QUADRA,
688 .scsi_type = MAC_SCSI_OLD,
689 .scc_type = MAC_SCC_QUADRA,
7ad93b42 690 .nubus_type = MAC_NUBUS,
53aac0ad 691 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
692 }, {
693 .ident = MAC_MODEL_PB165,
694 .name = "PowerBook 165",
695 .adb_type = MAC_ADB_PB1,
696 .via_type = MAC_VIA_QUADRA,
697 .scsi_type = MAC_SCSI_OLD,
698 .scc_type = MAC_SCC_QUADRA,
7ad93b42 699 .nubus_type = MAC_NUBUS,
53aac0ad 700 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
701 }, {
702 .ident = MAC_MODEL_PB165C,
703 .name = "PowerBook 165c",
704 .adb_type = MAC_ADB_PB1,
705 .via_type = MAC_VIA_QUADRA,
706 .scsi_type = MAC_SCSI_OLD,
707 .scc_type = MAC_SCC_QUADRA,
7ad93b42 708 .nubus_type = MAC_NUBUS,
53aac0ad 709 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
710 }, {
711 .ident = MAC_MODEL_PB170,
712 .name = "PowerBook 170",
713 .adb_type = MAC_ADB_PB1,
714 .via_type = MAC_VIA_QUADRA,
715 .scsi_type = MAC_SCSI_OLD,
716 .scc_type = MAC_SCC_QUADRA,
7ad93b42 717 .nubus_type = MAC_NUBUS,
53aac0ad 718 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
719 }, {
720 .ident = MAC_MODEL_PB180,
721 .name = "PowerBook 180",
722 .adb_type = MAC_ADB_PB1,
723 .via_type = MAC_VIA_QUADRA,
724 .scsi_type = MAC_SCSI_OLD,
725 .scc_type = MAC_SCC_QUADRA,
7ad93b42 726 .nubus_type = MAC_NUBUS,
53aac0ad 727 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
728 }, {
729 .ident = MAC_MODEL_PB180C,
730 .name = "PowerBook 180c",
731 .adb_type = MAC_ADB_PB1,
732 .via_type = MAC_VIA_QUADRA,
733 .scsi_type = MAC_SCSI_OLD,
734 .scc_type = MAC_SCC_QUADRA,
7ad93b42 735 .nubus_type = MAC_NUBUS,
53aac0ad 736 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
737 }, {
738 .ident = MAC_MODEL_PB190,
739 .name = "PowerBook 190",
740 .adb_type = MAC_ADB_PB2,
741 .via_type = MAC_VIA_QUADRA,
742 .scsi_type = MAC_SCSI_OLD,
743 .ide_type = MAC_IDE_BABOON,
744 .scc_type = MAC_SCC_QUADRA,
7ad93b42 745 .nubus_type = MAC_NUBUS,
53aac0ad 746 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
747 }, {
748 .ident = MAC_MODEL_PB520,
749 .name = "PowerBook 520",
750 .adb_type = MAC_ADB_PB2,
751 .via_type = MAC_VIA_QUADRA,
752 .scsi_type = MAC_SCSI_OLD,
753 .scc_type = MAC_SCC_QUADRA,
754 .ether_type = MAC_ETHER_SONIC,
7ad93b42 755 .nubus_type = MAC_NUBUS,
53aac0ad 756 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
757 },
758
759 /*
760 * PowerBook Duos are pretty much like normal PowerBooks
761 * All of these probably have onboard SONIC in the Dock which
762 * means we'll have to probe for it eventually.
1da177e4
LT
763 */
764
765 {
766 .ident = MAC_MODEL_PB210,
767 .name = "PowerBook Duo 210",
768 .adb_type = MAC_ADB_PB2,
608e287b 769 .via_type = MAC_VIA_IICI,
1da177e4
LT
770 .scsi_type = MAC_SCSI_OLD,
771 .scc_type = MAC_SCC_QUADRA,
7ad93b42 772 .nubus_type = MAC_NUBUS,
53aac0ad 773 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
774 }, {
775 .ident = MAC_MODEL_PB230,
776 .name = "PowerBook Duo 230",
777 .adb_type = MAC_ADB_PB2,
608e287b 778 .via_type = MAC_VIA_IICI,
1da177e4
LT
779 .scsi_type = MAC_SCSI_OLD,
780 .scc_type = MAC_SCC_QUADRA,
7ad93b42 781 .nubus_type = MAC_NUBUS,
53aac0ad 782 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
783 }, {
784 .ident = MAC_MODEL_PB250,
785 .name = "PowerBook Duo 250",
786 .adb_type = MAC_ADB_PB2,
608e287b 787 .via_type = MAC_VIA_IICI,
1da177e4
LT
788 .scsi_type = MAC_SCSI_OLD,
789 .scc_type = MAC_SCC_QUADRA,
7ad93b42 790 .nubus_type = MAC_NUBUS,
53aac0ad 791 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
792 }, {
793 .ident = MAC_MODEL_PB270C,
794 .name = "PowerBook Duo 270c",
795 .adb_type = MAC_ADB_PB2,
608e287b 796 .via_type = MAC_VIA_IICI,
1da177e4
LT
797 .scsi_type = MAC_SCSI_OLD,
798 .scc_type = MAC_SCC_QUADRA,
7ad93b42 799 .nubus_type = MAC_NUBUS,
53aac0ad 800 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
801 }, {
802 .ident = MAC_MODEL_PB280,
803 .name = "PowerBook Duo 280",
804 .adb_type = MAC_ADB_PB2,
608e287b 805 .via_type = MAC_VIA_IICI,
1da177e4
LT
806 .scsi_type = MAC_SCSI_OLD,
807 .scc_type = MAC_SCC_QUADRA,
7ad93b42 808 .nubus_type = MAC_NUBUS,
53aac0ad 809 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
810 }, {
811 .ident = MAC_MODEL_PB280C,
812 .name = "PowerBook Duo 280c",
813 .adb_type = MAC_ADB_PB2,
608e287b 814 .via_type = MAC_VIA_IICI,
1da177e4
LT
815 .scsi_type = MAC_SCSI_OLD,
816 .scc_type = MAC_SCC_QUADRA,
7ad93b42 817 .nubus_type = MAC_NUBUS,
53aac0ad 818 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
1da177e4
LT
819 },
820
821 /*
53aac0ad 822 * Other stuff?
1da177e4 823 */
53aac0ad 824
1da177e4
LT
825 {
826 .ident = -1
827 }
828};
829
80614e5a
FT
830static struct resource scc_a_rsrcs[] = {
831 { .flags = IORESOURCE_MEM },
832 { .flags = IORESOURCE_IRQ },
833};
834
835static struct resource scc_b_rsrcs[] = {
836 { .flags = IORESOURCE_MEM },
837 { .flags = IORESOURCE_IRQ },
838};
839
840struct platform_device scc_a_pdev = {
841 .name = "scc",
842 .id = 0,
843 .num_resources = ARRAY_SIZE(scc_a_rsrcs),
844 .resource = scc_a_rsrcs,
845};
846EXPORT_SYMBOL(scc_a_pdev);
847
848struct platform_device scc_b_pdev = {
849 .name = "scc",
850 .id = 1,
851 .num_resources = ARRAY_SIZE(scc_b_rsrcs),
852 .resource = scc_b_rsrcs,
853};
854EXPORT_SYMBOL(scc_b_pdev);
855
8dfbdf4a 856static void __init mac_identify(void)
1da177e4
LT
857{
858 struct mac_model *m;
859
860 /* Penguin data useful? */
861 int model = mac_bi_data.id;
862 if (!model) {
863 /* no bootinfo model id -> NetBSD booter was used! */
864 /* XXX FIXME: breaks for model > 31 */
6ff5801a 865 model = (mac_bi_data.cpuid >> 2) & 63;
53aac0ad
FT
866 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead "
867 "(obsolete bootloader?)\n");
1da177e4
LT
868 }
869
870 macintosh_config = mac_data_table;
6ff5801a 871 for (m = macintosh_config; m->ident != -1; m++) {
1da177e4
LT
872 if (m->ident == model) {
873 macintosh_config = m;
874 break;
875 }
876 }
877
80614e5a
FT
878 /* Set up serial port resources for the console initcall. */
879
880 scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
881 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
882 scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
883 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
884
885 switch (macintosh_config->scc_type) {
886 case MAC_SCC_PSC:
887 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
888 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
889 break;
890 default:
da3fb3c9
FT
891 /* On non-PSC machines, the serial ports share an IRQ. */
892 if (macintosh_config->ident == MAC_MODEL_IIFX) {
893 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
894 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
895 } else {
896 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
897 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
898 }
80614e5a
FT
899 break;
900 }
901
53aac0ad
FT
902 /*
903 * We need to pre-init the IOPs, if any. Otherwise
904 * the serial console won't work if the user had
905 * the serial ports set to "Faster" mode in MacOS.
906 */
1da177e4 907 iop_preinit();
1da177e4 908
b9b0d8b4 909 printk(KERN_INFO "Detected Macintosh model: %d\n", model);
1da177e4
LT
910
911 /*
912 * Report booter data:
913 */
6ff5801a 914 printk(KERN_DEBUG " Penguin bootinfo data:\n");
53aac0ad
FT
915 printk(KERN_DEBUG " Video: addr 0x%lx "
916 "row 0x%lx depth %lx dimensions %ld x %ld\n",
1da177e4
LT
917 mac_bi_data.videoaddr, mac_bi_data.videorow,
918 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
919 mac_bi_data.dimensions >> 16);
b9b0d8b4 920 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
1da177e4
LT
921 mac_bi_data.videological, mac_orig_videoaddr,
922 mac_bi_data.sccbase);
b9b0d8b4 923 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
1da177e4 924 mac_bi_data.boottime, mac_bi_data.gmtbias);
b9b0d8b4 925 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
1da177e4 926 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
1da177e4 927
1da177e4
LT
928 iop_init();
929 via_init();
930 oss_init();
931 psc_init();
932 baboon_init();
18814ee8
FT
933
934#ifdef CONFIG_ADB_CUDA
935 find_via_cuda();
936#endif
1da177e4
LT
937}
938
8dfbdf4a 939static void __init mac_report_hardware(void)
1da177e4
LT
940{
941 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
942}
943
944static void mac_get_model(char *str)
945{
6ff5801a 946 strcpy(str, "Macintosh ");
1da177e4
LT
947 strcat(str, macintosh_config->name);
948}
8852ecd9 949
2724daf4 950static struct resource swim_rsrc = { .flags = IORESOURCE_MEM };
8852ecd9 951
2724daf4 952static struct platform_device swim_pdev = {
8852ecd9
LV
953 .name = "swim",
954 .id = -1,
2724daf4
FT
955 .num_resources = 1,
956 .resource = &swim_rsrc,
8852ecd9
LV
957};
958
cff75f1f
FT
959static struct platform_device esp_0_pdev = {
960 .name = "mac_esp",
961 .id = 0,
962};
963
964static struct platform_device esp_1_pdev = {
965 .name = "mac_esp",
966 .id = 1,
967};
968
eeb9c182
FT
969static struct platform_device sonic_pdev = {
970 .name = "macsonic",
971 .id = -1,
972};
973
974static struct platform_device mace_pdev = {
975 .name = "macmace",
976 .id = -1,
977};
978
8852ecd9
LV
979int __init mac_platform_init(void)
980{
981 u8 *swim_base;
982
6cfeba53
GU
983 if (!MACH_IS_MAC)
984 return -ENODEV;
985
80614e5a
FT
986 /*
987 * Serial devices
988 */
989
990 platform_device_register(&scc_a_pdev);
991 platform_device_register(&scc_b_pdev);
992
2724daf4
FT
993 /*
994 * Floppy device
995 */
996
8852ecd9
LV
997 switch (macintosh_config->floppy_type) {
998 case MAC_FLOPPY_SWIM_ADDR1:
999 swim_base = (u8 *)(VIA1_BASE + 0x1E000);
1000 break;
1001 case MAC_FLOPPY_SWIM_ADDR2:
1002 swim_base = (u8 *)(VIA1_BASE + 0x16000);
1003 break;
1004 default:
2724daf4
FT
1005 swim_base = NULL;
1006 break;
8852ecd9
LV
1007 }
1008
2724daf4
FT
1009 if (swim_base) {
1010 swim_rsrc.start = (resource_size_t) swim_base,
1011 swim_rsrc.end = (resource_size_t) swim_base + 0x2000,
1012 platform_device_register(&swim_pdev);
1013 }
8852ecd9 1014
cff75f1f
FT
1015 /*
1016 * SCSI device(s)
1017 */
1018
1019 switch (macintosh_config->scsi_type) {
1020 case MAC_SCSI_QUADRA:
1021 case MAC_SCSI_QUADRA3:
1022 platform_device_register(&esp_0_pdev);
1023 break;
1024 case MAC_SCSI_QUADRA2:
1025 platform_device_register(&esp_0_pdev);
1026 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
1027 (macintosh_config->ident == MAC_MODEL_Q950))
1028 platform_device_register(&esp_1_pdev);
1029 break;
1030 }
1031
eeb9c182
FT
1032 /*
1033 * Ethernet device
1034 */
1035
1036 switch (macintosh_config->ether_type) {
1037 case MAC_ETHER_SONIC:
1038 platform_device_register(&sonic_pdev);
1039 break;
1040 case MAC_ETHER_MACE:
1041 platform_device_register(&mace_pdev);
1042 break;
1043 }
1044
2724daf4 1045 return 0;
8852ecd9
LV
1046}
1047
1048arch_initcall(mac_platform_init);
This page took 0.979077 seconds and 5 git commands to generate.