config.c 25.6 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
/*
 *  linux/arch/m68k/mac/config.c
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file COPYING in the main directory of this archive
 * for more details.
 */

/*
 * Miscellaneous linux stuff
 */

#include <linux/module.h>
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/console.h>
#include <linux/interrupt.h>
/* keyb */
#include <linux/random.h>
#include <linux/delay.h>
/* keyb */
#include <linux/init.h>
#include <linux/vt_kern.h>
25
#include <linux/platform_device.h>
F
Finn Thain 已提交
26 27
#include <linux/adb.h>
#include <linux/cuda.h>
L
Linus Torvalds 已提交
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

#define BOOTINFO_COMPAT_1_0
#include <asm/setup.h>
#include <asm/bootinfo.h>

#include <asm/system.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/pgtable.h>
#include <asm/rtc.h>
#include <asm/machdep.h>

#include <asm/macintosh.h>
#include <asm/macints.h>
#include <asm/machw.h>

#include <asm/mac_iop.h>
#include <asm/mac_via.h>
#include <asm/mac_oss.h>
#include <asm/mac_psc.h>

/* Mac bootinfo struct */
struct mac_booter_data mac_bi_data;

/* The phys. video addr. - might be bogus on some machines */
A
Adrian Bunk 已提交
53
static unsigned long mac_orig_videoaddr;
L
Linus Torvalds 已提交
54 55

/* Mac specific timer functions */
R
Roman Zippel 已提交
56 57 58
extern unsigned long mac_gettimeoffset(void);
extern int mac_hwclk(int, struct rtc_time *);
extern int mac_set_clock_mmss(unsigned long);
L
Linus Torvalds 已提交
59 60 61
extern void iop_preinit(void);
extern void iop_init(void);
extern void via_init(void);
62
extern void via_init_clock(irq_handler_t func);
L
Linus Torvalds 已提交
63 64 65 66 67 68 69 70
extern void via_flush_cache(void);
extern void oss_init(void);
extern void psc_init(void);
extern void baboon_init(void);

extern void mac_mksound(unsigned int, unsigned int);

static void mac_get_model(char *str);
A
Adrian Bunk 已提交
71 72
static void mac_identify(void);
static void mac_report_hardware(void);
L
Linus Torvalds 已提交
73

F
Finn Thain 已提交
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
#ifdef CONFIG_EARLY_PRINTK
asmlinkage void __init mac_early_print(const char *s, unsigned n);

static void __init mac_early_cons_write(struct console *con,
                                 const char *s, unsigned n)
{
	mac_early_print(s, n);
}

static struct console __initdata mac_early_cons = {
	.name  = "early",
	.write = mac_early_cons_write,
	.flags = CON_PRINTBUFFER | CON_BOOT,
	.index = -1
};

int __init mac_unregister_early_cons(void)
{
	/* mac_early_print can't be used after init sections are discarded */
	return unregister_console(&mac_early_cons);
}

late_initcall(mac_unregister_early_cons);
#endif

A
Al Viro 已提交
99
static void __init mac_sched_init(irq_handler_t vector)
L
Linus Torvalds 已提交
100 101 102 103 104 105 106 107 108 109
{
	via_init_clock(vector);
}

/*
 * Parse a Macintosh-specific record in the bootinfo
 */

