config.c 28.3 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

#include <asm/setup.h>
#include <asm/bootinfo.h>
31
#include <asm/bootinfo-mac.h>
32
#include <asm/byteorder.h>
L
Linus Torvalds 已提交
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

#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 */
56
extern u32 mac_gettimeoffset(void);
R
Roman Zippel 已提交
57 58
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

A
Al Viro 已提交
74
static void __init mac_sched_init(irq_handler_t vector)
L
Linus Torvalds 已提交
75 76 77 78 79 80 81 82 83 84
{
	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 已提交
85
	int unknown = 0;
86
	const void *data = record->data;
L
Linus Torvalds 已提交
87

88
	switch (be16_to_cpu(record->tag)) {
L
Linus Torvalds 已提交
89
	case BI_MAC_MODEL:
90
		mac_bi_data.id = be32_to_cpup(data);
R
Roman Zippel 已提交
91
		break;
L
Linus Torvalds 已提交
92
	case BI_MAC_VADDR:
93
		mac_bi_data.videoaddr = be32_to_cpup(data);
R
Roman Zippel 已提交
94
		break;
L
Linus Torvalds 已提交
95
	case BI_MAC_VDEPTH:
96
		mac_bi_data.videodepth = be32_to_cpup(data);
R
Roman Zippel 已提交
97
		break;
L
Linus Torvalds 已提交
98
	case BI_MAC_VROW:
99
		mac_bi_data.videorow = be32_to_cpup(data);
R
Roman Zippel 已提交
100
		break;
L
Linus Torvalds 已提交
101
	case BI_MAC_VDIM:
102
		mac_bi_data.dimensions = be32_to_cpup(data);
R
Roman Zippel 已提交
103
		break;
L
Linus Torvalds 已提交
104
	case BI_MAC_VLOGICAL:
105 106 107
		mac_orig_videoaddr = be32_to_cpup(data);
		mac_bi_data.videological =
			VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
R
Roman Zippel 已提交
108
		break;
L
Linus Torvalds 已提交
109
	case BI_MAC_SCCBASE:
110
		mac_bi_data.sccbase = be32_to_cpup(data);
R
Roman Zippel 已提交
111
		break;
L
Linus Torvalds 已提交
112
	case BI_MAC_BTIME:
113
		mac_bi_data.boottime = be32_to_cpup(data);
R
Roman Zippel 已提交
114
		break;
L
Linus Torvalds 已提交
115
	case BI_MAC_GMTBIAS:
116
		mac_bi_data.gmtbias = be32_to_cpup(data);
R
Roman Zippel 已提交
117
		break;
L
Linus Torvalds 已提交
118
	case BI_MAC_MEMSIZE:
119
		mac_bi_data.memsize = be32_to_cpup(data);
R
Roman Zippel 已提交
120
		break;
L
Linus Torvalds 已提交
121
	case BI_MAC_CPUID:
122
		mac_bi_data.cpuid = be32_to_cpup(data);
R
Roman Zippel 已提交
123 124
		break;
	case BI_MAC_ROMBASE:
125
		mac_bi_data.rombase = be32_to_cpup(data);
R
Roman Zippel 已提交
126
		break;
L
Linus Torvalds 已提交
127
	default:
R
Roman Zippel 已提交
128 129 130 131
		unknown = 1;
		break;
	}
	return unknown;
L
Linus Torvalds 已提交
132 133 134 135 136 137 138 139 140 141 142
}

/*
 * 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 已提交
143

L
Linus Torvalds 已提交
144 145 146 147 148 149 150
	local_irq_save(flags);
	via_flush_cache();
	local_irq_restore(flags);
}

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

R
Roman Zippel 已提交
154 155 156
	mach_sched_init = mac_sched_init;
	mach_init_IRQ = mac_init_IRQ;
	mach_get_model = mac_get_model;
157
	arch_gettimeoffset = mac_gettimeoffset;
R
Roman Zippel 已提交
158 159 160 161 162
	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 已提交
163 164
	mach_max_dma_address = 0xffffffff;
#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
R
Roman Zippel 已提交
165
	mach_beep = mac_mksound;
L
Linus Torvalds 已提交
166 167 168 169 170 171 172 173 174
#endif

	/*
	 * Determine hardware present
	 */

	mac_identify();
	mac_report_hardware();

