blob: e48069da04edafb422d5b198b6180f87436c9fa3 [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>
Finn Thain18814ee2009-11-17 20:03:05 +110026#include <linux/adb.h>
27#include <linux/cuda.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
Linus Torvalds1da177e2005-04-16 15:20:36 -070029#include <asm/setup.h>
30#include <asm/bootinfo.h>
Geert Uytterhoeven4c3c5222013-10-02 11:37:33 +020031#include <asm/bootinfo-mac.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070032
Linus Torvalds1da177e2005-04-16 15:20:36 -070033#include <asm/io.h>
34#include <asm/irq.h>
35#include <asm/pgtable.h>
36#include <asm/rtc.h>
37#include <asm/machdep.h>
38
39#include <asm/macintosh.h>
40#include <asm/macints.h>
41#include <asm/machw.h>
42
43#include <asm/mac_iop.h>
44#include <asm/mac_via.h>
45#include <asm/mac_oss.h>
46#include <asm/mac_psc.h>
47
48/* Mac bootinfo struct */
Linus Torvalds1da177e2005-04-16 15:20:36 -070049struct mac_booter_data mac_bi_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Linus Torvalds1da177e2005-04-16 15:20:36 -070051/* The phys. video addr. - might be bogus on some machines */
Adrian Bunk8dfbdf42008-07-17 21:16:25 +020052static unsigned long mac_orig_videoaddr;
Linus Torvalds1da177e2005-04-16 15:20:36 -070053
54/* Mac specific timer functions */
Stephen Warrenc8d5ba12012-11-08 11:34:55 -070055extern u32 mac_gettimeoffset(void);
Roman Zippel6ff58012007-05-01 22:32:43 +020056extern int mac_hwclk(int, struct rtc_time *);
57extern int mac_set_clock_mmss(unsigned long);
Linus Torvalds1da177e2005-04-16 15:20:36 -070058extern void iop_preinit(void);
59extern void iop_init(void);
60extern void via_init(void);
David Howells40220c12006-10-09 12:19:47 +010061extern void via_init_clock(irq_handler_t func);
Linus Torvalds1da177e2005-04-16 15:20:36 -070062extern void via_flush_cache(void);
63extern void oss_init(void);
64extern void psc_init(void);
65extern void baboon_init(void);
66
67extern void mac_mksound(unsigned int, unsigned int);
68
Linus Torvalds1da177e2005-04-16 15:20:36 -070069static void mac_get_model(char *str);
Adrian Bunk8dfbdf42008-07-17 21:16:25 +020070static void mac_identify(void);
71static void mac_report_hardware(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070072
Finn Thain93edd022011-10-24 01:11:12 +110073#ifdef CONFIG_EARLY_PRINTK
74asmlinkage void __init mac_early_print(const char *s, unsigned n);
75
76static void __init mac_early_cons_write(struct console *con,
77 const char *s, unsigned n)
78{
79 mac_early_print(s, n);
80}
81
82static struct console __initdata mac_early_cons = {
83 .name = "early",
84 .write = mac_early_cons_write,
85 .flags = CON_PRINTBUFFER | CON_BOOT,
86 .index = -1
87};
88
89int __init mac_unregister_early_cons(void)
90{
91 /* mac_early_print can't be used after init sections are discarded */
92 return unregister_console(&mac_early_cons);
93}
94
95late_initcall(mac_unregister_early_cons);
96#endif
97
Al Viro66a3f822007-07-20 04:33:28 +010098static void __init mac_sched_init(irq_handler_t vector)
Linus Torvalds1da177e2005-04-16 15:20:36 -070099{
100 via_init_clock(vector);
101}
102
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103/*
104 * Parse a Macintosh-specific record in the bootinfo
105 */
106
107int __init mac_parse_bootinfo(const struct bi_record *record)
108{
Roman Zippel6ff58012007-05-01 22:32:43 +0200109 int unknown = 0;
110 const u_long *data = record->data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700111
Roman Zippel6ff58012007-05-01 22:32:43 +0200112 switch (record->tag) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700113 case BI_MAC_MODEL:
Roman Zippel6ff58012007-05-01 22:32:43 +0200114 mac_bi_data.id = *data;
115 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116 case BI_MAC_VADDR:
Roman Zippel6ff58012007-05-01 22:32:43 +0200117 mac_bi_data.videoaddr = *data;
118 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119 case BI_MAC_VDEPTH:
Roman Zippel6ff58012007-05-01 22:32:43 +0200120 mac_bi_data.videodepth = *data;
121 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 case BI_MAC_VROW:
Roman Zippel6ff58012007-05-01 22:32:43 +0200123 mac_bi_data.videorow = *data;
124 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700125 case BI_MAC_VDIM:
Roman Zippel6ff58012007-05-01 22:32:43 +0200126 mac_bi_data.dimensions = *data;
127 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128 case BI_MAC_VLOGICAL:
Roman Zippel6ff58012007-05-01 22:32:43 +0200129 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
130 mac_orig_videoaddr = *data;
131 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 case BI_MAC_SCCBASE:
Roman Zippel6ff58012007-05-01 22:32:43 +0200133 mac_bi_data.sccbase = *data;
134 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 case BI_MAC_BTIME:
Roman Zippel6ff58012007-05-01 22:32:43 +0200136 mac_bi_data.boottime = *data;
137 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 case BI_MAC_GMTBIAS:
Roman Zippel6ff58012007-05-01 22:32:43 +0200139 mac_bi_data.gmtbias = *data;
140 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700141 case BI_MAC_MEMSIZE:
Roman Zippel6ff58012007-05-01 22:32:43 +0200142 mac_bi_data.memsize = *data;
143 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 case BI_MAC_CPUID:
Roman Zippel6ff58012007-05-01 22:32:43 +0200145 mac_bi_data.cpuid = *data;
146 break;
147 case BI_MAC_ROMBASE:
148 mac_bi_data.rombase = *data;
149 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700150 default:
Roman Zippel6ff58012007-05-01 22:32:43 +0200151 unknown = 1;
152 break;
153 }
154 return unknown;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700155}
156
157/*
158 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
159 * have to disable interrupts for this. Our IRQ handlers will crap
160 * themselves if they take an IRQ in 24bit mode!
161 */
162
163static void mac_cache_card_flush(int writeback)
164{
165 unsigned long flags;
Roman Zippel6ff58012007-05-01 22:32:43 +0200166
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 local_irq_save(flags);
168 via_flush_cache();
169 local_irq_restore(flags);
170}
171
172void __init config_mac(void)
173{
Roman Zippel6ff58012007-05-01 22:32:43 +0200174 if (!MACH_IS_MAC)
Frans Popb9b0d8b2010-02-06 18:47:11 +0100175 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!!\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700176
Roman Zippel6ff58012007-05-01 22:32:43 +0200177 mach_sched_init = mac_sched_init;
178 mach_init_IRQ = mac_init_IRQ;
179 mach_get_model = mac_get_model;
Stephen Warrenc8d5ba12012-11-08 11:34:55 -0700180 arch_gettimeoffset = mac_gettimeoffset;
Roman Zippel6ff58012007-05-01 22:32:43 +0200181 mach_hwclk = mac_hwclk;
Roman Zippel6ff58012007-05-01 22:32:43 +0200182 mach_set_clock_mmss = mac_set_clock_mmss;
183 mach_reset = mac_reset;
184 mach_halt = mac_poweroff;
185 mach_power_off = mac_poweroff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186 mach_max_dma_address = 0xffffffff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700187#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
Roman Zippel6ff58012007-05-01 22:32:43 +0200188 mach_beep = mac_mksound;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700190
Finn Thain93edd022011-10-24 01:11:12 +1100191#ifdef CONFIG_EARLY_PRINTK
192 register_console(&mac_early_cons);
193#endif
194
Linus Torvalds1da177e2005-04-16 15:20:36 -0700195 /*
196 * Determine hardware present
197 */
198
199 mac_identify();
200 mac_report_hardware();
201
Roman Zippel6ff58012007-05-01 22:32:43 +0200202 /*
203 * AFAIK only the IIci takes a cache card. The IIfx has onboard
204 * cache ... someone needs to figure out how to tell if it's on or
205 * not.
206 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700207
208 if (macintosh_config->ident == MAC_MODEL_IICI
Roman Zippel6ff58012007-05-01 22:32:43 +0200209 || macintosh_config->ident == MAC_MODEL_IIFX)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210 mach_l2_flush = mac_cache_card_flush;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700211}
212
213
214/*
Finn Thain53aac0a2009-11-04 00:39:09 +1100215 * Macintosh Table: hardcoded model configuration data.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 *
Finn Thain53aac0a2009-11-04 00:39:09 +1100217 * Much of this was defined by Alan, based on who knows what docs.
218 * I've added a lot more, and some of that was pure guesswork based
219 * on hardware pages present on the Mac web site. Possibly wildly
220 * inaccurate, so look here if a new Mac model won't run. Example: if
221 * a Mac crashes immediately after the VIA1 registers have been dumped
222 * to the screen, it probably died attempting to read DirB on a RBV.
Finn Thain608e2872011-10-24 01:11:22 +1100223 * Meaning it should have MAC_VIA_IICI here :-)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224 */
225
226struct mac_model *macintosh_config;
227EXPORT_SYMBOL(macintosh_config);
228
Roman Zippel6ff58012007-05-01 22:32:43 +0200229static struct mac_model mac_data_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100231 * We'll pretend to be a Macintosh II, that's pretty safe.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700232 */
233
234 {
235 .ident = MAC_MODEL_II,
236 .name = "Unknown",
237 .adb_type = MAC_ADB_II,
238 .via_type = MAC_VIA_II,
239 .scsi_type = MAC_SCSI_OLD,
240 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100241 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100242 .floppy_type = MAC_FLOPPY_IWM,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243 },
244
245 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100246 * Original Mac II hardware
Linus Torvalds1da177e2005-04-16 15:20:36 -0700247 */
248
249 {
250 .ident = MAC_MODEL_II,
251 .name = "II",
252 .adb_type = MAC_ADB_II,
253 .via_type = MAC_VIA_II,
254 .scsi_type = MAC_SCSI_OLD,
255 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100256 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100257 .floppy_type = MAC_FLOPPY_IWM,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 }, {
259 .ident = MAC_MODEL_IIX,
260 .name = "IIx",
261 .adb_type = MAC_ADB_II,
262 .via_type = MAC_VIA_II,
263 .scsi_type = MAC_SCSI_OLD,
264 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100265 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100266 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700267 }, {
268 .ident = MAC_MODEL_IICX,
269 .name = "IIcx",
270 .adb_type = MAC_ADB_II,
271 .via_type = MAC_VIA_II,
272 .scsi_type = MAC_SCSI_OLD,
273 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100274 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100275 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276 }, {
277 .ident = MAC_MODEL_SE30,
278 .name = "SE/30",
279 .adb_type = MAC_ADB_II,
280 .via_type = MAC_VIA_II,
281 .scsi_type = MAC_SCSI_OLD,
282 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100283 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100284 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285 },
286
287 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100288 * Weirdified Mac II hardware - all subtly different. Gee thanks
289 * Apple. All these boxes seem to have VIA2 in a different place to
290 * the Mac II (+1A000 rather than +4000)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700291 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
292 */
293
294 {
295 .ident = MAC_MODEL_IICI,
296 .name = "IIci",
297 .adb_type = MAC_ADB_II,
Finn Thain608e2872011-10-24 01:11:22 +1100298 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700299 .scsi_type = MAC_SCSI_OLD,
300 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100301 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100302 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303 }, {
304 .ident = MAC_MODEL_IIFX,
305 .name = "IIfx",
306 .adb_type = MAC_ADB_IOP,
Finn Thain608e2872011-10-24 01:11:22 +1100307 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700308 .scsi_type = MAC_SCSI_OLD,
309 .scc_type = MAC_SCC_IOP,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100310 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100311 .floppy_type = MAC_FLOPPY_SWIM_IOP,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 }, {
313 .ident = MAC_MODEL_IISI,
314 .name = "IIsi",
315 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100316 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317 .scsi_type = MAC_SCSI_OLD,
318 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100319 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100320 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321 }, {
322 .ident = MAC_MODEL_IIVI,
323 .name = "IIvi",
324 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100325 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700326 .scsi_type = MAC_SCSI_OLD,
327 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100328 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100329 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700330 }, {
331 .ident = MAC_MODEL_IIVX,
332 .name = "IIvx",
333 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100334 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700335 .scsi_type = MAC_SCSI_OLD,
336 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100337 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100338 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339 },
340
341 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100342 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343 */
344
345 {
346 .ident = MAC_MODEL_CLII,
347 .name = "Classic II",
348 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100349 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700350 .scsi_type = MAC_SCSI_OLD,
351 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100352 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100353 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700354 }, {
355 .ident = MAC_MODEL_CCL,
356 .name = "Color Classic",
357 .adb_type = MAC_ADB_CUDA,
Finn Thain608e2872011-10-24 01:11:22 +1100358 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359 .scsi_type = MAC_SCSI_OLD,
360 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100361 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100362 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Finn Thain1b460102010-05-29 03:27:18 +1000363 }, {
364 .ident = MAC_MODEL_CCLII,
365 .name = "Color Classic II",
366 .adb_type = MAC_ADB_CUDA,
Finn Thain608e2872011-10-24 01:11:22 +1100367 .via_type = MAC_VIA_IICI,
Finn Thain1b460102010-05-29 03:27:18 +1000368 .scsi_type = MAC_SCSI_OLD,
369 .scc_type = MAC_SCC_II,
370 .nubus_type = MAC_NUBUS,
371 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100372 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700373
374 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100375 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
Linus Torvalds1da177e2005-04-16 15:20:36 -0700376 */
377
378 {
379 .ident = MAC_MODEL_LC,
380 .name = "LC",
381 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100382 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700383 .scsi_type = MAC_SCSI_OLD,
384 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100385 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100386 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700387 }, {
388 .ident = MAC_MODEL_LCII,
389 .name = "LC II",
390 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100391 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700392 .scsi_type = MAC_SCSI_OLD,
393 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100394 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100395 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700396 }, {
397 .ident = MAC_MODEL_LCIII,
398 .name = "LC III",
399 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100400 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700401 .scsi_type = MAC_SCSI_OLD,
402 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100403 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100404 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 },
406
407 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100408 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
409 * differently as some of the stuff connected to VIA2 seems different.
410 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
411 * the 660AV and 840AV which use an AMD 79C940 (MACE).
412 * The 700, 900 and 950 have some I/O chips in the wrong place to
413 * confuse us. The 840AV has a SCSI location of its own (same as
414 * the 660AV).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700415 */
416
417 {
418 .ident = MAC_MODEL_Q605,
419 .name = "Quadra 605",
420 .adb_type = MAC_ADB_CUDA,
421 .via_type = MAC_VIA_QUADRA,
422 .scsi_type = MAC_SCSI_QUADRA,
423 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100424 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100425 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426 }, {
427 .ident = MAC_MODEL_Q605_ACC,
428 .name = "Quadra 605",
429 .adb_type = MAC_ADB_CUDA,
430 .via_type = MAC_VIA_QUADRA,
431 .scsi_type = MAC_SCSI_QUADRA,
432 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100433 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100434 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700435 }, {
436 .ident = MAC_MODEL_Q610,
437 .name = "Quadra 610",
438 .adb_type = MAC_ADB_II,
439 .via_type = MAC_VIA_QUADRA,
440 .scsi_type = MAC_SCSI_QUADRA,
441 .scc_type = MAC_SCC_QUADRA,
442 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100443 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100444 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700445 }, {
446 .ident = MAC_MODEL_Q630,
447 .name = "Quadra 630",
448 .adb_type = MAC_ADB_CUDA,
449 .via_type = MAC_VIA_QUADRA,
450 .scsi_type = MAC_SCSI_QUADRA,
451 .ide_type = MAC_IDE_QUADRA,
452 .scc_type = MAC_SCC_QUADRA,
453 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100454 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100455 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700456 }, {
457 .ident = MAC_MODEL_Q650,
458 .name = "Quadra 650",
459 .adb_type = MAC_ADB_II,
460 .via_type = MAC_VIA_QUADRA,
461 .scsi_type = MAC_SCSI_QUADRA,
462 .scc_type = MAC_SCC_QUADRA,
463 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100464 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100465 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700466 },
Finn Thain53aac0a2009-11-04 00:39:09 +1100467 /* The Q700 does have a NS Sonic */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700468 {
469 .ident = MAC_MODEL_Q700,
470 .name = "Quadra 700",
471 .adb_type = MAC_ADB_II,
472 .via_type = MAC_VIA_QUADRA,
473 .scsi_type = MAC_SCSI_QUADRA2,
474 .scc_type = MAC_SCC_QUADRA,
475 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100476 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100477 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700478 }, {
479 .ident = MAC_MODEL_Q800,
480 .name = "Quadra 800",
481 .adb_type = MAC_ADB_II,
482 .via_type = MAC_VIA_QUADRA,
483 .scsi_type = MAC_SCSI_QUADRA,
484 .scc_type = MAC_SCC_QUADRA,
485 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100486 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100487 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700488 }, {
489 .ident = MAC_MODEL_Q840,
490 .name = "Quadra 840AV",
491 .adb_type = MAC_ADB_CUDA,
492 .via_type = MAC_VIA_QUADRA,
493 .scsi_type = MAC_SCSI_QUADRA3,
494 .scc_type = MAC_SCC_PSC,
495 .ether_type = MAC_ETHER_MACE,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100496 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100497 .floppy_type = MAC_FLOPPY_AV,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700498 }, {
499 .ident = MAC_MODEL_Q900,
500 .name = "Quadra 900",
501 .adb_type = MAC_ADB_IOP,
502 .via_type = MAC_VIA_QUADRA,
503 .scsi_type = MAC_SCSI_QUADRA2,
504 .scc_type = MAC_SCC_IOP,
505 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100506 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100507 .floppy_type = MAC_FLOPPY_SWIM_IOP,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508 }, {
509 .ident = MAC_MODEL_Q950,
510 .name = "Quadra 950",
511 .adb_type = MAC_ADB_IOP,
512 .via_type = MAC_VIA_QUADRA,
513 .scsi_type = MAC_SCSI_QUADRA2,
514 .scc_type = MAC_SCC_IOP,
515 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100516 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100517 .floppy_type = MAC_FLOPPY_SWIM_IOP,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 },
519
520 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100521 * Performa - more LC type machines
Linus Torvalds1da177e2005-04-16 15:20:36 -0700522 */
523
524 {
525 .ident = MAC_MODEL_P460,
Finn Thain53aac0a2009-11-04 00:39:09 +1100526 .name = "Performa 460",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100528 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700529 .scsi_type = MAC_SCSI_OLD,
530 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100531 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100532 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700533 }, {
534 .ident = MAC_MODEL_P475,
Finn Thain53aac0a2009-11-04 00:39:09 +1100535 .name = "Performa 475",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536 .adb_type = MAC_ADB_CUDA,
537 .via_type = MAC_VIA_QUADRA,
538 .scsi_type = MAC_SCSI_QUADRA,
539 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100540 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100541 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 }, {
543 .ident = MAC_MODEL_P475F,
Finn Thain53aac0a2009-11-04 00:39:09 +1100544 .name = "Performa 475",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 .adb_type = MAC_ADB_CUDA,
546 .via_type = MAC_VIA_QUADRA,
547 .scsi_type = MAC_SCSI_QUADRA,
548 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100549 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100550 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700551 }, {
552 .ident = MAC_MODEL_P520,
Finn Thain53aac0a2009-11-04 00:39:09 +1100553 .name = "Performa 520",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554 .adb_type = MAC_ADB_CUDA,
Finn Thain608e2872011-10-24 01:11:22 +1100555 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700556 .scsi_type = MAC_SCSI_OLD,
557 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100558 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100559 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700560 }, {
561 .ident = MAC_MODEL_P550,
Finn Thain53aac0a2009-11-04 00:39:09 +1100562 .name = "Performa 550",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700563 .adb_type = MAC_ADB_CUDA,
Finn Thain608e2872011-10-24 01:11:22 +1100564 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 .scsi_type = MAC_SCSI_OLD,
566 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100567 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100568 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 },
Finn Thain53aac0a2009-11-04 00:39:09 +1100570 /* These have the comm slot, and therefore possibly SONIC ethernet */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700571 {
572 .ident = MAC_MODEL_P575,
573 .name = "Performa 575",
574 .adb_type = MAC_ADB_CUDA,
575 .via_type = MAC_VIA_QUADRA,
576 .scsi_type = MAC_SCSI_QUADRA,
577 .scc_type = MAC_SCC_II,
578 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100579 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100580 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700581 }, {
582 .ident = MAC_MODEL_P588,
583 .name = "Performa 588",
584 .adb_type = MAC_ADB_CUDA,
585 .via_type = MAC_VIA_QUADRA,
586 .scsi_type = MAC_SCSI_QUADRA,
587 .ide_type = MAC_IDE_QUADRA,
588 .scc_type = MAC_SCC_II,
589 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100590 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100591 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700592 }, {
593 .ident = MAC_MODEL_TV,
594 .name = "TV",
595 .adb_type = MAC_ADB_CUDA,
Finn Thain608e2872011-10-24 01:11:22 +1100596 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 .scsi_type = MAC_SCSI_OLD,
598 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100599 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100600 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700601 }, {
602 .ident = MAC_MODEL_P600,
603 .name = "Performa 600",
604 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100605 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700606 .scsi_type = MAC_SCSI_OLD,
607 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100608 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100609 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 },
611
612 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100613 * Centris - just guessing again; maybe like Quadra.
614 * The C610 may or may not have SONIC. We probe to make sure.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 */
616
Linus Torvalds1da177e2005-04-16 15:20:36 -0700617 {
618 .ident = MAC_MODEL_C610,
619 .name = "Centris 610",
620 .adb_type = MAC_ADB_II,
621 .via_type = MAC_VIA_QUADRA,
622 .scsi_type = MAC_SCSI_QUADRA,
623 .scc_type = MAC_SCC_QUADRA,
624 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100625 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100626 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700627 }, {
628 .ident = MAC_MODEL_C650,
629 .name = "Centris 650",
630 .adb_type = MAC_ADB_II,
631 .via_type = MAC_VIA_QUADRA,
632 .scsi_type = MAC_SCSI_QUADRA,
633 .scc_type = MAC_SCC_QUADRA,
634 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100635 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100636 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637 }, {
638 .ident = MAC_MODEL_C660,
639 .name = "Centris 660AV",
640 .adb_type = MAC_ADB_CUDA,
641 .via_type = MAC_VIA_QUADRA,
642 .scsi_type = MAC_SCSI_QUADRA3,
643 .scc_type = MAC_SCC_PSC,
644 .ether_type = MAC_ETHER_MACE,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100645 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100646 .floppy_type = MAC_FLOPPY_AV,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700647 },
648
649 /*
650 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
651 * and a PMU (in two variations?) for ADB. Most of them use the
652 * Quadra-style VIAs. A few models also have IDE from hell.
653 */
654
655 {
656 .ident = MAC_MODEL_PB140,
657 .name = "PowerBook 140",
658 .adb_type = MAC_ADB_PB1,
659 .via_type = MAC_VIA_QUADRA,
660 .scsi_type = MAC_SCSI_OLD,
661 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100662 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100663 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700664 }, {
665 .ident = MAC_MODEL_PB145,
666 .name = "PowerBook 145",
667 .adb_type = MAC_ADB_PB1,
668 .via_type = MAC_VIA_QUADRA,
669 .scsi_type = MAC_SCSI_OLD,
670 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100671 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100672 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700673 }, {
674 .ident = MAC_MODEL_PB150,
675 .name = "PowerBook 150",
Finn Thain4107c452011-10-24 01:11:20 +1100676 .adb_type = MAC_ADB_PB2,
Finn Thain608e2872011-10-24 01:11:22 +1100677 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700678 .scsi_type = MAC_SCSI_OLD,
679 .ide_type = MAC_IDE_PB,
680 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100681 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100682 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700683 }, {
684 .ident = MAC_MODEL_PB160,
685 .name = "PowerBook 160",
686 .adb_type = MAC_ADB_PB1,
687 .via_type = MAC_VIA_QUADRA,
688 .scsi_type = MAC_SCSI_OLD,
689 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100690 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100691 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700692 }, {
693 .ident = MAC_MODEL_PB165,
694 .name = "PowerBook 165",
695 .adb_type = MAC_ADB_PB1,
696 .via_type = MAC_VIA_QUADRA,
697 .scsi_type = MAC_SCSI_OLD,
698 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100699 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100700 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700701 }, {
702 .ident = MAC_MODEL_PB165C,
703 .name = "PowerBook 165c",
704 .adb_type = MAC_ADB_PB1,
705 .via_type = MAC_VIA_QUADRA,
706 .scsi_type = MAC_SCSI_OLD,
707 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100708 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100709 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700710 }, {
711 .ident = MAC_MODEL_PB170,
712 .name = "PowerBook 170",
713 .adb_type = MAC_ADB_PB1,
714 .via_type = MAC_VIA_QUADRA,
715 .scsi_type = MAC_SCSI_OLD,
716 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100717 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100718 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700719 }, {
720 .ident = MAC_MODEL_PB180,
721 .name = "PowerBook 180",
722 .adb_type = MAC_ADB_PB1,
723 .via_type = MAC_VIA_QUADRA,
724 .scsi_type = MAC_SCSI_OLD,
725 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100726 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100727 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700728 }, {
729 .ident = MAC_MODEL_PB180C,
730 .name = "PowerBook 180c",
731 .adb_type = MAC_ADB_PB1,
732 .via_type = MAC_VIA_QUADRA,
733 .scsi_type = MAC_SCSI_OLD,
734 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100735 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100736 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700737 }, {
738 .ident = MAC_MODEL_PB190,
739 .name = "PowerBook 190",
740 .adb_type = MAC_ADB_PB2,
741 .via_type = MAC_VIA_QUADRA,
742 .scsi_type = MAC_SCSI_OLD,
743 .ide_type = MAC_IDE_BABOON,
744 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100745 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100746 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700747 }, {
748 .ident = MAC_MODEL_PB520,
749 .name = "PowerBook 520",
750 .adb_type = MAC_ADB_PB2,
751 .via_type = MAC_VIA_QUADRA,
752 .scsi_type = MAC_SCSI_OLD,
753 .scc_type = MAC_SCC_QUADRA,
754 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100755 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100756 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700757 },
758
759 /*
760 * PowerBook Duos are pretty much like normal PowerBooks
761 * All of these probably have onboard SONIC in the Dock which
762 * means we'll have to probe for it eventually.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700763 */
764
765 {
766 .ident = MAC_MODEL_PB210,
767 .name = "PowerBook Duo 210",
768 .adb_type = MAC_ADB_PB2,
Finn Thain608e2872011-10-24 01:11:22 +1100769 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700770 .scsi_type = MAC_SCSI_OLD,
771 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100772 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100773 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700774 }, {
775 .ident = MAC_MODEL_PB230,
776 .name = "PowerBook Duo 230",
777 .adb_type = MAC_ADB_PB2,
Finn Thain608e2872011-10-24 01:11:22 +1100778 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700779 .scsi_type = MAC_SCSI_OLD,
780 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100781 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100782 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700783 }, {
784 .ident = MAC_MODEL_PB250,
785 .name = "PowerBook Duo 250",
786 .adb_type = MAC_ADB_PB2,
Finn Thain608e2872011-10-24 01:11:22 +1100787 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700788 .scsi_type = MAC_SCSI_OLD,
789 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100790 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100791 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700792 }, {
793 .ident = MAC_MODEL_PB270C,
794 .name = "PowerBook Duo 270c",
795 .adb_type = MAC_ADB_PB2,
Finn Thain608e2872011-10-24 01:11:22 +1100796 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700797 .scsi_type = MAC_SCSI_OLD,
798 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100799 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100800 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700801 }, {
802 .ident = MAC_MODEL_PB280,
803 .name = "PowerBook Duo 280",
804 .adb_type = MAC_ADB_PB2,
Finn Thain608e2872011-10-24 01:11:22 +1100805 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700806 .scsi_type = MAC_SCSI_OLD,
807 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100808 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100809 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700810 }, {
811 .ident = MAC_MODEL_PB280C,
812 .name = "PowerBook Duo 280c",
813 .adb_type = MAC_ADB_PB2,
Finn Thain608e2872011-10-24 01:11:22 +1100814 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700815 .scsi_type = MAC_SCSI_OLD,
816 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100817 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100818 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700819 },
820
821 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100822 * Other stuff?
Linus Torvalds1da177e2005-04-16 15:20:36 -0700823 */
Finn Thain53aac0a2009-11-04 00:39:09 +1100824
Linus Torvalds1da177e2005-04-16 15:20:36 -0700825 {
826 .ident = -1
827 }
828};
829
Finn Thain80614e52009-11-17 20:06:48 +1100830static struct resource scc_a_rsrcs[] = {
831 { .flags = IORESOURCE_MEM },
832 { .flags = IORESOURCE_IRQ },
833};
834
835static struct resource scc_b_rsrcs[] = {
836 { .flags = IORESOURCE_MEM },
837 { .flags = IORESOURCE_IRQ },
838};
839
840struct platform_device scc_a_pdev = {
841 .name = "scc",
842 .id = 0,
843 .num_resources = ARRAY_SIZE(scc_a_rsrcs),
844 .resource = scc_a_rsrcs,
845};
846EXPORT_SYMBOL(scc_a_pdev);
847
848struct platform_device scc_b_pdev = {
849 .name = "scc",
850 .id = 1,
851 .num_resources = ARRAY_SIZE(scc_b_rsrcs),
852 .resource = scc_b_rsrcs,
853};
854EXPORT_SYMBOL(scc_b_pdev);
855
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200856static void __init mac_identify(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700857{
858 struct mac_model *m;
859
860 /* Penguin data useful? */
861 int model = mac_bi_data.id;
862 if (!model) {
863 /* no bootinfo model id -> NetBSD booter was used! */
864 /* XXX FIXME: breaks for model > 31 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200865 model = (mac_bi_data.cpuid >> 2) & 63;
Finn Thain53aac0a2009-11-04 00:39:09 +1100866 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead "
867 "(obsolete bootloader?)\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700868 }
869
870 macintosh_config = mac_data_table;
Roman Zippel6ff58012007-05-01 22:32:43 +0200871 for (m = macintosh_config; m->ident != -1; m++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700872 if (m->ident == model) {
873 macintosh_config = m;
874 break;
875 }
876 }
877
Finn Thain80614e52009-11-17 20:06:48 +1100878 /* Set up serial port resources for the console initcall. */
879
880 scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
881 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
882 scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
883 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
884
885 switch (macintosh_config->scc_type) {
886 case MAC_SCC_PSC:
887 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
888 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
889 break;
890 default:
Finn Thainda3fb3c2011-10-24 01:11:18 +1100891 /* On non-PSC machines, the serial ports share an IRQ. */
892 if (macintosh_config->ident == MAC_MODEL_IIFX) {
893 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
894 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
895 } else {
896 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
897 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
898 }
Finn Thain80614e52009-11-17 20:06:48 +1100899 break;
900 }
901
Finn Thain53aac0a2009-11-04 00:39:09 +1100902 /*
903 * We need to pre-init the IOPs, if any. Otherwise
904 * the serial console won't work if the user had
905 * the serial ports set to "Faster" mode in MacOS.
906 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700907 iop_preinit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700908
Frans Popb9b0d8b2010-02-06 18:47:11 +0100909 printk(KERN_INFO "Detected Macintosh model: %d\n", model);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700910
911 /*
912 * Report booter data:
913 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200914 printk(KERN_DEBUG " Penguin bootinfo data:\n");
Finn Thain53aac0a2009-11-04 00:39:09 +1100915 printk(KERN_DEBUG " Video: addr 0x%lx "
916 "row 0x%lx depth %lx dimensions %ld x %ld\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700917 mac_bi_data.videoaddr, mac_bi_data.videorow,
918 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
919 mac_bi_data.dimensions >> 16);
Frans Popb9b0d8b2010-02-06 18:47:11 +0100920 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700921 mac_bi_data.videological, mac_orig_videoaddr,
922 mac_bi_data.sccbase);
Frans Popb9b0d8b2010-02-06 18:47:11 +0100923 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700924 mac_bi_data.boottime, mac_bi_data.gmtbias);
Frans Popb9b0d8b2010-02-06 18:47:11 +0100925 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700926 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700927
Linus Torvalds1da177e2005-04-16 15:20:36 -0700928 iop_init();
929 via_init();
930 oss_init();
931 psc_init();
932 baboon_init();
Finn Thain18814ee2009-11-17 20:03:05 +1100933
934#ifdef CONFIG_ADB_CUDA
935 find_via_cuda();
936#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700937}
938
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200939static void __init mac_report_hardware(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700940{
941 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
942}
943
944static void mac_get_model(char *str)
945{
Roman Zippel6ff58012007-05-01 22:32:43 +0200946 strcpy(str, "Macintosh ");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700947 strcat(str, macintosh_config->name);
948}
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100949
Finn Thain2724daf2009-11-04 00:39:56 +1100950static struct resource swim_rsrc = { .flags = IORESOURCE_MEM };
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100951
Finn Thain2724daf2009-11-04 00:39:56 +1100952static struct platform_device swim_pdev = {
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100953 .name = "swim",
954 .id = -1,
Finn Thain2724daf2009-11-04 00:39:56 +1100955 .num_resources = 1,
956 .resource = &swim_rsrc,
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100957};
958
Finn Thaincff75f12009-11-04 00:41:35 +1100959static struct platform_device esp_0_pdev = {
960 .name = "mac_esp",
961 .id = 0,
962};
963
964static struct platform_device esp_1_pdev = {
965 .name = "mac_esp",
966 .id = 1,
967};
968
Finn Thaineeb9c182009-11-04 00:42:02 +1100969static struct platform_device sonic_pdev = {
970 .name = "macsonic",
971 .id = -1,
972};
973
974static struct platform_device mace_pdev = {
975 .name = "macmace",
976 .id = -1,
977};
978
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100979int __init mac_platform_init(void)
980{
981 u8 *swim_base;
982
Geert Uytterhoeven6cfeba52012-03-18 13:21:38 +0100983 if (!MACH_IS_MAC)
984 return -ENODEV;
985
Finn Thain2724daf2009-11-04 00:39:56 +1100986 /*
Finn Thain80614e52009-11-17 20:06:48 +1100987 * Serial devices
988 */
989
990 platform_device_register(&scc_a_pdev);
991 platform_device_register(&scc_b_pdev);
992
993 /*
Finn Thain2724daf2009-11-04 00:39:56 +1100994 * Floppy device
995 */
996
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100997 switch (macintosh_config->floppy_type) {
998 case MAC_FLOPPY_SWIM_ADDR1:
999 swim_base = (u8 *)(VIA1_BASE + 0x1E000);
1000 break;
1001 case MAC_FLOPPY_SWIM_ADDR2:
1002 swim_base = (u8 *)(VIA1_BASE + 0x16000);
1003 break;
1004 default:
Finn Thain2724daf2009-11-04 00:39:56 +11001005 swim_base = NULL;
1006 break;
Laurent Vivier8852ecd2008-11-15 16:10:10 +01001007 }
1008
Finn Thain2724daf2009-11-04 00:39:56 +11001009 if (swim_base) {
1010 swim_rsrc.start = (resource_size_t) swim_base,
1011 swim_rsrc.end = (resource_size_t) swim_base + 0x2000,
1012 platform_device_register(&swim_pdev);
1013 }
Laurent Vivier8852ecd2008-11-15 16:10:10 +01001014
Finn Thaincff75f12009-11-04 00:41:35 +11001015 /*
1016 * SCSI device(s)
1017 */
1018
1019 switch (macintosh_config->scsi_type) {
1020 case MAC_SCSI_QUADRA:
1021 case MAC_SCSI_QUADRA3:
1022 platform_device_register(&esp_0_pdev);
1023 break;
1024 case MAC_SCSI_QUADRA2:
1025 platform_device_register(&esp_0_pdev);
1026 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
1027 (macintosh_config->ident == MAC_MODEL_Q950))
1028 platform_device_register(&esp_1_pdev);
1029 break;
1030 }
1031
Finn Thaineeb9c182009-11-04 00:42:02 +11001032 /*
1033 * Ethernet device
1034 */
1035
1036 switch (macintosh_config->ether_type) {
1037 case MAC_ETHER_SONIC:
1038 platform_device_register(&sonic_pdev);
1039 break;
1040 case MAC_ETHER_MACE:
1041 platform_device_register(&mace_pdev);
1042 break;
1043 }
1044
Finn Thain2724daf2009-11-04 00:39:56 +11001045 return 0;
Laurent Vivier8852ecd2008-11-15 16:10:10 +01001046}
1047
1048arch_initcall(mac_platform_init);