int __init mac_parse_bootinfo(const struct bi_record *record)
{
R
Roman Zippel 已提交
110 111
	int unknown = 0;
	const u_long *data = record->data;
L
Linus Torvalds 已提交
112

R
Roman Zippel 已提交
113
	switch (record->tag) {
L
Linus Torvalds 已提交
114
	case BI_MAC_MODEL:
R
Roman Zippel 已提交
115 116
		mac_bi_data.id = *data;
		break;
L
Linus Torvalds 已提交
117
	case BI_MAC_VADDR:
R
Roman Zippel 已提交
118 119
		mac_bi_data.videoaddr = *data;
		break;
L
Linus Torvalds 已提交
120
	case BI_MAC_VDEPTH:
R
Roman Zippel 已提交
121 122
		mac_bi_data.videodepth = *data;
		break;
L
Linus Torvalds 已提交
123
	case BI_MAC_VROW:
R
Roman Zippel 已提交
124 125
		mac_bi_data.videorow = *data;
		break;
L
Linus Torvalds 已提交
126
	case BI_MAC_VDIM:
R
Roman Zippel 已提交
127 128
		mac_bi_data.dimensions = *data;
		break;
L
Linus Torvalds 已提交
129
	case BI_MAC_VLOGICAL:
R
Roman Zippel 已提交
130 131 132
		mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
		mac_orig_videoaddr = *data;
		break;
L
Linus Torvalds 已提交
133
	case BI_MAC_SCCBASE:
R
Roman Zippel 已提交
134 135
		mac_bi_data.sccbase = *data;
		break;
L
Linus Torvalds 已提交
136
	case BI_MAC_BTIME:
R
Roman Zippel 已提交
137 138
		mac_bi_data.boottime = *data;
		break;
L
Linus Torvalds 已提交
139
	case BI_MAC_GMTBIAS:
R
Roman Zippel 已提交
140 141
		mac_bi_data.gmtbias = *data;
		break;
L
Linus Torvalds 已提交
142
	case BI_MAC_MEMSIZE:
R
Roman Zippel 已提交
143 144
		mac_bi_data.memsize = *data;
		break;
L
Linus Torvalds 已提交
145
	case BI_MAC_CPUID:
R
Roman Zippel 已提交
146 147 148 149 150
		mac_bi_data.cpuid = *data;
		break;
	case BI_MAC_ROMBASE:
		mac_bi_data.rombase = *data;
		break;
L
Linus Torvalds 已提交
151
	default:
R
Roman Zippel 已提交
152 153 154 155
		unknown = 1;
		break;
	}
	return unknown;
L
Linus Torvalds 已提交
156 157 158 159 160 161 162 163 164 165 166
}

/*
 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
 * have to disable interrupts for this. Our IRQ handlers will crap
 * themselves if they take an IRQ in 24bit mode!
 */

static void mac_cache_card_flush(int writeback)
{
	unsigned long flags;
R
Roman Zippel 已提交
167

L
Linus Torvalds 已提交
168 169 170 171 172 173 174
	local_irq_save(flags);
	via_flush_cache();
	local_irq_restore(flags);
}

void __init config_mac(void)
{
R
Roman Zippel 已提交
175
	if (!MACH_IS_MAC)
176
		printk(KERN_ERR "ERROR: no Mac, but config_mac() called!!\n");
L
Linus Torvalds 已提交
177

R
Roman Zippel 已提交
178 179 180 181 182 183 184 185 186
	mach_sched_init = mac_sched_init;
	mach_init_IRQ = mac_init_IRQ;
	mach_get_model = mac_get_model;
	mach_gettimeoffset = mac_gettimeoffset;
	mach_hwclk = mac_hwclk;
	mach_set_clock_mmss = mac_set_clock_mmss;
	mach_reset = mac_reset;
	mach_halt = mac_poweroff;
	mach_power_off = mac_poweroff;
L
Linus Torvalds 已提交
187 188
	mach_max_dma_address = 0xffffffff;
#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
R
Roman Zippel 已提交
189
	mach_beep = mac_mksound;
L
Linus Torvalds 已提交
190 191
#endif

F
Finn Thain 已提交
192 193 194 195
#ifdef CONFIG_EARLY_PRINTK
	register_console(&mac_early_cons);
#endif

L
Linus Torvalds 已提交
196 197 198 199 200 201 202
	/*
	 * Determine hardware present
	 */

	mac_identify();
	mac_report_hardware();

R
Roman Zippel 已提交
203 204 205 206 207
	/*
	 * AFAIK only the IIci takes a cache card.  The IIfx has onboard
	 * cache ... someone needs to figure out how to tell if it's on or
	 * not.
	 */
L
Linus Torvalds 已提交
208 209

	if (macintosh_config->ident == MAC_MODEL_IICI
R
Roman Zippel 已提交
210
	    || macintosh_config->ident == MAC_MODEL_IIFX)
L
Linus Torvalds 已提交
211 212 213 214 215
		mach_l2_flush = mac_cache_card_flush;
}