R
Roman Zippel 已提交
175 176 177 178 179
	/*
	 * 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 已提交
180 181

	if (macintosh_config->ident == MAC_MODEL_IICI
R
Roman Zippel 已提交
182
	    || macintosh_config->ident == MAC_MODEL_IIFX)
L
Linus Torvalds 已提交
183 184 185 186 187
		mach_l2_flush = mac_cache_card_flush;
}


/*
F
Finn Thain 已提交
188
 * Macintosh Table: hardcoded model configuration data.
L
Linus Torvalds 已提交
189
 *
F
Finn Thain 已提交
190 191 192 193 194 195
 * 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.
F
Finn Thain 已提交
196
 * Meaning it should have MAC_VIA_IICI here :-)
L
Linus Torvalds 已提交
197 198 199 200 201
 */

struct mac_model *macintosh_config;
EXPORT_SYMBOL(macintosh_config);

R
Roman Zippel 已提交
202
static struct mac_model mac_data_table[] = {
L
Linus Torvalds 已提交
203
	/*
F
Finn Thain 已提交
204
	 * We'll pretend to be a Macintosh II, that's pretty safe.
L
Linus Torvalds 已提交
205 206 207 208 209 210 211 212 213
	 */

	{
		.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,
214
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
215
		.floppy_type	= MAC_FLOPPY_IWM,
L
Linus Torvalds 已提交
216 217 218
	},

	/*
F
Finn Thain 已提交
219
	 * Original Mac II hardware
L
Linus Torvalds 已提交
220 221 222 223 224 225 226 227 228
	 */

	{
		.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,
229
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
230
		.floppy_type	= MAC_FLOPPY_IWM,
L
Linus Torvalds 已提交
231 232 233 234 235 236 237
	}, {
		.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,
238
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
239
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
240 241 242 243 244 245 246
	}, {
		.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,
247
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
248
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
249 250 251 252 253 254 255
	}, {
		.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,
256
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
257
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
258 259 260
	},

	/*
F
Finn Thain 已提交
261 262 263
	 * 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 已提交
264 265 266 267 268 269 270
	 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
	 */

	{
		.ident		= MAC_MODEL_IICI,
		.name		= "IIci",
		.adb_type	= MAC_ADB_II,
F
Finn Thain 已提交
271
		.via_type	= MAC_VIA_IICI,
L
Linus Torvalds 已提交
272 273
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
274
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
275
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
276 277 278 279
	}, {
		.ident		= MAC_MODEL_IIFX,
		.name		= "IIfx",
		.adb_type	= MAC_ADB_IOP,
F
Finn Thain 已提交
280
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
281
		.scsi_type	= MAC_SCSI_IIFX,
L
Linus Torvalds 已提交
282
		.scc_type	= MAC_SCC_IOP,
283
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
284
		.floppy_type	= MAC_FLOPPY_SWIM_IOP,
L
Linus Torvalds 已提交
285 286 287 288
	}, {
		.ident		= MAC_MODEL_IISI,
		.name		= "IIsi",
		.adb_type	= MAC_ADB_IISI,
F
Finn Thain 已提交
289
		.via_type	= MAC_VIA_IICI,
L
Linus Torvalds 已提交
290 291
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
292
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
293
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
294 295 296 297
	}, {
		.ident		= MAC_MODEL_IIVI,
		.name		= "IIvi",
		.adb_type	= MAC_ADB_IISI,
F
Finn Thain 已提交
298
		.via_type	= MAC_VIA_IICI,
L
Linus Torvalds 已提交
299 300
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
301
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
302
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
303 304 305 306
	}, {
		.ident		= MAC_MODEL_IIVX,
		.name		= "IIvx",
		.adb_type	= MAC_ADB_IISI,
F
Finn Thain 已提交
307
		.via_type	= MAC_VIA_IICI,
L
Linus Torvalds 已提交
308 309
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
310
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
311
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
312 313 314
	},

	/*
F
Finn Thain 已提交
315
	 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
L
Linus Torvalds 已提交
316 317 318 319 320 321
	 */

