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