/*
F
Finn Thain 已提交
216
 * Macintosh Table: hardcoded model configuration data.
L
Linus Torvalds 已提交
217
 *
F
Finn Thain 已提交
218 219 220 221 222 223 224
 * Much of this was defined by Alan, based on who knows what docs.
 * I've added a lot more, and some of that was pure guesswork based
 * on hardware pages present on the Mac web site. Possibly wildly
 * inaccurate, so look here if a new Mac model won't run. Example: if
 * a Mac crashes immediately after the VIA1 registers have been dumped
 * to the screen, it probably died attempting to read DirB on a RBV.
 * Meaning it should have MAC_VIA_IIci here :-)
L
Linus Torvalds 已提交
225 226 227 228 229
 */

struct mac_model *macintosh_config;
EXPORT_SYMBOL(macintosh_config);

R
Roman Zippel 已提交
230
static struct mac_model mac_data_table[] = {
L
Linus Torvalds 已提交
231
	/*
F
Finn Thain 已提交
232
	 * We'll pretend to be a Macintosh II, that's pretty safe.
L
Linus Torvalds 已提交
233 234 235 236 237 238 239 240 241
	 */

	{
		.ident		= MAC_MODEL_II,
		.name		= "Unknown",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_II,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
242
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
243
		.floppy_type	= MAC_FLOPPY_IWM,
L
Linus Torvalds 已提交
244 245 246
	},

	/*
F
Finn Thain 已提交
247
	 * Original Mac II hardware
L
Linus Torvalds 已提交
248 249 250 251 252 253 254 255 256
	 */

	{
		.ident		= MAC_MODEL_II,
		.name		= "II",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_II,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
257
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
258
		.floppy_type	= MAC_FLOPPY_IWM,
L
Linus Torvalds 已提交
259 260 261 262 263 264 265
	}, {
		.ident		= MAC_MODEL_IIX,
		.name		= "IIx",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_II,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
266
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
267
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
268 269 270 271 272 273 274
	}, {
		.ident		= MAC_MODEL_IICX,
		.name		= "IIcx",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_II,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
275
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
276
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
277 278 279 280 281 282 283
	}, {
		.ident		= MAC_MODEL_SE30,
		.name		= "SE/30",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_II,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
284
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
285
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
286 287 288
	},

	/*
F
Finn Thain 已提交
289 290 291
	 * Weirdified Mac II hardware - all subtly different. Gee thanks
	 * Apple. All these boxes seem to have VIA2 in a different place to
	 * the Mac II (+1A000 rather than +4000)
L
Linus Torvalds 已提交
292 293 294 295 296 297 298 299 300 301
	 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
	 */

	{
		.ident		= MAC_MODEL_IICI,
		.name		= "IIci",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
302
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
303
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
304 305 306 307 308 309 310
	}, {
		.ident		= MAC_MODEL_IIFX,
		.name		= "IIfx",
		.adb_type	= MAC_ADB_IOP,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_IOP,
311
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
312
		.floppy_type	= MAC_FLOPPY_SWIM_IOP,
L
Linus Torvalds 已提交
313 314 315 316 317 318 319
	}, {
		.ident		= MAC_MODEL_IISI,
		.name		= "IIsi",
		.adb_type	= MAC_ADB_IISI,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
320
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
321
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
322 323 324 325 326 327 328
	}, {
		.ident		= MAC_MODEL_IIVI,
		.name		= "IIvi",
		.adb_type	= MAC_ADB_IISI,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
329
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
330
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
331 332 333 334 335 336 337
	}, {
		.ident		= MAC_MODEL_IIVX,
		.name		= "IIvx",
		.adb_type	= MAC_ADB_IISI,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
338
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
339
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
340 341 342
	},

	/*
F
Finn Thain 已提交
343
	 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
L
Linus Torvalds 已提交
344 345 346 347 348 349 350 351 352
	 */

	{
		.ident		= MAC_MODEL_CLII,
		.name		= "Classic II",
		.adb_type	= MAC_ADB_IISI,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
353
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
354
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
355 356 357 358 359 360 361
	}, {
		.ident		= MAC_MODEL_CCL,
		.name		= "Color Classic",
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
362
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
363
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
364 365 366 367 368 369 370 371 372
	}, {
		.ident		= MAC_MODEL_CCLII,
		.name		= "Color Classic II",
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
		.nubus_type	= MAC_NUBUS,
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
373
	},
L
Linus Torvalds 已提交
374 375