	{
		.ident		= MAC_MODEL_CLII,
		.name		= "Classic II",
		.adb_type	= MAC_ADB_IISI,
F
Finn Thain 已提交
322
		.via_type	= MAC_VIA_IICI,
L
Linus Torvalds 已提交
323 324
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
325
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
326
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
327 328 329 330
	}, {
		.ident		= MAC_MODEL_CCL,
		.name		= "Color Classic",
		.adb_type	= MAC_ADB_CUDA,
F
Finn Thain 已提交
331
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
332
		.scsi_type	= MAC_SCSI_CCL,
L
Linus Torvalds 已提交
333
		.scc_type	= MAC_SCC_II,
334
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
335
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
336 337 338 339
	}, {
		.ident		= MAC_MODEL_CCLII,
		.name		= "Color Classic II",
		.adb_type	= MAC_ADB_CUDA,
F
Finn Thain 已提交
340
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
341
		.scsi_type	= MAC_SCSI_CCL,
342 343 344
		.scc_type	= MAC_SCC_II,
		.nubus_type	= MAC_NUBUS,
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
345
	},
L
Linus Torvalds 已提交
346 347

	/*
F
Finn Thain 已提交
348
	 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
L
Linus Torvalds 已提交
349 350 351 352 353 354
	 */

	{
		.ident		= MAC_MODEL_LC,
		.name		= "LC",
		.adb_type	= MAC_ADB_IISI,
F
Finn Thain 已提交
355
		.via_type	= MAC_VIA_IICI,
L
Linus Torvalds 已提交
356 357
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
358
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
359
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
360 361 362 363
	}, {
		.ident		= MAC_MODEL_LCII,
		.name		= "LC II",
		.adb_type	= MAC_ADB_IISI,
F
Finn Thain 已提交
364
		.via_type	= MAC_VIA_IICI,
L
Linus Torvalds 已提交
365 366
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
367
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
368
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
369 370 371 372
	}, {
		.ident		= MAC_MODEL_LCIII,
		.name		= "LC III",
		.adb_type	= MAC_ADB_IISI,
F
Finn Thain 已提交
373
		.via_type	= MAC_VIA_IICI,
L
Linus Torvalds 已提交
374 375
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
376
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
377
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
378 379 380
	},

	/*
F
Finn Thain 已提交
381 382 383 384 385 386 387
	 * 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 已提交
388 389 390 391 392 393 394 395 396
	 */

	{
		.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,
397
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
398
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
399 400 401 402 403 404 405
	}, {
		.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,
406
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
407
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
408 409 410 411 412 413 414 415
	}, {
		.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,
416
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
417
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
418 419 420 421 422 423 424 425 426
	}, {
		.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,
427
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
428
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
429 430 431 432 433 434 435 436
	}, {
		.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,
437
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
438
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
439
	},
F
Finn Thain 已提交
440
	/* The Q700 does have a NS Sonic */
L
Linus Torvalds 已提交
441 442 443 444 445 446 447 448
	{
		.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,
449
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
450
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
451 452 453 454 455 456 457 458
	}, {
		.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,
459
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
460
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
461 462 463 464 465 466 467 468
	}, {
		.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,
469
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
470
		.floppy_type	= MAC_FLOPPY_AV,
L
Linus Torvalds 已提交
471 472 473 474 475 476 477 478
	}, {
		.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,
479
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
480
		.floppy_type	= MAC_FLOPPY_SWIM_IOP,
L
Linus Torvalds 已提交
481 482 483 484 485 486 487 488
	}, {
		.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,
489
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
490
		.floppy_type	= MAC_FLOPPY_SWIM_IOP,
L
Linus Torvalds 已提交
491 492 493
	},

	/*
F
Finn Thain 已提交
494
	 * Performa - more LC type machines
L
Linus Torvalds 已提交
495 496 497 498
	 */

