2 * linux/arch/m68k/mac/config.c
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
10 * Miscellaneous linux stuff
13 #include <linux/errno.h>
14 #include <linux/module.h>
15 #include <linux/types.h>
17 #include <linux/tty.h>
18 #include <linux/console.h>
19 #include <linux/interrupt.h>
21 #include <linux/random.h>
22 #include <linux/delay.h>
24 #include <linux/init.h>
25 #include <linux/vt_kern.h>
26 #include <linux/platform_device.h>
27 #include <linux/adb.h>
28 #include <linux/cuda.h>
29 #include <linux/pmu.h>
30 #include <linux/rtc.h>
32 #include <asm/setup.h>
33 #include <asm/bootinfo.h>
34 #include <asm/bootinfo-mac.h>
35 #include <asm/byteorder.h>
39 #include <asm/pgtable.h>
40 #include <asm/machdep.h>
42 #include <asm/macintosh.h>
43 #include <asm/macints.h>
44 #include <asm/machw.h>
46 #include <asm/mac_iop.h>
47 #include <asm/mac_via.h>
48 #include <asm/mac_oss.h>
49 #include <asm/mac_psc.h>
51 /* Mac bootinfo struct */
52 struct mac_booter_data mac_bi_data;
54 /* The phys. video addr. - might be bogus on some machines */
55 static unsigned long mac_orig_videoaddr;
57 extern int mac_hwclk(int, struct rtc_time *);
58 extern void iop_preinit(void);
59 extern void iop_init(void);
60 extern void via_init(void);
61 extern void via_init_clock(irq_handler_t func);
62 extern void oss_init(void);
63 extern void psc_init(void);
64 extern void baboon_init(void);
66 extern void mac_mksound(unsigned int, unsigned int);
68 static void mac_get_model(char *str);
69 static void mac_identify(void);
70 static void mac_report_hardware(void);
72 static void __init mac_sched_init(irq_handler_t vector)
74 via_init_clock(vector);
78 * Parse a Macintosh-specific record in the bootinfo
81 int __init mac_parse_bootinfo(const struct bi_record *record)
84 const void *data = record->data;
86 switch (be16_to_cpu(record->tag)) {
88 mac_bi_data.id = be32_to_cpup(data);
91 mac_bi_data.videoaddr = be32_to_cpup(data);
94 mac_bi_data.videodepth = be32_to_cpup(data);
97 mac_bi_data.videorow = be32_to_cpup(data);
100 mac_bi_data.dimensions = be32_to_cpup(data);
102 case BI_MAC_VLOGICAL:
103 mac_orig_videoaddr = be32_to_cpup(data);
104 mac_bi_data.videological =
105 VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
108 mac_bi_data.sccbase = be32_to_cpup(data);
111 mac_bi_data.boottime = be32_to_cpup(data);
114 mac_bi_data.gmtbias = be32_to_cpup(data);
117 mac_bi_data.memsize = be32_to_cpup(data);
120 mac_bi_data.cpuid = be32_to_cpup(data);
123 mac_bi_data.rombase = be32_to_cpup(data);
132 void __init config_mac(void)
135 pr_err("ERROR: no Mac, but config_mac() called!!\n");
137 mach_sched_init = mac_sched_init;
138 mach_init_IRQ = mac_init_IRQ;
139 mach_get_model = mac_get_model;
140 mach_hwclk = mac_hwclk;
141 mach_reset = mac_reset;
142 mach_halt = mac_poweroff;
143 mach_power_off = mac_poweroff;
144 mach_max_dma_address = 0xffffffff;
145 #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
146 mach_beep = mac_mksound;
150 * Determine hardware present
154 mac_report_hardware();
157 * AFAIK only the IIci takes a cache card. The IIfx has onboard
158 * cache ... someone needs to figure out how to tell if it's on or
162 if (macintosh_config->ident == MAC_MODEL_IICI)
163 mach_l2_flush = via_l2_flush;
168 * Macintosh Table: hardcoded model configuration data.
170 * Much of this was defined by Alan, based on who knows what docs.
171 * I've added a lot more, and some of that was pure guesswork based
172 * on hardware pages present on the Mac web site. Possibly wildly
173 * inaccurate, so look here if a new Mac model won't run. Example: if
174 * a Mac crashes immediately after the VIA1 registers have been dumped
175 * to the screen, it probably died attempting to read DirB on a RBV.
176 * Meaning it should have MAC_VIA_IICI here :-)
179 struct mac_model *macintosh_config;
180 EXPORT_SYMBOL(macintosh_config);
182 static struct mac_model mac_data_table[] = {
184 * We'll pretend to be a Macintosh II, that's pretty safe.
188 .ident = MAC_MODEL_II,
190 .adb_type = MAC_ADB_II,
191 .via_type = MAC_VIA_II,
192 .scsi_type = MAC_SCSI_OLD,
193 .scc_type = MAC_SCC_II,
194 .expansion_type = MAC_EXP_NUBUS,
195 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
199 * Original Mac II hardware
203 .ident = MAC_MODEL_II,
205 .adb_type = MAC_ADB_II,
206 .via_type = MAC_VIA_II,
207 .scsi_type = MAC_SCSI_OLD,
208 .scc_type = MAC_SCC_II,
209 .expansion_type = MAC_EXP_NUBUS,
210 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */
212 .ident = MAC_MODEL_IIX,
214 .adb_type = MAC_ADB_II,
215 .via_type = MAC_VIA_II,
216 .scsi_type = MAC_SCSI_OLD,
217 .scc_type = MAC_SCC_II,
218 .expansion_type = MAC_EXP_NUBUS,
219 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
221 .ident = MAC_MODEL_IICX,
223 .adb_type = MAC_ADB_II,
224 .via_type = MAC_VIA_II,
225 .scsi_type = MAC_SCSI_OLD,
226 .scc_type = MAC_SCC_II,
227 .expansion_type = MAC_EXP_NUBUS,
228 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
230 .ident = MAC_MODEL_SE30,
232 .adb_type = MAC_ADB_II,
233 .via_type = MAC_VIA_II,
234 .scsi_type = MAC_SCSI_OLD,
235 .scc_type = MAC_SCC_II,
236 .expansion_type = MAC_EXP_PDS,
237 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
241 * Weirdified Mac II hardware - all subtly different. Gee thanks
242 * Apple. All these boxes seem to have VIA2 in a different place to
243 * the Mac II (+1A000 rather than +4000)
244 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
248 .ident = MAC_MODEL_IICI,
250 .adb_type = MAC_ADB_II,
251 .via_type = MAC_VIA_IICI,
252 .scsi_type = MAC_SCSI_OLD,
253 .scc_type = MAC_SCC_II,
254 .expansion_type = MAC_EXP_NUBUS,
255 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
257 .ident = MAC_MODEL_IIFX,
259 .adb_type = MAC_ADB_IOP,
260 .via_type = MAC_VIA_IICI,
261 .scsi_type = MAC_SCSI_IIFX,
262 .scc_type = MAC_SCC_IOP,
263 .expansion_type = MAC_EXP_PDS_NUBUS,
264 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
266 .ident = MAC_MODEL_IISI,
268 .adb_type = MAC_ADB_EGRET,
269 .via_type = MAC_VIA_IICI,
270 .scsi_type = MAC_SCSI_OLD,
271 .scc_type = MAC_SCC_II,
272 .expansion_type = MAC_EXP_PDS_NUBUS,
273 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
275 .ident = MAC_MODEL_IIVI,
277 .adb_type = MAC_ADB_EGRET,
278 .via_type = MAC_VIA_IICI,
279 .scsi_type = MAC_SCSI_LC,
280 .scc_type = MAC_SCC_II,
281 .expansion_type = MAC_EXP_NUBUS,
282 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
284 .ident = MAC_MODEL_IIVX,
286 .adb_type = MAC_ADB_EGRET,
287 .via_type = MAC_VIA_IICI,
288 .scsi_type = MAC_SCSI_LC,
289 .scc_type = MAC_SCC_II,
290 .expansion_type = MAC_EXP_NUBUS,
291 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
295 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
299 .ident = MAC_MODEL_CLII,
300 .name = "Classic II",
301 .adb_type = MAC_ADB_EGRET,
302 .via_type = MAC_VIA_IICI,
303 .scsi_type = MAC_SCSI_LC,
304 .scc_type = MAC_SCC_II,
305 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
307 .ident = MAC_MODEL_CCL,
308 .name = "Color Classic",
309 .adb_type = MAC_ADB_CUDA,
310 .via_type = MAC_VIA_IICI,
311 .scsi_type = MAC_SCSI_LC,
312 .scc_type = MAC_SCC_II,
313 .expansion_type = MAC_EXP_PDS,
314 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
316 .ident = MAC_MODEL_CCLII,
317 .name = "Color Classic II",
318 .adb_type = MAC_ADB_CUDA,
319 .via_type = MAC_VIA_IICI,
320 .scsi_type = MAC_SCSI_LC,
321 .scc_type = MAC_SCC_II,
322 .expansion_type = MAC_EXP_PDS,
323 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
327 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
331 .ident = MAC_MODEL_LC,
333 .adb_type = MAC_ADB_EGRET,
334 .via_type = MAC_VIA_IICI,
335 .scsi_type = MAC_SCSI_LC,
336 .scc_type = MAC_SCC_II,
337 .expansion_type = MAC_EXP_PDS,
338 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
340 .ident = MAC_MODEL_LCII,
342 .adb_type = MAC_ADB_EGRET,
343 .via_type = MAC_VIA_IICI,
344 .scsi_type = MAC_SCSI_LC,
345 .scc_type = MAC_SCC_II,
346 .expansion_type = MAC_EXP_PDS,
347 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
349 .ident = MAC_MODEL_LCIII,
351 .adb_type = MAC_ADB_EGRET,
352 .via_type = MAC_VIA_IICI,
353 .scsi_type = MAC_SCSI_LC,
354 .scc_type = MAC_SCC_II,
355 .expansion_type = MAC_EXP_PDS,
356 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
360 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
361 * differently as some of the stuff connected to VIA2 seems different.
362 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
363 * the 660AV and 840AV which use an AMD 79C940 (MACE).
364 * The 700, 900 and 950 have some I/O chips in the wrong place to
365 * confuse us. The 840AV has a SCSI location of its own (same as
370 .ident = MAC_MODEL_Q605,
371 .name = "Quadra 605",
372 .adb_type = MAC_ADB_CUDA,
373 .via_type = MAC_VIA_QUADRA,
374 .scsi_type = MAC_SCSI_QUADRA,
375 .scc_type = MAC_SCC_QUADRA,
376 .expansion_type = MAC_EXP_PDS,
377 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
379 .ident = MAC_MODEL_Q605_ACC,
380 .name = "Quadra 605",
381 .adb_type = MAC_ADB_CUDA,
382 .via_type = MAC_VIA_QUADRA,
383 .scsi_type = MAC_SCSI_QUADRA,
384 .scc_type = MAC_SCC_QUADRA,
385 .expansion_type = MAC_EXP_PDS,
386 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
388 .ident = MAC_MODEL_Q610,
389 .name = "Quadra 610",
390 .adb_type = MAC_ADB_II,
391 .via_type = MAC_VIA_QUADRA,
392 .scsi_type = MAC_SCSI_QUADRA,
393 .scc_type = MAC_SCC_QUADRA,
394 .ether_type = MAC_ETHER_SONIC,
395 .expansion_type = MAC_EXP_PDS_NUBUS,
396 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
398 .ident = MAC_MODEL_Q630,
399 .name = "Quadra 630",
400 .adb_type = MAC_ADB_CUDA,
401 .via_type = MAC_VIA_QUADRA,
402 .scsi_type = MAC_SCSI_QUADRA,
403 .ide_type = MAC_IDE_QUADRA,
404 .scc_type = MAC_SCC_QUADRA,
405 .expansion_type = MAC_EXP_PDS_COMM,
406 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
408 .ident = MAC_MODEL_Q650,
409 .name = "Quadra 650",
410 .adb_type = MAC_ADB_II,
411 .via_type = MAC_VIA_QUADRA,
412 .scsi_type = MAC_SCSI_QUADRA,
413 .scc_type = MAC_SCC_QUADRA,
414 .ether_type = MAC_ETHER_SONIC,
415 .expansion_type = MAC_EXP_PDS_NUBUS,
416 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
418 /* The Q700 does have a NS Sonic */
420 .ident = MAC_MODEL_Q700,
421 .name = "Quadra 700",
422 .adb_type = MAC_ADB_II,
423 .via_type = MAC_VIA_QUADRA,
424 .scsi_type = MAC_SCSI_QUADRA2,
425 .scc_type = MAC_SCC_QUADRA,
426 .ether_type = MAC_ETHER_SONIC,
427 .expansion_type = MAC_EXP_PDS_NUBUS,
428 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM */
430 .ident = MAC_MODEL_Q800,
431 .name = "Quadra 800",
432 .adb_type = MAC_ADB_II,
433 .via_type = MAC_VIA_QUADRA,
434 .scsi_type = MAC_SCSI_QUADRA,
435 .scc_type = MAC_SCC_QUADRA,
436 .ether_type = MAC_ETHER_SONIC,
437 .expansion_type = MAC_EXP_PDS_NUBUS,
438 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
440 .ident = MAC_MODEL_Q840,
441 .name = "Quadra 840AV",
442 .adb_type = MAC_ADB_CUDA,
443 .via_type = MAC_VIA_QUADRA,
444 .scsi_type = MAC_SCSI_QUADRA3,
445 .scc_type = MAC_SCC_PSC,
446 .ether_type = MAC_ETHER_MACE,
447 .expansion_type = MAC_EXP_NUBUS,
448 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
450 .ident = MAC_MODEL_Q900,
451 .name = "Quadra 900",
452 .adb_type = MAC_ADB_IOP,
453 .via_type = MAC_VIA_QUADRA,
454 .scsi_type = MAC_SCSI_QUADRA2,
455 .scc_type = MAC_SCC_IOP,
456 .ether_type = MAC_ETHER_SONIC,
457 .expansion_type = MAC_EXP_PDS_NUBUS,
458 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
460 .ident = MAC_MODEL_Q950,
461 .name = "Quadra 950",
462 .adb_type = MAC_ADB_IOP,
463 .via_type = MAC_VIA_QUADRA,
464 .scsi_type = MAC_SCSI_QUADRA2,
465 .scc_type = MAC_SCC_IOP,
466 .ether_type = MAC_ETHER_SONIC,
467 .expansion_type = MAC_EXP_PDS_NUBUS,
468 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */
472 * Performa - more LC type machines
476 .ident = MAC_MODEL_P460,
477 .name = "Performa 460",
478 .adb_type = MAC_ADB_EGRET,
479 .via_type = MAC_VIA_IICI,
480 .scsi_type = MAC_SCSI_LC,
481 .scc_type = MAC_SCC_II,
482 .expansion_type = MAC_EXP_PDS,
483 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
485 .ident = MAC_MODEL_P475,
486 .name = "Performa 475",
487 .adb_type = MAC_ADB_CUDA,
488 .via_type = MAC_VIA_QUADRA,
489 .scsi_type = MAC_SCSI_QUADRA,
490 .scc_type = MAC_SCC_II,
491 .expansion_type = MAC_EXP_PDS,
492 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
494 .ident = MAC_MODEL_P475F,
495 .name = "Performa 475",
496 .adb_type = MAC_ADB_CUDA,
497 .via_type = MAC_VIA_QUADRA,
498 .scsi_type = MAC_SCSI_QUADRA,
499 .scc_type = MAC_SCC_II,
500 .expansion_type = MAC_EXP_PDS,
501 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
503 .ident = MAC_MODEL_P520,
504 .name = "Performa 520",
505 .adb_type = MAC_ADB_CUDA,
506 .via_type = MAC_VIA_IICI,
507 .scsi_type = MAC_SCSI_LC,
508 .scc_type = MAC_SCC_II,
509 .expansion_type = MAC_EXP_PDS,
510 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
512 .ident = MAC_MODEL_P550,
513 .name = "Performa 550",
514 .adb_type = MAC_ADB_CUDA,
515 .via_type = MAC_VIA_IICI,
516 .scsi_type = MAC_SCSI_LC,
517 .scc_type = MAC_SCC_II,
518 .expansion_type = MAC_EXP_PDS,
519 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
521 /* These have the comm slot, and therefore possibly SONIC ethernet */
523 .ident = MAC_MODEL_P575,
524 .name = "Performa 575",
525 .adb_type = MAC_ADB_CUDA,
526 .via_type = MAC_VIA_QUADRA,
527 .scsi_type = MAC_SCSI_QUADRA,
528 .scc_type = MAC_SCC_II,
529 .expansion_type = MAC_EXP_PDS_COMM,
530 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
532 .ident = MAC_MODEL_P588,
533 .name = "Performa 588",
534 .adb_type = MAC_ADB_CUDA,
535 .via_type = MAC_VIA_QUADRA,
536 .scsi_type = MAC_SCSI_QUADRA,
537 .ide_type = MAC_IDE_QUADRA,
538 .scc_type = MAC_SCC_II,
539 .expansion_type = MAC_EXP_PDS_COMM,
540 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
542 .ident = MAC_MODEL_TV,
544 .adb_type = MAC_ADB_CUDA,
545 .via_type = MAC_VIA_IICI,
546 .scsi_type = MAC_SCSI_LC,
547 .scc_type = MAC_SCC_II,
548 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */
550 .ident = MAC_MODEL_P600,
551 .name = "Performa 600",
552 .adb_type = MAC_ADB_EGRET,
553 .via_type = MAC_VIA_IICI,
554 .scsi_type = MAC_SCSI_LC,
555 .scc_type = MAC_SCC_II,
556 .expansion_type = MAC_EXP_NUBUS,
557 .floppy_type = MAC_FLOPPY_LC, /* SWIM */
561 * Centris - just guessing again; maybe like Quadra.
562 * The C610 may or may not have SONIC. We probe to make sure.
566 .ident = MAC_MODEL_C610,
567 .name = "Centris 610",
568 .adb_type = MAC_ADB_II,
569 .via_type = MAC_VIA_QUADRA,
570 .scsi_type = MAC_SCSI_QUADRA,
571 .scc_type = MAC_SCC_QUADRA,
572 .ether_type = MAC_ETHER_SONIC,
573 .expansion_type = MAC_EXP_PDS_NUBUS,
574 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
576 .ident = MAC_MODEL_C650,
577 .name = "Centris 650",
578 .adb_type = MAC_ADB_II,
579 .via_type = MAC_VIA_QUADRA,
580 .scsi_type = MAC_SCSI_QUADRA,
581 .scc_type = MAC_SCC_QUADRA,
582 .ether_type = MAC_ETHER_SONIC,
583 .expansion_type = MAC_EXP_PDS_NUBUS,
584 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */
586 .ident = MAC_MODEL_C660,
587 .name = "Centris 660AV",
588 .adb_type = MAC_ADB_CUDA,
589 .via_type = MAC_VIA_QUADRA,
590 .scsi_type = MAC_SCSI_QUADRA3,
591 .scc_type = MAC_SCC_PSC,
592 .ether_type = MAC_ETHER_MACE,
593 .expansion_type = MAC_EXP_PDS_NUBUS,
594 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */
598 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
599 * and a PMU (in two variations?) for ADB. Most of them use the
600 * Quadra-style VIAs. A few models also have IDE from hell.
604 .ident = MAC_MODEL_PB140,
605 .name = "PowerBook 140",
606 .adb_type = MAC_ADB_PB1,
607 .via_type = MAC_VIA_QUADRA,
608 .scsi_type = MAC_SCSI_OLD,
609 .scc_type = MAC_SCC_QUADRA,
610 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
612 .ident = MAC_MODEL_PB145,
613 .name = "PowerBook 145",
614 .adb_type = MAC_ADB_PB1,
615 .via_type = MAC_VIA_QUADRA,
616 .scsi_type = MAC_SCSI_OLD,
617 .scc_type = MAC_SCC_QUADRA,
618 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
620 .ident = MAC_MODEL_PB150,
621 .name = "PowerBook 150",
622 .adb_type = MAC_ADB_PB2,
623 .via_type = MAC_VIA_IICI,
624 .scsi_type = MAC_SCSI_OLD,
625 .ide_type = MAC_IDE_PB,
626 .scc_type = MAC_SCC_QUADRA,
627 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
629 .ident = MAC_MODEL_PB160,
630 .name = "PowerBook 160",
631 .adb_type = MAC_ADB_PB1,
632 .via_type = MAC_VIA_QUADRA,
633 .scsi_type = MAC_SCSI_OLD,
634 .scc_type = MAC_SCC_QUADRA,
635 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
637 .ident = MAC_MODEL_PB165,
638 .name = "PowerBook 165",
639 .adb_type = MAC_ADB_PB1,
640 .via_type = MAC_VIA_QUADRA,
641 .scsi_type = MAC_SCSI_OLD,
642 .scc_type = MAC_SCC_QUADRA,
643 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
645 .ident = MAC_MODEL_PB165C,
646 .name = "PowerBook 165c",
647 .adb_type = MAC_ADB_PB1,
648 .via_type = MAC_VIA_QUADRA,
649 .scsi_type = MAC_SCSI_OLD,
650 .scc_type = MAC_SCC_QUADRA,
651 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
653 .ident = MAC_MODEL_PB170,
654 .name = "PowerBook 170",
655 .adb_type = MAC_ADB_PB1,
656 .via_type = MAC_VIA_QUADRA,
657 .scsi_type = MAC_SCSI_OLD,
658 .scc_type = MAC_SCC_QUADRA,
659 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
661 .ident = MAC_MODEL_PB180,
662 .name = "PowerBook 180",
663 .adb_type = MAC_ADB_PB1,
664 .via_type = MAC_VIA_QUADRA,
665 .scsi_type = MAC_SCSI_OLD,
666 .scc_type = MAC_SCC_QUADRA,
667 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
669 .ident = MAC_MODEL_PB180C,
670 .name = "PowerBook 180c",
671 .adb_type = MAC_ADB_PB1,
672 .via_type = MAC_VIA_QUADRA,
673 .scsi_type = MAC_SCSI_OLD,
674 .scc_type = MAC_SCC_QUADRA,
675 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
677 .ident = MAC_MODEL_PB190,
678 .name = "PowerBook 190",
679 .adb_type = MAC_ADB_PB2,
680 .via_type = MAC_VIA_QUADRA,
681 .scsi_type = MAC_SCSI_OLD,
682 .ide_type = MAC_IDE_BABOON,
683 .scc_type = MAC_SCC_QUADRA,
684 .floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */
686 .ident = MAC_MODEL_PB520,
687 .name = "PowerBook 520",
688 .adb_type = MAC_ADB_PB2,
689 .via_type = MAC_VIA_QUADRA,
690 .scsi_type = MAC_SCSI_OLD,
691 .scc_type = MAC_SCC_QUADRA,
692 .ether_type = MAC_ETHER_SONIC,
693 .floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */
697 * PowerBook Duos are pretty much like normal PowerBooks
698 * All of these probably have onboard SONIC in the Dock which
699 * means we'll have to probe for it eventually.
703 .ident = MAC_MODEL_PB210,
704 .name = "PowerBook Duo 210",
705 .adb_type = MAC_ADB_PB2,
706 .via_type = MAC_VIA_IICI,
707 .scsi_type = MAC_SCSI_DUO,
708 .scc_type = MAC_SCC_QUADRA,
709 .expansion_type = MAC_EXP_NUBUS,
710 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
712 .ident = MAC_MODEL_PB230,
713 .name = "PowerBook Duo 230",
714 .adb_type = MAC_ADB_PB2,
715 .via_type = MAC_VIA_IICI,
716 .scsi_type = MAC_SCSI_DUO,
717 .scc_type = MAC_SCC_QUADRA,
718 .expansion_type = MAC_EXP_NUBUS,
719 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
721 .ident = MAC_MODEL_PB250,
722 .name = "PowerBook Duo 250",
723 .adb_type = MAC_ADB_PB2,
724 .via_type = MAC_VIA_IICI,
725 .scsi_type = MAC_SCSI_DUO,
726 .scc_type = MAC_SCC_QUADRA,
727 .expansion_type = MAC_EXP_NUBUS,
728 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
730 .ident = MAC_MODEL_PB270C,
731 .name = "PowerBook Duo 270c",
732 .adb_type = MAC_ADB_PB2,
733 .via_type = MAC_VIA_IICI,
734 .scsi_type = MAC_SCSI_DUO,
735 .scc_type = MAC_SCC_QUADRA,
736 .expansion_type = MAC_EXP_NUBUS,
737 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
739 .ident = MAC_MODEL_PB280,
740 .name = "PowerBook Duo 280",
741 .adb_type = MAC_ADB_PB2,
742 .via_type = MAC_VIA_IICI,
743 .scsi_type = MAC_SCSI_DUO,
744 .scc_type = MAC_SCC_QUADRA,
745 .expansion_type = MAC_EXP_NUBUS,
746 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
748 .ident = MAC_MODEL_PB280C,
749 .name = "PowerBook Duo 280c",
750 .adb_type = MAC_ADB_PB2,
751 .via_type = MAC_VIA_IICI,
752 .scsi_type = MAC_SCSI_DUO,
753 .scc_type = MAC_SCC_QUADRA,
754 .expansion_type = MAC_EXP_NUBUS,
755 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */
767 static struct resource scc_a_rsrcs[] = {
768 { .flags = IORESOURCE_MEM },
769 { .flags = IORESOURCE_IRQ },
772 static struct resource scc_b_rsrcs[] = {
773 { .flags = IORESOURCE_MEM },
774 { .flags = IORESOURCE_IRQ },
777 struct platform_device scc_a_pdev = {
780 .num_resources = ARRAY_SIZE(scc_a_rsrcs),
781 .resource = scc_a_rsrcs,
783 EXPORT_SYMBOL(scc_a_pdev);
785 struct platform_device scc_b_pdev = {
788 .num_resources = ARRAY_SIZE(scc_b_rsrcs),
789 .resource = scc_b_rsrcs,
791 EXPORT_SYMBOL(scc_b_pdev);
793 static void __init mac_identify(void)
797 /* Penguin data useful? */
798 int model = mac_bi_data.id;
800 /* no bootinfo model id -> NetBSD booter was used! */
801 /* XXX FIXME: breaks for model > 31 */
802 model = (mac_bi_data.cpuid >> 2) & 63;
803 pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
806 macintosh_config = mac_data_table;
807 for (m = macintosh_config; m->ident != -1; m++) {
808 if (m->ident == model) {
809 macintosh_config = m;
814 /* Set up serial port resources for the console initcall. */
816 scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
817 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
818 scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
819 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
821 switch (macintosh_config->scc_type) {
823 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
824 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
827 /* On non-PSC machines, the serial ports share an IRQ. */
828 if (macintosh_config->ident == MAC_MODEL_IIFX) {
829 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
830 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
832 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
833 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
839 * We need to pre-init the IOPs, if any. Otherwise
840 * the serial console won't work if the user had
841 * the serial ports set to "Faster" mode in MacOS.
845 pr_info("Detected Macintosh model: %d\n", model);
848 * Report booter data:
850 printk(KERN_DEBUG " Penguin bootinfo data:\n");
851 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
852 mac_bi_data.videoaddr, mac_bi_data.videorow,
853 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
854 mac_bi_data.dimensions >> 16);
855 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
856 mac_bi_data.videological, mac_orig_videoaddr,
857 mac_bi_data.sccbase);
858 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
859 mac_bi_data.boottime, mac_bi_data.gmtbias);
860 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
861 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
869 #ifdef CONFIG_ADB_CUDA
872 #ifdef CONFIG_ADB_PMU
877 static void __init mac_report_hardware(void)
879 pr_info("Apple Macintosh %s\n", macintosh_config->name);
882 static void mac_get_model(char *str)
884 strcpy(str, "Macintosh ");
885 strcat(str, macintosh_config->name);
888 static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
890 .flags = IORESOURCE_IRQ,
891 .start = IRQ_MAC_SCSI,
894 .flags = IORESOURCE_MEM,
898 .flags = IORESOURCE_MEM,
904 static const struct resource mac_scsi_duo_rsrc[] __initconst = {
906 .flags = IORESOURCE_MEM,
912 static const struct resource mac_scsi_old_rsrc[] __initconst = {
914 .flags = IORESOURCE_IRQ,
915 .start = IRQ_MAC_SCSI,
918 .flags = IORESOURCE_MEM,
922 .flags = IORESOURCE_MEM,
928 static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
930 .flags = IORESOURCE_IRQ,
931 .start = IRQ_MAC_SCSI,
934 .flags = IORESOURCE_MEM,
938 .flags = IORESOURCE_MEM,
944 int __init mac_platform_init(void)
946 phys_addr_t swim_base = 0;
955 platform_device_register(&scc_a_pdev);
956 platform_device_register(&scc_b_pdev);
962 switch (macintosh_config->floppy_type) {
963 case MAC_FLOPPY_QUADRA:
964 swim_base = 0x5001E000;
967 swim_base = 0x50016000;
970 swim_base = 0x50F16000;
975 struct resource swim_rsrc = {
976 .flags = IORESOURCE_MEM,
978 .end = swim_base + 0x1FFF,
981 platform_device_register_simple("swim", -1, &swim_rsrc, 1);
988 switch (macintosh_config->scsi_type) {
989 case MAC_SCSI_QUADRA:
990 case MAC_SCSI_QUADRA3:
991 platform_device_register_simple("mac_esp", 0, NULL, 0);
993 case MAC_SCSI_QUADRA2:
994 platform_device_register_simple("mac_esp", 0, NULL, 0);
995 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
996 (macintosh_config->ident == MAC_MODEL_Q950))
997 platform_device_register_simple("mac_esp", 1, NULL, 0);
1000 /* Addresses from The Guide to Mac Family Hardware.
1001 * $5000 8000 - $5000 9FFF: SCSI DMA
1002 * $5000 A000 - $5000 BFFF: Alternate SCSI
1003 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
1004 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
1005 * The A/UX header file sys/uconfig.h says $50F0 8000.
1006 * The "SCSI DMA" custom IC embeds the 53C80 core and
1007 * supports Programmed IO, DMA and PDMA (hardware handshake).
1009 platform_device_register_simple("mac_scsi", 0,
1010 mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
1013 /* Addresses from the Duo Dock II Developer Note.
1014 * $FEE0 2000 - $FEE0 3FFF: normal mode
1015 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
1016 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
1017 * The NetBSD code indicates that both 5380 chips share
1018 * an IRQ (?) which would need careful handling (see mac_esp).
1020 platform_device_register_simple("mac_scsi", 1,
1021 mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
1024 /* Addresses from Developer Notes for Duo System,
1025 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
1026 * and also from The Guide to Mac Family Hardware for
1027 * SE/30, II, IIx, IIcx, IIci.
1028 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
1029 * $5001 0000 - $5001 1FFF: normal mode
1030 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
1031 * GMFH says that $5000 0000 - $50FF FFFF "wraps
1032 * $5000 0000 - $5001 FFFF eight times" (!)
1033 * mess.org says IIci and Color Classic do not alias
1034 * I/O address space.
1036 platform_device_register_simple("mac_scsi", 0,
1037 mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
1040 /* Addresses from Mac LC data in Designing Cards & Drivers 3ed.
1041 * Also from the Developer Notes for Classic II, LC III,
1042 * Color Classic and IIvx.
1043 * $50F0 6000 - $50F0 7FFF: SCSI handshake
1044 * $50F1 0000 - $50F1 1FFF: SCSI
1045 * $50F1 2000 - $50F1 3FFF: SCSI DMA
1047 platform_device_register_simple("mac_scsi", 0,
1048 mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
1056 if (macintosh_config->ether_type == MAC_ETHER_SONIC ||
1057 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1058 platform_device_register_simple("macsonic", -1, NULL, 0);
1060 if (macintosh_config->expansion_type == MAC_EXP_PDS ||
1061 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1062 platform_device_register_simple("mac89x0", -1, NULL, 0);
1064 if (macintosh_config->ether_type == MAC_ETHER_MACE)
1065 platform_device_register_simple("macmace", -1, NULL, 0);
1070 arch_initcall(mac_platform_init);