	/*
F
Finn Thain 已提交
376
	 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
L
Linus Torvalds 已提交
377 378 379 380 381 382 383 384 385
	 */

	{
		.ident		= MAC_MODEL_LC,
		.name		= "LC",
		.adb_type	= MAC_ADB_IISI,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
386
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
387
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
388 389 390 391 392 393 394
	}, {
		.ident		= MAC_MODEL_LCII,
		.name		= "LC II",
		.adb_type	= MAC_ADB_IISI,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
395
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
396
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
397 398 399 400 401 402 403
	}, {
		.ident		= MAC_MODEL_LCIII,
		.name		= "LC III",
		.adb_type	= MAC_ADB_IISI,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
404
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
405
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
406 407 408
	},

	/*
F
Finn Thain 已提交
409 410 411 412 413 414 415
	 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
	 * differently as some of the stuff connected to VIA2 seems different.
	 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
	 * the 660AV and 840AV which use an AMD 79C940 (MACE).
	 * The 700, 900 and 950 have some I/O chips in the wrong place to
	 * confuse us. The 840AV has a SCSI location of its own (same as
	 * the 660AV).
L
Linus Torvalds 已提交
416 417 418 419 420 421 422 423 424
	 */

	{
		.ident		= MAC_MODEL_Q605,
		.name		= "Quadra 605",
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_QUADRA,
425
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
426
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
427 428 429 430 431 432 433
	}, {
		.ident		= MAC_MODEL_Q605_ACC,
		.name		= "Quadra 605",
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_QUADRA,
434
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
435
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
436 437 438 439 440 441 442 443
	}, {
		.ident		= MAC_MODEL_Q610,
		.name		= "Quadra 610",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_QUADRA,
		.ether_type	= MAC_ETHER_SONIC,
444
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
445
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
446 447 448 449 450 451 452 453 454
	}, {
		.ident		= MAC_MODEL_Q630,
		.name		= "Quadra 630",
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.ide_type	= MAC_IDE_QUADRA,
		.scc_type	= MAC_SCC_QUADRA,
		.ether_type	= MAC_ETHER_SONIC,
455
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
456
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
457 458 459 460 461 462 463 464
	}, {
		.ident		= MAC_MODEL_Q650,
		.name		= "Quadra 650",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_QUADRA,
		.ether_type	= MAC_ETHER_SONIC,
465
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
466
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
467
	},
F
Finn Thain 已提交
468
	/* The Q700 does have a NS Sonic */
L
Linus Torvalds 已提交
469 470 471 472 473 474 475 476
	{
		.ident		= MAC_MODEL_Q700,
		.name		= "Quadra 700",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA2,
		.scc_type	= MAC_SCC_QUADRA,
		.ether_type	= MAC_ETHER_SONIC,
477
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
478
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
479 480 481 482 483 484 485 486
	}, {
		.ident		= MAC_MODEL_Q800,
		.name		= "Quadra 800",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_QUADRA,
		.ether_type	= MAC_ETHER_SONIC,
487
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
488
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
489 490 491 492 493 494 495 496
	}, {
		.ident		= MAC_MODEL_Q840,
		.name		= "Quadra 840AV",
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA3,
		.scc_type	= MAC_SCC_PSC,
		.ether_type	= MAC_ETHER_MACE,
497
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
498
		.floppy_type	= MAC_FLOPPY_AV,
L
Linus Torvalds 已提交
499 500 501 502 503 504 505 506
	}, {
		.ident		= MAC_MODEL_Q900,
		.name		= "Quadra 900",
		.adb_type	= MAC_ADB_IOP,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA2,
		.scc_type	= MAC_SCC_IOP,
		.ether_type	= MAC_ETHER_SONIC,
507
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
508
		.floppy_type	= MAC_FLOPPY_SWIM_IOP,
L
Linus Torvalds 已提交
509 510 511 512 513 514 515 516
	}, {
		.ident		= MAC_MODEL_Q950,
		.name		= "Quadra 950",
		.adb_type	= MAC_ADB_IOP,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA2,
		.scc_type	= MAC_SCC_IOP,
		.ether_type	= MAC_ETHER_SONIC,
517
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
518
		.floppy_type	= MAC_FLOPPY_SWIM_IOP,
L
Linus Torvalds 已提交
519 520 521
	},