	{
		.ident		= MAC_MODEL_P460,
F
Finn Thain 已提交
499
		.name		= "Performa 460",
L
Linus Torvalds 已提交
500
		.adb_type	= MAC_ADB_IISI,
F
Finn Thain 已提交
501
		.via_type	= MAC_VIA_IICI,
L
Linus Torvalds 已提交
502 503
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
504
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
505
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
506 507
	}, {
		.ident		= MAC_MODEL_P475,
F
Finn Thain 已提交
508
		.name		= "Performa 475",
L
Linus Torvalds 已提交
509 510 511 512
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_II,
513
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
514
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
515 516
	}, {
		.ident		= MAC_MODEL_P475F,
F
Finn Thain 已提交
517
		.name		= "Performa 475",
L
Linus Torvalds 已提交
518 519 520 521
		.adb_type	= MAC_ADB_CUDA,
		.via_type	= MAC_VIA_QUADRA,
		.scsi_type	= MAC_SCSI_QUADRA,
		.scc_type	= MAC_SCC_II,
522
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
523
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
524 525
	}, {
		.ident		= MAC_MODEL_P520,
F
Finn Thain 已提交
526
		.name		= "Performa 520",
L
Linus Torvalds 已提交
527
		.adb_type	= MAC_ADB_CUDA,
F
Finn Thain 已提交
528
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
529
		.scsi_type	= MAC_SCSI_CCL,
L
Linus Torvalds 已提交
530
		.scc_type	= MAC_SCC_II,
531
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
532
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
533 534
	}, {
		.ident		= MAC_MODEL_P550,
F
Finn Thain 已提交
535
		.name		= "Performa 550",
L
Linus Torvalds 已提交
536
		.adb_type	= MAC_ADB_CUDA,
F
Finn Thain 已提交
537
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
538
		.scsi_type	= MAC_SCSI_CCL,
L
Linus Torvalds 已提交
539
		.scc_type	= MAC_SCC_II,
540
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
541
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
542
	},
F
Finn Thain 已提交
543
	/* These have the comm slot, and therefore possibly SONIC ethernet */
L
Linus Torvalds 已提交
544 545 546 547 548 549 550 551
	{
		.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,
552
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
553
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
554 555 556 557 558 559 560 561 562
	}, {
		.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,
563
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
564
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
565 566 567 568
	}, {
		.ident		= MAC_MODEL_TV,
		.name		= "TV",
		.adb_type	= MAC_ADB_CUDA,
F
Finn Thain 已提交
569
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
570
		.scsi_type	= MAC_SCSI_CCL,
L
Linus Torvalds 已提交
571
		.scc_type	= MAC_SCC_II,
572
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
573
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
574 575 576 577
	}, {
		.ident		= MAC_MODEL_P600,
		.name		= "Performa 600",
		.adb_type	= MAC_ADB_IISI,
F
Finn Thain 已提交
578
		.via_type	= MAC_VIA_IICI,
L
Linus Torvalds 已提交
579 580
		.scsi_type	= MAC_SCSI_OLD,
		.scc_type	= MAC_SCC_II,
581
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
582
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
583 584 585
	},

	/*
F
Finn Thain 已提交
586 587
	 * Centris - just guessing again; maybe like Quadra.
	 * The C610 may or may not have SONIC. We probe to make sure.
L
Linus Torvalds 已提交
588 589 590 591 592 593 594 595 596 597
	 */

	{
		.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,
598
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
599
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
600 601 602 603 604 605 606 607
	}, {
		.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,
608
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
609
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR1,
L
Linus Torvalds 已提交
610 611 612 613 614 615 616 617
	}, {
		.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,
618
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
619
		.floppy_type	= MAC_FLOPPY_AV,
L
Linus Torvalds 已提交
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634
	},

