1 /* 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 13 #include <linux/errno.h> 14 #include <linux/module.h> 15 #include <linux/types.h> 16 #include <linux/mm.h> 17 #include <linux/tty.h> 18 #include <linux/console.h> 19 #include <linux/interrupt.h> 20 /* keyb */ 21 #include <linux/random.h> 22 #include <linux/delay.h> 23 /* keyb */ 24 #include <linux/init.h> 25 #include <linux/vt_kern.h> 26 #include <linux/platform_device.h> 27 #include <linux/ata_platform.h> 28 #include <linux/adb.h> 29 #include <linux/cuda.h> 30 #include <linux/pmu.h> 31 #include <linux/rtc.h> 32 33 #include <asm/setup.h> 34 #include <asm/bootinfo.h> 35 #include <asm/bootinfo-mac.h> 36 #include <asm/byteorder.h> 37 38 #include <asm/io.h> 39 #include <asm/irq.h> 40 #include <asm/machdep.h> 41 42 #include <asm/macintosh.h> 43 #include <asm/macints.h> 44 #include <asm/machw.h> 45 46 #include <asm/mac_iop.h> 47 #include <asm/mac_via.h> 48 #include <asm/mac_oss.h> 49 #include <asm/mac_psc.h> 50 #include <asm/config.h> 51 52 /* Mac bootinfo struct */ 53 struct mac_booter_data mac_bi_data; 54 55 /* The phys. video addr. - might be bogus on some machines */ 56 static unsigned long mac_orig_videoaddr; 57 58 extern int mac_hwclk(int, struct rtc_time *); 59 extern void iop_init(void); 60 extern void via_init(void); 61 extern void via_init_clock(void); 62 extern void oss_init(void); 63 extern void psc_init(void); 64 extern void baboon_init(void); 65 66 extern void mac_mksound(unsigned int, unsigned int); 67 68 static void mac_get_model(char *str); 69 static void mac_identify(void); 70 static void mac_report_hardware(void); 71 72 static void __init mac_sched_init(void) 73 { 74 via_init_clock(); 75 } 76 77 /* 78 * Parse a Macintosh-specific record in the bootinfo 79 */ 80 81 int __init mac_parse_bootinfo(const struct bi_record *record) 82 { 83 int unknown = 0; 84 const void *data = record->data; 85 86 switch (be16_to_cpu(record->tag)) { 87 case BI_MAC_MODEL: 88 mac_bi_data.id = be32_to_cpup(data); 89 break; 90 case BI_MAC_VADDR: 91 mac_bi_data.videoaddr = be32_to_cpup(data); 92 break; 93 case BI_MAC_VDEPTH: 94 mac_bi_data.videodepth = be32_to_cpup(data); 95 break; 96 case BI_MAC_VROW: 97 mac_bi_data.videorow = be32_to_cpup(data); 98 break; 99 case BI_MAC_VDIM: 100 mac_bi_data.dimensions = be32_to_cpup(data); 101 break; 102 case BI_MAC_VLOGICAL: 103 mac_orig_videoaddr = be32_to_cpup(data); 104 mac_bi_data.videological = 105 VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK); 106 break; 107 case BI_MAC_SCCBASE: 108 mac_bi_data.sccbase = be32_to_cpup(data); 109 break; 110 case BI_MAC_BTIME: 111 mac_bi_data.boottime = be32_to_cpup(data); 112 break; 113 case BI_MAC_GMTBIAS: 114 mac_bi_data.gmtbias = be32_to_cpup(data); 115 break; 116 case BI_MAC_MEMSIZE: 117 mac_bi_data.memsize = be32_to_cpup(data); 118 break; 119 case BI_MAC_CPUID: 120 mac_bi_data.cpuid = be32_to_cpup(data); 121 break; 122 case BI_MAC_ROMBASE: 123 mac_bi_data.rombase = be32_to_cpup(data); 124 break; 125 default: 126 unknown = 1; 127 break; 128 } 129 return unknown; 130 } 131 132 void __init config_mac(void) 133 { 134 if (!MACH_IS_MAC) 135 pr_err("ERROR: no Mac, but config_mac() called!!\n"); 136 137 mach_sched_init = mac_sched_init; 138 mach_init_IRQ = mac_init_IRQ; 139 mach_get_model = mac_get_model; 140 mach_hwclk = mac_hwclk; 141 mach_reset = mac_reset; 142 mach_halt = mac_poweroff; 143 mach_power_off = mac_poweroff; 144 #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP) 145 mach_beep = mac_mksound; 146 #endif 147 148 /* 149 * Determine hardware present 150 */ 151 152 mac_identify(); 153 mac_report_hardware(); 154 155 /* 156 * AFAIK only the IIci takes a cache card. The IIfx has onboard 157 * cache ... someone needs to figure out how to tell if it's on or 158 * not. 159 */ 160 161 if (macintosh_config->ident == MAC_MODEL_IICI) 162 mach_l2_flush = via_l2_flush; 163 } 164 165 166 /* 167 * Macintosh Table: hardcoded model configuration data. 168 * 169 * Much of this was defined by Alan, based on who knows what docs. 170 * I've added a lot more, and some of that was pure guesswork based 171 * on hardware pages present on the Mac web site. Possibly wildly 172 * inaccurate, so look here if a new Mac model won't run. Example: if 173 * a Mac crashes immediately after the VIA1 registers have been dumped 174 * to the screen, it probably died attempting to read DirB on a RBV. 175 * Meaning it should have MAC_VIA_IICI here :-) 176 */ 177 178 struct mac_model *macintosh_config; 179 EXPORT_SYMBOL(macintosh_config); 180 181 static struct mac_model mac_data_table[] = { 182 /* 183 * We'll pretend to be a Macintosh II, that's pretty safe. 184 */ 185 186 { 187 .ident = MAC_MODEL_II, 188 .name = "Unknown", 189 .adb_type = MAC_ADB_II, 190 .via_type = MAC_VIA_II, 191 .scsi_type = MAC_SCSI_OLD, 192 .scc_type = MAC_SCC_II, 193 .expansion_type = MAC_EXP_NUBUS, 194 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */ 195 }, 196 197 /* 198 * Original Mac II hardware 199 */ 200 201 { 202 .ident = MAC_MODEL_II, 203 .name = "II", 204 .adb_type = MAC_ADB_II, 205 .via_type = MAC_VIA_II, 206 .scsi_type = MAC_SCSI_OLD, 207 .scc_type = MAC_SCC_II, 208 .expansion_type = MAC_EXP_NUBUS, 209 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* IWM */ 210 }, { 211 .ident = MAC_MODEL_IIX, 212 .name = "IIx", 213 .adb_type = MAC_ADB_II, 214 .via_type = MAC_VIA_II, 215 .scsi_type = MAC_SCSI_OLD, 216 .scc_type = MAC_SCC_II, 217 .expansion_type = MAC_EXP_NUBUS, 218 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 219 }, { 220 .ident = MAC_MODEL_IICX, 221 .name = "IIcx", 222 .adb_type = MAC_ADB_II, 223 .via_type = MAC_VIA_II, 224 .scsi_type = MAC_SCSI_OLD, 225 .scc_type = MAC_SCC_II, 226 .expansion_type = MAC_EXP_NUBUS, 227 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 228 }, { 229 .ident = MAC_MODEL_SE30, 230 .name = "SE/30", 231 .adb_type = MAC_ADB_II, 232 .via_type = MAC_VIA_II, 233 .scsi_type = MAC_SCSI_OLD, 234 .scc_type = MAC_SCC_II, 235 .expansion_type = MAC_EXP_PDS, 236 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 237 }, 238 239 /* 240 * Weirdified Mac II hardware - all subtly different. Gee thanks 241 * Apple. All these boxes seem to have VIA2 in a different place to 242 * the Mac II (+1A000 rather than +4000) 243 * CSA: see http://developer.apple.com/technotes/hw/hw_09.html 244 */ 245 246 { 247 .ident = MAC_MODEL_IICI, 248 .name = "IIci", 249 .adb_type = MAC_ADB_II, 250 .via_type = MAC_VIA_IICI, 251 .scsi_type = MAC_SCSI_OLD, 252 .scc_type = MAC_SCC_II, 253 .expansion_type = MAC_EXP_NUBUS, 254 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 255 }, { 256 .ident = MAC_MODEL_IIFX, 257 .name = "IIfx", 258 .adb_type = MAC_ADB_IOP, 259 .via_type = MAC_VIA_IICI, 260 .scsi_type = MAC_SCSI_IIFX, 261 .scc_type = MAC_SCC_IOP, 262 .expansion_type = MAC_EXP_PDS_NUBUS, 263 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */ 264 }, { 265 .ident = MAC_MODEL_IISI, 266 .name = "IIsi", 267 .adb_type = MAC_ADB_EGRET, 268 .via_type = MAC_VIA_IICI, 269 .scsi_type = MAC_SCSI_OLD, 270 .scc_type = MAC_SCC_II, 271 .expansion_type = MAC_EXP_PDS_NUBUS, 272 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 273 }, { 274 .ident = MAC_MODEL_IIVI, 275 .name = "IIvi", 276 .adb_type = MAC_ADB_EGRET, 277 .via_type = MAC_VIA_IICI, 278 .scsi_type = MAC_SCSI_LC, 279 .scc_type = MAC_SCC_II, 280 .expansion_type = MAC_EXP_NUBUS, 281 .floppy_type = MAC_FLOPPY_LC, /* SWIM */ 282 }, { 283 .ident = MAC_MODEL_IIVX, 284 .name = "IIvx", 285 .adb_type = MAC_ADB_EGRET, 286 .via_type = MAC_VIA_IICI, 287 .scsi_type = MAC_SCSI_LC, 288 .scc_type = MAC_SCC_II, 289 .expansion_type = MAC_EXP_NUBUS, 290 .floppy_type = MAC_FLOPPY_LC, /* SWIM */ 291 }, 292 293 /* 294 * Classic models (guessing: similar to SE/30? Nope, similar to LC...) 295 */ 296 297 { 298 .ident = MAC_MODEL_CLII, 299 .name = "Classic II", 300 .adb_type = MAC_ADB_EGRET, 301 .via_type = MAC_VIA_IICI, 302 .scsi_type = MAC_SCSI_LC, 303 .scc_type = MAC_SCC_II, 304 .floppy_type = MAC_FLOPPY_LC, /* SWIM */ 305 }, { 306 .ident = MAC_MODEL_CCL, 307 .name = "Color Classic", 308 .adb_type = MAC_ADB_CUDA, 309 .via_type = MAC_VIA_IICI, 310 .scsi_type = MAC_SCSI_LC, 311 .scc_type = MAC_SCC_II, 312 .expansion_type = MAC_EXP_PDS, 313 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */ 314 }, { 315 .ident = MAC_MODEL_CCLII, 316 .name = "Color Classic II", 317 .adb_type = MAC_ADB_CUDA, 318 .via_type = MAC_VIA_IICI, 319 .scsi_type = MAC_SCSI_LC, 320 .scc_type = MAC_SCC_II, 321 .expansion_type = MAC_EXP_PDS, 322 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */ 323 }, 324 325 /* 326 * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi 327 */ 328 329 { 330 .ident = MAC_MODEL_LC, 331 .name = "LC", 332 .adb_type = MAC_ADB_EGRET, 333 .via_type = MAC_VIA_IICI, 334 .scsi_type = MAC_SCSI_LC, 335 .scc_type = MAC_SCC_II, 336 .expansion_type = MAC_EXP_PDS, 337 .floppy_type = MAC_FLOPPY_LC, /* SWIM */ 338 }, { 339 .ident = MAC_MODEL_LCII, 340 .name = "LC II", 341 .adb_type = MAC_ADB_EGRET, 342 .via_type = MAC_VIA_IICI, 343 .scsi_type = MAC_SCSI_LC, 344 .scc_type = MAC_SCC_II, 345 .expansion_type = MAC_EXP_PDS, 346 .floppy_type = MAC_FLOPPY_LC, /* SWIM */ 347 }, { 348 .ident = MAC_MODEL_LCIII, 349 .name = "LC III", 350 .adb_type = MAC_ADB_EGRET, 351 .via_type = MAC_VIA_IICI, 352 .scsi_type = MAC_SCSI_LC, 353 .scc_type = MAC_SCC_II, 354 .expansion_type = MAC_EXP_PDS, 355 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */ 356 }, 357 358 /* 359 * Quadra. Video is at 0xF9000000, via is like a MacII. We label it 360 * differently as some of the stuff connected to VIA2 seems different. 361 * Better SCSI chip and onboard ethernet using a NatSemi SONIC except 362 * the 660AV and 840AV which use an AMD 79C940 (MACE). 363 * The 700, 900 and 950 have some I/O chips in the wrong place to 364 * confuse us. The 840AV has a SCSI location of its own (same as 365 * the 660AV). 366 */ 367 368 { 369 .ident = MAC_MODEL_Q605, 370 .name = "Quadra 605", 371 .adb_type = MAC_ADB_CUDA, 372 .via_type = MAC_VIA_QUADRA, 373 .scsi_type = MAC_SCSI_QUADRA, 374 .scc_type = MAC_SCC_QUADRA, 375 .expansion_type = MAC_EXP_PDS, 376 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 377 }, { 378 .ident = MAC_MODEL_Q605_ACC, 379 .name = "Quadra 605", 380 .adb_type = MAC_ADB_CUDA, 381 .via_type = MAC_VIA_QUADRA, 382 .scsi_type = MAC_SCSI_QUADRA, 383 .scc_type = MAC_SCC_QUADRA, 384 .expansion_type = MAC_EXP_PDS, 385 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 386 }, { 387 .ident = MAC_MODEL_Q610, 388 .name = "Quadra 610", 389 .adb_type = MAC_ADB_II, 390 .via_type = MAC_VIA_QUADRA, 391 .scsi_type = MAC_SCSI_QUADRA, 392 .scc_type = MAC_SCC_QUADRA, 393 .ether_type = MAC_ETHER_SONIC, 394 .expansion_type = MAC_EXP_PDS_NUBUS, 395 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 396 }, { 397 .ident = MAC_MODEL_Q630, 398 .name = "Quadra 630", 399 .adb_type = MAC_ADB_CUDA, 400 .via_type = MAC_VIA_QUADRA, 401 .scsi_type = MAC_SCSI_QUADRA, 402 .ide_type = MAC_IDE_QUADRA, 403 .scc_type = MAC_SCC_QUADRA, 404 .expansion_type = MAC_EXP_PDS_COMM, 405 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 406 }, { 407 .ident = MAC_MODEL_Q650, 408 .name = "Quadra 650", 409 .adb_type = MAC_ADB_II, 410 .via_type = MAC_VIA_QUADRA, 411 .scsi_type = MAC_SCSI_QUADRA, 412 .scc_type = MAC_SCC_QUADRA, 413 .ether_type = MAC_ETHER_SONIC, 414 .expansion_type = MAC_EXP_PDS_NUBUS, 415 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 416 }, 417 /* The Q700 does have a NS Sonic */ 418 { 419 .ident = MAC_MODEL_Q700, 420 .name = "Quadra 700", 421 .adb_type = MAC_ADB_II, 422 .via_type = MAC_VIA_QUADRA, 423 .scsi_type = MAC_SCSI_QUADRA2, 424 .scc_type = MAC_SCC_QUADRA, 425 .ether_type = MAC_ETHER_SONIC, 426 .expansion_type = MAC_EXP_PDS_NUBUS, 427 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM */ 428 }, { 429 .ident = MAC_MODEL_Q800, 430 .name = "Quadra 800", 431 .adb_type = MAC_ADB_II, 432 .via_type = MAC_VIA_QUADRA, 433 .scsi_type = MAC_SCSI_QUADRA, 434 .scc_type = MAC_SCC_QUADRA, 435 .ether_type = MAC_ETHER_SONIC, 436 .expansion_type = MAC_EXP_PDS_NUBUS, 437 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 438 }, { 439 .ident = MAC_MODEL_Q840, 440 .name = "Quadra 840AV", 441 .adb_type = MAC_ADB_CUDA, 442 .via_type = MAC_VIA_QUADRA, 443 .scsi_type = MAC_SCSI_QUADRA3, 444 .scc_type = MAC_SCC_PSC, 445 .ether_type = MAC_ETHER_MACE, 446 .expansion_type = MAC_EXP_NUBUS, 447 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */ 448 }, { 449 .ident = MAC_MODEL_Q900, 450 .name = "Quadra 900", 451 .adb_type = MAC_ADB_IOP, 452 .via_type = MAC_VIA_QUADRA, 453 .scsi_type = MAC_SCSI_QUADRA2, 454 .scc_type = MAC_SCC_IOP, 455 .ether_type = MAC_ETHER_SONIC, 456 .expansion_type = MAC_EXP_PDS_NUBUS, 457 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */ 458 }, { 459 .ident = MAC_MODEL_Q950, 460 .name = "Quadra 950", 461 .adb_type = MAC_ADB_IOP, 462 .via_type = MAC_VIA_QUADRA, 463 .scsi_type = MAC_SCSI_QUADRA2, 464 .scc_type = MAC_SCC_IOP, 465 .ether_type = MAC_ETHER_SONIC, 466 .expansion_type = MAC_EXP_PDS_NUBUS, 467 .floppy_type = MAC_FLOPPY_SWIM_IOP, /* SWIM */ 468 }, 469 470 /* 471 * Performa - more LC type machines 472 */ 473 474 { 475 .ident = MAC_MODEL_P460, 476 .name = "Performa 460", 477 .adb_type = MAC_ADB_EGRET, 478 .via_type = MAC_VIA_IICI, 479 .scsi_type = MAC_SCSI_LC, 480 .scc_type = MAC_SCC_II, 481 .expansion_type = MAC_EXP_PDS, 482 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */ 483 }, { 484 .ident = MAC_MODEL_P475, 485 .name = "Performa 475", 486 .adb_type = MAC_ADB_CUDA, 487 .via_type = MAC_VIA_QUADRA, 488 .scsi_type = MAC_SCSI_QUADRA, 489 .scc_type = MAC_SCC_II, 490 .expansion_type = MAC_EXP_PDS, 491 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 492 }, { 493 .ident = MAC_MODEL_P475F, 494 .name = "Performa 475", 495 .adb_type = MAC_ADB_CUDA, 496 .via_type = MAC_VIA_QUADRA, 497 .scsi_type = MAC_SCSI_QUADRA, 498 .scc_type = MAC_SCC_II, 499 .expansion_type = MAC_EXP_PDS, 500 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 501 }, { 502 .ident = MAC_MODEL_P520, 503 .name = "Performa 520", 504 .adb_type = MAC_ADB_CUDA, 505 .via_type = MAC_VIA_IICI, 506 .scsi_type = MAC_SCSI_LC, 507 .scc_type = MAC_SCC_II, 508 .expansion_type = MAC_EXP_PDS, 509 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */ 510 }, { 511 .ident = MAC_MODEL_P550, 512 .name = "Performa 550", 513 .adb_type = MAC_ADB_CUDA, 514 .via_type = MAC_VIA_IICI, 515 .scsi_type = MAC_SCSI_LC, 516 .scc_type = MAC_SCC_II, 517 .expansion_type = MAC_EXP_PDS, 518 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */ 519 }, 520 /* These have the comm slot, and therefore possibly SONIC ethernet */ 521 { 522 .ident = MAC_MODEL_P575, 523 .name = "Performa 575", 524 .adb_type = MAC_ADB_CUDA, 525 .via_type = MAC_VIA_QUADRA, 526 .scsi_type = MAC_SCSI_QUADRA, 527 .scc_type = MAC_SCC_II, 528 .expansion_type = MAC_EXP_PDS_COMM, 529 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 530 }, { 531 .ident = MAC_MODEL_P588, 532 .name = "Performa 588", 533 .adb_type = MAC_ADB_CUDA, 534 .via_type = MAC_VIA_QUADRA, 535 .scsi_type = MAC_SCSI_QUADRA, 536 .ide_type = MAC_IDE_QUADRA, 537 .scc_type = MAC_SCC_II, 538 .expansion_type = MAC_EXP_PDS_COMM, 539 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 540 }, { 541 .ident = MAC_MODEL_TV, 542 .name = "TV", 543 .adb_type = MAC_ADB_CUDA, 544 .via_type = MAC_VIA_IICI, 545 .scsi_type = MAC_SCSI_LC, 546 .scc_type = MAC_SCC_II, 547 .floppy_type = MAC_FLOPPY_LC, /* SWIM 2 */ 548 }, { 549 .ident = MAC_MODEL_P600, 550 .name = "Performa 600", 551 .adb_type = MAC_ADB_EGRET, 552 .via_type = MAC_VIA_IICI, 553 .scsi_type = MAC_SCSI_LC, 554 .scc_type = MAC_SCC_II, 555 .expansion_type = MAC_EXP_NUBUS, 556 .floppy_type = MAC_FLOPPY_LC, /* SWIM */ 557 }, 558 559 /* 560 * Centris - just guessing again; maybe like Quadra. 561 * The C610 may or may not have SONIC. We probe to make sure. 562 */ 563 564 { 565 .ident = MAC_MODEL_C610, 566 .name = "Centris 610", 567 .adb_type = MAC_ADB_II, 568 .via_type = MAC_VIA_QUADRA, 569 .scsi_type = MAC_SCSI_QUADRA, 570 .scc_type = MAC_SCC_QUADRA, 571 .ether_type = MAC_ETHER_SONIC, 572 .expansion_type = MAC_EXP_PDS_NUBUS, 573 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 574 }, { 575 .ident = MAC_MODEL_C650, 576 .name = "Centris 650", 577 .adb_type = MAC_ADB_II, 578 .via_type = MAC_VIA_QUADRA, 579 .scsi_type = MAC_SCSI_QUADRA, 580 .scc_type = MAC_SCC_QUADRA, 581 .ether_type = MAC_ETHER_SONIC, 582 .expansion_type = MAC_EXP_PDS_NUBUS, 583 .floppy_type = MAC_FLOPPY_QUADRA, /* SWIM 2 */ 584 }, { 585 .ident = MAC_MODEL_C660, 586 .name = "Centris 660AV", 587 .adb_type = MAC_ADB_CUDA, 588 .via_type = MAC_VIA_QUADRA, 589 .scsi_type = MAC_SCSI_QUADRA3, 590 .scc_type = MAC_SCC_PSC, 591 .ether_type = MAC_ETHER_MACE, 592 .expansion_type = MAC_EXP_PDS_NUBUS, 593 .floppy_type = MAC_FLOPPY_UNSUPPORTED, /* New Age */ 594 }, 595 596 /* 597 * The PowerBooks all the same "Combo" custom IC for SCSI and SCC 598 * and a PMU (in two variations?) for ADB. Most of them use the 599 * Quadra-style VIAs. A few models also have IDE from hell. 600 */ 601 602 { 603 .ident = MAC_MODEL_PB140, 604 .name = "PowerBook 140", 605 .adb_type = MAC_ADB_PB1, 606 .via_type = MAC_VIA_QUADRA, 607 .scsi_type = MAC_SCSI_OLD, 608 .scc_type = MAC_SCC_QUADRA, 609 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 610 }, { 611 .ident = MAC_MODEL_PB145, 612 .name = "PowerBook 145", 613 .adb_type = MAC_ADB_PB1, 614 .via_type = MAC_VIA_QUADRA, 615 .scsi_type = MAC_SCSI_OLD, 616 .scc_type = MAC_SCC_QUADRA, 617 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 618 }, { 619 .ident = MAC_MODEL_PB150, 620 .name = "PowerBook 150", 621 .adb_type = MAC_ADB_PB2, 622 .via_type = MAC_VIA_IICI, 623 .scsi_type = MAC_SCSI_OLD, 624 .ide_type = MAC_IDE_PB, 625 .scc_type = MAC_SCC_QUADRA, 626 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 627 }, { 628 .ident = MAC_MODEL_PB160, 629 .name = "PowerBook 160", 630 .adb_type = MAC_ADB_PB1, 631 .via_type = MAC_VIA_QUADRA, 632 .scsi_type = MAC_SCSI_OLD, 633 .scc_type = MAC_SCC_QUADRA, 634 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 635 }, { 636 .ident = MAC_MODEL_PB165, 637 .name = "PowerBook 165", 638 .adb_type = MAC_ADB_PB1, 639 .via_type = MAC_VIA_QUADRA, 640 .scsi_type = MAC_SCSI_OLD, 641 .scc_type = MAC_SCC_QUADRA, 642 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 643 }, { 644 .ident = MAC_MODEL_PB165C, 645 .name = "PowerBook 165c", 646 .adb_type = MAC_ADB_PB1, 647 .via_type = MAC_VIA_QUADRA, 648 .scsi_type = MAC_SCSI_OLD, 649 .scc_type = MAC_SCC_QUADRA, 650 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 651 }, { 652 .ident = MAC_MODEL_PB170, 653 .name = "PowerBook 170", 654 .adb_type = MAC_ADB_PB1, 655 .via_type = MAC_VIA_QUADRA, 656 .scsi_type = MAC_SCSI_OLD, 657 .scc_type = MAC_SCC_QUADRA, 658 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 659 }, { 660 .ident = MAC_MODEL_PB180, 661 .name = "PowerBook 180", 662 .adb_type = MAC_ADB_PB1, 663 .via_type = MAC_VIA_QUADRA, 664 .scsi_type = MAC_SCSI_OLD, 665 .scc_type = MAC_SCC_QUADRA, 666 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 667 }, { 668 .ident = MAC_MODEL_PB180C, 669 .name = "PowerBook 180c", 670 .adb_type = MAC_ADB_PB1, 671 .via_type = MAC_VIA_QUADRA, 672 .scsi_type = MAC_SCSI_OLD, 673 .scc_type = MAC_SCC_QUADRA, 674 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 675 }, { 676 .ident = MAC_MODEL_PB190, 677 .name = "PowerBook 190", 678 .adb_type = MAC_ADB_PB2, 679 .via_type = MAC_VIA_QUADRA, 680 .scsi_type = MAC_SCSI_OLD, 681 .ide_type = MAC_IDE_BABOON, 682 .scc_type = MAC_SCC_QUADRA, 683 .floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */ 684 }, { 685 .ident = MAC_MODEL_PB520, 686 .name = "PowerBook 520", 687 .adb_type = MAC_ADB_PB2, 688 .via_type = MAC_VIA_QUADRA, 689 .scsi_type = MAC_SCSI_OLD, 690 .scc_type = MAC_SCC_QUADRA, 691 .ether_type = MAC_ETHER_SONIC, 692 .floppy_type = MAC_FLOPPY_OLD, /* SWIM 2 */ 693 }, 694 695 /* 696 * PowerBook Duos are pretty much like normal PowerBooks 697 * All of these probably have onboard SONIC in the Dock which 698 * means we'll have to probe for it eventually. 699 */ 700 701 { 702 .ident = MAC_MODEL_PB210, 703 .name = "PowerBook Duo 210", 704 .adb_type = MAC_ADB_PB2, 705 .via_type = MAC_VIA_IICI, 706 .scsi_type = MAC_SCSI_DUO, 707 .scc_type = MAC_SCC_QUADRA, 708 .expansion_type = MAC_EXP_NUBUS, 709 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 710 }, { 711 .ident = MAC_MODEL_PB230, 712 .name = "PowerBook Duo 230", 713 .adb_type = MAC_ADB_PB2, 714 .via_type = MAC_VIA_IICI, 715 .scsi_type = MAC_SCSI_DUO, 716 .scc_type = MAC_SCC_QUADRA, 717 .expansion_type = MAC_EXP_NUBUS, 718 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 719 }, { 720 .ident = MAC_MODEL_PB250, 721 .name = "PowerBook Duo 250", 722 .adb_type = MAC_ADB_PB2, 723 .via_type = MAC_VIA_IICI, 724 .scsi_type = MAC_SCSI_DUO, 725 .scc_type = MAC_SCC_QUADRA, 726 .expansion_type = MAC_EXP_NUBUS, 727 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 728 }, { 729 .ident = MAC_MODEL_PB270C, 730 .name = "PowerBook Duo 270c", 731 .adb_type = MAC_ADB_PB2, 732 .via_type = MAC_VIA_IICI, 733 .scsi_type = MAC_SCSI_DUO, 734 .scc_type = MAC_SCC_QUADRA, 735 .expansion_type = MAC_EXP_NUBUS, 736 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 737 }, { 738 .ident = MAC_MODEL_PB280, 739 .name = "PowerBook Duo 280", 740 .adb_type = MAC_ADB_PB2, 741 .via_type = MAC_VIA_IICI, 742 .scsi_type = MAC_SCSI_DUO, 743 .scc_type = MAC_SCC_QUADRA, 744 .expansion_type = MAC_EXP_NUBUS, 745 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 746 }, { 747 .ident = MAC_MODEL_PB280C, 748 .name = "PowerBook Duo 280c", 749 .adb_type = MAC_ADB_PB2, 750 .via_type = MAC_VIA_IICI, 751 .scsi_type = MAC_SCSI_DUO, 752 .scc_type = MAC_SCC_QUADRA, 753 .expansion_type = MAC_EXP_NUBUS, 754 .floppy_type = MAC_FLOPPY_OLD, /* SWIM */ 755 }, 756 757 /* 758 * Other stuff? 759 */ 760 761 { 762 .ident = -1 763 } 764 }; 765 766 static struct resource scc_a_rsrcs[] = { 767 { .flags = IORESOURCE_MEM }, 768 { .flags = IORESOURCE_IRQ }, 769 }; 770 771 static struct resource scc_b_rsrcs[] = { 772 { .flags = IORESOURCE_MEM }, 773 { .flags = IORESOURCE_IRQ }, 774 }; 775 776 struct platform_device scc_a_pdev = { 777 .name = "scc", 778 .id = 0, 779 }; 780 EXPORT_SYMBOL(scc_a_pdev); 781 782 struct platform_device scc_b_pdev = { 783 .name = "scc", 784 .id = 1, 785 }; 786 EXPORT_SYMBOL(scc_b_pdev); 787 788 static void __init mac_identify(void) 789 { 790 struct mac_model *m; 791 792 /* Penguin data useful? */ 793 int model = mac_bi_data.id; 794 if (!model) { 795 /* no bootinfo model id -> NetBSD booter was used! */ 796 /* XXX FIXME: breaks for model > 31 */ 797 model = (mac_bi_data.cpuid >> 2) & 63; 798 pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n"); 799 } 800 801 macintosh_config = mac_data_table; 802 for (m = macintosh_config; m->ident != -1; m++) { 803 if (m->ident == model) { 804 macintosh_config = m; 805 break; 806 } 807 } 808 809 /* Set up serial port resources for the console initcall. */ 810 811 scc_a_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase + 2; 812 scc_a_rsrcs[0].end = scc_a_rsrcs[0].start; 813 scc_a_pdev.num_resources = ARRAY_SIZE(scc_a_rsrcs); 814 scc_a_pdev.resource = scc_a_rsrcs; 815 816 scc_b_rsrcs[0].start = (resource_size_t)mac_bi_data.sccbase; 817 scc_b_rsrcs[0].end = scc_b_rsrcs[0].start; 818 scc_b_pdev.num_resources = ARRAY_SIZE(scc_b_rsrcs); 819 scc_b_pdev.resource = scc_b_rsrcs; 820 821 switch (macintosh_config->scc_type) { 822 case MAC_SCC_PSC: 823 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A; 824 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B; 825 break; 826 default: 827 /* On non-PSC machines, the serial ports share an IRQ. */ 828 if (macintosh_config->ident == MAC_MODEL_IIFX) { 829 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC; 830 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC; 831 } else { 832 scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4; 833 scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4; 834 } 835 break; 836 } 837 838 pr_info("Detected Macintosh model: %d\n", model); 839 840 /* 841 * Report booter data: 842 */ 843 printk(KERN_DEBUG " Penguin bootinfo data:\n"); 844 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n", 845 mac_bi_data.videoaddr, mac_bi_data.videorow, 846 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF, 847 mac_bi_data.dimensions >> 16); 848 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n", 849 mac_bi_data.videological, mac_orig_videoaddr, 850 mac_bi_data.sccbase); 851 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n", 852 mac_bi_data.boottime, mac_bi_data.gmtbias); 853 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n", 854 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize); 855 856 iop_init(); 857 oss_init(); 858 via_init(); 859 psc_init(); 860 baboon_init(); 861 862 #ifdef CONFIG_ADB_CUDA 863 find_via_cuda(); 864 #endif 865 #ifdef CONFIG_ADB_PMU 866 find_via_pmu(); 867 #endif 868 } 869 870 static void __init mac_report_hardware(void) 871 { 872 pr_info("Apple Macintosh %s\n", macintosh_config->name); 873 } 874 875 static void mac_get_model(char *str) 876 { 877 strcpy(str, "Macintosh "); 878 strcat(str, macintosh_config->name); 879 } 880 881 static const struct resource mac_scsi_iifx_rsrc[] __initconst = { 882 { 883 .flags = IORESOURCE_IRQ, 884 .start = IRQ_MAC_SCSI, 885 .end = IRQ_MAC_SCSI, 886 }, { 887 .flags = IORESOURCE_MEM, 888 .start = 0x50008000, 889 .end = 0x50009FFF, 890 }, { 891 .flags = IORESOURCE_MEM, 892 .start = 0x50008000, 893 .end = 0x50009FFF, 894 }, 895 }; 896 897 static const struct resource mac_scsi_duo_rsrc[] __initconst = { 898 { 899 .flags = IORESOURCE_MEM, 900 .start = 0xFEE02000, 901 .end = 0xFEE03FFF, 902 }, 903 }; 904 905 static const struct resource mac_scsi_old_rsrc[] __initconst = { 906 { 907 .flags = IORESOURCE_IRQ, 908 .start = IRQ_MAC_SCSI, 909 .end = IRQ_MAC_SCSI, 910 }, { 911 .flags = IORESOURCE_MEM, 912 .start = 0x50010000, 913 .end = 0x50011FFF, 914 }, { 915 .flags = IORESOURCE_MEM, 916 .start = 0x50006000, 917 .end = 0x50007FFF, 918 }, 919 }; 920 921 static const struct resource mac_scsi_ccl_rsrc[] __initconst = { 922 { 923 .flags = IORESOURCE_IRQ, 924 .start = IRQ_MAC_SCSI, 925 .end = IRQ_MAC_SCSI, 926 }, { 927 .flags = IORESOURCE_MEM, 928 .start = 0x50F10000, 929 .end = 0x50F11FFF, 930 }, { 931 .flags = IORESOURCE_MEM, 932 .start = 0x50F06000, 933 .end = 0x50F07FFF, 934 }, 935 }; 936 937 static const struct resource mac_pata_quadra_rsrc[] __initconst = { 938 DEFINE_RES_MEM(0x50F1A000, 0x38), 939 DEFINE_RES_MEM(0x50F1A038, 0x04), 940 DEFINE_RES_IRQ(IRQ_NUBUS_F), 941 }; 942 943 static const struct resource mac_pata_pb_rsrc[] __initconst = { 944 DEFINE_RES_MEM(0x50F1A000, 0x38), 945 DEFINE_RES_MEM(0x50F1A038, 0x04), 946 DEFINE_RES_IRQ(IRQ_NUBUS_C), 947 }; 948 949 static const struct resource mac_pata_baboon_rsrc[] __initconst = { 950 DEFINE_RES_MEM(0x50F1A000, 0x38), 951 DEFINE_RES_MEM(0x50F1A038, 0x04), 952 DEFINE_RES_IRQ(IRQ_BABOON_1), 953 }; 954 955 static const struct pata_platform_info mac_pata_data __initconst = { 956 .ioport_shift = 2, 957 }; 958 959 int __init mac_platform_init(void) 960 { 961 phys_addr_t swim_base = 0; 962 963 if (!MACH_IS_MAC) 964 return -ENODEV; 965 966 /* 967 * Serial devices 968 */ 969 970 platform_device_register(&scc_a_pdev); 971 platform_device_register(&scc_b_pdev); 972 973 /* 974 * Floppy device 975 */ 976 977 switch (macintosh_config->floppy_type) { 978 case MAC_FLOPPY_QUADRA: 979 swim_base = 0x5001E000; 980 break; 981 case MAC_FLOPPY_OLD: 982 swim_base = 0x50016000; 983 break; 984 case MAC_FLOPPY_LC: 985 swim_base = 0x50F16000; 986 break; 987 } 988 989 if (swim_base) { 990 struct resource swim_rsrc = { 991 .flags = IORESOURCE_MEM, 992 .start = swim_base, 993 .end = swim_base + 0x1FFF, 994 }; 995 996 platform_device_register_simple("swim", -1, &swim_rsrc, 1); 997 } 998 999 /* 1000 * SCSI device(s) 1001 */ 1002 1003 switch (macintosh_config->scsi_type) { 1004 case MAC_SCSI_QUADRA: 1005 case MAC_SCSI_QUADRA3: 1006 platform_device_register_simple("mac_esp", 0, NULL, 0); 1007 break; 1008 case MAC_SCSI_QUADRA2: 1009 platform_device_register_simple("mac_esp", 0, NULL, 0); 1010 if ((macintosh_config->ident == MAC_MODEL_Q900) || 1011 (macintosh_config->ident == MAC_MODEL_Q950)) 1012 platform_device_register_simple("mac_esp", 1, NULL, 0); 1013 break; 1014 case MAC_SCSI_IIFX: 1015 /* Addresses from The Guide to Mac Family Hardware. 1016 * $5000 8000 - $5000 9FFF: SCSI DMA 1017 * $5000 A000 - $5000 BFFF: Alternate SCSI 1018 * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA) 1019 * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk) 1020 * The A/UX header file sys/uconfig.h says $50F0 8000. 1021 * The "SCSI DMA" custom IC embeds the 53C80 core and 1022 * supports Programmed IO, DMA and PDMA (hardware handshake). 1023 */ 1024 platform_device_register_simple("mac_scsi", 0, 1025 mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc)); 1026 break; 1027 case MAC_SCSI_DUO: 1028 /* Addresses from the Duo Dock II Developer Note. 1029 * $FEE0 2000 - $FEE0 3FFF: normal mode 1030 * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ 1031 * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ 1032 * The NetBSD code indicates that both 5380 chips share 1033 * an IRQ (?) which would need careful handling (see mac_esp). 1034 */ 1035 platform_device_register_simple("mac_scsi", 1, 1036 mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc)); 1037 fallthrough; 1038 case MAC_SCSI_OLD: 1039 /* Addresses from Developer Notes for Duo System, 1040 * PowerBook 180 & 160, 140 & 170, Macintosh IIsi 1041 * and also from The Guide to Mac Family Hardware for 1042 * SE/30, II, IIx, IIcx, IIci. 1043 * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ 1044 * $5001 0000 - $5001 1FFF: normal mode 1045 * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ 1046 * GMFH says that $5000 0000 - $50FF FFFF "wraps 1047 * $5000 0000 - $5001 FFFF eight times" (!) 1048 * mess.org says IIci and Color Classic do not alias 1049 * I/O address space. 1050 */ 1051 platform_device_register_simple("mac_scsi", 0, 1052 mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc)); 1053 break; 1054 case MAC_SCSI_LC: 1055 /* Addresses from Mac LC data in Designing Cards & Drivers 3ed. 1056 * Also from the Developer Notes for Classic II, LC III, 1057 * Color Classic and IIvx. 1058 * $50F0 6000 - $50F0 7FFF: SCSI handshake 1059 * $50F1 0000 - $50F1 1FFF: SCSI 1060 * $50F1 2000 - $50F1 3FFF: SCSI DMA 1061 */ 1062 platform_device_register_simple("mac_scsi", 0, 1063 mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc)); 1064 break; 1065 } 1066 1067 /* 1068 * IDE device 1069 */ 1070 1071 switch (macintosh_config->ide_type) { 1072 case MAC_IDE_QUADRA: 1073 platform_device_register_resndata(NULL, "pata_platform", -1, 1074 mac_pata_quadra_rsrc, ARRAY_SIZE(mac_pata_quadra_rsrc), 1075 &mac_pata_data, sizeof(mac_pata_data)); 1076 break; 1077 case MAC_IDE_PB: 1078 platform_device_register_resndata(NULL, "pata_platform", -1, 1079 mac_pata_pb_rsrc, ARRAY_SIZE(mac_pata_pb_rsrc), 1080 &mac_pata_data, sizeof(mac_pata_data)); 1081 break; 1082 case MAC_IDE_BABOON: 1083 platform_device_register_resndata(NULL, "pata_platform", -1, 1084 mac_pata_baboon_rsrc, ARRAY_SIZE(mac_pata_baboon_rsrc), 1085 &mac_pata_data, sizeof(mac_pata_data)); 1086 break; 1087 } 1088 1089 /* 1090 * Ethernet device 1091 */ 1092 1093 if (macintosh_config->ether_type == MAC_ETHER_SONIC || 1094 macintosh_config->expansion_type == MAC_EXP_PDS_COMM) 1095 platform_device_register_simple("macsonic", -1, NULL, 0); 1096 1097 if (macintosh_config->expansion_type == MAC_EXP_PDS || 1098 macintosh_config->expansion_type == MAC_EXP_PDS_COMM) 1099 platform_device_register_simple("mac89x0", -1, NULL, 0); 1100 1101 if (macintosh_config->ether_type == MAC_ETHER_MACE) 1102 platform_device_register_simple("macmace", -1, NULL, 0); 1103 1104 return 0; 1105 } 1106 1107 arch_initcall(mac_platform_init); 1108