	/*
F
Finn Thain 已提交
522
	 * Performa - more LC type machines
L
Linus Torvalds 已提交
523 524 525 526
	 */

	{
		.ident		= MAC_MODEL_P460,
F
Finn Thain 已提交
527
		.name		= "Performa 460",
L
Linus Torvalds 已提交
528 529 530 531
		.adb_type	= MAC_ADB_IISI,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
532
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
533
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
534 535
	}, {
		.ident		= MAC_MODEL_P475,
F
Finn Thain 已提交
536
		.name		= "Performa 475",
L
Linus Torvalds 已提交
537 538 539 540
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_II,
541
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
542
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
543 544
	}, {
		.ident		= MAC_MODEL_P475F,
F
Finn Thain 已提交
545
		.name		= "Performa 475",
L
Linus Torvalds 已提交
546 547 548 549
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_II,
550
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
551
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
552 553
	}, {
		.ident		= MAC_MODEL_P520,
F
Finn Thain 已提交
554
		.name		= "Performa 520",
L
Linus Torvalds 已提交
555 556 557 558
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
559
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
560
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
561 562
	}, {
		.ident		= MAC_MODEL_P550,
F
Finn Thain 已提交
563
		.name		= "Performa 550",
L
Linus Torvalds 已提交
564 565 566 567
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
568
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
569
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
570
	},
F
Finn Thain 已提交
571
	/* These have the comm slot, and therefore possibly SONIC ethernet */
L
Linus Torvalds 已提交
572 573 574 575 576 577 578 579
	{
		.ident		= MAC_MODEL_P575,
		.name		= "Performa 575",
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_II,
		.ether_type	= MAC_ETHER_SONIC,
580
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
581
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
582 583 584 585 586 587 588 589 590
	}, {
		.ident		= MAC_MODEL_P588,
		.name		= "Performa 588",
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.ide_type	= MAC_IDE_QUADRA,
		.scc_type	= MAC_SCC_II,
		.ether_type	= MAC_ETHER_SONIC,
591
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
592
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
593 594 595 596
	}, {
		.ident		= MAC_MODEL_TV,
		.name		= "TV",
		.adb_type	= MAC_ADB_CUDA,
597
		.via_type	= MAC_VIA_IIci,
L
Linus Torvalds 已提交
598 599
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
600
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
601
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
602 603 604 605 606 607 608
	}, {
		.ident		= MAC_MODEL_P600,
		.name		= "Performa 600",
		.adb_type	= MAC_ADB_IISI,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
609
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
610
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
611 612 613
	},

	/*
F
Finn Thain 已提交
614 615
	 * Centris - just guessing again; maybe like Quadra.
	 * The C610 may or may not have SONIC. We probe to make sure.
L
Linus Torvalds 已提交
616 617 618 619 620 621 622 623 624 625
	 */

	{
		.ident		= MAC_MODEL_C610,
		.name		= "Centris 610",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_QUADRA,
		.ether_type	= MAC_ETHER_SONIC,
626
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
627
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
628 629 630 631 632 633 634 635
	}, {
		.ident		= MAC_MODEL_C650,
		.name		= "Centris 650",
		.adb_type	= MAC_ADB_II,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_QUADRA,
		.ether_type	= MAC_ETHER_SONIC,
636
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
637
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
638 639 640 641 642 643 644 645
	}, {
		.ident		= MAC_MODEL_C660,
		.name		= "Centris 660AV",
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA3,
		.scc_type	= MAC_SCC_PSC,
		.ether_type	= MAC_ETHER_MACE,
646
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
647
		.floppy_type	= MAC_FLOPPY_AV,
L
Linus Torvalds 已提交
648 649 650 651 652 653 654 655 656 657 658 659 660 661 662
	},

	/*
	 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
	 * and a PMU (in two variations?) for ADB. Most of them use the
	 * Quadra-style VIAs. A few models also have IDE from hell.
	 */

