int amiga7xx_detect(Scsi_Host_Template *tpnt) { static unsigned char called = 0; int key, clock; int num = 0; unsigned long address; long long options; struct ConfigDev *cd; if (called || !MACH_IS_AMIGA) return 0; tpnt->proc_dir = &proc_scsi_amiga7xx; #if defined(CONFIG_BLZ603EPLUS_SCSI) || defined(CONFIG_BLZ603EPLUS_SCSI_MODULE) if ((key = zorro_find(MANUF_PHASE5, PROD_BLIZZARD_603E_SCSI, 0, 0))) { cd = zorro_get_board(key); options = OPTION_MEMORY_MAPPED|OPTION_DEBUG_TEST1|OPTION_INTFLY|OPTION_SYNCHRONOUS|OPTION_ALWAYS_SYNCHRONOUS|OPTION_DISCONNECT; clock = 50000000; /* 50MHz SCSI Clock */ ncr53c7xx_init(tpnt, 0, 710, (u32)(unsigned char *)ZTWO_VADDR(0xf40000), 0, IRQ_AMIGA_PORTS & ~IRQ_MACHSPEC, DMA_NONE, options, clock); zorro_config_board(key, 0); num++; } #endif #if defined(CONFIG_WARPENGINE_SCSI) || defined(CONFIG_WARPENGINE_SCSI_MODULE) if ((key = zorro_find(MANUF_MACROSYSTEMS, PROD_WARP_ENGINE, 0, 0))) { cd = zorro_get_board(key); address = (unsigned long)kernel_map((unsigned long)cd->cd_BoardAddr, cd->cd_BoardSize, KERNELMAP_NOCACHE_SER, NULL); options = OPTION_MEMORY_MAPPED|OPTION_DEBUG_TEST1|OPTION_INTFLY|OPTION_SYNCHRONOUS|OPTION_ALWAYS_SYNCHRONOUS|OPTION_DISCONNECT; clock = 50000000; /* 50MHz SCSI Clock */ ncr53c7xx_init(tpnt, 0, 710, (u32)(unsigned char *)(address + 0x40000), 0, IRQ_AMIGA_PORTS & ~IRQ_MACHSPEC, DMA_NONE, options, clock); zorro_config_board(key, 0); num++; } #endif #if defined(CONFIG_A4000T_SCSI) || defined(CONFIG_A4000T_SCSI_MODULE) if (AMIGAHW_PRESENT(A4000_SCSI)) { options = OPTION_MEMORY_MAPPED|OPTION_DEBUG_TEST1|OPTION_INTFLY|OPTION_SYNCHRONOUS|OPTION_ALWAYS_SYNCHRONOUS|OPTION_DISCONNECT; clock = 50000000; /* 50MHz SCSI Clock */ ncr53c7xx_init(tpnt, 0, 710, (u32)(unsigned char *)ZTWO_VADDR(0xDD0040), 0, IRQ_AMIGA_PORTS & ~IRQ_MACHSPEC, DMA_NONE, options, clock); num++; } #endif #if defined(CONFIG_A4091_SCSI) || defined(CONFIG_A4091_SCSI_MODULE) while ( (key = zorro_find(MANUF_COMMODORE, PROD_A4091, 0, 0)) || (key = zorro_find(MANUF_COMMODORE2, PROD_A4091_2, 0, 0)) ) { cd = zorro_get_board(key); address = (unsigned long)kernel_map((unsigned long)cd->cd_BoardAddr, cd->cd_BoardSize, KERNELMAP_NOCACHE_SER, NULL); options = OPTION_MEMORY_MAPPED|OPTION_DEBUG_TEST1|OPTION_INTFLY|OPTION_SYNCHRONOUS|OPTION_ALWAYS_SYNCHRONOUS|OPTION_DISCONNECT; clock = 50000000; /* 50MHz SCSI Clock */ ncr53c7xx_init(tpnt, 0, 710, (u32)(unsigned char *)(address+0x800000), 0, IRQ_AMIGA_PORTS & ~IRQ_MACHSPEC, DMA_NONE, options, clock); zorro_config_board(key, 0); num++; } #endif called = 1; return num; }
int asdg_setup(void) { int i, line1, line2; struct SCC *scc=NULL; int dummy; struct ConfigDev *cd=NULL; struct serial_struct req; struct async_struct *info=NULL; int CardFound=0; if (!MACH_IS_AMIGA) return -ENODEV; #ifdef DEBUG printk("We are a miggy\n"); #endif nr_asdg = 0; while((i=zorro_find(MANUF_ASDG, PROD_TWIN_X,1, 0))) { CardFound=1; board_index[nr_asdg/2] = i; cd = zorro_get_board(i); scc = (struct SCC *)ZTWO_VADDR((((volatile u_char *)cd->cd_BoardAddr))); #ifdef DEBUG printk("Found ASDG DSB at %p\n", scc); #endif req.line = -1; /* first free ttyS? device */ req.type = SER_ASDG; req.port = (int) &(scc->B); if ((line1 = register_serial( &req )) < 0) { printk( "Cannot register ASDG serial port: no free device\n" ); return -EBUSY; } lines[nr_asdg++] = line1; info = &rs_table[line1]; info->sw = &asdg_ser_switch; info->nr_uarts = nr_asdg; info->board_base = scc; req.line = -1; /* first free ttyS? device */ req.type = SER_ASDG; req.port = (int) &(scc->A); if ((line2 = register_serial( &req )) < 0) { printk( "Cannot register ASDG serial port: no free device\n" ); unregister_serial( line1 ); return -EBUSY; } lines[nr_asdg++] = line2; info = &rs_table[line2]; info->sw = &asdg_ser_switch; info->nr_uarts = nr_asdg--; info->board_base = scc; nr_asdg++; zorro_config_board(i,1); /* Clear pointers */ dummy = scc->A.control; dummy = scc->B.control; #ifdef DEBUG printk("Pointers cleared \n"); #endif /* Reset card */ write_zsreg(&scc->A, R9, FHWRES | MIE); udelay(10); /* Give card time to reset */ write_zsreg(&scc->B, R9, FHWRES | MIE); udelay(10); /* Give card time to reset */ #ifdef DEBUG printk("Card reset - MIE on \n"); #endif /* Reset all potential interupt sources */ write_zsreg(&scc->A, R0, RES_EXT_INT); /* Ext ints (disabled anyways) */ write_zsreg(&scc->B, R0, RES_EXT_INT); #ifdef DEBUG printk("Ext ints cleared\n"); #endif write_zsreg(&scc->A, R0, RES_Tx_P); /* TBE int */ write_zsreg(&scc->B, R0, RES_Tx_P); #ifdef DEBUG printk("TBE Cleared\n"); #endif /* Clear Rx FIFO */ while( (read_zsreg(&scc->A, R0) & Rx_CH_AV) != 0) dummy=read_zsdata(&scc->A); while( (read_zsreg(&scc->B, R0) & Rx_CH_AV) != 0) dummy=read_zsdata(&scc->B); #ifdef DEBUG printk("Rx buffer empty\n"); #endif /* TBE and RX int off - we will turn them on in _init()*/ write_zsreg(&scc->A, R1, 0); write_zsreg(&scc->B, R1, 0); #ifdef DEBUG printk("Tx and Rx ints off \n"); #endif /* Interrupt vector */ write_zsreg(&scc->A, R2, 0); write_zsreg(&scc->B, R2, 0); #ifdef DEBUG printk("Int vector set (unused) \n"); #endif write_zsreg(&scc->A, R3, Rx8); write_zsreg(&scc->B, R3, Rx8); #ifdef DEBUG printk("Rx enabled\n"); #endif write_zsreg(&scc->A, R4, SB1 | X16CLK); write_zsreg(&scc->B, R4, SB1 | X16CLK); #ifdef DEBUG printk("1 stop bit, x16 clock\n"); #endif write_zsreg(&scc->A, R5, Tx8); write_zsreg(&scc->B, R5, Tx8); #ifdef DEBUG printk("Tx enabled \n"); #endif write_zsreg(&scc->A, R10, NRZ); write_zsreg(&scc->B, R10, NRZ); #ifdef DEBUG printk("NRZ mode\n"); #endif write_zsreg(&scc->A, R11, TCBR | RCBR | TRxCBR); write_zsreg(&scc->B, R11, TCBR | RCBR | TRxCBR); #ifdef DEBUG printk("Clock source setup\n"); #endif /*300 bps */ write_zsreg(&scc->A, R12, 0xfe); write_zsreg(&scc->A, R13, 2); write_zsreg(&scc->B, R12, 0xfe); write_zsreg(&scc->B, R13, 2); #ifdef DEBUG printk("Baud rate set - 300\n"); #endif write_zsreg(&scc->A, R14, BRENABL | BRSRC); write_zsreg(&scc->B, R14, BRENABL | BRSRC); #ifdef DEBUG printk("BRG enabled \n"); #endif write_zsreg(&scc->A, R15, 0); write_zsreg(&scc->A, R15, 0); #ifdef DEBUG printk("Ext INT IE bits cleared \n"); #endif } if(CardFound) { request_irq(IRQ_AMIGA_EXTER, asdg_interrupt, 0, "ASDG serial", asdg_interrupt); return 0; } else { printk("No ASDG Cards found\n"); return -ENODEV; } }
/***************************************************************** Detection */ int fastlane_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; const struct ConfigDev *esp_dev; unsigned int key; unsigned long address; if ((key = zorro_find(ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060, 0, 0))){ esp_dev = zorro_get_board(key); /* Check if this is really a fastlane controller. The problem * is that also the cyberstorm and blizzard controllers use * this ID value. Fortunately only Fastlane maps in Z3 space */ if((unsigned long)esp_dev->cd_BoardAddr < 0x1000000) return 0; esp = esp_allocate(tpnt, (void *) esp_dev); /* Do command transfer with programmed I/O */ esp->do_pio_cmds = 1; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; esp->dma_can_transfer = &dma_can_transfer; esp->dma_dump_state = &dma_dump_state; esp->dma_init_read = &dma_init_read; esp->dma_init_write = &dma_init_write; esp->dma_ints_off = &dma_ints_off; esp->dma_ints_on = &dma_ints_on; esp->dma_irq_p = &dma_irq_p; esp->dma_ports_p = &dma_ports_p; esp->dma_setup = &dma_setup; /* Optional functions */ esp->dma_barrier = 0; esp->dma_drain = 0; esp->dma_invalidate = 0; esp->dma_irq_entry = 0; esp->dma_irq_exit = &dma_irq_exit; esp->dma_led_on = &dma_led_on; esp->dma_led_off = &dma_led_off; esp->dma_poll = 0; esp->dma_reset = 0; /* Initialize the portBits (enable IRQs) */ ctrl_data = (FASTLANE_DMA_FCODE | #ifndef NODMAIRQ FASTLANE_DMA_EDI | #endif FASTLANE_DMA_ESI); /* SCSI chip clock */ esp->cfreq = 40000000; /* Map the physical address space into virtual kernel space */ address = (unsigned long) kernel_map((unsigned long)esp_dev->cd_BoardAddr, esp_dev->cd_BoardSize, KERNELMAP_NOCACHE_SER, NULL); if(!address){ printk("Could not remap Fastlane controller memory!"); scsi_unregister (esp->ehost); return 0; } /* The DMA registers on the Fastlane are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ esp->dregs = (void *)(address + FASTLANE_DMA_ADDR); /* ESP register base */ esp->eregs = (struct ESP_regs *)(address + FASTLANE_ESP_ADDR); /* Board base */ esp->edev = (void *) address; /* Set the command buffer */ esp->esp_command = (volatile unsigned char*) cmd_buffer; esp->esp_command_dvma = virt_to_bus((unsigned long) cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; request_irq(IRQ_AMIGA_PORTS, esp_intr, 0, "Fastlane SCSI", esp_intr); /* Controller ID */ esp->scsi_id = 7; /* Check for differential SCSI-bus */ /* What is this stuff? */ esp->diff = 0; dma_clear(esp); esp_initialize(esp); zorro_config_board(key, 0); printk("\nESP: Total of %d ESP hosts found, %d actually in use.\n", nesps,esps_in_use); esps_running = esps_in_use; return esps_in_use; } return 0; }
/***************************************************************** Detection */ int cyber_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; const struct ConfigDev *esp_dev; unsigned int key; unsigned long address; if ((key = zorro_find(ZORRO_PROD_PHASE5_BLIZZARD_1220_CYBERSTORM, 0, 0)) || (key = zorro_find(ZORRO_PROD_PHASE5_BLIZZARD_1230_II_FASTLANE_Z3_CYBERSCSI_CYBERSTORM060, 0, 0))){ esp_dev = zorro_get_board(key); /* Figure out if this is a CyberStorm or really a * Fastlane/Blizzard Mk II by looking at the board size. * CyberStorm maps 64kB * (ZORRO_PROD_PHASE5_BLIZZARD_1220_CYBERSTORM does anyway) */ if((unsigned long)esp_dev->cd_BoardSize != 0x10000) return 0; esp = esp_allocate(tpnt, (void *) esp_dev); /* Do command transfer with programmed I/O */ esp->do_pio_cmds = 1; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; esp->dma_can_transfer = &dma_can_transfer; esp->dma_dump_state = &dma_dump_state; esp->dma_init_read = &dma_init_read; esp->dma_init_write = &dma_init_write; esp->dma_ints_off = &dma_ints_off; esp->dma_ints_on = &dma_ints_on; esp->dma_irq_p = &dma_irq_p; esp->dma_ports_p = &dma_ports_p; esp->dma_setup = &dma_setup; /* Optional functions */ esp->dma_barrier = 0; esp->dma_drain = 0; esp->dma_invalidate = 0; esp->dma_irq_entry = 0; esp->dma_irq_exit = 0; esp->dma_led_on = &dma_led_on; esp->dma_led_off = &dma_led_off; esp->dma_poll = 0; esp->dma_reset = 0; /* SCSI chip speed */ esp->cfreq = 40000000; /* The DMA registers on the CyberStorm are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ address = (unsigned long)ZTWO_VADDR(esp_dev->cd_BoardAddr); esp->dregs = (void *)(address + CYBER_DMA_ADDR); /* ESP register base */ esp->eregs = (struct ESP_regs *)(address + CYBER_ESP_ADDR); /* Set the command buffer */ esp->esp_command = (volatile unsigned char*) cmd_buffer; esp->esp_command_dvma = virt_to_bus((unsigned long) cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; request_irq(IRQ_AMIGA_PORTS, esp_intr, 0, "CyberStorm SCSI", esp_intr); /* Figure out our scsi ID on the bus */ /* The DMA cond flag contains a hardcoded jumper bit * which can be used to select host number 6 or 7. * However, even though it may change, we use a hardcoded * value of 7. */ esp->scsi_id = 7; /* Check for differential SCSI-bus */ /* What is this stuff? */ esp->diff = 0; esp_initialize(esp); zorro_config_board(key, 0); printk("\nESP: Total of %d ESP hosts found, %d actually in use.\n", nesps,esps_in_use); esps_running = esps_in_use; return esps_in_use; } return 0; }
/***************************************************************** Detection */ int blz2060_esp_detect(Scsi_Host_Template *tpnt) { struct NCR_ESP *esp; const struct ConfigDev *esp_dev; unsigned int key; unsigned long address; if ((key = zorro_find(ZORRO_PROD_PHASE5_BLIZZARD_2060, 0, 0))){ esp_dev = zorro_get_board(key); esp = esp_allocate(tpnt, (void *) esp_dev); /* Do command transfer with programmed I/O */ esp->do_pio_cmds = 1; /* Required functions */ esp->dma_bytes_sent = &dma_bytes_sent; esp->dma_can_transfer = &dma_can_transfer; esp->dma_dump_state = &dma_dump_state; esp->dma_init_read = &dma_init_read; esp->dma_init_write = &dma_init_write; esp->dma_ints_off = &dma_ints_off; esp->dma_ints_on = &dma_ints_on; esp->dma_irq_p = &dma_irq_p; esp->dma_ports_p = &dma_ports_p; esp->dma_setup = &dma_setup; /* Optional functions */ esp->dma_barrier = 0; esp->dma_drain = 0; esp->dma_invalidate = 0; esp->dma_irq_entry = 0; esp->dma_irq_exit = 0; esp->dma_led_on = &dma_led_on; esp->dma_led_off = &dma_led_off; esp->dma_poll = 0; esp->dma_reset = 0; /* SCSI chip speed */ esp->cfreq = 40000000; /* The DMA registers on the Blizzard are mapped * relative to the device (i.e. in the same Zorro * I/O block). */ address = (unsigned long)ZTWO_VADDR(esp_dev->cd_BoardAddr); esp->dregs = (void *)(address + BLZ2060_DMA_ADDR); /* ESP register base */ esp->eregs = (struct ESP_regs *)(address + BLZ2060_ESP_ADDR); /* Set the command buffer */ esp->esp_command = (volatile unsigned char*) cmd_buffer; esp->esp_command_dvma = virt_to_bus((unsigned long) cmd_buffer); esp->irq = IRQ_AMIGA_PORTS; request_irq(IRQ_AMIGA_PORTS, esp_intr, 0, "Blizzard 2060 SCSI", esp_intr); /* Figure out our scsi ID on the bus */ esp->scsi_id = 7; /* Check for differential SCSI-bus */ /* What is this stuff? */ esp->diff = 0; esp_initialize(esp); zorro_config_board(key, 0); printk("\nESP: Total of %d ESP hosts found, %d actually in use.\n", nesps,esps_in_use); esps_running = esps_in_use; return esps_in_use; } return 0; }