	/*
	 * 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,
635
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
636
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
637 638 639 640 641 642 643
	}, {
		.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,
644
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
645
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
646 647 648
	}, {
		.ident		= MAC_MODEL_PB150,
		.name		= "PowerBook 150",
F
Finn Thain 已提交
649
		.adb_type	= MAC_ADB_PB2,
F
Finn Thain 已提交
650
		.via_type	= MAC_VIA_IICI,
L
Linus Torvalds 已提交
651 652 653
		.scsi_type	= MAC_SCSI_OLD,
		.ide_type	= MAC_IDE_PB,
		.scc_type	= MAC_SCC_QUADRA,
654
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
655
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
656 657 658 659 660 661 662
	}, {
		.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,
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_PB165,
		.name		= "PowerBook 165",
		.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 677 678 679 680
	}, {
		.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,
681
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
682
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
683 684 685 686 687 688 689
	}, {
		.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,
690
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
691
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
692 693 694 695 696 697 698
	}, {
		.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,
699
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
700
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
701 702 703 704 705 706 707
	}, {
		.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,
708
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
709
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
710 711 712 713 714
	}, {
		.ident		= MAC_MODEL_PB190,
		.name		= "PowerBook 190",
		.adb_type	= MAC_ADB_PB2,
		.via_type	= MAC_VIA_QUADRA,
F
Finn Thain 已提交
715
		.scsi_type	= MAC_SCSI_LATE,
L
Linus Torvalds 已提交
716 717
		.ide_type	= MAC_IDE_BABOON,
		.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
	}, {
		.ident		= MAC_MODEL_PB520,
		.name		= "PowerBook 520",
		.adb_type	= MAC_ADB_PB2,
		.via_type	= MAC_VIA_QUADRA,
F
Finn Thain 已提交
725
		.scsi_type	= MAC_SCSI_LATE,
L
Linus Torvalds 已提交
726 727
		.scc_type	= MAC_SCC_QUADRA,
		.ether_type	= MAC_ETHER_SONIC,
728
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
729
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
730 731 732 733 734 735 736 737 738 739 740 741
	},

	/*
	 * 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.
	 */

	{
		.ident		= MAC_MODEL_PB210,
		.name		= "PowerBook Duo 210",
		.adb_type	= MAC_ADB_PB2,
F
Finn Thain 已提交
742
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
743
		.scsi_type	= MAC_SCSI_DUO,
L
Linus Torvalds 已提交
744
		.scc_type	= MAC_SCC_QUADRA,
745
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
746
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
747 748 749 750
	}, {
		.ident		= MAC_MODEL_PB230,
		.name		= "PowerBook Duo 230",
		.adb_type	= MAC_ADB_PB2,
F
Finn Thain 已提交
751
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
752
		.scsi_type	= MAC_SCSI_DUO,
L
Linus Torvalds 已提交
753
		.scc_type	= MAC_SCC_QUADRA,
754
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
755
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
756 757 758 759
	}, {
		.ident		= MAC_MODEL_PB250,
		.name		= "PowerBook Duo 250",
		.adb_type	= MAC_ADB_PB2,
F
Finn Thain 已提交
760
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
761
		.scsi_type	= MAC_SCSI_DUO,
L
Linus Torvalds 已提交
762
		.scc_type	= MAC_SCC_QUADRA,
763
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
764
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
765 766 767 768
	}, {
		.ident		= MAC_MODEL_PB270C,
		.name		= "PowerBook Duo 270c",
		.adb_type	= MAC_ADB_PB2,
F
Finn Thain 已提交
769
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
770
		.scsi_type	= MAC_SCSI_DUO,
L
Linus Torvalds 已提交
771
		.scc_type	= MAC_SCC_QUADRA,
772
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
773
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
774 775 776 777
	}, {
		.ident		= MAC_MODEL_PB280,
		.name		= "PowerBook Duo 280",
		.adb_type	= MAC_ADB_PB2,
F
Finn Thain 已提交
778
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
779
		.scsi_type	= MAC_SCSI_DUO,
L
Linus Torvalds 已提交
780
		.scc_type	= MAC_SCC_QUADRA,
781
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
782
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
783 784 785 786
	}, {
		.ident		= MAC_MODEL_PB280C,
		.name		= "PowerBook Duo 280c",
		.adb_type	= MAC_ADB_PB2,
F
Finn Thain 已提交
787
		.via_type	= MAC_VIA_IICI,
F
Finn Thain 已提交
788
		.scsi_type	= MAC_SCSI_DUO,
L
Linus Torvalds 已提交
789
		.scc_type	= MAC_SCC_QUADRA,
790
		.nubus_type	= MAC_NUBUS,
F
Finn Thain 已提交
791
		.floppy_type	= MAC_FLOPPY_SWIM_ADDR2,
L
Linus Torvalds 已提交
792 793 794
	},