	{
		.ident		= MAC_MODEL_PB140,
		.name		= "PowerBook 140",
		.adb_type	= MAC_ADB_PB1,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
663
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
664
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
665 666 667 668 669 670 671
	}, {
		.ident		= MAC_MODEL_PB145,
		.name		= "PowerBook 145",
		.adb_type	= MAC_ADB_PB1,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
672
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
673
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
674 675 676
	}, {
		.ident		= MAC_MODEL_PB150,
		.name		= "PowerBook 150",
F
Finn Thain 已提交
677
		.adb_type	= MAC_ADB_PB2,
L
Linus Torvalds 已提交
678 679 680 681
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.ide_type	= MAC_IDE_PB,
		.scc_type	= MAC_SCC_QUADRA,
682
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
683
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
684 685 686 687 688 689 690
	}, {
		.ident		= MAC_MODEL_PB160,
		.name		= "PowerBook 160",
		.adb_type	= MAC_ADB_PB1,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
691
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
692
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
693 694 695 696 697 698 699
	}, {
		.ident		= MAC_MODEL_PB165,
		.name		= "PowerBook 165",
		.adb_type	= MAC_ADB_PB1,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
700
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
701
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
702 703 704 705 706 707 708
	}, {
		.ident		= MAC_MODEL_PB165C,
		.name		= "PowerBook 165c",
		.adb_type	= MAC_ADB_PB1,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
709
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
710
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
711 712 713 714 715 716 717
	}, {
		.ident		= MAC_MODEL_PB170,
		.name		= "PowerBook 170",
		.adb_type	= MAC_ADB_PB1,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
718
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
719
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
720 721 722 723 724 725 726
	}, {
		.ident		= MAC_MODEL_PB180,
		.name		= "PowerBook 180",
		.adb_type	= MAC_ADB_PB1,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
727
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
728
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
729 730 731 732 733 734 735
	}, {
		.ident		= MAC_MODEL_PB180C,
		.name		= "PowerBook 180c",
		.adb_type	= MAC_ADB_PB1,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
736
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
737
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
738 739 740 741 742 743 744 745
	}, {
		.ident		= MAC_MODEL_PB190,
		.name		= "PowerBook 190",
		.adb_type	= MAC_ADB_PB2,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_OLD,
		.ide_type	= MAC_IDE_BABOON,
		.scc_type	= MAC_SCC_QUADRA,
746
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
747
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
748 749 750 751 752 753 754 755
	}, {
		.ident		= MAC_MODEL_PB520,
		.name		= "PowerBook 520",
		.adb_type	= MAC_ADB_PB2,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
		.ether_type	= MAC_ETHER_SONIC,
756
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
757
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
758 759 760 761 762 763 764
	},

	/*
	 * PowerBook Duos are pretty much like normal PowerBooks
	 * All of these probably have onboard SONIC in the Dock which
	 * means we'll have to probe for it eventually.
	 *
S
Simon Arlott 已提交
765
	 * Are these really MAC_VIA_IIci? The developer notes for the
L
Linus Torvalds 已提交
766 767 768 769 770 771 772 773 774 775 776
	 * Duos show pretty much the same custom parts as in most of
	 * the other PowerBooks which would imply MAC_VIA_QUADRA.
	 */

	{
		.ident		= MAC_MODEL_PB210,
		.name		= "PowerBook Duo 210",
		.adb_type	= MAC_ADB_PB2,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
777
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
778
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
779 780 781 782 783 784 785
	}, {
		.ident		= MAC_MODEL_PB230,
		.name		= "PowerBook Duo 230",
		.adb_type	= MAC_ADB_PB2,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
786
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
787
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
788 789 790 791 792 793 794
	}, {
		.ident		= MAC_MODEL_PB250,
		.name		= "PowerBook Duo 250",
		.adb_type	= MAC_ADB_PB2,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
795
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
796
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
797 798 799 800 801 802 803
	}, {
		.ident		= MAC_MODEL_PB270C,
		.name		= "PowerBook Duo 270c",
		.adb_type	= MAC_ADB_PB2,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
804
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
805
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
806 807 808 809 810 811 812
	}, {
		.ident		= MAC_MODEL_PB280,
		.name		= "PowerBook Duo 280",
		.adb_type	= MAC_ADB_PB2,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
813
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
814
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
815 816 817 818 819 820 821
	}, {
		.ident		= MAC_MODEL_PB280C,
		.name		= "PowerBook Duo 280c",
		.adb_type	= MAC_ADB_PB2,
		.via_type	= MAC_VIA_IIci,
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_QUADRA,
822
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
823
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
824 825 826
	},

