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