	/*
F
Finn Thain 已提交
795
	 * Other stuff?
L
Linus Torvalds 已提交
796
	 */
F
Finn Thain 已提交
797

L
Linus Torvalds 已提交
798 799 800 801 802
	{
		.ident		= -1
	}
};

803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828
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 已提交
829
static void __init mac_identify(void)
L
Linus Torvalds 已提交
830 831 832 833 834 835 836 837
{
	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 已提交
838
		model = (mac_bi_data.cpuid >> 2) & 63;
F
Finn Thain 已提交
839 840
		printk(KERN_WARNING "No bootinfo model ID, using cpuid instead "
		       "(obsolete bootloader?)\n");
L
Linus Torvalds 已提交
841 842 843
	}

	macintosh_config = mac_data_table;
R
Roman Zippel 已提交
844
	for (m = macintosh_config; m->ident != -1; m++) {
L
Linus Torvalds 已提交
845 846 847 848 849 850
		if (m->ident == model) {
			macintosh_config = m;
			break;
		}
	}

851 852 853 854 855 856 857 858 859 860 861 862 863
	/* 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 已提交
864 865 866 867 868 869 870 871
		/* 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;
		}
872 873 874
		break;
	}

F
Finn Thain 已提交
875 876 877 878 879
	/*
	 * 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 已提交
880 881
	iop_preinit();

882
	printk(KERN_INFO "Detected Macintosh model: %d\n", model);
L
Linus Torvalds 已提交
883 884 885 886

	/*
	 * Report booter data:
	 */
R
Roman Zippel 已提交
887
	printk(KERN_DEBUG " Penguin bootinfo data:\n");
F
Finn Thain 已提交
888 889
	printk(KERN_DEBUG " Video: addr 0x%lx "
		"row 0x%lx depth %lx dimensions %ld x %ld\n",
L
Linus Torvalds 已提交
890 891 892
		mac_bi_data.videoaddr, mac_bi_data.videorow,
		mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
		mac_bi_data.dimensions >> 16);
893
	printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
L
Linus Torvalds 已提交
894 895
		mac_bi_data.videological, mac_orig_videoaddr,
		mac_bi_data.sccbase);
896
	printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
L
Linus Torvalds 已提交
897
		mac_bi_data.boottime, mac_bi_data.gmtbias);
898
	printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
L
Linus Torvalds 已提交
899 900 901 902 903 904 905
		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 已提交
906 907 908 909

#ifdef CONFIG_ADB_CUDA
	find_via_cuda();
#endif
L
Linus Torvalds 已提交
910 911
}

A
Adrian Bunk 已提交
912
static void __init mac_report_hardware(void)
L
Linus Torvalds 已提交
913 914 915 916 917 918
{
	printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
}

static void mac_get_model(char *str)
{
R
Roman Zippel 已提交
919
	strcpy(str, "Macintosh ");
L
Linus Torvalds 已提交
920 921
	strcat(str, macintosh_config->name);
}
922

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

F
Finn Thain 已提交
925
static struct platform_device swim_pdev = {
926 927
	.name		= "swim",
	.id		= -1,
F
Finn Thain 已提交
928 929
	.num_resources	= 1,
	.resource	= &swim_rsrc,
930 931
};

F
Finn Thain 已提交
932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995
static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
	{
		.flags = IORESOURCE_IRQ,
		.start = IRQ_MAC_SCSI,
		.end   = IRQ_MAC_SCSI,
	}, {
		.flags = IORESOURCE_MEM,
		.start = 0x50008000,
		.end   = 0x50009FFF,
	},
};

static const struct resource mac_scsi_duo_rsrc[] __initconst = {
	{
		.flags = IORESOURCE_MEM,
		.start = 0xFEE02000,
		.end   = 0xFEE03FFF,
	},
};

static const struct resource mac_scsi_old_rsrc[] __initconst = {
	{
		.flags = IORESOURCE_IRQ,
		.start = IRQ_MAC_SCSI,
		.end   = IRQ_MAC_SCSI,
	}, {
		.flags = IORESOURCE_MEM,
		.start = 0x50010000,
		.end   = 0x50011FFF,
	}, {
		.flags = IORESOURCE_MEM,
		.start = 0x50006000,
		.end   = 0x50007FFF,
	},
};