	/*
F
Finn Thain 已提交
827
	 * Other stuff?
L
Linus Torvalds 已提交
828
	 */
F
Finn Thain 已提交
829

L
Linus Torvalds 已提交
830 831 832 833 834
	{
		.ident		= -1
	}
};

835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860
static struct resource scc_a_rsrcs[] = {
	{ .flags = IORESOURCE_MEM },
	{ .flags = IORESOURCE_IRQ },
};

static struct resource scc_b_rsrcs[] = {
	{ .flags = IORESOURCE_MEM },
	{ .flags = IORESOURCE_IRQ },
};

struct platform_device scc_a_pdev = {
	.name           = "scc",
	.id             = 0,
	.num_resources  = ARRAY_SIZE(scc_a_rsrcs),
	.resource       = scc_a_rsrcs,
};
EXPORT_SYMBOL(scc_a_pdev);

struct platform_device scc_b_pdev = {
	.name           = "scc",
	.id             = 1,
	.num_resources  = ARRAY_SIZE(scc_b_rsrcs),
	.resource       = scc_b_rsrcs,
};
EXPORT_SYMBOL(scc_b_pdev);

A
Adrian Bunk 已提交
861
static void __init mac_identify(void)
L
Linus Torvalds 已提交
862 863 864 865 866 867 868 869
{
	struct mac_model *m;

	/* Penguin data useful? */
	int model = mac_bi_data.id;
	if (!model) {
		/* no bootinfo model id -> NetBSD booter was used! */
		/* XXX FIXME: breaks for model > 31 */
R
Roman Zippel 已提交
870
		model = (mac_bi_data.cpuid >> 2) & 63;
F
Finn Thain 已提交
871 872
		printk(KERN_WARNING "No bootinfo model ID, using cpuid instead "
		       "(obsolete bootloader?)\n");
L
Linus Torvalds 已提交
873 874 875
	}

	macintosh_config = mac_data_table;
R
Roman Zippel 已提交
876
	for (m = macintosh_config; m->ident != -1; m++) {
L
Linus Torvalds 已提交
877 878 879 880 881 882
		if (m->ident == model) {
			macintosh_config = m;
			break;
		}
	}

883 884 885 886 887 888 889 890 891 892 893 894 895
	/* Set up serial port resources for the console initcall. */

	scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
	scc_a_rsrcs[0].end   = scc_a_rsrcs[0].start;
	scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
	scc_b_rsrcs[0].end   = scc_b_rsrcs[0].start;

	switch (macintosh_config->scc_type) {
	case MAC_SCC_PSC:
		scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
		scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
		break;
	default:
F
Finn Thain 已提交
896 897 898 899 900 901 902 903
		/* On non-PSC machines, the serial ports share an IRQ. */
		if (macintosh_config->ident == MAC_MODEL_IIFX) {
			scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
			scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
		} else {
			scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
			scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
		}
904 905 906
		break;
	}

F
Finn Thain 已提交
907 908 909 910 911
	/*
	 * We need to pre-init the IOPs, if any. Otherwise
	 * the serial console won't work if the user had
	 * the serial ports set to "Faster" mode in MacOS.
	 */
L
Linus Torvalds 已提交
912 913
	iop_preinit();

914
	printk(KERN_INFO "Detected Macintosh model: %d\n", model);
L
Linus Torvalds 已提交
915 916 917 918

	/*
	 * Report booter data:
	 */
R
Roman Zippel 已提交
919
	printk(KERN_DEBUG " Penguin bootinfo data:\n");
F
Finn Thain 已提交
920 921
	printk(KERN_DEBUG " Video: addr 0x%lx "
		"row 0x%lx depth %lx dimensions %ld x %ld\n",
L
Linus Torvalds 已提交
922 923 924
		mac_bi_data.videoaddr, mac_bi_data.videorow,
		mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
		mac_bi_data.dimensions >> 16);
925
	printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
L
Linus Torvalds 已提交
926 927
		mac_bi_data.videological, mac_orig_videoaddr,
		mac_bi_data.sccbase);
