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/rtc.h>
31 #include <asm/setup.h>
32 #include <asm/bootinfo.h>
33 #include <asm/bootinfo-mac.h>
34 #include <asm/byteorder.h>
38 #include <asm/pgtable.h>
39 #include <asm/machdep.h>
41 #include <asm/macintosh.h>
42 #include <asm/macints.h>
43 #include <asm/machw.h>
45 #include <asm/mac_iop.h>
46 #include <asm/mac_via.h>
47 #include <asm/mac_oss.h>
48 #include <asm/mac_psc.h>
50 /* Mac bootinfo struct */
51 struct mac_booter_data mac_bi_data;
53 /* The phys. video addr. - might be bogus on some machines */
54 static unsigned long mac_orig_videoaddr;
56 /* Mac specific timer functions */
57 extern u32 mac_gettimeoffset(void);
58 extern int mac_hwclk(int, struct rtc_time *);
59 extern int mac_set_clock_mmss(unsigned long);
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_set_clock_mmss = mac_set_clock_mmss;
161 mach_reset = mac_reset;
162 mach_halt = mac_poweroff;
163 mach_power_off = mac_poweroff;
164 mach_max_dma_address = 0xffffffff;
165 #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
166 mach_beep = mac_mksound;
170 * Determine hardware present
174 mac_report_hardware();
177 * AFAIK only the IIci takes a cache card. The IIfx has onboard
178 * cache ... someone needs to figure out how to tell if it's on or
182 if (macintosh_config->ident == MAC_MODEL_IICI
183 || macintosh_config->ident == MAC_MODEL_IIFX)
184 mach_l2_flush = mac_cache_card_flush;
189 * Macintosh Table: hardcoded model configuration data.
191 * Much of this was defined by Alan, based on who knows what docs.
192 * I've added a lot more, and some of that was pure guesswork based
193 * on hardware pages present on the Mac web site. Possibly wildly
194 * inaccurate, so look here if a new Mac model won't run. Example: if
195 * a Mac crashes immediately after the VIA1 registers have been dumped
196 * to the screen, it probably died attempting to read DirB on a RBV.
197 * Meaning it should have MAC_VIA_IICI here :-)
200 struct mac_model *macintosh_config;
201 EXPORT_SYMBOL(macintosh_config);
203 static struct mac_model mac_data_table[] = {
205 * We'll pretend to be a Macintosh II, that's pretty safe.
209 .ident = MAC_MODEL_II,
211 .adb_type = MAC_ADB_II,
212 .via_type = MAC_VIA_II,
213 .scsi_type = MAC_SCSI_OLD,
214 .scc_type = MAC_SCC_II,
215 .expansion_type = MAC_EXP_NUBUS,
216 .floppy_type = MAC_FLOPPY_IWM,
220 * Original Mac II hardware
224 .ident = MAC_MODEL_II,
226 .adb_type = MAC_ADB_II,
227 .via_type = MAC_VIA_II,
228 .scsi_type = MAC_SCSI_OLD,
229 .scc_type = MAC_SCC_II,
230 .expansion_type = MAC_EXP_NUBUS,
231 .floppy_type = MAC_FLOPPY_IWM,
233 .ident = MAC_MODEL_IIX,
235 .adb_type = MAC_ADB_II,
236 .via_type = MAC_VIA_II,
237 .scsi_type = MAC_SCSI_OLD,
238 .scc_type = MAC_SCC_II,
239 .expansion_type = MAC_EXP_NUBUS,
240 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
242 .ident = MAC_MODEL_IICX,
244 .adb_type = MAC_ADB_II,
245 .via_type = MAC_VIA_II,
246 .scsi_type = MAC_SCSI_OLD,
247 .scc_type = MAC_SCC_II,
248 .expansion_type = MAC_EXP_NUBUS,
249 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
251 .ident = MAC_MODEL_SE30,
253 .adb_type = MAC_ADB_II,
254 .via_type = MAC_VIA_II,
255 .scsi_type = MAC_SCSI_OLD,
256 .scc_type = MAC_SCC_II,
257 .expansion_type = MAC_EXP_PDS,
258 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
262 * Weirdified Mac II hardware - all subtly different. Gee thanks
263 * Apple. All these boxes seem to have VIA2 in a different place to
264 * the Mac II (+1A000 rather than +4000)
265 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
269 .ident = MAC_MODEL_IICI,
271 .adb_type = MAC_ADB_II,
272 .via_type = MAC_VIA_IICI,
273 .scsi_type = MAC_SCSI_OLD,
274 .scc_type = MAC_SCC_II,
275 .expansion_type = MAC_EXP_NUBUS,
276 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
278 .ident = MAC_MODEL_IIFX,
280 .adb_type = MAC_ADB_IOP,
281 .via_type = MAC_VIA_IICI,
282 .scsi_type = MAC_SCSI_IIFX,
283 .scc_type = MAC_SCC_IOP,
284 .expansion_type = MAC_EXP_PDS_NUBUS,
285 .floppy_type = MAC_FLOPPY_SWIM_IOP,
287 .ident = MAC_MODEL_IISI,
289 .adb_type = MAC_ADB_EGRET,
290 .via_type = MAC_VIA_IICI,
291 .scsi_type = MAC_SCSI_OLD,
292 .scc_type = MAC_SCC_II,
293 .expansion_type = MAC_EXP_PDS_NUBUS,
294 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
296 .ident = MAC_MODEL_IIVI,
298 .adb_type = MAC_ADB_EGRET,
299 .via_type = MAC_VIA_IICI,
300 .scsi_type = MAC_SCSI_LC,
301 .scc_type = MAC_SCC_II,
302 .expansion_type = MAC_EXP_NUBUS,
303 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
305 .ident = MAC_MODEL_IIVX,
307 .adb_type = MAC_ADB_EGRET,
308 .via_type = MAC_VIA_IICI,
309 .scsi_type = MAC_SCSI_LC,
310 .scc_type = MAC_SCC_II,
311 .expansion_type = MAC_EXP_NUBUS,
312 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
316 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
320 .ident = MAC_MODEL_CLII,
321 .name = "Classic II",
322 .adb_type = MAC_ADB_EGRET,
323 .via_type = MAC_VIA_IICI,
324 .scsi_type = MAC_SCSI_LC,
325 .scc_type = MAC_SCC_II,
326 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
328 .ident = MAC_MODEL_CCL,
329 .name = "Color Classic",
330 .adb_type = MAC_ADB_CUDA,
331 .via_type = MAC_VIA_IICI,
332 .scsi_type = MAC_SCSI_LC,
333 .scc_type = MAC_SCC_II,
334 .expansion_type = MAC_EXP_PDS,
335 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
337 .ident = MAC_MODEL_CCLII,
338 .name = "Color Classic II",
339 .adb_type = MAC_ADB_CUDA,
340 .via_type = MAC_VIA_IICI,
341 .scsi_type = MAC_SCSI_LC,
342 .scc_type = MAC_SCC_II,
343 .expansion_type = MAC_EXP_PDS,
344 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
348 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
352 .ident = MAC_MODEL_LC,
354 .adb_type = MAC_ADB_EGRET,
355 .via_type = MAC_VIA_IICI,
356 .scsi_type = MAC_SCSI_LC,
357 .scc_type = MAC_SCC_II,
358 .expansion_type = MAC_EXP_PDS,
359 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
361 .ident = MAC_MODEL_LCII,
363 .adb_type = MAC_ADB_EGRET,
364 .via_type = MAC_VIA_IICI,
365 .scsi_type = MAC_SCSI_LC,
366 .scc_type = MAC_SCC_II,
367 .expansion_type = MAC_EXP_PDS,
368 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
370 .ident = MAC_MODEL_LCIII,
372 .adb_type = MAC_ADB_EGRET,
373 .via_type = MAC_VIA_IICI,
374 .scsi_type = MAC_SCSI_LC,
375 .scc_type = MAC_SCC_II,
376 .expansion_type = MAC_EXP_PDS,
377 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
381 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
382 * differently as some of the stuff connected to VIA2 seems different.
383 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
384 * the 660AV and 840AV which use an AMD 79C940 (MACE).
385 * The 700, 900 and 950 have some I/O chips in the wrong place to
386 * confuse us. The 840AV has a SCSI location of its own (same as
391 .ident = MAC_MODEL_Q605,
392 .name = "Quadra 605",
393 .adb_type = MAC_ADB_CUDA,
394 .via_type = MAC_VIA_QUADRA,
395 .scsi_type = MAC_SCSI_QUADRA,
396 .scc_type = MAC_SCC_QUADRA,
397 .expansion_type = MAC_EXP_PDS,
398 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
400 .ident = MAC_MODEL_Q605_ACC,
401 .name = "Quadra 605",
402 .adb_type = MAC_ADB_CUDA,
403 .via_type = MAC_VIA_QUADRA,
404 .scsi_type = MAC_SCSI_QUADRA,
405 .scc_type = MAC_SCC_QUADRA,
406 .expansion_type = MAC_EXP_PDS,
407 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
409 .ident = MAC_MODEL_Q610,
410 .name = "Quadra 610",
411 .adb_type = MAC_ADB_II,
412 .via_type = MAC_VIA_QUADRA,
413 .scsi_type = MAC_SCSI_QUADRA,
414 .scc_type = MAC_SCC_QUADRA,
415 .ether_type = MAC_ETHER_SONIC,
416 .expansion_type = MAC_EXP_PDS_NUBUS,
417 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
419 .ident = MAC_MODEL_Q630,
420 .name = "Quadra 630",
421 .adb_type = MAC_ADB_CUDA,
422 .via_type = MAC_VIA_QUADRA,
423 .scsi_type = MAC_SCSI_QUADRA,
424 .ide_type = MAC_IDE_QUADRA,
425 .scc_type = MAC_SCC_QUADRA,
426 .expansion_type = MAC_EXP_PDS_COMM,
427 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
429 .ident = MAC_MODEL_Q650,
430 .name = "Quadra 650",
431 .adb_type = MAC_ADB_II,
432 .via_type = MAC_VIA_QUADRA,
433 .scsi_type = MAC_SCSI_QUADRA,
434 .scc_type = MAC_SCC_QUADRA,
435 .ether_type = MAC_ETHER_SONIC,
436 .expansion_type = MAC_EXP_PDS_NUBUS,
437 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
439 /* The Q700 does have a NS Sonic */
441 .ident = MAC_MODEL_Q700,
442 .name = "Quadra 700",
443 .adb_type = MAC_ADB_II,
444 .via_type = MAC_VIA_QUADRA,
445 .scsi_type = MAC_SCSI_QUADRA2,
446 .scc_type = MAC_SCC_QUADRA,
447 .ether_type = MAC_ETHER_SONIC,
448 .expansion_type = MAC_EXP_PDS_NUBUS,
449 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
451 .ident = MAC_MODEL_Q800,
452 .name = "Quadra 800",
453 .adb_type = MAC_ADB_II,
454 .via_type = MAC_VIA_QUADRA,
455 .scsi_type = MAC_SCSI_QUADRA,
456 .scc_type = MAC_SCC_QUADRA,
457 .ether_type = MAC_ETHER_SONIC,
458 .expansion_type = MAC_EXP_PDS_NUBUS,
459 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
461 .ident = MAC_MODEL_Q840,
462 .name = "Quadra 840AV",
463 .adb_type = MAC_ADB_CUDA,
464 .via_type = MAC_VIA_QUADRA,
465 .scsi_type = MAC_SCSI_QUADRA3,
466 .scc_type = MAC_SCC_PSC,
467 .ether_type = MAC_ETHER_MACE,
468 .expansion_type = MAC_EXP_NUBUS,
469 .floppy_type = MAC_FLOPPY_AV,
471 .ident = MAC_MODEL_Q900,
472 .name = "Quadra 900",
473 .adb_type = MAC_ADB_IOP,
474 .via_type = MAC_VIA_QUADRA,
475 .scsi_type = MAC_SCSI_QUADRA2,
476 .scc_type = MAC_SCC_IOP,
477 .ether_type = MAC_ETHER_SONIC,
478 .expansion_type = MAC_EXP_PDS_NUBUS,
479 .floppy_type = MAC_FLOPPY_SWIM_IOP,
481 .ident = MAC_MODEL_Q950,
482 .name = "Quadra 950",
483 .adb_type = MAC_ADB_IOP,
484 .via_type = MAC_VIA_QUADRA,
485 .scsi_type = MAC_SCSI_QUADRA2,
486 .scc_type = MAC_SCC_IOP,
487 .ether_type = MAC_ETHER_SONIC,
488 .expansion_type = MAC_EXP_PDS_NUBUS,
489 .floppy_type = MAC_FLOPPY_SWIM_IOP,
493 * Performa - more LC type machines
497 .ident = MAC_MODEL_P460,
498 .name = "Performa 460",
499 .adb_type = MAC_ADB_EGRET,
500 .via_type = MAC_VIA_IICI,
501 .scsi_type = MAC_SCSI_LC,
502 .scc_type = MAC_SCC_II,
503 .expansion_type = MAC_EXP_PDS,
504 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
506 .ident = MAC_MODEL_P475,
507 .name = "Performa 475",
508 .adb_type = MAC_ADB_CUDA,
509 .via_type = MAC_VIA_QUADRA,
510 .scsi_type = MAC_SCSI_QUADRA,
511 .scc_type = MAC_SCC_II,
512 .expansion_type = MAC_EXP_PDS,
513 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
515 .ident = MAC_MODEL_P475F,
516 .name = "Performa 475",
517 .adb_type = MAC_ADB_CUDA,
518 .via_type = MAC_VIA_QUADRA,
519 .scsi_type = MAC_SCSI_QUADRA,
520 .scc_type = MAC_SCC_II,
521 .expansion_type = MAC_EXP_PDS,
522 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
524 .ident = MAC_MODEL_P520,
525 .name = "Performa 520",
526 .adb_type = MAC_ADB_CUDA,
527 .via_type = MAC_VIA_IICI,
528 .scsi_type = MAC_SCSI_LC,
529 .scc_type = MAC_SCC_II,
530 .expansion_type = MAC_EXP_PDS,
531 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
533 .ident = MAC_MODEL_P550,
534 .name = "Performa 550",
535 .adb_type = MAC_ADB_CUDA,
536 .via_type = MAC_VIA_IICI,
537 .scsi_type = MAC_SCSI_LC,
538 .scc_type = MAC_SCC_II,
539 .expansion_type = MAC_EXP_PDS,
540 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
542 /* These have the comm slot, and therefore possibly SONIC ethernet */
544 .ident = MAC_MODEL_P575,
545 .name = "Performa 575",
546 .adb_type = MAC_ADB_CUDA,
547 .via_type = MAC_VIA_QUADRA,
548 .scsi_type = MAC_SCSI_QUADRA,
549 .scc_type = MAC_SCC_II,
550 .expansion_type = MAC_EXP_PDS_COMM,
551 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
553 .ident = MAC_MODEL_P588,
554 .name = "Performa 588",
555 .adb_type = MAC_ADB_CUDA,
556 .via_type = MAC_VIA_QUADRA,
557 .scsi_type = MAC_SCSI_QUADRA,
558 .ide_type = MAC_IDE_QUADRA,
559 .scc_type = MAC_SCC_II,
560 .expansion_type = MAC_EXP_PDS_COMM,
561 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
563 .ident = MAC_MODEL_TV,
565 .adb_type = MAC_ADB_CUDA,
566 .via_type = MAC_VIA_IICI,
567 .scsi_type = MAC_SCSI_LC,
568 .scc_type = MAC_SCC_II,
569 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
571 .ident = MAC_MODEL_P600,
572 .name = "Performa 600",
573 .adb_type = MAC_ADB_EGRET,
574 .via_type = MAC_VIA_IICI,
575 .scsi_type = MAC_SCSI_LC,
576 .scc_type = MAC_SCC_II,
577 .expansion_type = MAC_EXP_NUBUS,
578 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
582 * Centris - just guessing again; maybe like Quadra.
583 * The C610 may or may not have SONIC. We probe to make sure.
587 .ident = MAC_MODEL_C610,
588 .name = "Centris 610",
589 .adb_type = MAC_ADB_II,
590 .via_type = MAC_VIA_QUADRA,
591 .scsi_type = MAC_SCSI_QUADRA,
592 .scc_type = MAC_SCC_QUADRA,
593 .ether_type = MAC_ETHER_SONIC,
594 .expansion_type = MAC_EXP_PDS_NUBUS,
595 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
597 .ident = MAC_MODEL_C650,
598 .name = "Centris 650",
599 .adb_type = MAC_ADB_II,
600 .via_type = MAC_VIA_QUADRA,
601 .scsi_type = MAC_SCSI_QUADRA,
602 .scc_type = MAC_SCC_QUADRA,
603 .ether_type = MAC_ETHER_SONIC,
604 .expansion_type = MAC_EXP_PDS_NUBUS,
605 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
607 .ident = MAC_MODEL_C660,
608 .name = "Centris 660AV",
609 .adb_type = MAC_ADB_CUDA,
610 .via_type = MAC_VIA_QUADRA,
611 .scsi_type = MAC_SCSI_QUADRA3,
612 .scc_type = MAC_SCC_PSC,
613 .ether_type = MAC_ETHER_MACE,
614 .expansion_type = MAC_EXP_PDS_NUBUS,
615 .floppy_type = MAC_FLOPPY_AV,
619 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
620 * and a PMU (in two variations?) for ADB. Most of them use the
621 * Quadra-style VIAs. A few models also have IDE from hell.
625 .ident = MAC_MODEL_PB140,
626 .name = "PowerBook 140",
627 .adb_type = MAC_ADB_PB1,
628 .via_type = MAC_VIA_QUADRA,
629 .scsi_type = MAC_SCSI_OLD,
630 .scc_type = MAC_SCC_QUADRA,
631 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
633 .ident = MAC_MODEL_PB145,
634 .name = "PowerBook 145",
635 .adb_type = MAC_ADB_PB1,
636 .via_type = MAC_VIA_QUADRA,
637 .scsi_type = MAC_SCSI_OLD,
638 .scc_type = MAC_SCC_QUADRA,
639 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
641 .ident = MAC_MODEL_PB150,
642 .name = "PowerBook 150",
643 .adb_type = MAC_ADB_PB2,
644 .via_type = MAC_VIA_IICI,
645 .scsi_type = MAC_SCSI_OLD,
646 .ide_type = MAC_IDE_PB,
647 .scc_type = MAC_SCC_QUADRA,
648 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
650 .ident = MAC_MODEL_PB160,
651 .name = "PowerBook 160",
652 .adb_type = MAC_ADB_PB1,
653 .via_type = MAC_VIA_QUADRA,
654 .scsi_type = MAC_SCSI_OLD,
655 .scc_type = MAC_SCC_QUADRA,
656 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
658 .ident = MAC_MODEL_PB165,
659 .name = "PowerBook 165",
660 .adb_type = MAC_ADB_PB1,
661 .via_type = MAC_VIA_QUADRA,
662 .scsi_type = MAC_SCSI_OLD,
663 .scc_type = MAC_SCC_QUADRA,
664 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
666 .ident = MAC_MODEL_PB165C,
667 .name = "PowerBook 165c",
668 .adb_type = MAC_ADB_PB1,
669 .via_type = MAC_VIA_QUADRA,
670 .scsi_type = MAC_SCSI_OLD,
671 .scc_type = MAC_SCC_QUADRA,
672 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
674 .ident = MAC_MODEL_PB170,
675 .name = "PowerBook 170",
676 .adb_type = MAC_ADB_PB1,
677 .via_type = MAC_VIA_QUADRA,
678 .scsi_type = MAC_SCSI_OLD,
679 .scc_type = MAC_SCC_QUADRA,
680 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
682 .ident = MAC_MODEL_PB180,
683 .name = "PowerBook 180",
684 .adb_type = MAC_ADB_PB1,
685 .via_type = MAC_VIA_QUADRA,
686 .scsi_type = MAC_SCSI_OLD,
687 .scc_type = MAC_SCC_QUADRA,
688 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
690 .ident = MAC_MODEL_PB180C,
691 .name = "PowerBook 180c",
692 .adb_type = MAC_ADB_PB1,
693 .via_type = MAC_VIA_QUADRA,
694 .scsi_type = MAC_SCSI_OLD,
695 .scc_type = MAC_SCC_QUADRA,
696 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
698 .ident = MAC_MODEL_PB190,
699 .name = "PowerBook 190",
700 .adb_type = MAC_ADB_PB2,
701 .via_type = MAC_VIA_QUADRA,
702 .scsi_type = MAC_SCSI_LATE,
703 .ide_type = MAC_IDE_BABOON,
704 .scc_type = MAC_SCC_QUADRA,
705 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
707 .ident = MAC_MODEL_PB520,
708 .name = "PowerBook 520",
709 .adb_type = MAC_ADB_PB2,
710 .via_type = MAC_VIA_QUADRA,
711 .scsi_type = MAC_SCSI_LATE,
712 .scc_type = MAC_SCC_QUADRA,
713 .ether_type = MAC_ETHER_SONIC,
714 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
718 * PowerBook Duos are pretty much like normal PowerBooks
719 * All of these probably have onboard SONIC in the Dock which
720 * means we'll have to probe for it eventually.
724 .ident = MAC_MODEL_PB210,
725 .name = "PowerBook Duo 210",
726 .adb_type = MAC_ADB_PB2,
727 .via_type = MAC_VIA_IICI,
728 .scsi_type = MAC_SCSI_DUO,
729 .scc_type = MAC_SCC_QUADRA,
730 .expansion_type = MAC_EXP_NUBUS,
731 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
733 .ident = MAC_MODEL_PB230,
734 .name = "PowerBook Duo 230",
735 .adb_type = MAC_ADB_PB2,
736 .via_type = MAC_VIA_IICI,
737 .scsi_type = MAC_SCSI_DUO,
738 .scc_type = MAC_SCC_QUADRA,
739 .expansion_type = MAC_EXP_NUBUS,
740 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
742 .ident = MAC_MODEL_PB250,
743 .name = "PowerBook Duo 250",
744 .adb_type = MAC_ADB_PB2,
745 .via_type = MAC_VIA_IICI,
746 .scsi_type = MAC_SCSI_DUO,
747 .scc_type = MAC_SCC_QUADRA,
748 .expansion_type = MAC_EXP_NUBUS,
749 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
751 .ident = MAC_MODEL_PB270C,
752 .name = "PowerBook Duo 270c",
753 .adb_type = MAC_ADB_PB2,
754 .via_type = MAC_VIA_IICI,
755 .scsi_type = MAC_SCSI_DUO,
756 .scc_type = MAC_SCC_QUADRA,
757 .expansion_type = MAC_EXP_NUBUS,
758 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
760 .ident = MAC_MODEL_PB280,
761 .name = "PowerBook Duo 280",
762 .adb_type = MAC_ADB_PB2,
763 .via_type = MAC_VIA_IICI,
764 .scsi_type = MAC_SCSI_DUO,
765 .scc_type = MAC_SCC_QUADRA,
766 .expansion_type = MAC_EXP_NUBUS,
767 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
769 .ident = MAC_MODEL_PB280C,
770 .name = "PowerBook Duo 280c",
771 .adb_type = MAC_ADB_PB2,
772 .via_type = MAC_VIA_IICI,
773 .scsi_type = MAC_SCSI_DUO,
774 .scc_type = MAC_SCC_QUADRA,
775 .expansion_type = MAC_EXP_NUBUS,
776 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
788 static struct resource scc_a_rsrcs[] = {
789 { .flags = IORESOURCE_MEM },
790 { .flags = IORESOURCE_IRQ },
793 static struct resource scc_b_rsrcs[] = {
794 { .flags = IORESOURCE_MEM },
795 { .flags = IORESOURCE_IRQ },
798 struct platform_device scc_a_pdev = {
801 .num_resources = ARRAY_SIZE(scc_a_rsrcs),
802 .resource = scc_a_rsrcs,
804 EXPORT_SYMBOL(scc_a_pdev);
806 struct platform_device scc_b_pdev = {
809 .num_resources = ARRAY_SIZE(scc_b_rsrcs),
810 .resource = scc_b_rsrcs,
812 EXPORT_SYMBOL(scc_b_pdev);
814 static void __init mac_identify(void)
818 /* Penguin data useful? */
819 int model = mac_bi_data.id;
821 /* no bootinfo model id -> NetBSD booter was used! */
822 /* XXX FIXME: breaks for model > 31 */
823 model = (mac_bi_data.cpuid >> 2) & 63;
824 pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
827 macintosh_config = mac_data_table;
828 for (m = macintosh_config; m->ident != -1; m++) {
829 if (m->ident == model) {
830 macintosh_config = m;
835 /* Set up serial port resources for the console initcall. */
837 scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
838 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
839 scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
840 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
842 switch (macintosh_config->scc_type) {
844 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
845 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
848 /* On non-PSC machines, the serial ports share an IRQ. */
849 if (macintosh_config->ident == MAC_MODEL_IIFX) {
850 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
851 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
853 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
854 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
860 * We need to pre-init the IOPs, if any. Otherwise
861 * the serial console won't work if the user had
862 * the serial ports set to "Faster" mode in MacOS.
866 pr_info("Detected Macintosh model: %d\n", model);
869 * Report booter data:
871 printk(KERN_DEBUG " Penguin bootinfo data:\n");
872 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
873 mac_bi_data.videoaddr, mac_bi_data.videorow,
874 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
875 mac_bi_data.dimensions >> 16);
876 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
877 mac_bi_data.videological, mac_orig_videoaddr,
878 mac_bi_data.sccbase);
879 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
880 mac_bi_data.boottime, mac_bi_data.gmtbias);
881 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
882 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
890 #ifdef CONFIG_ADB_CUDA
895 static void __init mac_report_hardware(void)
897 pr_info("Apple Macintosh %s\n", macintosh_config->name);
900 static void mac_get_model(char *str)
902 strcpy(str, "Macintosh ");
903 strcat(str, macintosh_config->name);
906 static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
908 .flags = IORESOURCE_IRQ,
909 .start = IRQ_MAC_SCSI,
912 .flags = IORESOURCE_MEM,
918 static const struct resource mac_scsi_duo_rsrc[] __initconst = {
920 .flags = IORESOURCE_MEM,
926 static const struct resource mac_scsi_old_rsrc[] __initconst = {
928 .flags = IORESOURCE_IRQ,
929 .start = IRQ_MAC_SCSI,
932 .flags = IORESOURCE_MEM,
936 .flags = IORESOURCE_MEM,
942 static const struct resource mac_scsi_late_rsrc[] __initconst = {
944 .flags = IORESOURCE_IRQ,
945 .start = IRQ_MAC_SCSI,
948 .flags = IORESOURCE_MEM,
954 static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
956 .flags = IORESOURCE_IRQ,
957 .start = IRQ_MAC_SCSI,
960 .flags = IORESOURCE_MEM,
964 .flags = IORESOURCE_MEM,
970 int __init mac_platform_init(void)
981 platform_device_register(&scc_a_pdev);
982 platform_device_register(&scc_b_pdev);
988 switch (macintosh_config->floppy_type) {
989 case MAC_FLOPPY_SWIM_ADDR1:
990 swim_base = (u8 *)(VIA1_BASE + 0x1E000);
992 case MAC_FLOPPY_SWIM_ADDR2:
993 swim_base = (u8 *)(VIA1_BASE + 0x16000);
1001 struct resource swim_rsrc = {
1002 .flags = IORESOURCE_MEM,
1003 .start = (resource_size_t)swim_base,
1004 .end = (resource_size_t)swim_base + 0x2000,
1007 platform_device_register_simple("swim", -1, &swim_rsrc, 1);
1014 switch (macintosh_config->scsi_type) {
1015 case MAC_SCSI_QUADRA:
1016 case MAC_SCSI_QUADRA3:
1017 platform_device_register_simple("mac_esp", 0, NULL, 0);
1019 case MAC_SCSI_QUADRA2:
1020 platform_device_register_simple("mac_esp", 0, NULL, 0);
1021 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
1022 (macintosh_config->ident == MAC_MODEL_Q950))
1023 platform_device_register_simple("mac_esp", 1, NULL, 0);
1026 /* Addresses from The Guide to Mac Family Hardware.
1027 * $5000 8000 - $5000 9FFF: SCSI DMA
1028 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
1029 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
1030 * The SCSI DMA custom IC embeds the 53C80 core. mac_scsi does
1031 * not make use of its DMA or hardware handshaking logic.
1033 platform_device_register_simple("mac_scsi", 0,
1034 mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
1037 /* Addresses from the Duo Dock II Developer Note.
1038 * $FEE0 2000 - $FEE0 3FFF: normal mode
1039 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
1040 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
1041 * The NetBSD code indicates that both 5380 chips share
1042 * an IRQ (?) which would need careful handling (see mac_esp).
1044 platform_device_register_simple("mac_scsi", 1,
1045 mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
1048 /* Addresses from Developer Notes for Duo System,
1049 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
1050 * and also from The Guide to Mac Family Hardware for
1051 * SE/30, II, IIx, IIcx, IIci.
1052 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
1053 * $5001 0000 - $5001 1FFF: normal mode
1054 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
1055 * GMFH says that $5000 0000 - $50FF FFFF "wraps
1056 * $5000 0000 - $5001 FFFF eight times" (!)
1057 * mess.org says IIci and Color Classic do not alias
1058 * I/O address space.
1060 platform_device_register_simple("mac_scsi", 0,
1061 mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
1064 /* PDMA logic in 68040 PowerBooks is somehow different to
1065 * '030 models. It's probably more like Quadras (see mac_esp).
1067 platform_device_register_simple("mac_scsi", 0,
1068 mac_scsi_late_rsrc, ARRAY_SIZE(mac_scsi_late_rsrc));
1071 /* Addresses from Mac LC data in Designing Cards & Drivers 3ed.
1072 * Also from the Developer Notes for Classic II, LC III,
1073 * Color Classic and IIvx.
1074 * $50F0 6000 - $50F0 7FFF: SCSI handshake
1075 * $50F1 0000 - $50F1 1FFF: SCSI
1076 * $50F1 2000 - $50F1 3FFF: SCSI DMA
1078 platform_device_register_simple("mac_scsi", 0,
1079 mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
1087 if (macintosh_config->ether_type == MAC_ETHER_SONIC ||
1088 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1089 platform_device_register_simple("macsonic", -1, NULL, 0);
1091 if (macintosh_config->expansion_type == MAC_EXP_PDS ||
1092 macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
1093 platform_device_register_simple("mac89x0", -1, NULL, 0);
1095 if (macintosh_config->ether_type == MAC_ETHER_MACE)
1096 platform_device_register_simple("macmace", -1, NULL, 0);
1101 arch_initcall(mac_platform_init);