static const struct resource mac_scsi_late_rsrc[] __initconst = {
	{
		.flags = IORESOURCE_IRQ,
		.start = IRQ_MAC_SCSI,
		.end   = IRQ_MAC_SCSI,
	}, {
		.flags = IORESOURCE_MEM,
		.start = 0x50010000,
		.end   = 0x50011FFF,
	},
};

static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
	{
		.flags = IORESOURCE_IRQ,
		.start = IRQ_MAC_SCSI,
		.end   = IRQ_MAC_SCSI,
	}, {
		.flags = IORESOURCE_MEM,
		.start = 0x50F10000,
		.end   = 0x50F11FFF,
	}, {
		.flags = IORESOURCE_MEM,
		.start = 0x50F06000,
		.end   = 0x50F07FFF,
	},
};

996 997 998 999 1000 1001 1002 1003 1004 1005
static struct platform_device esp_0_pdev = {
	.name		= "mac_esp",
	.id		= 0,
};

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

1006 1007 1008 1009 1010 1011 1012 1013 1014 1015
static struct platform_device sonic_pdev = {
	.name		= "macsonic",
	.id		= -1,
};

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

1016 1017 1018 1019
int __init mac_platform_init(void)
{
	u8 *swim_base;

1020 1021 1022
	if (!MACH_IS_MAC)
		return -ENODEV;

1023 1024 1025 1026 1027 1028 1029
	/*
	 * Serial devices
	 */

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

F
Finn Thain 已提交
1030 1031 1032 1033
	/*
	 * Floppy device
	 */

1034 1035 1036 1037 1038 1039 1040 1041
	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 已提交
1042 1043
		swim_base = NULL;
		break;
1044 1045
	}

F
Finn Thain 已提交
1046 1047 1048 1049 1050
	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);
	}
1051

1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066
	/*
	 * 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;
F
Finn Thain 已提交
1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120
	case MAC_SCSI_IIFX:
		/* Addresses from The Guide to Mac Family Hardware.
		 * $5000 8000 - $5000 9FFF: SCSI DMA
		 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
		 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
		 * The SCSI DMA custom IC embeds the 53C80 core. mac_scsi does
		 * not make use of its DMA or hardware handshaking logic.
		 */
		platform_device_register_simple("mac_scsi", 0,
			mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
		break;
	case MAC_SCSI_DUO:
		/* Addresses from the Duo Dock II Developer Note.
		 * $FEE0 2000 - $FEE0 3FFF: normal mode
		 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
		 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
		 * The NetBSD code indicates that both 5380 chips share
		 * an IRQ (?) which would need careful handling (see mac_esp).
		 */
		platform_device_register_simple("mac_scsi", 1,
			mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
		/* fall through */
	case MAC_SCSI_OLD:
		/* Addresses from Developer Notes for Duo System,
		 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
		 * and also from The Guide to Mac Family Hardware for
		 * SE/30, II, IIx, IIcx, IIci.
		 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
		 * $5001 0000 - $5001 1FFF: normal mode
		 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
		 * GMFH says that $5000 0000 - $50FF FFFF "wraps
		 * $5000 0000 - $5001 FFFF eight times" (!)
		 * mess.org says IIci and Color Classic do not alias
		 * I/O address space.
		 */
		platform_device_register_simple("mac_scsi", 0,
			mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
		break;
	case MAC_SCSI_LATE:
		/* PDMA logic in 68040 PowerBooks is somehow different to
		 * '030 models. It's probably more like Quadras (see mac_esp).
		 */
		platform_device_register_simple("mac_scsi", 0,
			mac_scsi_late_rsrc, ARRAY_SIZE(mac_scsi_late_rsrc));
		break;
	case MAC_SCSI_CCL:
		/* Addresses from the Color Classic Developer Note.
		 * $50F0 6000 - $50F0 7FFF: SCSI handshake
		 * $50F1 0000 - $50F1 1FFF: SCSI
		 * $50F1 2000 - $50F1 3FFF: SCSI DMA
		 */
		platform_device_register_simple("mac_scsi", 0,
			mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
		break;
1121 1122
	}

1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135
	/*
	 * 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 已提交
1136
	return 0;
1137 1138 1139
}

arch_initcall(mac_platform_init);