blob: a471eab1a4dda8d65214df570da554b9be44e378 [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>
Geert Uytterhoevenabe48102013-10-04 11:41:24 +020032#include <asm/byteorder.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
Linus Torvalds1da177e2005-04-16 15:20:36 -070034#include <asm/io.h>
35#include <asm/irq.h>
36#include <asm/pgtable.h>
37#include <asm/rtc.h>
38#include <asm/machdep.h>
39
40#include <asm/macintosh.h>
41#include <asm/macints.h>
42#include <asm/machw.h>
43
44#include <asm/mac_iop.h>
45#include <asm/mac_via.h>
46#include <asm/mac_oss.h>
47#include <asm/mac_psc.h>
48
49/* Mac bootinfo struct */
Linus Torvalds1da177e2005-04-16 15:20:36 -070050struct mac_booter_data mac_bi_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070051
Linus Torvalds1da177e2005-04-16 15:20:36 -070052/* The phys. video addr. - might be bogus on some machines */
Adrian Bunk8dfbdf42008-07-17 21:16:25 +020053static unsigned long mac_orig_videoaddr;
Linus Torvalds1da177e2005-04-16 15:20:36 -070054
55/* Mac specific timer functions */
Stephen Warrenc8d5ba12012-11-08 11:34:55 -070056extern u32 mac_gettimeoffset(void);
Roman Zippel6ff58012007-05-01 22:32:43 +020057extern int mac_hwclk(int, struct rtc_time *);
58extern int mac_set_clock_mmss(unsigned long);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059extern void iop_preinit(void);
60extern void iop_init(void);
61extern void via_init(void);
David Howells40220c12006-10-09 12:19:47 +010062extern void via_init_clock(irq_handler_t func);
Linus Torvalds1da177e2005-04-16 15:20:36 -070063extern void via_flush_cache(void);
64extern void oss_init(void);
65extern void psc_init(void);
66extern void baboon_init(void);
67
68extern void mac_mksound(unsigned int, unsigned int);
69
Linus Torvalds1da177e2005-04-16 15:20:36 -070070static void mac_get_model(char *str);
Adrian Bunk8dfbdf42008-07-17 21:16:25 +020071static void mac_identify(void);
72static void mac_report_hardware(void);
Linus Torvalds1da177e2005-04-16 15:20:36 -070073
Al Viro66a3f822007-07-20 04:33:28 +010074static void __init mac_sched_init(irq_handler_t vector)
Linus Torvalds1da177e2005-04-16 15:20:36 -070075{
76 via_init_clock(vector);
77}
78
Linus Torvalds1da177e2005-04-16 15:20:36 -070079/*
80 * Parse a Macintosh-specific record in the bootinfo
81 */
82
83int __init mac_parse_bootinfo(const struct bi_record *record)
84{
Roman Zippel6ff58012007-05-01 22:32:43 +020085 int unknown = 0;
Geert Uytterhoevenabe48102013-10-04 11:41:24 +020086 const void *data = record->data;
Linus Torvalds1da177e2005-04-16 15:20:36 -070087
Geert Uytterhoevenabe48102013-10-04 11:41:24 +020088 switch (be16_to_cpu(record->tag)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -070089 case BI_MAC_MODEL:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +020090 mac_bi_data.id = be32_to_cpup(data);
Roman Zippel6ff58012007-05-01 22:32:43 +020091 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070092 case BI_MAC_VADDR:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +020093 mac_bi_data.videoaddr = be32_to_cpup(data);
Roman Zippel6ff58012007-05-01 22:32:43 +020094 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 case BI_MAC_VDEPTH:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +020096 mac_bi_data.videodepth = be32_to_cpup(data);
Roman Zippel6ff58012007-05-01 22:32:43 +020097 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 case BI_MAC_VROW:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +020099 mac_bi_data.videorow = be32_to_cpup(data);
Roman Zippel6ff58012007-05-01 22:32:43 +0200100 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700101 case BI_MAC_VDIM:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +0200102 mac_bi_data.dimensions = be32_to_cpup(data);
Roman Zippel6ff58012007-05-01 22:32:43 +0200103 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104 case BI_MAC_VLOGICAL:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +0200105 mac_orig_videoaddr = be32_to_cpup(data);
106 mac_bi_data.videological =
107 VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
Roman Zippel6ff58012007-05-01 22:32:43 +0200108 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700109 case BI_MAC_SCCBASE:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +0200110 mac_bi_data.sccbase = be32_to_cpup(data);
Roman Zippel6ff58012007-05-01 22:32:43 +0200111 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112 case BI_MAC_BTIME:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +0200113 mac_bi_data.boottime = be32_to_cpup(data);
Roman Zippel6ff58012007-05-01 22:32:43 +0200114 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 case BI_MAC_GMTBIAS:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +0200116 mac_bi_data.gmtbias = be32_to_cpup(data);
Roman Zippel6ff58012007-05-01 22:32:43 +0200117 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 case BI_MAC_MEMSIZE:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +0200119 mac_bi_data.memsize = be32_to_cpup(data);
Roman Zippel6ff58012007-05-01 22:32:43 +0200120 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 case BI_MAC_CPUID:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +0200122 mac_bi_data.cpuid = be32_to_cpup(data);
Roman Zippel6ff58012007-05-01 22:32:43 +0200123 break;
124 case BI_MAC_ROMBASE:
Geert Uytterhoevenabe48102013-10-04 11:41:24 +0200125 mac_bi_data.rombase = be32_to_cpup(data);
Roman Zippel6ff58012007-05-01 22:32:43 +0200126 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700127 default:
Roman Zippel6ff58012007-05-01 22:32:43 +0200128 unknown = 1;
129 break;
130 }
131 return unknown;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132}
133
134/*
135 * Flip into 24bit mode for an instant - flushes the L2 cache card. We
136 * have to disable interrupts for this. Our IRQ handlers will crap
137 * themselves if they take an IRQ in 24bit mode!
138 */
139
140static void mac_cache_card_flush(int writeback)
141{
142 unsigned long flags;
Roman Zippel6ff58012007-05-01 22:32:43 +0200143
Linus Torvalds1da177e2005-04-16 15:20:36 -0700144 local_irq_save(flags);
145 via_flush_cache();
146 local_irq_restore(flags);
147}
148
149void __init config_mac(void)
150{
Roman Zippel6ff58012007-05-01 22:32:43 +0200151 if (!MACH_IS_MAC)
Frans Popb9b0d8b2010-02-06 18:47:11 +0100152 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!!\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700153
Roman Zippel6ff58012007-05-01 22:32:43 +0200154 mach_sched_init = mac_sched_init;
155 mach_init_IRQ = mac_init_IRQ;
156 mach_get_model = mac_get_model;
Stephen Warrenc8d5ba12012-11-08 11:34:55 -0700157 arch_gettimeoffset = mac_gettimeoffset;
Roman Zippel6ff58012007-05-01 22:32:43 +0200158 mach_hwclk = mac_hwclk;
Roman Zippel6ff58012007-05-01 22:32:43 +0200159 mach_set_clock_mmss = mac_set_clock_mmss;
160 mach_reset = mac_reset;
161 mach_halt = mac_poweroff;
162 mach_power_off = mac_poweroff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 mach_max_dma_address = 0xffffffff;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700164#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
Roman Zippel6ff58012007-05-01 22:32:43 +0200165 mach_beep = mac_mksound;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700166#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167
168 /*
169 * Determine hardware present
170 */
171
172 mac_identify();
173 mac_report_hardware();
174
Roman Zippel6ff58012007-05-01 22:32:43 +0200175 /*
176 * AFAIK only the IIci takes a cache card. The IIfx has onboard
177 * cache ... someone needs to figure out how to tell if it's on or
178 * not.
179 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700180
181 if (macintosh_config->ident == MAC_MODEL_IICI
Roman Zippel6ff58012007-05-01 22:32:43 +0200182 || macintosh_config->ident == MAC_MODEL_IIFX)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183 mach_l2_flush = mac_cache_card_flush;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700184}
185
186
187/*
Finn Thain53aac0a2009-11-04 00:39:09 +1100188 * Macintosh Table: hardcoded model configuration data.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189 *
Finn Thain53aac0a2009-11-04 00:39:09 +1100190 * Much of this was defined by Alan, based on who knows what docs.
191 * I've added a lot more, and some of that was pure guesswork based
192 * on hardware pages present on the Mac web site. Possibly wildly
193 * inaccurate, so look here if a new Mac model won't run. Example: if
194 * a Mac crashes immediately after the VIA1 registers have been dumped
195 * to the screen, it probably died attempting to read DirB on a RBV.
Finn Thain608e2872011-10-24 01:11:22 +1100196 * Meaning it should have MAC_VIA_IICI here :-)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700197 */
198
199struct mac_model *macintosh_config;
200EXPORT_SYMBOL(macintosh_config);
201
Roman Zippel6ff58012007-05-01 22:32:43 +0200202static struct mac_model mac_data_table[] = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700203 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100204 * We'll pretend to be a Macintosh II, that's pretty safe.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700205 */
206
207 {
208 .ident = MAC_MODEL_II,
209 .name = "Unknown",
210 .adb_type = MAC_ADB_II,
211 .via_type = MAC_VIA_II,
212 .scsi_type = MAC_SCSI_OLD,
213 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100214 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100215 .floppy_type = MAC_FLOPPY_IWM,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700216 },
217
218 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100219 * Original Mac II hardware
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220 */
221
222 {
223 .ident = MAC_MODEL_II,
224 .name = "II",
225 .adb_type = MAC_ADB_II,
226 .via_type = MAC_VIA_II,
227 .scsi_type = MAC_SCSI_OLD,
228 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100229 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100230 .floppy_type = MAC_FLOPPY_IWM,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 }, {
232 .ident = MAC_MODEL_IIX,
233 .name = "IIx",
234 .adb_type = MAC_ADB_II,
235 .via_type = MAC_VIA_II,
236 .scsi_type = MAC_SCSI_OLD,
237 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100238 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100239 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240 }, {
241 .ident = MAC_MODEL_IICX,
242 .name = "IIcx",
243 .adb_type = MAC_ADB_II,
244 .via_type = MAC_VIA_II,
245 .scsi_type = MAC_SCSI_OLD,
246 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100247 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100248 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700249 }, {
250 .ident = MAC_MODEL_SE30,
251 .name = "SE/30",
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_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258 },
259
260 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100261 * Weirdified Mac II hardware - all subtly different. Gee thanks
262 * Apple. All these boxes seem to have VIA2 in a different place to
263 * the Mac II (+1A000 rather than +4000)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
265 */
266
267 {
268 .ident = MAC_MODEL_IICI,
269 .name = "IIci",
270 .adb_type = MAC_ADB_II,
Finn Thain608e2872011-10-24 01:11:22 +1100271 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 .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_IIFX,
278 .name = "IIfx",
279 .adb_type = MAC_ADB_IOP,
Finn Thain608e2872011-10-24 01:11:22 +1100280 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281 .scsi_type = MAC_SCSI_OLD,
282 .scc_type = MAC_SCC_IOP,
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_IOP,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700285 }, {
286 .ident = MAC_MODEL_IISI,
287 .name = "IIsi",
288 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100289 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700290 .scsi_type = MAC_SCSI_OLD,
291 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100292 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100293 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700294 }, {
295 .ident = MAC_MODEL_IIVI,
296 .name = "IIvi",
297 .adb_type = MAC_ADB_IISI,
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_IIVX,
305 .name = "IIvx",
306 .adb_type = MAC_ADB_IISI,
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_II,
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_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 },
313
314 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100315 * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700316 */
317
318 {
319 .ident = MAC_MODEL_CLII,
320 .name = "Classic II",
321 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100322 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700323 .scsi_type = MAC_SCSI_OLD,
324 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100325 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100326 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327 }, {
328 .ident = MAC_MODEL_CCL,
329 .name = "Color Classic",
330 .adb_type = MAC_ADB_CUDA,
Finn Thain608e2872011-10-24 01:11:22 +1100331 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700332 .scsi_type = MAC_SCSI_OLD,
333 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100334 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100335 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Finn Thain1b460102010-05-29 03:27:18 +1000336 }, {
337 .ident = MAC_MODEL_CCLII,
338 .name = "Color Classic II",
339 .adb_type = MAC_ADB_CUDA,
Finn Thain608e2872011-10-24 01:11:22 +1100340 .via_type = MAC_VIA_IICI,
Finn Thain1b460102010-05-29 03:27:18 +1000341 .scsi_type = MAC_SCSI_OLD,
342 .scc_type = MAC_SCC_II,
343 .nubus_type = MAC_NUBUS,
344 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100345 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346
347 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100348 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
Linus Torvalds1da177e2005-04-16 15:20:36 -0700349 */
350
351 {
352 .ident = MAC_MODEL_LC,
353 .name = "LC",
354 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100355 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700356 .scsi_type = MAC_SCSI_OLD,
357 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100358 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100359 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700360 }, {
361 .ident = MAC_MODEL_LCII,
362 .name = "LC II",
363 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100364 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365 .scsi_type = MAC_SCSI_OLD,
366 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100367 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100368 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700369 }, {
370 .ident = MAC_MODEL_LCIII,
371 .name = "LC III",
372 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100373 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700374 .scsi_type = MAC_SCSI_OLD,
375 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100376 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100377 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378 },
379
380 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100381 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
382 * differently as some of the stuff connected to VIA2 seems different.
383 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
384 * the 660AV and 840AV which use an AMD 79C940 (MACE).
385 * The 700, 900 and 950 have some I/O chips in the wrong place to
386 * confuse us. The 840AV has a SCSI location of its own (same as
387 * the 660AV).
Linus Torvalds1da177e2005-04-16 15:20:36 -0700388 */
389
390 {
391 .ident = MAC_MODEL_Q605,
392 .name = "Quadra 605",
393 .adb_type = MAC_ADB_CUDA,
394 .via_type = MAC_VIA_QUADRA,
395 .scsi_type = MAC_SCSI_QUADRA,
396 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100397 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100398 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700399 }, {
400 .ident = MAC_MODEL_Q605_ACC,
401 .name = "Quadra 605",
402 .adb_type = MAC_ADB_CUDA,
403 .via_type = MAC_VIA_QUADRA,
404 .scsi_type = MAC_SCSI_QUADRA,
405 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100406 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100407 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408 }, {
409 .ident = MAC_MODEL_Q610,
410 .name = "Quadra 610",
411 .adb_type = MAC_ADB_II,
412 .via_type = MAC_VIA_QUADRA,
413 .scsi_type = MAC_SCSI_QUADRA,
414 .scc_type = MAC_SCC_QUADRA,
415 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100416 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100417 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700418 }, {
419 .ident = MAC_MODEL_Q630,
420 .name = "Quadra 630",
421 .adb_type = MAC_ADB_CUDA,
422 .via_type = MAC_VIA_QUADRA,
423 .scsi_type = MAC_SCSI_QUADRA,
424 .ide_type = MAC_IDE_QUADRA,
425 .scc_type = MAC_SCC_QUADRA,
426 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100427 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100428 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700429 }, {
430 .ident = MAC_MODEL_Q650,
431 .name = "Quadra 650",
432 .adb_type = MAC_ADB_II,
433 .via_type = MAC_VIA_QUADRA,
434 .scsi_type = MAC_SCSI_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,
Finn Thain53aac0a2009-11-04 00:39:09 +1100438 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700439 },
Finn Thain53aac0a2009-11-04 00:39:09 +1100440 /* The Q700 does have a NS Sonic */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700441 {
442 .ident = MAC_MODEL_Q700,
443 .name = "Quadra 700",
444 .adb_type = MAC_ADB_II,
445 .via_type = MAC_VIA_QUADRA,
446 .scsi_type = MAC_SCSI_QUADRA2,
447 .scc_type = MAC_SCC_QUADRA,
448 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100449 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100450 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700451 }, {
452 .ident = MAC_MODEL_Q800,
453 .name = "Quadra 800",
454 .adb_type = MAC_ADB_II,
455 .via_type = MAC_VIA_QUADRA,
456 .scsi_type = MAC_SCSI_QUADRA,
457 .scc_type = MAC_SCC_QUADRA,
458 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100459 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100460 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700461 }, {
462 .ident = MAC_MODEL_Q840,
463 .name = "Quadra 840AV",
464 .adb_type = MAC_ADB_CUDA,
465 .via_type = MAC_VIA_QUADRA,
466 .scsi_type = MAC_SCSI_QUADRA3,
467 .scc_type = MAC_SCC_PSC,
468 .ether_type = MAC_ETHER_MACE,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100469 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100470 .floppy_type = MAC_FLOPPY_AV,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700471 }, {
472 .ident = MAC_MODEL_Q900,
473 .name = "Quadra 900",
474 .adb_type = MAC_ADB_IOP,
475 .via_type = MAC_VIA_QUADRA,
476 .scsi_type = MAC_SCSI_QUADRA2,
477 .scc_type = MAC_SCC_IOP,
478 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100479 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100480 .floppy_type = MAC_FLOPPY_SWIM_IOP,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700481 }, {
482 .ident = MAC_MODEL_Q950,
483 .name = "Quadra 950",
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,
Finn Thain53aac0a2009-11-04 00:39:09 +1100490 .floppy_type = MAC_FLOPPY_SWIM_IOP,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700491 },
492
493 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100494 * Performa - more LC type machines
Linus Torvalds1da177e2005-04-16 15:20:36 -0700495 */
496
497 {
498 .ident = MAC_MODEL_P460,
Finn Thain53aac0a2009-11-04 00:39:09 +1100499 .name = "Performa 460",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700500 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100501 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700502 .scsi_type = MAC_SCSI_OLD,
503 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100504 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100505 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700506 }, {
507 .ident = MAC_MODEL_P475,
Finn Thain53aac0a2009-11-04 00:39:09 +1100508 .name = "Performa 475",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700509 .adb_type = MAC_ADB_CUDA,
510 .via_type = MAC_VIA_QUADRA,
511 .scsi_type = MAC_SCSI_QUADRA,
512 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100513 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100514 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 }, {
516 .ident = MAC_MODEL_P475F,
Finn Thain53aac0a2009-11-04 00:39:09 +1100517 .name = "Performa 475",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 .adb_type = MAC_ADB_CUDA,
519 .via_type = MAC_VIA_QUADRA,
520 .scsi_type = MAC_SCSI_QUADRA,
521 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100522 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100523 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700524 }, {
525 .ident = MAC_MODEL_P520,
Finn Thain53aac0a2009-11-04 00:39:09 +1100526 .name = "Performa 520",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527 .adb_type = MAC_ADB_CUDA,
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_P550,
Finn Thain53aac0a2009-11-04 00:39:09 +1100535 .name = "Performa 550",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536 .adb_type = MAC_ADB_CUDA,
Finn Thain608e2872011-10-24 01:11:22 +1100537 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 .scsi_type = MAC_SCSI_OLD,
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_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 },
Finn Thain53aac0a2009-11-04 00:39:09 +1100543 /* These have the comm slot, and therefore possibly SONIC ethernet */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700544 {
545 .ident = MAC_MODEL_P575,
546 .name = "Performa 575",
547 .adb_type = MAC_ADB_CUDA,
548 .via_type = MAC_VIA_QUADRA,
549 .scsi_type = MAC_SCSI_QUADRA,
550 .scc_type = MAC_SCC_II,
551 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100552 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100553 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700554 }, {
555 .ident = MAC_MODEL_P588,
556 .name = "Performa 588",
557 .adb_type = MAC_ADB_CUDA,
558 .via_type = MAC_VIA_QUADRA,
559 .scsi_type = MAC_SCSI_QUADRA,
560 .ide_type = MAC_IDE_QUADRA,
561 .scc_type = MAC_SCC_II,
562 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100563 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100564 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700565 }, {
566 .ident = MAC_MODEL_TV,
567 .name = "TV",
568 .adb_type = MAC_ADB_CUDA,
Finn Thain608e2872011-10-24 01:11:22 +1100569 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 .scsi_type = MAC_SCSI_OLD,
571 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100572 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100573 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700574 }, {
575 .ident = MAC_MODEL_P600,
576 .name = "Performa 600",
577 .adb_type = MAC_ADB_IISI,
Finn Thain608e2872011-10-24 01:11:22 +1100578 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700579 .scsi_type = MAC_SCSI_OLD,
580 .scc_type = MAC_SCC_II,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100581 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100582 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700583 },
584
585 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100586 * Centris - just guessing again; maybe like Quadra.
587 * The C610 may or may not have SONIC. We probe to make sure.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700588 */
589
Linus Torvalds1da177e2005-04-16 15:20:36 -0700590 {
591 .ident = MAC_MODEL_C610,
592 .name = "Centris 610",
593 .adb_type = MAC_ADB_II,
594 .via_type = MAC_VIA_QUADRA,
595 .scsi_type = MAC_SCSI_QUADRA,
596 .scc_type = MAC_SCC_QUADRA,
597 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100598 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100599 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700600 }, {
601 .ident = MAC_MODEL_C650,
602 .name = "Centris 650",
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,
Finn Thain53aac0a2009-11-04 00:39:09 +1100609 .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 }, {
611 .ident = MAC_MODEL_C660,
612 .name = "Centris 660AV",
613 .adb_type = MAC_ADB_CUDA,
614 .via_type = MAC_VIA_QUADRA,
615 .scsi_type = MAC_SCSI_QUADRA3,
616 .scc_type = MAC_SCC_PSC,
617 .ether_type = MAC_ETHER_MACE,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100618 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100619 .floppy_type = MAC_FLOPPY_AV,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700620 },
621
622 /*
623 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
624 * and a PMU (in two variations?) for ADB. Most of them use the
625 * Quadra-style VIAs. A few models also have IDE from hell.
626 */
627
628 {
629 .ident = MAC_MODEL_PB140,
630 .name = "PowerBook 140",
631 .adb_type = MAC_ADB_PB1,
632 .via_type = MAC_VIA_QUADRA,
633 .scsi_type = MAC_SCSI_OLD,
634 .scc_type = MAC_SCC_QUADRA,
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_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700637 }, {
638 .ident = MAC_MODEL_PB145,
639 .name = "PowerBook 145",
640 .adb_type = MAC_ADB_PB1,
641 .via_type = MAC_VIA_QUADRA,
642 .scsi_type = MAC_SCSI_OLD,
643 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100644 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100645 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700646 }, {
647 .ident = MAC_MODEL_PB150,
648 .name = "PowerBook 150",
Finn Thain4107c452011-10-24 01:11:20 +1100649 .adb_type = MAC_ADB_PB2,
Finn Thain608e2872011-10-24 01:11:22 +1100650 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700651 .scsi_type = MAC_SCSI_OLD,
652 .ide_type = MAC_IDE_PB,
653 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100654 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100655 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700656 }, {
657 .ident = MAC_MODEL_PB160,
658 .name = "PowerBook 160",
659 .adb_type = MAC_ADB_PB1,
660 .via_type = MAC_VIA_QUADRA,
661 .scsi_type = MAC_SCSI_OLD,
662 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100663 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100664 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700665 }, {
666 .ident = MAC_MODEL_PB165,
667 .name = "PowerBook 165",
668 .adb_type = MAC_ADB_PB1,
669 .via_type = MAC_VIA_QUADRA,
670 .scsi_type = MAC_SCSI_OLD,
671 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100672 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100673 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700674 }, {
675 .ident = MAC_MODEL_PB165C,
676 .name = "PowerBook 165c",
677 .adb_type = MAC_ADB_PB1,
678 .via_type = MAC_VIA_QUADRA,
679 .scsi_type = MAC_SCSI_OLD,
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_PB170,
685 .name = "PowerBook 170",
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_PB180,
694 .name = "PowerBook 180",
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_PB180C,
703 .name = "PowerBook 180c",
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_PB190,
712 .name = "PowerBook 190",
713 .adb_type = MAC_ADB_PB2,
714 .via_type = MAC_VIA_QUADRA,
715 .scsi_type = MAC_SCSI_OLD,
716 .ide_type = MAC_IDE_BABOON,
717 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100718 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100719 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700720 }, {
721 .ident = MAC_MODEL_PB520,
722 .name = "PowerBook 520",
723 .adb_type = MAC_ADB_PB2,
724 .via_type = MAC_VIA_QUADRA,
725 .scsi_type = MAC_SCSI_OLD,
726 .scc_type = MAC_SCC_QUADRA,
727 .ether_type = MAC_ETHER_SONIC,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100728 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100729 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700730 },
731
732 /*
733 * PowerBook Duos are pretty much like normal PowerBooks
734 * All of these probably have onboard SONIC in the Dock which
735 * means we'll have to probe for it eventually.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700736 */
737
738 {
739 .ident = MAC_MODEL_PB210,
740 .name = "PowerBook Duo 210",
741 .adb_type = MAC_ADB_PB2,
Finn Thain608e2872011-10-24 01:11:22 +1100742 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700743 .scsi_type = MAC_SCSI_OLD,
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_PB230,
749 .name = "PowerBook Duo 230",
750 .adb_type = MAC_ADB_PB2,
Finn Thain608e2872011-10-24 01:11:22 +1100751 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700752 .scsi_type = MAC_SCSI_OLD,
753 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100754 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100755 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700756 }, {
757 .ident = MAC_MODEL_PB250,
758 .name = "PowerBook Duo 250",
759 .adb_type = MAC_ADB_PB2,
Finn Thain608e2872011-10-24 01:11:22 +1100760 .via_type = MAC_VIA_IICI,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700761 .scsi_type = MAC_SCSI_OLD,
762 .scc_type = MAC_SCC_QUADRA,
Laurent Vivier7ad93b42008-11-06 20:57:41 +0100763 .nubus_type = MAC_NUBUS,
Finn Thain53aac0a2009-11-04 00:39:09 +1100764 .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700765 }, {
766 .ident = MAC_MODEL_PB270C,
767 .name = "PowerBook Duo 270c",
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_PB280,
776 .name = "PowerBook Duo 280",
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_PB280C,
785 .name = "PowerBook Duo 280c",
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
794 /*
Finn Thain53aac0a2009-11-04 00:39:09 +1100795 * Other stuff?
Linus Torvalds1da177e2005-04-16 15:20:36 -0700796 */
Finn Thain53aac0a2009-11-04 00:39:09 +1100797
Linus Torvalds1da177e2005-04-16 15:20:36 -0700798 {
799 .ident = -1
800 }
801};
802
Finn Thain80614e52009-11-17 20:06:48 +1100803static struct resource scc_a_rsrcs[] = {
804 { .flags = IORESOURCE_MEM },
805 { .flags = IORESOURCE_IRQ },
806};
807
808static struct resource scc_b_rsrcs[] = {
809 { .flags = IORESOURCE_MEM },
810 { .flags = IORESOURCE_IRQ },
811};
812
813struct platform_device scc_a_pdev = {
814 .name = "scc",
815 .id = 0,
816 .num_resources = ARRAY_SIZE(scc_a_rsrcs),
817 .resource = scc_a_rsrcs,
818};
819EXPORT_SYMBOL(scc_a_pdev);
820
821struct platform_device scc_b_pdev = {
822 .name = "scc",
823 .id = 1,
824 .num_resources = ARRAY_SIZE(scc_b_rsrcs),
825 .resource = scc_b_rsrcs,
826};
827EXPORT_SYMBOL(scc_b_pdev);
828
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200829static void __init mac_identify(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700830{
831 struct mac_model *m;
832
833 /* Penguin data useful? */
834 int model = mac_bi_data.id;
835 if (!model) {
836 /* no bootinfo model id -> NetBSD booter was used! */
837 /* XXX FIXME: breaks for model > 31 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200838 model = (mac_bi_data.cpuid >> 2) & 63;
Finn Thain53aac0a2009-11-04 00:39:09 +1100839 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead "
840 "(obsolete bootloader?)\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700841 }
842
843 macintosh_config = mac_data_table;
Roman Zippel6ff58012007-05-01 22:32:43 +0200844 for (m = macintosh_config; m->ident != -1; m++) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700845 if (m->ident == model) {
846 macintosh_config = m;
847 break;
848 }
849 }
850
Finn Thain80614e52009-11-17 20:06:48 +1100851 /* Set up serial port resources for the console initcall. */
852
853 scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
854 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
855 scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
856 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
857
858 switch (macintosh_config->scc_type) {
859 case MAC_SCC_PSC:
860 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
861 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
862 break;
863 default:
Finn Thainda3fb3c2011-10-24 01:11:18 +1100864 /* On non-PSC machines, the serial ports share an IRQ. */
865 if (macintosh_config->ident == MAC_MODEL_IIFX) {
866 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
867 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
868 } else {
869 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
870 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
871 }
Finn Thain80614e52009-11-17 20:06:48 +1100872 break;
873 }
874
Finn Thain53aac0a2009-11-04 00:39:09 +1100875 /*
876 * We need to pre-init the IOPs, if any. Otherwise
877 * the serial console won't work if the user had
878 * the serial ports set to "Faster" mode in MacOS.
879 */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700880 iop_preinit();
Linus Torvalds1da177e2005-04-16 15:20:36 -0700881
Frans Popb9b0d8b2010-02-06 18:47:11 +0100882 printk(KERN_INFO "Detected Macintosh model: %d\n", model);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700883
884 /*
885 * Report booter data:
886 */
Roman Zippel6ff58012007-05-01 22:32:43 +0200887 printk(KERN_DEBUG " Penguin bootinfo data:\n");
Finn Thain53aac0a2009-11-04 00:39:09 +1100888 printk(KERN_DEBUG " Video: addr 0x%lx "
889 "row 0x%lx depth %lx dimensions %ld x %ld\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700890 mac_bi_data.videoaddr, mac_bi_data.videorow,
891 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
892 mac_bi_data.dimensions >> 16);
Frans Popb9b0d8b2010-02-06 18:47:11 +0100893 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700894 mac_bi_data.videological, mac_orig_videoaddr,
895 mac_bi_data.sccbase);
Frans Popb9b0d8b2010-02-06 18:47:11 +0100896 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700897 mac_bi_data.boottime, mac_bi_data.gmtbias);
Frans Popb9b0d8b2010-02-06 18:47:11 +0100898 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
Linus Torvalds1da177e2005-04-16 15:20:36 -0700899 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700900
Linus Torvalds1da177e2005-04-16 15:20:36 -0700901 iop_init();
902 via_init();
903 oss_init();
904 psc_init();
905 baboon_init();
Finn Thain18814ee2009-11-17 20:03:05 +1100906
907#ifdef CONFIG_ADB_CUDA
908 find_via_cuda();
909#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700910}
911
Adrian Bunk8dfbdf42008-07-17 21:16:25 +0200912static void __init mac_report_hardware(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700913{
914 printk(KERN_INFO "Apple Macintosh %s\n", macintosh_config->name);
915}
916
917static void mac_get_model(char *str)
918{
Roman Zippel6ff58012007-05-01 22:32:43 +0200919 strcpy(str, "Macintosh ");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700920 strcat(str, macintosh_config->name);
921}
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100922
Finn Thain2724daf2009-11-04 00:39:56 +1100923static struct resource swim_rsrc = { .flags = IORESOURCE_MEM };
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100924
Finn Thain2724daf2009-11-04 00:39:56 +1100925static struct platform_device swim_pdev = {
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100926 .name = "swim",
927 .id = -1,
Finn Thain2724daf2009-11-04 00:39:56 +1100928 .num_resources = 1,
929 .resource = &swim_rsrc,
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100930};
931
Finn Thaincff75f12009-11-04 00:41:35 +1100932static struct platform_device esp_0_pdev = {
933 .name = "mac_esp",
934 .id = 0,
935};
936
937static struct platform_device esp_1_pdev = {
938 .name = "mac_esp",
939 .id = 1,
940};
941
Finn Thaineeb9c182009-11-04 00:42:02 +1100942static struct platform_device sonic_pdev = {
943 .name = "macsonic",
944 .id = -1,
945};
946
947static struct platform_device mace_pdev = {
948 .name = "macmace",
949 .id = -1,
950};
951
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100952int __init mac_platform_init(void)
953{
954 u8 *swim_base;
955
Geert Uytterhoeven6cfeba52012-03-18 13:21:38 +0100956 if (!MACH_IS_MAC)
957 return -ENODEV;
958
Finn Thain2724daf2009-11-04 00:39:56 +1100959 /*
Finn Thain80614e52009-11-17 20:06:48 +1100960 * Serial devices
961 */
962
963 platform_device_register(&scc_a_pdev);
964 platform_device_register(&scc_b_pdev);
965
966 /*
Finn Thain2724daf2009-11-04 00:39:56 +1100967 * Floppy device
968 */
969
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100970 switch (macintosh_config->floppy_type) {
971 case MAC_FLOPPY_SWIM_ADDR1:
972 swim_base = (u8 *)(VIA1_BASE + 0x1E000);
973 break;
974 case MAC_FLOPPY_SWIM_ADDR2:
975 swim_base = (u8 *)(VIA1_BASE + 0x16000);
976 break;
977 default:
Finn Thain2724daf2009-11-04 00:39:56 +1100978 swim_base = NULL;
979 break;
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100980 }
981
Finn Thain2724daf2009-11-04 00:39:56 +1100982 if (swim_base) {
983 swim_rsrc.start = (resource_size_t) swim_base,
984 swim_rsrc.end = (resource_size_t) swim_base + 0x2000,
985 platform_device_register(&swim_pdev);
986 }
Laurent Vivier8852ecd2008-11-15 16:10:10 +0100987
Finn Thaincff75f12009-11-04 00:41:35 +1100988 /*
989 * SCSI device(s)
990 */
991
992 switch (macintosh_config->scsi_type) {
993 case MAC_SCSI_QUADRA:
994 case MAC_SCSI_QUADRA3:
995 platform_device_register(&esp_0_pdev);
996 break;
997 case MAC_SCSI_QUADRA2:
998 platform_device_register(&esp_0_pdev);
999 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
1000 (macintosh_config->ident == MAC_MODEL_Q950))
1001 platform_device_register(&esp_1_pdev);
1002 break;
1003 }
1004
Finn Thaineeb9c182009-11-04 00:42:02 +11001005 /*
1006 * Ethernet device
1007 */
1008
1009 switch (macintosh_config->ether_type) {
1010 case MAC_ETHER_SONIC:
1011 platform_device_register(&sonic_pdev);
1012 break;
1013 case MAC_ETHER_MACE:
1014 platform_device_register(&mace_pdev);
1015 break;
1016 }
1017
Finn Thain2724daf2009-11-04 00:39:56 +11001018 return 0;
Laurent Vivier8852ecd2008-11-15 16:10:10 +01001019}
1020
1021arch_initcall(mac_platform_init);