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 /* Mac specific timer functions */
58 extern u32 mac_gettimeoffset(void);
59 extern int mac_hwclk(int, struct rtc_time *);
60 extern void iop_preinit(void);
61 extern void iop_init(void);
62 extern void via_init(void);
63 extern void via_init_clock(irq_handler_t func);
64 extern void via_flush_cache(void);
65 extern void oss_init(void);
66 extern void psc_init(void);
67 extern void baboon_init(void);
69 extern void mac_mksound(unsigned int, unsigned int);
71 static void mac_get_model(char *str);
72 static void mac_identify(void);
73 static void mac_report_hardware(void);
75 static void __init mac_sched_init(irq_handler_t vector)
77 via_init_clock(vector);
81 * Parse a Macintosh-specific record in the bootinfo
84 int __init mac_parse_bootinfo(const struct bi_record *record)
87 const void *data = record->data;
89 switch (be16_to_cpu(record->tag)) {
91 mac_bi_data.id = be32_to_cpup(data);
94 mac_bi_data.videoaddr = be32_to_cpup(data);
97 mac_bi_data.videodepth = be32_to_cpup(data);
100 mac_bi_data.videorow = be32_to_cpup(data);
103 mac_bi_data.dimensions = be32_to_cpup(data);
105 case BI_MAC_VLOGICAL:
106 mac_orig_videoaddr = be32_to_cpup(data);
107 mac_bi_data.videological =
108 VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
111 mac_bi_data.sccbase = be32_to_cpup(data);
114 mac_bi_data.boottime = be32_to_cpup(data);
117 mac_bi_data.gmtbias = be32_to_cpup(data);
120 mac_bi_data.memsize = be32_to_cpup(data);
123 mac_bi_data.cpuid = be32_to_cpup(data);
126 mac_bi_data.rombase = be32_to_cpup(data);
136 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
137 * have to disable interrupts for this. Our IRQ handlers will crap
138 * themselves if they take an IRQ in 24bit mode!
141 static void mac_cache_card_flush(int writeback)
145 local_irq_save(flags);
147 local_irq_restore(flags);
150 void __init config_mac(void)
153 pr_err("ERROR: no Mac, but config_mac() called!!\n");
155 mach_sched_init = mac_sched_init;
156 mach_init_IRQ = mac_init_IRQ;
157 mach_get_model = mac_get_model;
158 arch_gettimeoffset = mac_gettimeoffset;
159 mach_hwclk = mac_hwclk;
160 mach_reset = mac_reset;
161 mach_halt = mac_poweroff;
162 mach_power_off = mac_poweroff;
163 mach_max_dma_address = 0xffffffff;
164 #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
165 mach_beep = mac_mksound;
169 * Determine hardware present
173 mac_report_hardware();
176 * AFAIK only the IIci takes a cache card. The IIfx has onboard
177 * cache ... someone needs to figure out how to tell if it's on or
181 if (macintosh_config->ident == MAC_MODEL_IICI
182 || macintosh_config->ident == MAC_MODEL_IIFX)
183 mach_l2_flush = mac_cache_card_flush;
188 * Macintosh Table: hardcoded model configuration data.
190 * Much of this was defined by Alan, based on who knows what docs.
191 * I've added a lot more, and some of that was pure guesswork based
192 * on hardware pages present on the Mac web site. Possibly wildly
193 * inaccurate, so look here if a new Mac model won't run. Example: if
194 * a Mac crashes immediately after the VIA1 registers have been dumped
195 * to the screen, it probably died attempting to read DirB on a RBV.
196 * Meaning it should have MAC_VIA_IICI here :-)
199 struct mac_model *macintosh_config;
200 EXPORT_SYMBOL(macintosh_config);
202 static struct mac_model mac_data_table[] = {
204 * We'll pretend to be a Macintosh II, that's pretty safe.
208 .ident = MAC_MODEL_II,
210 .adb_type = MAC_ADB_II,
211 .via_type = MAC_VIA_II,
212 .scsi_type = MAC_SCSI_OLD,
213 .scc_type = MAC_SCC_II,
214 .expansion_type = MAC_EXP_NUBUS,
215 .floppy_type = MAC_FLOPPY_IWM,
219 * Original Mac II hardware
223 .ident = MAC_MODEL_II,
225 .adb_type = MAC_ADB_II,
226 .via_type = MAC_VIA_II,
227 .scsi_type = MAC_SCSI_OLD,
228 .scc_type = MAC_SCC_II,
229 .expansion_type = MAC_EXP_NUBUS,
230 .floppy_type = MAC_FLOPPY_IWM,
232 .ident = MAC_MODEL_IIX,
234 .adb_type = MAC_ADB_II,
235 .via_type = MAC_VIA_II,
236 .scsi_type = MAC_SCSI_OLD,
237 .scc_type = MAC_SCC_II,
238 .expansion_type = MAC_EXP_NUBUS,
239 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
241 .ident = MAC_MODEL_IICX,
243 .adb_type = MAC_ADB_II,
244 .via_type = MAC_VIA_II,
245 .scsi_type = MAC_SCSI_OLD,
246 .scc_type = MAC_SCC_II,
247 .expansion_type = MAC_EXP_NUBUS,
248 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
250 .ident = MAC_MODEL_SE30,
252 .adb_type = MAC_ADB_II,
253 .via_type = MAC_VIA_II,
254 .scsi_type = MAC_SCSI_OLD,
255 .scc_type = MAC_SCC_II,
256 .expansion_type = MAC_EXP_PDS,
257 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
261 * Weirdified Mac II hardware - all subtly different. Gee thanks
262 * Apple. All these boxes seem to have VIA2 in a different place to
263 * the Mac II (+1A000 rather than +4000)
264 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
268 .ident = MAC_MODEL_IICI,
270 .adb_type = MAC_ADB_II,
271 .via_type = MAC_VIA_IICI,
272 .scsi_type = MAC_SCSI_OLD,
273 .scc_type = MAC_SCC_II,
274 .expansion_type = MAC_EXP_NUBUS,
275 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
277 .ident = MAC_MODEL_IIFX,
279 .adb_type = MAC_ADB_IOP,
280 .via_type = MAC_VIA_IICI,
281 .scsi_type = MAC_SCSI_IIFX,
282 .scc_type = MAC_SCC_IOP,
283 .expansion_type = MAC_EXP_PDS_NUBUS,
284 .floppy_type = MAC_FLOPPY_SWIM_IOP,
286 .ident = MAC_MODEL_IISI,
288 .adb_type = MAC_ADB_EGRET,
289 .via_type = MAC_VIA_IICI,
290 .scsi_type = MAC_SCSI_OLD,
291 .scc_type = MAC_SCC_II,
292 .expansion_type = MAC_EXP_PDS_NUBUS,
293 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
295 .ident = MAC_MODEL_IIVI,
297 .adb_type = MAC_ADB_EGRET,
298 .via_type = MAC_VIA_IICI,
299 .scsi_type = MAC_SCSI_LC,
300 .scc_type = MAC_SCC_II,
301 .expansion_type = MAC_EXP_NUBUS,
302 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
304 .ident = MAC_MODEL_IIVX,
306 .adb_type = MAC_ADB_EGRET,
307 .via_type = MAC_VIA_IICI,
308 .scsi_type = MAC_SCSI_LC,
309 .scc_type = MAC_SCC_II,
310 .expansion_type = MAC_EXP_NUBUS,
311 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
315 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
319 .ident = MAC_MODEL_CLII,
320 .name = "Classic II",
321 .adb_type = MAC_ADB_EGRET,
322 .via_type = MAC_VIA_IICI,
323 .scsi_type = MAC_SCSI_LC,
324 .scc_type = MAC_SCC_II,
325 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
327 .ident = MAC_MODEL_CCL,
328 .name = "Color Classic",
329 .adb_type = MAC_ADB_CUDA,
330 .via_type = MAC_VIA_IICI,
331 .scsi_type = MAC_SCSI_LC,
332 .scc_type = MAC_SCC_II,
333 .expansion_type = MAC_EXP_PDS,
334 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
336 .ident = MAC_MODEL_CCLII,
337 .name = "Color Classic II",
338 .adb_type = MAC_ADB_CUDA,
339 .via_type = MAC_VIA_IICI,
340 .scsi_type = MAC_SCSI_LC,
341 .scc_type = MAC_SCC_II,
342 .expansion_type = MAC_EXP_PDS,
343 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
347 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
351 .ident = MAC_MODEL_LC,
353 .adb_type = MAC_ADB_EGRET,
354 .via_type = MAC_VIA_IICI,
355 .scsi_type = MAC_SCSI_LC,
356 .scc_type = MAC_SCC_II,
357 .expansion_type = MAC_EXP_PDS,
358 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
360 .ident = MAC_MODEL_LCII,
362 .adb_type = MAC_ADB_EGRET,
363 .via_type = MAC_VIA_IICI,
364 .scsi_type = MAC_SCSI_LC,
365 .scc_type = MAC_SCC_II,
366 .expansion_type = MAC_EXP_PDS,
367 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
369 .ident = MAC_MODEL_LCIII,
371 .adb_type = MAC_ADB_EGRET,
372 .via_type = MAC_VIA_IICI,
373 .scsi_type = MAC_SCSI_LC,
374 .scc_type = MAC_SCC_II,
375 .expansion_type = MAC_EXP_PDS,
376 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
380 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
381 * differently as some of the stuff connected to VIA2 seems different.
382 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
383 * the 660AV and 840AV which use an AMD 79C940 (MACE).
384 * The 700, 900 and 950 have some I/O chips in the wrong place to
385 * confuse us. The 840AV has a SCSI location of its own (same as
390 .ident = MAC_MODEL_Q605,
391 .name = "Quadra 605",
392 .adb_type = MAC_ADB_CUDA,
393 .via_type = MAC_VIA_QUADRA,
394 .scsi_type = MAC_SCSI_QUADRA,
395 .scc_type = MAC_SCC_QUADRA,
396 .expansion_type = MAC_EXP_PDS,
397 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
399 .ident = MAC_MODEL_Q605_ACC,
400 .name = "Quadra 605",
401 .adb_type = MAC_ADB_CUDA,
402 .via_type = MAC_VIA_QUADRA,
403 .scsi_type = MAC_SCSI_QUADRA,
404 .scc_type = MAC_SCC_QUADRA,
405 .expansion_type = MAC_EXP_PDS,
406 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
408 .ident = MAC_MODEL_Q610,
409 .name = "Quadra 610",
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_SWIM_ADDR1,
418 .ident = MAC_MODEL_Q630,
419 .name = "Quadra 630",
420 .adb_type = MAC_ADB_CUDA,
421 .via_type = MAC_VIA_QUADRA,
422 .scsi_type = MAC_SCSI_QUADRA,
423 .ide_type = MAC_IDE_QUADRA,
424 .scc_type = MAC_SCC_QUADRA,
425 .expansion_type = MAC_EXP_PDS_COMM,
426 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
428 .ident = MAC_MODEL_Q650,
429 .name = "Quadra 650",
430 .adb_type = MAC_ADB_II,
431 .via_type = MAC_VIA_QUADRA,
432 .scsi_type = MAC_SCSI_QUADRA,
433 .scc_type = MAC_SCC_QUADRA,
434 .ether_type = MAC_ETHER_SONIC,
435 .expansion_type = MAC_EXP_PDS_NUBUS,
436 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
438 /* The Q700 does have a NS Sonic */
440 .ident = MAC_MODEL_Q700,
441 .name = "Quadra 700",
442 .adb_type = MAC_ADB_II,
443 .via_type = MAC_VIA_QUADRA,
444 .scsi_type = MAC_SCSI_QUADRA2,
445 .scc_type = MAC_SCC_QUADRA,
446 .ether_type = MAC_ETHER_SONIC,
447 .expansion_type = MAC_EXP_PDS_NUBUS,
448 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
450 .ident = MAC_MODEL_Q800,
451 .name = "Quadra 800",
452 .adb_type = MAC_ADB_II,
453 .via_type = MAC_VIA_QUADRA,
454 .scsi_type = MAC_SCSI_QUADRA,
455 .scc_type = MAC_SCC_QUADRA,
456 .ether_type = MAC_ETHER_SONIC,
457 .expansion_type = MAC_EXP_PDS_NUBUS,
458 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
460 .ident = MAC_MODEL_Q840,
461 .name = "Quadra 840AV",
462 .adb_type = MAC_ADB_CUDA,
463 .via_type = MAC_VIA_QUADRA,
464 .scsi_type = MAC_SCSI_QUADRA3,
465 .scc_type = MAC_SCC_PSC,
466 .ether_type = MAC_ETHER_MACE,
467 .expansion_type = MAC_EXP_NUBUS,
468 .floppy_type = MAC_FLOPPY_AV,
470 .ident = MAC_MODEL_Q900,
471 .name = "Quadra 900",
472 .adb_type = MAC_ADB_IOP,
473 .via_type = MAC_VIA_QUADRA,
474 .scsi_type = MAC_SCSI_QUADRA2,
475 .scc_type = MAC_SCC_IOP,
476 .ether_type = MAC_ETHER_SONIC,
477 .expansion_type = MAC_EXP_PDS_NUBUS,
478 .floppy_type = MAC_FLOPPY_SWIM_IOP,
480 .ident = MAC_MODEL_Q950,
481 .name = "Quadra 950",
482 .adb_type = MAC_ADB_IOP,
483 .via_type = MAC_VIA_QUADRA,
484 .scsi_type = MAC_SCSI_QUADRA2,
485 .scc_type = MAC_SCC_IOP,
486 .ether_type = MAC_ETHER_SONIC,
487 .expansion_type = MAC_EXP_PDS_NUBUS,
488 .floppy_type = MAC_FLOPPY_SWIM_IOP,
492 * Performa - more LC type machines
496 .ident = MAC_MODEL_P460,
497 .name = "Performa 460",
498 .adb_type = MAC_ADB_EGRET,
499 .via_type = MAC_VIA_IICI,
500 .scsi_type = MAC_SCSI_LC,
501 .scc_type = MAC_SCC_II,
502 .expansion_type = MAC_EXP_PDS,
503 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
505 .ident = MAC_MODEL_P475,
506 .name = "Performa 475",
507 .adb_type = MAC_ADB_CUDA,
508 .via_type = MAC_VIA_QUADRA,
509 .scsi_type = MAC_SCSI_QUADRA,
510 .scc_type = MAC_SCC_II,
511 .expansion_type = MAC_EXP_PDS,
512 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
514 .ident = MAC_MODEL_P475F,
515 .name = "Performa 475",
516 .adb_type = MAC_ADB_CUDA,
517 .via_type = MAC_VIA_QUADRA,
518 .scsi_type = MAC_SCSI_QUADRA,
519 .scc_type = MAC_SCC_II,
520 .expansion_type = MAC_EXP_PDS,
521 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
523 .ident = MAC_MODEL_P520,
524 .name = "Performa 520",
525 .adb_type = MAC_ADB_CUDA,
526 .via_type = MAC_VIA_IICI,
527 .scsi_type = MAC_SCSI_LC,
528 .scc_type = MAC_SCC_II,
529 .expansion_type = MAC_EXP_PDS,
530 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
532 .ident = MAC_MODEL_P550,
533 .name = "Performa 550",
534 .adb_type = MAC_ADB_CUDA,
535 .via_type = MAC_VIA_IICI,
536 .scsi_type = MAC_SCSI_LC,
537 .scc_type = MAC_SCC_II,
538 .expansion_type = MAC_EXP_PDS,
539 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
541 /* These have the comm slot, and therefore possibly SONIC ethernet */
543 .ident = MAC_MODEL_P575,
544 .name = "Performa 575",
545 .adb_type = MAC_ADB_CUDA,
546 .via_type = MAC_VIA_QUADRA,
547 .scsi_type = MAC_SCSI_QUADRA,
548 .scc_type = MAC_SCC_II,
549 .expansion_type = MAC_EXP_PDS_COMM,
550 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
552 .ident = MAC_MODEL_P588,
553 .name = "Performa 588",
554 .adb_type = MAC_ADB_CUDA,
555 .via_type = MAC_VIA_QUADRA,
556 .scsi_type = MAC_SCSI_QUADRA,
557 .ide_type = MAC_IDE_QUADRA,
558 .scc_type = MAC_SCC_II,
559 .expansion_type = MAC_EXP_PDS_COMM,
560 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
562 .ident = MAC_MODEL_TV,
564 .adb_type = MAC_ADB_CUDA,
565 .via_type = MAC_VIA_IICI,
566 .scsi_type = MAC_SCSI_LC,
567 .scc_type = MAC_SCC_II,
568 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
570 .ident = MAC_MODEL_P600,
571 .name = "Performa 600",
572 .adb_type = MAC_ADB_EGRET,
573 .via_type = MAC_VIA_IICI,
574 .scsi_type = MAC_SCSI_LC,
575 .scc_type = MAC_SCC_II,
576 .expansion_type = MAC_EXP_NUBUS,
577 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
581 * Centris - just guessing again; maybe like Quadra.
582 * The C610 may or may not have SONIC. We probe to make sure.
586 .ident = MAC_MODEL_C610,
587 .name = "Centris 610",
588 .adb_type = MAC_ADB_II,
589 .via_type = MAC_VIA_QUADRA,
590 .scsi_type = MAC_SCSI_QUADRA,
591 .scc_type = MAC_SCC_QUADRA,
592 .ether_type = MAC_ETHER_SONIC,
593 .expansion_type = MAC_EXP_PDS_NUBUS,
594 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
596 .ident = MAC_MODEL_C650,
597 .name = "Centris 650",
598 .adb_type = MAC_ADB_II,
599 .via_type = MAC_VIA_QUADRA,
600 .scsi_type = MAC_SCSI_QUADRA,
601 .scc_type = MAC_SCC_QUADRA,
602 .ether_type = MAC_ETHER_SONIC,
603 .expansion_type = MAC_EXP_PDS_NUBUS,
604 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
606 .ident = MAC_MODEL_C660,
607 .name = "Centris 660AV",
608 .adb_type = MAC_ADB_CUDA,
609 .via_type = MAC_VIA_QUADRA,
610 .scsi_type = MAC_SCSI_QUADRA3,
611 .scc_type = MAC_SCC_PSC,
612 .ether_type = MAC_ETHER_MACE,
613 .expansion_type = MAC_EXP_PDS_NUBUS,
614 .floppy_type = MAC_FLOPPY_AV,
618 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
619 * and a PMU (in two variations?) for ADB. Most of them use the
620 * Quadra-style VIAs. A few models also have IDE from hell.
624 .ident = MAC_MODEL_PB140,
625 .name = "PowerBook 140",
626 .adb_type = MAC_ADB_PB1,
627 .via_type = MAC_VIA_QUADRA,
628 .scsi_type = MAC_SCSI_OLD,
629 .scc_type = MAC_SCC_QUADRA,
630 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
632 .ident = MAC_MODEL_PB145,
633 .name = "PowerBook 145",
634 .adb_type = MAC_ADB_PB1,
635 .via_type = MAC_VIA_QUADRA,
636 .scsi_type = MAC_SCSI_OLD,
637 .scc_type = MAC_SCC_QUADRA,
638 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
640 .ident = MAC_MODEL_PB150,
641 .name = "PowerBook 150",
642 .adb_type = MAC_ADB_PB2,
643 .via_type = MAC_VIA_IICI,
644 .scsi_type = MAC_SCSI_OLD,
645 .ide_type = MAC_IDE_PB,
646 .scc_type = MAC_SCC_QUADRA,
647 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
649 .ident = MAC_MODEL_PB160,
650 .name = "PowerBook 160",
651 .adb_type = MAC_ADB_PB1,
652 .via_type = MAC_VIA_QUADRA,
653 .scsi_type = MAC_SCSI_OLD,
654 .scc_type = MAC_SCC_QUADRA,
655 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
657 .ident = MAC_MODEL_PB165,
658 .name = "PowerBook 165",
659 .adb_type = MAC_ADB_PB1,
660 .via_type = MAC_VIA_QUADRA,
661 .scsi_type = MAC_SCSI_OLD,
662 .scc_type = MAC_SCC_QUADRA,
663 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
665 .ident = MAC_MODEL_PB165C,
666 .name = "PowerBook 165c",
667 .adb_type = MAC_ADB_PB1,
668 .via_type = MAC_VIA_QUADRA,
669 .scsi_type = MAC_SCSI_OLD,
670 .scc_type = MAC_SCC_QUADRA,
671 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
673 .ident = MAC_MODEL_PB170,
674 .name = "PowerBook 170",
675 .adb_type = MAC_ADB_PB1,
676 .via_type = MAC_VIA_QUADRA,
677 .scsi_type = MAC_SCSI_OLD,
678 .scc_type = MAC_SCC_QUADRA,
679 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
681 .ident = MAC_MODEL_PB180,
682 .name = "PowerBook 180",
683 .adb_type = MAC_ADB_PB1,
684 .via_type = MAC_VIA_QUADRA,
685 .scsi_type = MAC_SCSI_OLD,
686 .scc_type = MAC_SCC_QUADRA,
687 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
689 .ident = MAC_MODEL_PB180C,
690 .name = "PowerBook 180c",
691 .adb_type = MAC_ADB_PB1,
692 .via_type = MAC_VIA_QUADRA,
693 .scsi_type = MAC_SCSI_OLD,
694 .scc_type = MAC_SCC_QUADRA,
695 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
697 .ident = MAC_MODEL_PB190,
698 .name = "PowerBook 190",
699 .adb_type = MAC_ADB_PB2,
700 .via_type = MAC_VIA_QUADRA,
701 .scsi_type = MAC_SCSI_OLD,
702 .ide_type = MAC_IDE_BABOON,
703 .scc_type = MAC_SCC_QUADRA,
704 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
706 .ident = MAC_MODEL_PB520,
707 .name = "PowerBook 520",
708 .adb_type = MAC_ADB_PB2,
709 .via_type = MAC_VIA_QUADRA,
710 .scsi_type = MAC_SCSI_OLD,
711 .scc_type = MAC_SCC_QUADRA,
712 .ether_type = MAC_ETHER_SONIC,
713 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
717 * PowerBook Duos are pretty much like normal PowerBooks
718 * All of these probably have onboard SONIC in the Dock which
719 * means we'll have to probe for it eventually.
723 .ident = MAC_MODEL_PB210,
724 .name = "PowerBook Duo 210",
725 .adb_type = MAC_ADB_PB2,
726 .via_type = MAC_VIA_IICI,
727 .scsi_type = MAC_SCSI_DUO,
728 .scc_type = MAC_SCC_QUADRA,
729 .expansion_type = MAC_EXP_NUBUS,
730 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
732 .ident = MAC_MODEL_PB230,
733 .name = "PowerBook Duo 230",
734 .adb_type = MAC_ADB_PB2,
735 .via_type = MAC_VIA_IICI,
736 .scsi_type = MAC_SCSI_DUO,
737 .scc_type = MAC_SCC_QUADRA,
738 .expansion_type = MAC_EXP_NUBUS,
739 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
741 .ident = MAC_MODEL_PB250,
742 .name = "PowerBook Duo 250",
743 .adb_type = MAC_ADB_PB2,
744 .via_type = MAC_VIA_IICI,
745 .scsi_type = MAC_SCSI_DUO,
746 .scc_type = MAC_SCC_QUADRA,
747 .expansion_type = MAC_EXP_NUBUS,
748 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
750 .ident = MAC_MODEL_PB270C,
751 .name = "PowerBook Duo 270c",
752 .adb_type = MAC_ADB_PB2,
753 .via_type = MAC_VIA_IICI,
754 .scsi_type = MAC_SCSI_DUO,
755 .scc_type = MAC_SCC_QUADRA,
756 .expansion_type = MAC_EXP_NUBUS,
757 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
759 .ident = MAC_MODEL_PB280,
760 .name = "PowerBook Duo 280",
761 .adb_type = MAC_ADB_PB2,
762 .via_type = MAC_VIA_IICI,
763 .scsi_type = MAC_SCSI_DUO,
764 .scc_type = MAC_SCC_QUADRA,
765 .expansion_type = MAC_EXP_NUBUS,
766 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
768 .ident = MAC_MODEL_PB280C,
769 .name = "PowerBook Duo 280c",
770 .adb_type = MAC_ADB_PB2,
771 .via_type = MAC_VIA_IICI,
772 .scsi_type = MAC_SCSI_DUO,
773 .scc_type = MAC_SCC_QUADRA,
774 .expansion_type = MAC_EXP_NUBUS,
775 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
787 static struct resource scc_a_rsrcs[] = {
788 { .flags = IORESOURCE_MEM },
789 { .flags = IORESOURCE_IRQ },
792 static struct resource scc_b_rsrcs[] = {
793 { .flags = IORESOURCE_MEM },
794 { .flags = IORESOURCE_IRQ },
797 struct platform_device scc_a_pdev = {
800 .num_resources = ARRAY_SIZE(scc_a_rsrcs),
801 .resource = scc_a_rsrcs,
803 EXPORT_SYMBOL(scc_a_pdev);
805 struct platform_device scc_b_pdev = {
808 .num_resources = ARRAY_SIZE(scc_b_rsrcs),
809 .resource = scc_b_rsrcs,
811 EXPORT_SYMBOL(scc_b_pdev);
813 static void __init mac_identify(void)
817 /* Penguin data useful? */
818 int model = mac_bi_data.id;
820 /* no bootinfo model id -> NetBSD booter was used! */
821 /* XXX FIXME: breaks for model > 31 */
822 model = (mac_bi_data.cpuid >> 2) & 63;
823 pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
826 macintosh_config = mac_data_table;
827 for (m = macintosh_config; m->ident != -1; m++) {
828 if (m->ident == model) {
829 macintosh_config = m;
834 /* Set up serial port resources for the console initcall. */
836 scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
837 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
838 scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
839 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
841 switch (macintosh_config->scc_type) {
843 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
844 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
847 /* On non-PSC machines, the serial ports share an IRQ. */
848 if (macintosh_config->ident == MAC_MODEL_IIFX) {
849 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
850 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
852 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
853 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
859 * We need to pre-init the IOPs, if any. Otherwise
860 * the serial console won't work if the user had
861 * the serial ports set to "Faster" mode in MacOS.
865 pr_info("Detected Macintosh model: %d\n", model);
868 * Report booter data:
870 printk(KERN_DEBUG " Penguin bootinfo data:\n");
871 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
872 mac_bi_data.videoaddr, mac_bi_data.videorow,
873 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
874 mac_bi_data.dimensions >> 16);
875 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
876 mac_bi_data.videological, mac_orig_videoaddr,
877 mac_bi_data.sccbase);
878 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
879 mac_bi_data.boottime, mac_bi_data.gmtbias);
880 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
881 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
889 #ifdef CONFIG_ADB_CUDA
892 #ifdef CONFIG_ADB_PMU
897 static void __init mac_report_hardware(void)
899 pr_info("Apple Macintosh %s\n", macintosh_config->name);
902 static void mac_get_model(char *str)
904 strcpy(str, "Macintosh ");
905 strcat(str, macintosh_config->name);
908 static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
910 .flags = IORESOURCE_IRQ,
911 .start = IRQ_MAC_SCSI,
914 .flags = IORESOURCE_MEM,
920 static const struct resource mac_scsi_duo_rsrc[] __initconst = {
922 .flags = IORESOURCE_MEM,
928 static const struct resource mac_scsi_old_rsrc[] __initconst = {
930 .flags = IORESOURCE_IRQ,
931 .start = IRQ_MAC_SCSI,
934 .flags = IORESOURCE_MEM,
938 .flags = IORESOURCE_MEM,
944 static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
946 .flags = IORESOURCE_IRQ,
947 .start = IRQ_MAC_SCSI,
950 .flags = IORESOURCE_MEM,
954 .flags = IORESOURCE_MEM,
960 int __init mac_platform_init(void)
971 platform_device_register(&scc_a_pdev);
972 platform_device_register(&scc_b_pdev);
978 switch (macintosh_config->floppy_type) {
979 case MAC_FLOPPY_SWIM_ADDR1:
980 swim_base = (u8 *)(VIA1_BASE + 0x1E000);
982 case MAC_FLOPPY_SWIM_ADDR2:
983 swim_base = (u8 *)(VIA1_BASE + 0x16000);
991 struct resource swim_rsrc = {
992 .flags = IORESOURCE_MEM,
993 .start = (resource_size_t)swim_base,
994 .end = (resource_size_t)swim_base + 0x1FFF,
997 platform_device_register_simple("swim", -1, &swim_rsrc, 1);
1004 switch (macintosh_config->scsi_type) {
1005 case MAC_SCSI_QUADRA:
1006 case MAC_SCSI_QUADRA3:
1007 platform_device_register_simple("mac_esp", 0, NULL, 0);
1009 case MAC_SCSI_QUADRA2:
1010 platform_device_register_simple("mac_esp", 0, NULL, 0);
1011 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
1012 (macintosh_config->ident == MAC_MODEL_Q950))
1013 platform_device_register_simple("mac_esp", 1, NULL, 0);
1016 /* Addresses from The Guide to Mac Family Hardware.
1017 * $5000 8000 - $5000 9FFF: SCSI DMA
1018 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
1019 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
1020 * The SCSI DMA custom IC embeds the 53C80 core. mac_scsi does
1021 * not make use of its DMA or hardware handshaking logic.
1023 platform_device_register_simple("mac_scsi", 0,
1024 mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
1027 /* Addresses from the Duo Dock II Developer Note.
1028 * $FEE0 2000 - $FEE0 3FFF: normal mode
1029 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
1030 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
1031 * The NetBSD code indicates that both 5380 chips share
1032 * an IRQ (?) which would need careful handling (see mac_esp).
1034 platform_device_register_simple("mac_scsi", 1,
1035 mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
1038 /* Addresses from Developer Notes for Duo System,
1039 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
1040 * and also from The Guide to Mac Family Hardware for
1041 * SE/30, II, IIx, IIcx, IIci.
1042 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
1043 * $5001 0000 - $5001 1FFF: normal mode
1044 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
1045 * GMFH says that $5000 0000 - $50FF FFFF "wraps
1046 * $5000 0000 - $5001 FFFF eight times" (!)
1047 * mess.org says IIci and Color Classic do not alias
1048 * I/O address space.
1050 platform_device_register_simple("mac_scsi", 0,
1051 mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
1054 /* Addresses from Mac LC data in Designing Cards & Drivers 3ed.
1055 * Also from the Developer Notes for Classic II, LC III,
1056 * Color Classic and IIvx.
1057 * $50F0 6000 - $50F0 7FFF: SCSI handshake
1058 * $50F1 0000 - $50F1 1FFF: SCSI
1059 * $50F1 2000 - $50F1 3FFF: SCSI DMA
1061 platform_device_register_simple("mac_scsi", 0,
1062 mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
1070 if (macintosh_config->ether_type == MAC_ETHER_SONIC ||
1071 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1072 platform_device_register_simple("macsonic", -1, NULL, 0);
1074 if (macintosh_config->expansion_type == MAC_EXP_PDS ||
1075 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1076 platform_device_register_simple("mac89x0", -1, NULL, 0);
1078 if (macintosh_config->ether_type == MAC_ETHER_MACE)
1079 platform_device_register_simple("macmace", -1, NULL, 0);
1084 arch_initcall(mac_platform_init);