config.c revision 4c3c522bcebe16a717d7a809fd14b11823794027
1/* 2 * linux/arch/m68k/atari/config.c 3 * 4 * Copyright (C) 1994 Bjoern Brauel 5 * 6 * 5/2/94 Roman Hodek: 7 * Added setting of time_adj to get a better clock. 8 * 9 * 5/14/94 Roman Hodek: 10 * gettod() for TT 11 * 12 * 5/15/94 Roman Hodek: 13 * hard_reset_now() for Atari (and others?) 14 * 15 * 94/12/30 Andreas Schwab: 16 * atari_sched_init fixed to get precise clock. 17 * 18 * This file is subject to the terms and conditions of the GNU General Public 19 * License. See the file COPYING in the main directory of this archive 20 * for more details. 21 */ 22 23/* 24 * Miscellaneous atari stuff 25 */ 26 27#include <linux/types.h> 28#include <linux/mm.h> 29#include <linux/seq_file.h> 30#include <linux/console.h> 31#include <linux/init.h> 32#include <linux/delay.h> 33#include <linux/ioport.h> 34#include <linux/platform_device.h> 35#include <linux/usb/isp116x.h> 36#include <linux/vt_kern.h> 37#include <linux/module.h> 38 39#include <asm/bootinfo.h> 40#include <asm/bootinfo-atari.h> 41#include <asm/setup.h> 42#include <asm/atarihw.h> 43#include <asm/atariints.h> 44#include <asm/atari_stram.h> 45#include <asm/machdep.h> 46#include <asm/hwtest.h> 47#include <asm/io.h> 48 49u_long atari_mch_cookie; 50EXPORT_SYMBOL(atari_mch_cookie); 51 52u_long atari_mch_type; 53EXPORT_SYMBOL(atari_mch_type); 54 55struct atari_hw_present atari_hw_present; 56EXPORT_SYMBOL(atari_hw_present); 57 58u_long atari_switches; 59EXPORT_SYMBOL(atari_switches); 60 61int atari_dont_touch_floppy_select; 62EXPORT_SYMBOL(atari_dont_touch_floppy_select); 63 64int atari_rtc_year_offset; 65 66/* local function prototypes */ 67static void atari_reset(void); 68static void atari_get_model(char *model); 69static void atari_get_hardware_list(struct seq_file *m); 70 71/* atari specific irq functions */ 72extern void atari_init_IRQ (void); 73extern void atari_mksound(unsigned int count, unsigned int ticks); 74#ifdef CONFIG_HEARTBEAT 75static void atari_heartbeat(int on); 76#endif 77 78/* atari specific timer functions (in time.c) */ 79extern void atari_sched_init(irq_handler_t); 80extern u32 atari_gettimeoffset(void); 81extern int atari_mste_hwclk (int, struct rtc_time *); 82extern int atari_tt_hwclk (int, struct rtc_time *); 83extern int atari_mste_set_clock_mmss (unsigned long); 84extern int atari_tt_set_clock_mmss (unsigned long); 85 86 87/* ++roman: This is a more elaborate test for an SCC chip, since the plain 88 * Medusa board generates DTACK at the SCC's standard addresses, but a SCC 89 * board in the Medusa is possible. Also, the addresses where the ST_ESCC 90 * resides generate DTACK without the chip, too. 91 * The method is to write values into the interrupt vector register, that 92 * should be readable without trouble (from channel A!). 93 */ 94 95static int __init scc_test(volatile char *ctla) 96{ 97 if (!hwreg_present(ctla)) 98 return 0; 99 MFPDELAY(); 100 101 *ctla = 2; 102 MFPDELAY(); 103 *ctla = 0x40; 104 MFPDELAY(); 105 106 *ctla = 2; 107 MFPDELAY(); 108 if (*ctla != 0x40) 109 return 0; 110 MFPDELAY(); 111 112 *ctla = 2; 113 MFPDELAY(); 114 *ctla = 0x60; 115 MFPDELAY(); 116 117 *ctla = 2; 118 MFPDELAY(); 119 if (*ctla != 0x60) 120 return 0; 121 122 return 1; 123} 124 125 126 /* 127 * Parse an Atari-specific record in the bootinfo 128 */ 129 130int __init atari_parse_bootinfo(const struct bi_record *record) 131{ 132 int unknown = 0; 133 const u_long *data = record->data; 134 135 switch (record->tag) { 136 case BI_ATARI_MCH_COOKIE: 137 atari_mch_cookie = *data; 138 break; 139 case BI_ATARI_MCH_TYPE: 140 atari_mch_type = *data; 141 break; 142 default: 143 unknown = 1; 144 break; 145 } 146 return unknown; 147} 148 149 150/* Parse the Atari-specific switches= option. */ 151static int __init atari_switches_setup(char *str) 152{ 153 char switches[strlen(str) + 1]; 154 char *p; 155 int ovsc_shift; 156 char *args = switches; 157 158 if (!MACH_IS_ATARI) 159 return 0; 160 161 /* copy string to local array, strsep works destructively... */ 162 strcpy(switches, str); 163 atari_switches = 0; 164 165 /* parse the options */ 166 while ((p = strsep(&args, ",")) != NULL) { 167 if (!*p) 168 continue; 169 ovsc_shift = 0; 170 if (strncmp(p, "ov_", 3) == 0) { 171 p += 3; 172 ovsc_shift = ATARI_SWITCH_OVSC_SHIFT; 173 } 174 175 if (strcmp(p, "ikbd") == 0) { 176 /* RTS line of IKBD ACIA */ 177 atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift; 178 } else if (strcmp(p, "midi") == 0) { 179 /* RTS line of MIDI ACIA */ 180 atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift; 181 } else if (strcmp(p, "snd6") == 0) { 182 atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift; 183 } else if (strcmp(p, "snd7") == 0) { 184 atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift; 185 } 186 } 187 return 0; 188} 189 190early_param("switches", atari_switches_setup); 191 192 193 /* 194 * Setup the Atari configuration info 195 */ 196 197void __init config_atari(void) 198{ 199 unsigned short tos_version; 200 201 memset(&atari_hw_present, 0, sizeof(atari_hw_present)); 202 203 /* Change size of I/O space from 64KB to 4GB. */ 204 ioport_resource.end = 0xFFFFFFFF; 205 206 mach_sched_init = atari_sched_init; 207 mach_init_IRQ = atari_init_IRQ; 208 mach_get_model = atari_get_model; 209 mach_get_hardware_list = atari_get_hardware_list; 210 arch_gettimeoffset = atari_gettimeoffset; 211 mach_reset = atari_reset; 212 mach_max_dma_address = 0xffffff; 213#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 214 mach_beep = atari_mksound; 215#endif 216#ifdef CONFIG_HEARTBEAT 217 mach_heartbeat = atari_heartbeat; 218#endif 219 220 /* Set switches as requested by the user */ 221 if (atari_switches & ATARI_SWITCH_IKBD) 222 acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID; 223 if (atari_switches & ATARI_SWITCH_MIDI) 224 acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID; 225 if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) { 226 sound_ym.rd_data_reg_sel = 14; 227 sound_ym.wd_data = sound_ym.rd_data_reg_sel | 228 ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) | 229 ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0); 230 } 231 232 /* ++bjoern: 233 * Determine hardware present 234 */ 235 236 printk("Atari hardware found: "); 237 if (MACH_IS_MEDUSA) { 238 /* There's no Atari video hardware on the Medusa, but all the 239 * addresses below generate a DTACK so no bus error occurs! */ 240 } else if (hwreg_present(f030_xreg)) { 241 ATARIHW_SET(VIDEL_SHIFTER); 242 printk("VIDEL "); 243 /* This is a temporary hack: If there is Falcon video 244 * hardware, we assume that the ST-DMA serves SCSI instead of 245 * ACSI. In the future, there should be a better method for 246 * this... 247 */ 248 ATARIHW_SET(ST_SCSI); 249 printk("STDMA-SCSI "); 250 } else if (hwreg_present(tt_palette)) { 251 ATARIHW_SET(TT_SHIFTER); 252 printk("TT_SHIFTER "); 253 } else if (hwreg_present(&shifter.bas_hi)) { 254 if (hwreg_present(&shifter.bas_lo) && 255 (shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) { 256 ATARIHW_SET(EXTD_SHIFTER); 257 printk("EXTD_SHIFTER "); 258 } else { 259 ATARIHW_SET(STND_SHIFTER); 260 printk("STND_SHIFTER "); 261 } 262 } 263 if (hwreg_present(&st_mfp.par_dt_reg)) { 264 ATARIHW_SET(ST_MFP); 265 printk("ST_MFP "); 266 } 267 if (hwreg_present(&tt_mfp.par_dt_reg)) { 268 ATARIHW_SET(TT_MFP); 269 printk("TT_MFP "); 270 } 271 if (hwreg_present(&tt_scsi_dma.dma_addr_hi)) { 272 ATARIHW_SET(SCSI_DMA); 273 printk("TT_SCSI_DMA "); 274 } 275 /* 276 * The ST-DMA address registers aren't readable 277 * on all Medusas, so the test below may fail 278 */ 279 if (MACH_IS_MEDUSA || 280 (hwreg_present(&st_dma.dma_vhi) && 281 (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) && 282 st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa && 283 (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) && 284 st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) { 285 ATARIHW_SET(EXTD_DMA); 286 printk("EXTD_DMA "); 287 } 288 if (hwreg_present(&tt_scsi.scsi_data)) { 289 ATARIHW_SET(TT_SCSI); 290 printk("TT_SCSI "); 291 } 292 if (hwreg_present(&sound_ym.rd_data_reg_sel)) { 293 ATARIHW_SET(YM_2149); 294 printk("YM2149 "); 295 } 296 if (!MACH_IS_MEDUSA && hwreg_present(&tt_dmasnd.ctrl)) { 297 ATARIHW_SET(PCM_8BIT); 298 printk("PCM "); 299 } 300 if (hwreg_present(&falcon_codec.unused5)) { 301 ATARIHW_SET(CODEC); 302 printk("CODEC "); 303 } 304 if (hwreg_present(&dsp56k_host_interface.icr)) { 305 ATARIHW_SET(DSP56K); 306 printk("DSP56K "); 307 } 308 if (hwreg_present(&tt_scc_dma.dma_ctrl) && 309#if 0 310 /* This test sucks! Who knows some better? */ 311 (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) && 312 (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0) 313#else 314 !MACH_IS_MEDUSA 315#endif 316 ) { 317 ATARIHW_SET(SCC_DMA); 318 printk("SCC_DMA "); 319 } 320 if (scc_test(&atari_scc.cha_a_ctrl)) { 321 ATARIHW_SET(SCC); 322 printk("SCC "); 323 } 324 if (scc_test(&st_escc.cha_b_ctrl)) { 325 ATARIHW_SET(ST_ESCC); 326 printk("ST_ESCC "); 327 } 328 if (hwreg_present(&tt_scu.sys_mask)) { 329 ATARIHW_SET(SCU); 330 /* Assume a VME bus if there's a SCU */ 331 ATARIHW_SET(VME); 332 printk("VME SCU "); 333 } 334 if (hwreg_present((void *)(0xffff9210))) { 335 ATARIHW_SET(ANALOG_JOY); 336 printk("ANALOG_JOY "); 337 } 338 if (hwreg_present(blitter.halftone)) { 339 ATARIHW_SET(BLITTER); 340 printk("BLITTER "); 341 } 342 if (hwreg_present((void *)0xfff00039)) { 343 ATARIHW_SET(IDE); 344 printk("IDE "); 345 } 346#if 1 /* This maybe wrong */ 347 if (!MACH_IS_MEDUSA && hwreg_present(&tt_microwire.data) && 348 hwreg_present(&tt_microwire.mask) && 349 (tt_microwire.mask = 0x7ff, 350 udelay(1), 351 tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR, 352 udelay(1), 353 tt_microwire.data != 0)) { 354 ATARIHW_SET(MICROWIRE); 355 while (tt_microwire.mask != 0x7ff) 356 ; 357 printk("MICROWIRE "); 358 } 359#endif 360 if (hwreg_present(&tt_rtc.regsel)) { 361 ATARIHW_SET(TT_CLK); 362 printk("TT_CLK "); 363 mach_hwclk = atari_tt_hwclk; 364 mach_set_clock_mmss = atari_tt_set_clock_mmss; 365 } 366 if (hwreg_present(&mste_rtc.sec_ones)) { 367 ATARIHW_SET(MSTE_CLK); 368 printk("MSTE_CLK "); 369 mach_hwclk = atari_mste_hwclk; 370 mach_set_clock_mmss = atari_mste_set_clock_mmss; 371 } 372 if (!MACH_IS_MEDUSA && hwreg_present(&dma_wd.fdc_speed) && 373 hwreg_write(&dma_wd.fdc_speed, 0)) { 374 ATARIHW_SET(FDCSPEED); 375 printk("FDC_SPEED "); 376 } 377 if (!ATARIHW_PRESENT(ST_SCSI)) { 378 ATARIHW_SET(ACSI); 379 printk("ACSI "); 380 } 381 printk("\n"); 382 383 if (CPU_IS_040_OR_060) 384 /* Now it seems to be safe to turn of the tt0 transparent 385 * translation (the one that must not be turned off in 386 * head.S...) 387 */ 388 asm volatile ("\n" 389 " moveq #0,%%d0\n" 390 " .chip 68040\n" 391 " movec %%d0,%%itt0\n" 392 " movec %%d0,%%dtt0\n" 393 " .chip 68k" 394 : /* no outputs */ 395 : /* no inputs */ 396 : "d0"); 397 398 /* allocator for memory that must reside in st-ram */ 399 atari_stram_init(); 400 401 /* Set up a mapping for the VMEbus address region: 402 * 403 * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff 404 * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at 405 * 0xfe000000 virt., because this can be done with a single 406 * transparent translation. On the 68040, lots of often unused 407 * page tables would be needed otherwise. On a MegaSTE or similar, 408 * the highest byte is stripped off by hardware due to the 24 bit 409 * design of the bus. 410 */ 411 412 if (CPU_IS_020_OR_030) { 413 unsigned long tt1_val; 414 tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache 415 * inhibit, read and write, FDC mask = 3, 416 * FDC val = 4 -> Supervisor only */ 417 asm volatile ("\n" 418 " .chip 68030\n" 419 " pmove %0,%/tt1\n" 420 " .chip 68k" 421 : : "m" (tt1_val)); 422 } else { 423 asm volatile ("\n" 424 " .chip 68040\n" 425 " movec %0,%%itt1\n" 426 " movec %0,%%dtt1\n" 427 " .chip 68k" 428 : 429 : "d" (0xfe00a040)); /* Translate 0xfexxxxxx, enable, 430 * supervisor only, non-cacheable/ 431 * serialized, writable */ 432 433 } 434 435 /* Fetch tos version at Physical 2 */ 436 /* 437 * We my not be able to access this address if the kernel is 438 * loaded to st ram, since the first page is unmapped. On the 439 * Medusa this is always the case and there is nothing we can do 440 * about this, so we just assume the smaller offset. For the TT 441 * we use the fact that in head.S we have set up a mapping 442 * 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible 443 * in the last 16MB of the address space. 444 */ 445 tos_version = (MACH_IS_MEDUSA) ? 446 0xfff : *(unsigned short *)0xff000002; 447 atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68; 448} 449 450#ifdef CONFIG_HEARTBEAT 451static void atari_heartbeat(int on) 452{ 453 unsigned char tmp; 454 unsigned long flags; 455 456 if (atari_dont_touch_floppy_select) 457 return; 458 459 local_irq_save(flags); 460 sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */ 461 tmp = sound_ym.rd_data_reg_sel; 462 sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02); 463 local_irq_restore(flags); 464} 465#endif 466 467/* ++roman: 468 * 469 * This function does a reset on machines that lack the ability to 470 * assert the processor's _RESET signal somehow via hardware. It is 471 * based on the fact that you can find the initial SP and PC values 472 * after a reset at physical addresses 0 and 4. This works pretty well 473 * for Atari machines, since the lowest 8 bytes of physical memory are 474 * really ROM (mapped by hardware). For other 680x0 machines: don't 475 * know if it works... 476 * 477 * To get the values at addresses 0 and 4, the MMU better is turned 478 * off first. After that, we have to jump into physical address space 479 * (the PC before the pmove statement points to the virtual address of 480 * the code). Getting that physical address is not hard, but the code 481 * becomes a bit complex since I've tried to ensure that the jump 482 * statement after the pmove is in the cache already (otherwise the 483 * processor can't fetch it!). For that, the code first jumps to the 484 * jump statement with the (virtual) address of the pmove section in 485 * an address register . The jump statement is surely in the cache 486 * now. After that, that physical address of the reset code is loaded 487 * into the same address register, pmove is done and the same jump 488 * statements goes to the reset code. Since there are not many 489 * statements between the two jumps, I hope it stays in the cache. 490 * 491 * The C code makes heavy use of the GCC features that you can get the 492 * address of a C label. No hope to compile this with another compiler 493 * than GCC! 494 */ 495 496/* ++andreas: no need for complicated code, just depend on prefetch */ 497 498static void atari_reset(void) 499{ 500 long tc_val = 0; 501 long reset_addr; 502 503 /* 504 * On the Medusa, phys. 0x4 may contain garbage because it's no 505 * ROM. See above for explanation why we cannot use PTOV(4). 506 */ 507 reset_addr = MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 : 508 *(unsigned long *) 0xff000004; 509 510 /* reset ACIA for switch off OverScan, if it's active */ 511 if (atari_switches & ATARI_SWITCH_OVSC_IKBD) 512 acia.key_ctrl = ACIA_RESET; 513 if (atari_switches & ATARI_SWITCH_OVSC_MIDI) 514 acia.mid_ctrl = ACIA_RESET; 515 516 /* processor independent: turn off interrupts and reset the VBR; 517 * the caches must be left enabled, else prefetching the final jump 518 * instruction doesn't work. 519 */ 520 local_irq_disable(); 521 asm volatile ("movec %0,%%vbr" 522 : : "d" (0)); 523 524 if (CPU_IS_040_OR_060) { 525 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); 526 if (CPU_IS_060) { 527 /* 68060: clear PCR to turn off superscalar operation */ 528 asm volatile ("\n" 529 " .chip 68060\n" 530 " movec %0,%%pcr\n" 531 " .chip 68k" 532 : : "d" (0)); 533 } 534 535 asm volatile ("\n" 536 " move.l %0,%%d0\n" 537 " and.l #0xff000000,%%d0\n" 538 " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */ 539 " .chip 68040\n" 540 " movec %%d0,%%itt0\n" 541 " movec %%d0,%%dtt0\n" 542 " .chip 68k\n" 543 " jmp %0@" 544 : : "a" (jmp_addr040) 545 : "d0"); 546 jmp_addr_label040: 547 asm volatile ("\n" 548 " moveq #0,%%d0\n" 549 " nop\n" 550 " .chip 68040\n" 551 " cinva %%bc\n" 552 " nop\n" 553 " pflusha\n" 554 " nop\n" 555 " movec %%d0,%%tc\n" 556 " nop\n" 557 /* the following setup of transparent translations is needed on the 558 * Afterburner040 to successfully reboot. Other machines shouldn't 559 * care about a different tt regs setup, they also didn't care in 560 * the past that the regs weren't turned off. */ 561 " move.l #0xffc000,%%d0\n" /* whole insn space cacheable */ 562 " movec %%d0,%%itt0\n" 563 " movec %%d0,%%itt1\n" 564 " or.w #0x40,%/d0\n" /* whole data space non-cacheable/ser. */ 565 " movec %%d0,%%dtt0\n" 566 " movec %%d0,%%dtt1\n" 567 " .chip 68k\n" 568 " jmp %0@" 569 : /* no outputs */ 570 : "a" (reset_addr) 571 : "d0"); 572 } else 573 asm volatile ("\n" 574 " pmove %0,%%tc\n" 575 " jmp %1@" 576 : /* no outputs */ 577 : "m" (tc_val), "a" (reset_addr)); 578} 579 580 581static void atari_get_model(char *model) 582{ 583 strcpy(model, "Atari "); 584 switch (atari_mch_cookie >> 16) { 585 case ATARI_MCH_ST: 586 if (ATARIHW_PRESENT(MSTE_CLK)) 587 strcat(model, "Mega ST"); 588 else 589 strcat(model, "ST"); 590 break; 591 case ATARI_MCH_STE: 592 if (MACH_IS_MSTE) 593 strcat(model, "Mega STE"); 594 else 595 strcat(model, "STE"); 596 break; 597 case ATARI_MCH_TT: 598 if (MACH_IS_MEDUSA) 599 /* Medusa has TT _MCH cookie */ 600 strcat(model, "Medusa"); 601 else 602 strcat(model, "TT"); 603 break; 604 case ATARI_MCH_FALCON: 605 strcat(model, "Falcon"); 606 if (MACH_IS_AB40) 607 strcat(model, " (with Afterburner040)"); 608 break; 609 default: 610 sprintf(model + strlen(model), "(unknown mach cookie 0x%lx)", 611 atari_mch_cookie); 612 break; 613 } 614} 615 616 617static void atari_get_hardware_list(struct seq_file *m) 618{ 619 int i; 620 621 for (i = 0; i < m68k_num_memory; i++) 622 seq_printf(m, "\t%3ld MB at 0x%08lx (%s)\n", 623 m68k_memory[i].size >> 20, m68k_memory[i].addr, 624 (m68k_memory[i].addr & 0xff000000 ? 625 "alternate RAM" : "ST-RAM")); 626 627#define ATARIHW_ANNOUNCE(name, str) \ 628 if (ATARIHW_PRESENT(name)) \ 629 seq_printf(m, "\t%s\n", str) 630 631 seq_printf(m, "Detected hardware:\n"); 632 ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter"); 633 ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter"); 634 ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter"); 635 ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter"); 636 ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator"); 637 ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound"); 638 ATARIHW_ANNOUNCE(CODEC, "CODEC Sound"); 639 ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)"); 640 ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)"); 641 ATARIHW_ANNOUNCE(ACSI, "ACSI Interface"); 642 ATARIHW_ANNOUNCE(IDE, "IDE Interface"); 643 ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC"); 644 ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901"); 645 ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901"); 646 ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530"); 647 ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230"); 648 ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface"); 649 ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface"); 650 ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)"); 651 ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)"); 652 ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380"); 653 ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC"); 654 ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A"); 655 ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15"); 656 ATARIHW_ANNOUNCE(SCU, "System Control Unit"); 657 ATARIHW_ANNOUNCE(BLITTER, "Blitter"); 658 ATARIHW_ANNOUNCE(VME, "VME Bus"); 659 ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); 660} 661 662/* 663 * MSch: initial platform device support for Atari, 664 * required for EtherNAT/EtherNEC/NetUSBee drivers 665 */ 666 667#if defined(CONFIG_ATARI_ETHERNAT) || defined(CONFIG_ATARI_ETHERNEC) 668static void isp1160_delay(struct device *dev, int delay) 669{ 670 ndelay(delay); 671} 672#endif 673 674#ifdef CONFIG_ATARI_ETHERNAT 675/* 676 * EtherNAT: SMC91C111 Ethernet chipset, handled by smc91x driver 677 */ 678 679#define ATARI_ETHERNAT_IRQ 140 680 681static struct resource smc91x_resources[] = { 682 [0] = { 683 .name = "smc91x-regs", 684 .start = ATARI_ETHERNAT_PHYS_ADDR, 685 .end = ATARI_ETHERNAT_PHYS_ADDR + 0xfffff, 686 .flags = IORESOURCE_MEM, 687 }, 688 [1] = { 689 .name = "smc91x-irq", 690 .start = ATARI_ETHERNAT_IRQ, 691 .end = ATARI_ETHERNAT_IRQ, 692 .flags = IORESOURCE_IRQ, 693 }, 694}; 695 696static struct platform_device smc91x_device = { 697 .name = "smc91x", 698 .id = -1, 699 .num_resources = ARRAY_SIZE(smc91x_resources), 700 .resource = smc91x_resources, 701}; 702 703/* 704 * ISP 1160 - using the isp116x-hcd module 705 */ 706 707#define ATARI_USB_PHYS_ADDR 0x80000012 708#define ATARI_USB_IRQ 139 709 710static struct resource isp1160_resources[] = { 711 [0] = { 712 .name = "isp1160-data", 713 .start = ATARI_USB_PHYS_ADDR, 714 .end = ATARI_USB_PHYS_ADDR + 0x1, 715 .flags = IORESOURCE_MEM, 716 }, 717 [1] = { 718 .name = "isp1160-regs", 719 .start = ATARI_USB_PHYS_ADDR + 0x4, 720 .end = ATARI_USB_PHYS_ADDR + 0x5, 721 .flags = IORESOURCE_MEM, 722 }, 723 [2] = { 724 .name = "isp1160-irq", 725 .start = ATARI_USB_IRQ, 726 .end = ATARI_USB_IRQ, 727 .flags = IORESOURCE_IRQ, 728 }, 729}; 730 731/* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */ 732static struct isp116x_platform_data isp1160_platform_data = { 733 /* Enable internal resistors on downstream ports */ 734 .sel15Kres = 1, 735 /* On-chip overcurrent protection */ 736 .oc_enable = 1, 737 /* INT output polarity */ 738 .int_act_high = 1, 739 /* INT edge or level triggered */ 740 .int_edge_triggered = 0, 741 742 /* WAKEUP pin connected - NOT SUPPORTED */ 743 /* .remote_wakeup_connected = 0, */ 744 /* Wakeup by devices on usb bus enabled */ 745 .remote_wakeup_enable = 0, 746 .delay = isp1160_delay, 747}; 748 749static struct platform_device isp1160_device = { 750 .name = "isp116x-hcd", 751 .id = 0, 752 .num_resources = ARRAY_SIZE(isp1160_resources), 753 .resource = isp1160_resources, 754 .dev = { 755 .platform_data = &isp1160_platform_data, 756 }, 757}; 758 759static struct platform_device *atari_ethernat_devices[] __initdata = { 760 &smc91x_device, 761 &isp1160_device 762}; 763#endif /* CONFIG_ATARI_ETHERNAT */ 764 765#ifdef CONFIG_ATARI_ETHERNEC 766/* 767 * EtherNEC: RTL8019 (NE2000 compatible) Ethernet chipset, 768 * handled by ne.c driver 769 */ 770 771#define ATARI_ETHERNEC_PHYS_ADDR 0xfffa0000 772#define ATARI_ETHERNEC_BASE 0x300 773#define ATARI_ETHERNEC_IRQ IRQ_MFP_TIMER1 774 775static struct resource rtl8019_resources[] = { 776 [0] = { 777 .name = "rtl8019-regs", 778 .start = ATARI_ETHERNEC_BASE, 779 .end = ATARI_ETHERNEC_BASE + 0x20 - 1, 780 .flags = IORESOURCE_IO, 781 }, 782 [1] = { 783 .name = "rtl8019-irq", 784 .start = ATARI_ETHERNEC_IRQ, 785 .end = ATARI_ETHERNEC_IRQ, 786 .flags = IORESOURCE_IRQ, 787 }, 788}; 789 790static struct platform_device rtl8019_device = { 791 .name = "ne", 792 .id = -1, 793 .num_resources = ARRAY_SIZE(rtl8019_resources), 794 .resource = rtl8019_resources, 795}; 796 797/* 798 * NetUSBee: ISP1160 USB host adapter via ROM-port adapter 799 */ 800 801#define ATARI_NETUSBEE_PHYS_ADDR 0xfffa8000 802#define ATARI_NETUSBEE_BASE 0x340 803#define ATARI_NETUSBEE_IRQ IRQ_MFP_TIMER2 804 805static struct resource netusbee_resources[] = { 806 [0] = { 807 .name = "isp1160-data", 808 .start = ATARI_NETUSBEE_BASE, 809 .end = ATARI_NETUSBEE_BASE + 0x1, 810 .flags = IORESOURCE_MEM, 811 }, 812 [1] = { 813 .name = "isp1160-regs", 814 .start = ATARI_NETUSBEE_BASE + 0x20, 815 .end = ATARI_NETUSBEE_BASE + 0x21, 816 .flags = IORESOURCE_MEM, 817 }, 818 [2] = { 819 .name = "isp1160-irq", 820 .start = ATARI_NETUSBEE_IRQ, 821 .end = ATARI_NETUSBEE_IRQ, 822 .flags = IORESOURCE_IRQ, 823 }, 824}; 825 826/* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */ 827static struct isp116x_platform_data netusbee_platform_data = { 828 /* Enable internal resistors on downstream ports */ 829 .sel15Kres = 1, 830 /* On-chip overcurrent protection */ 831 .oc_enable = 1, 832 /* INT output polarity */ 833 .int_act_high = 1, 834 /* INT edge or level triggered */ 835 .int_edge_triggered = 0, 836 837 /* WAKEUP pin connected - NOT SUPPORTED */ 838 /* .remote_wakeup_connected = 0, */ 839 /* Wakeup by devices on usb bus enabled */ 840 .remote_wakeup_enable = 0, 841 .delay = isp1160_delay, 842}; 843 844static struct platform_device netusbee_device = { 845 .name = "isp116x-hcd", 846 .id = 1, 847 .num_resources = ARRAY_SIZE(netusbee_resources), 848 .resource = netusbee_resources, 849 .dev = { 850 .platform_data = &netusbee_platform_data, 851 }, 852}; 853 854static struct platform_device *atari_netusbee_devices[] __initdata = { 855 &rtl8019_device, 856 &netusbee_device 857}; 858#endif /* CONFIG_ATARI_ETHERNEC */ 859 860int __init atari_platform_init(void) 861{ 862 int rv = 0; 863 864 if (!MACH_IS_ATARI) 865 return -ENODEV; 866 867#ifdef CONFIG_ATARI_ETHERNAT 868 { 869 unsigned char *enatc_virt; 870 enatc_virt = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf); 871 if (hwreg_present(enatc_virt)) { 872 rv = platform_add_devices(atari_ethernat_devices, 873 ARRAY_SIZE(atari_ethernat_devices)); 874 } 875 iounmap(enatc_virt); 876 } 877#endif 878 879#ifdef CONFIG_ATARI_ETHERNEC 880 { 881 int error; 882 unsigned char *enec_virt; 883 enec_virt = (unsigned char *)ioremap((ATARI_ETHERNEC_PHYS_ADDR), 0xf); 884 if (hwreg_present(enec_virt)) { 885 error = platform_add_devices(atari_netusbee_devices, 886 ARRAY_SIZE(atari_netusbee_devices)); 887 if (error && !rv) 888 rv = error; 889 } 890 iounmap(enec_virt); 891 } 892#endif 893 894 return rv; 895} 896 897arch_initcall(atari_platform_init); 898