blob: be017984a456e66c58369748cec265f6da6f2c46 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#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>
Laurent Vivier8852ecd2008-11-15 16:10:10 +010025#include <linux/platform_device.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070026
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
Laurent Vivier8852ecd2008-11-15 16:10:10 +010047/* platform device info */
48
49#define SWIM_IO_SIZE 0x2000 /* SWIM IO resource size */
50
Linus Torvalds1da177e2005-04-16 15:20:36 -070051/* Mac bootinfo struct */
52
53struct mac_booter_data mac_bi_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
Linus Torvalds1da177e2005-04-16 15:20:36 -070055/* The phys. video addr. - might be bogus on some machines */
Adrian Bunk8dfbdf42008-07-17 21:16:25 +020056static unsigned long mac_orig_videoaddr;
Linus Torvalds1da177e2005-04-16 15:20:36 -070057
58/* Mac specific timer functions */
Roman Zippel6ff58012007-05-01 22:32:43 +020059extern unsigned long mac_gettimeoffset(void);
60extern int mac_hwclk(int, struct rtc_time *);
61extern int mac_set_clock_mmss(unsigned long);
Linus Torvalds1da177e2005-04-16 15:20:36 -070062extern void iop_preinit(void);
63extern void iop_init(void);
64extern void via_init(void);
David Howells40220c12006-10-09 12:19:47 +010065extern void via_init_clock(irq_handler_t func);
Linus Torvalds1da177e2005-04-16 15:20:36 -070066extern void via_flush_cache(void);
67extern void oss_init(void);
68extern void psc_init(void);
69extern void baboon_init(void);
70
71extern void mac_mksound(unsigned int, unsigned int);
72
73extern void nubus_sweep_video(void);
74
Linus Torvalds1da177e2005-04-16 15:20:36 -070075static void mac_get_model(char *str);
Adrian Bunk8dfbdf42008-07-17 21:16:25 +020076static void mac_identify(void);
77static void mac_report_hardware(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070078
Al Viro66a3f822007-07-20 04:33:28 +010079static void __init mac_sched_init(irq_handler_t vector)
Linus Torvalds1da177e2005-04-16 15:20:36 -070080{
81 via_init_clock(vector);
82}
83
Linus Torvalds1da177e2005-04-16 15:20:36 -070084/*
85 * Parse a Macintosh-specific record in the bootinfo
86 */
87
88int __init mac_parse_bootinfo(const struct bi_record *record)
89{
Roman Zippel6ff58012007-05-01 22:32:43 +020090 int unknown = 0;
91 const u_long *data = record->data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070092
Roman Zippel6ff58012007-05-01 22:32:43 +020093 switch (record->tag) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070094 case BI_MAC_MODEL:
Roman Zippel6ff58012007-05-01 22:32:43 +020095 mac_bi_data.id = *data;
96 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070097 case BI_MAC_VADDR:
Roman Zippel6ff58012007-05-01 22:32:43 +020098 mac_bi_data.videoaddr = *data;
99 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700100 case BI_MAC_VDEPTH:
Roman Zippel6ff58012007-05-01 22:32:43 +0200101 mac_bi_data.videodepth = *data;
102 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103 case BI_MAC_VROW:
Roman Zippel6ff58012007-05-01 22:32:43 +0200104 mac_bi_data.videorow = *data;
105 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700106 case BI_MAC_VDIM:
Roman Zippel6ff58012007-05-01 22:32:43 +0200107 mac_bi_data.dimensions = *data;
108 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 case BI_MAC_VLOGICAL:
Roman Zippel6ff58012007-05-01 22:32:43 +0200110 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
111 mac_orig_videoaddr = *data;
112 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113 case BI_MAC_SCCBASE:
Roman Zippel6ff58012007-05-01 22:32:43 +0200114 mac_bi_data.sccbase = *data;
115 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 case BI_MAC_BTIME:
Roman Zippel6ff58012007-05-01 22:32:43 +0200117 mac_bi_data.boottime = *data;
118 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 case BI_MAC_GMTBIAS:
Roman Zippel6ff58012007-05-01 22:32:43 +0200120 mac_bi_data.gmtbias = *data;
121 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 case BI_MAC_MEMSIZE:
Roman Zippel6ff58012007-05-01 22:32:43 +0200123 mac_bi_data.memsize = *data;
124 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125 case BI_MAC_CPUID:
Roman Zippel6ff58012007-05-01 22:32:43 +0200126 mac_bi_data.cpuid = *data;
127 break;
128 case BI_MAC_ROMBASE:
129 mac_bi_data.rombase = *data;
130 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 default:
Roman Zippel6ff58012007-05-01 22:32:43 +0200132 unknown = 1;
133 break;
134 }
135 return unknown;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136}
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
144static void mac_cache_card_flush(int writeback)
145{
146 unsigned long flags;
Roman Zippel6ff58012007-05-01 22:32:43 +0200147
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148 local_irq_save(flags);
149 via_flush_cache();
150 local_irq_restore(flags);
151}
152
153void __init config_mac(void)
154{
Roman Zippel6ff58012007-05-01 22:32:43 +0200155 if (!MACH_IS_MAC)
156 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157
Roman Zippel6ff58012007-05-01 22:32:43 +0200158 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;
Roman Zippel6ff58012007-05-01 22:32:43 +0200162 mach_hwclk = mac_hwclk;
Roman Zippel6ff58012007-05-01 22:32:43 +0200163 mach_set_clock_mmss = mac_set_clock_mmss;
164 mach_reset = mac_reset;
165 mach_halt = mac_poweroff;
166 mach_power_off = mac_poweroff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 mach_max_dma_address = 0xffffffff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
Roman Zippel6ff58012007-05-01 22:32:43 +0200169 mach_beep = mac_mksound;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700170#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
Roman Zippel6ff58012007-05-01 22:32:43 +0200185 /*
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 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190
191 if (macintosh_config->ident == MAC_MODEL_IICI
Roman Zippel6ff58012007-05-01 22:32:43 +0200192 || macintosh_config->ident == MAC_MODEL_IIFX)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193 mach_l2_flush = mac_cache_card_flush;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700194
195 /*
196 * Check for machine specific fixups.
197 */
198
199#ifdef OLD_NUBUS_CODE
Roman Zippel6ff58012007-05-01 22:32:43 +0200200 nubus_sweep_video();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700201#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
217struct mac_model *macintosh_config;
218EXPORT_SYMBOL(macintosh_config);
219
Roman Zippel6ff58012007-05-01 22:32:43 +0200220static struct mac_model mac_data_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700221 /*
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100232 .nubus_type = MAC_NUBUS,
233 .floppy_type = MAC_FLOPPY_IWM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234 },
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100248 .nubus_type = MAC_NUBUS,
249 .floppy_type = MAC_FLOPPY_IWM
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100257 .nubus_type = MAC_NUBUS,
258 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100266 .nubus_type = MAC_NUBUS,
267 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100275 .nubus_type = MAC_NUBUS,
276 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700277 },
278
279 /*
Simon Arlott0c79cf62007-10-20 01:20:32 +0200280 * Weirdified MacII hardware - all subtly different. Gee thanks
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281 * 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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100293 .nubus_type = MAC_NUBUS,
294 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100302 .nubus_type = MAC_NUBUS,
303 .floppy_type = MAC_FLOPPY_SWIM_IOP
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100311 .nubus_type = MAC_NUBUS,
312 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700313 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100320 .nubus_type = MAC_NUBUS,
321 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100329 .nubus_type = MAC_NUBUS,
330 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331 },
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100344 .nubus_type = MAC_NUBUS,
345 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100353 .nubus_type = MAC_NUBUS,
354 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
355 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100368 .nubus_type = MAC_NUBUS,
369 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100377 .nubus_type = MAC_NUBUS,
378 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700379 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100386 .nubus_type = MAC_NUBUS,
387 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388 },
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100407 .nubus_type = MAC_NUBUS,
408 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100416 .nubus_type = MAC_NUBUS,
417 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100426 .nubus_type = MAC_NUBUS,
427 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100437 .nubus_type = MAC_NUBUS,
438 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100447 .nubus_type = MAC_NUBUS,
448 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700449 },
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100459 .nubus_type = MAC_NUBUS,
460 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100469 .nubus_type = MAC_NUBUS,
470 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100479 .nubus_type = MAC_NUBUS,
480 .floppy_type = MAC_FLOPPY_AV
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100489 .nubus_type = MAC_NUBUS,
490 .floppy_type = MAC_FLOPPY_SWIM_IOP
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100499 .nubus_type = MAC_NUBUS,
500 .floppy_type = MAC_FLOPPY_SWIM_IOP
Linus Torvalds1da177e2005-04-16 15:20:36 -0700501 },
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100514 .nubus_type = MAC_NUBUS,
515 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700516 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100523 .nubus_type = MAC_NUBUS,
524 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700525 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100532 .nubus_type = MAC_NUBUS,
533 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700534 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100541 .nubus_type = MAC_NUBUS,
542 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100550 .nubus_type = MAC_NUBUS,
551 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700552 },
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100562 .nubus_type = MAC_NUBUS,
563 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700564 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100573 .nubus_type = MAC_NUBUS,
574 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100582 .nubus_type = MAC_NUBUS,
583 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700584 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100591 .nubus_type = MAC_NUBUS,
592 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700593 },
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100608 .nubus_type = MAC_NUBUS,
609 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100618 .nubus_type = MAC_NUBUS,
619 .floppy_type = MAC_FLOPPY_SWIM_ADDR1
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100628 .nubus_type = MAC_NUBUS,
629 .floppy_type = MAC_FLOPPY_AV
Linus Torvalds1da177e2005-04-16 15:20:36 -0700630 },
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100645 .nubus_type = MAC_NUBUS,
646 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100654 .nubus_type = MAC_NUBUS,
655 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700656 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100664 .nubus_type = MAC_NUBUS,
665 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700666 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100673 .nubus_type = MAC_NUBUS,
674 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700675 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100682 .nubus_type = MAC_NUBUS,
683 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700684 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100691 .nubus_type = MAC_NUBUS,
692 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700693 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100700 .nubus_type = MAC_NUBUS,
701 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700702 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100709 .nubus_type = MAC_NUBUS,
710 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700711 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100718 .nubus_type = MAC_NUBUS,
719 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100728 .nubus_type = MAC_NUBUS,
729 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700730 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100738 .nubus_type = MAC_NUBUS,
739 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700740 },
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 *
Simon Arlott0c79cf62007-10-20 01:20:32 +0200747 * Are these really MAC_VIA_IIci? The developer notes for the
Linus Torvalds1da177e2005-04-16 15:20:36 -0700748 * 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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100759 .nubus_type = MAC_NUBUS,
760 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700761 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100768 .nubus_type = MAC_NUBUS,
769 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100777 .nubus_type = MAC_NUBUS,
778 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100786 .nubus_type = MAC_NUBUS,
787 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700788 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100795 .nubus_type = MAC_NUBUS,
796 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700797 }, {
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,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100804 .nubus_type = MAC_NUBUS,
805 .floppy_type = MAC_FLOPPY_SWIM_ADDR2
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806 },
807
808 /*
809 * Other stuff ??
810 */
811 {
812 .ident = -1
813 }
814};
815
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200816static void __init mac_identify(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700817{
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 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200825 model = (mac_bi_data.cpuid >> 2) & 63;
826 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700827 }
828
829 macintosh_config = mac_data_table;
Roman Zippel6ff58012007-05-01 22:32:43 +0200830 for (m = macintosh_config; m->ident != -1; m++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700831 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();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700842
Roman Zippel6ff58012007-05-01 22:32:43 +0200843 printk(KERN_INFO "Detected Macintosh model: %d \n", model);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700844
845 /*
846 * Report booter data:
847 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200848 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",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700850 mac_bi_data.videoaddr, mac_bi_data.videorow,
851 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
852 mac_bi_data.dimensions >> 16);
Roman Zippel6ff58012007-05-01 22:32:43 +0200853 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700854 mac_bi_data.videological, mac_orig_videoaddr,
855 mac_bi_data.sccbase);
Roman Zippel6ff58012007-05-01 22:32:43 +0200856 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857 mac_bi_data.boottime, mac_bi_data.gmtbias);
Roman Zippel6ff58012007-05-01 22:32:43 +0200858 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700859 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700860
Linus Torvalds1da177e2005-04-16 15:20:36 -0700861 iop_init();
862 via_init();
863 oss_init();
864 psc_init();
865 baboon_init();
866}
867
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200868static void __init mac_report_hardware(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700869{
870 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
871}
872
873static void mac_get_model(char *str)
874{
Roman Zippel6ff58012007-05-01 22:32:43 +0200875 strcpy(str, "Macintosh ");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700876 strcat(str, macintosh_config->name);
877}
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100878
879static struct resource swim_resources[1];
880
881static struct platform_device swim_device = {
882 .name = "swim",
883 .id = -1,
884 .num_resources = ARRAY_SIZE(swim_resources),
885 .resource = swim_resources,
886};
887
888static struct platform_device *mac_platform_devices[] __initdata = {
889 &swim_device
890};
891
892int __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
916arch_initcall(mac_platform_init);