928
	printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
L
Linus Torvalds 已提交
929
		mac_bi_data.boottime, mac_bi_data.gmtbias);
930
	printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
L
Linus Torvalds 已提交
931 932 933 934 935 936 937
		mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);

	iop_init();
	via_init();
	oss_init();
	psc_init();
	baboon_init();
F
Finn Thain 已提交
938 939 940 941

#ifdef CONFIG_ADB_CUDA
	find_via_cuda();
#endif
L
Linus Torvalds 已提交
942 943
}

A
Adrian Bunk 已提交
944
static void __init mac_report_hardware(void)
L
Linus Torvalds 已提交
945 946 947 948 949 950
{
	printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
}

static void mac_get_model(char *str)
{
R
Roman Zippel 已提交
951
	strcpy(str, "Macintosh ");
L
Linus Torvalds 已提交
952 953
	strcat(str, macintosh_config->name);
}
954

F
Finn Thain 已提交
955
static struct resource swim_rsrc = { .flags = IORESOURCE_MEM };
956

F
Finn Thain 已提交
957
static struct platform_device swim_pdev = {
958 959
	.name		= "swim",
	.id		= -1,
F
Finn Thain 已提交
960 961
	.num_resources	= 1,
	.resource	= &swim_rsrc,
962 963
};

964 965 966 967 968 969 970 971 972 973
static struct platform_device esp_0_pdev = {
	.name		= "mac_esp",
	.id		= 0,
};

static struct platform_device esp_1_pdev = {
	.name		= "mac_esp",
	.id		= 1,
};

974 975 976 977 978 979 980 981 982 983
static struct platform_device sonic_pdev = {
	.name		= "macsonic",
	.id		= -1,
};

static struct platform_device mace_pdev = {
	.name		= "macmace",
	.id		= -1,
};

984 985 986 987
int __init mac_platform_init(void)
{
	u8 *swim_base;

988 989 990 991 992 993 994
	/*
	 * Serial devices
	 */

	platform_device_register(&scc_a_pdev);
	platform_device_register(&scc_b_pdev);

F
Finn Thain 已提交
995 996 997 998
	/*
	 * Floppy device
	 */

999 1000 1001 1002 1003 1004 1005 1006
	switch (macintosh_config->floppy_type) {
	case MAC_FLOPPY_SWIM_ADDR1:
		swim_base = (u8 *)(VIA1_BASE + 0x1E000);
		break;
	case MAC_FLOPPY_SWIM_ADDR2:
		swim_base = (u8 *)(VIA1_BASE + 0x16000);
		break;
	default:
F
Finn Thain 已提交
1007 1008
		swim_base = NULL;
		break;
1009 1010
	}

F
Finn Thain 已提交
1011 1012 1013 1014 1015
	if (swim_base) {
		swim_rsrc.start = (resource_size_t) swim_base,
		swim_rsrc.end   = (resource_size_t) swim_base + 0x2000,
		platform_device_register(&swim_pdev);
	}
1016

1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033
	/*
	 * SCSI device(s)
	 */

	switch (macintosh_config->scsi_type) {
	case MAC_SCSI_QUADRA:
	case MAC_SCSI_QUADRA3:
		platform_device_register(&esp_0_pdev);
		break;
	case MAC_SCSI_QUADRA2:
		platform_device_register(&esp_0_pdev);
		if ((macintosh_config->ident == MAC_MODEL_Q900) ||
		    (macintosh_config->ident == MAC_MODEL_Q950))
			platform_device_register(&esp_1_pdev);
		break;
	}

1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046
	/*
	 * Ethernet device
	 */

	switch (macintosh_config->ether_type) {
	case MAC_ETHER_SONIC:
		platform_device_register(&sonic_pdev);
		break;
	case MAC_ETHER_MACE:
		platform_device_register(&mace_pdev);
		break;
	}

F
Finn Thain 已提交
1047
	return 0;
1048 1049 1050
}

arch_initcall(mac_platform_init);