amiga7xx.c
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:4k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

  1. /*
  2.  * Detection routine for the NCR53c710 based Amiga SCSI Controllers for Linux.
  3.  *   Amiga MacroSystemUS WarpEngine SCSI controller.
  4.  * Amiga Technologies A4000T SCSI controller.
  5.  * Amiga Technologies/DKB A4091 SCSI controller.
  6.  *
  7.  * Written 1997 by Alan Hourihane <alanh@fairlite.demon.co.uk>
  8.  * plus modifications of the 53c7xx.c driver to support the Amiga.
  9.  */
  10. #include <linux/types.h>
  11. #include <linux/mm.h>
  12. #include <linux/blk.h>
  13. #include <linux/sched.h>
  14. #include <linux/version.h>
  15. #include <linux/config.h>
  16. #include <linux/zorro.h>
  17. #include <asm/setup.h>
  18. #include <asm/page.h>
  19. #include <asm/pgtable.h>
  20. #include <asm/amigaints.h>
  21. #include <asm/amigahw.h>
  22. #include <asm/irq.h>
  23. #include "scsi.h"
  24. #include "hosts.h"
  25. #include "53c7xx.h"
  26. #include "amiga7xx.h"
  27. #include<linux/stat.h>
  28. extern int ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip, 
  29.    u32 base, int io_port, int irq, int dma,
  30.    long long options, int clock);
  31. int __init amiga7xx_detect(Scsi_Host_Template *tpnt)
  32. {
  33.     static unsigned char called = 0;
  34.     int num = 0, clock;
  35.     long long options;
  36.     struct zorro_dev *z = NULL;
  37.     unsigned long address;
  38.     if (called || !MACH_IS_AMIGA)
  39. return 0;
  40.     tpnt->proc_name = "Amiga7xx";
  41. #ifdef CONFIG_A4000T_SCSI
  42.     if (AMIGAHW_PRESENT(A4000_SCSI)) {
  43. address = 0xdd0040;
  44. if (request_mem_region(address, 0x1000, "ncr53c710")) { 
  45.     address = ZTWO_VADDR(address);
  46.     options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 |
  47.       OPTION_INTFLY | OPTION_SYNCHRONOUS |
  48.       OPTION_ALWAYS_SYNCHRONOUS | OPTION_DISCONNECT;
  49.     clock = 50000000; /* 50MHz SCSI Clock */
  50.     ncr53c7xx_init(tpnt, 0, 710, address, 0, IRQ_AMIGA_PORTS, DMA_NONE,
  51.    options, clock);
  52.     num++;
  53. }
  54.     }
  55. #endif
  56.     while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
  57. unsigned long address = z->resource.start;
  58. unsigned long size = z->resource.end-z->resource.start+1;
  59. switch (z->id) {
  60. #ifdef CONFIG_BLZ603EPLUS_SCSI
  61.     case ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS:
  62. address = 0xf40000;
  63. if (request_mem_region(address, 0x1000, "ncr53c710")) {
  64.     address = ZTWO_VADDR(address);
  65.     options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 |
  66.       OPTION_INTFLY | OPTION_SYNCHRONOUS | 
  67.       OPTION_ALWAYS_SYNCHRONOUS | OPTION_DISCONNECT;
  68.     clock = 50000000; /* 50MHz SCSI Clock */
  69.     ncr53c7xx_init(tpnt, 0, 710, address, 0, IRQ_AMIGA_PORTS,
  70.    DMA_NONE, options, clock);
  71.     num++;
  72. }
  73. break;
  74. #endif
  75. #ifdef CONFIG_WARPENGINE_SCSI
  76.          case ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE_40xx:
  77. if (request_mem_region(address+0x40000, 0x1000, "ncr53c710")) {
  78.     address = (unsigned long)ioremap(address, size);
  79.     options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 |
  80.       OPTION_INTFLY | OPTION_SYNCHRONOUS |
  81.       OPTION_ALWAYS_SYNCHRONOUS | OPTION_DISCONNECT;
  82.     clock = 50000000; /* 50MHz SCSI Clock */
  83.     ncr53c7xx_init(tpnt, 0, 710, address+0x40000, 0,
  84.    IRQ_AMIGA_PORTS, DMA_NONE, options, clock);
  85.     num++;
  86. }
  87. break;
  88. #endif
  89. #ifdef CONFIG_A4091_SCSI
  90.     case ZORRO_PROD_CBM_A4091_1:
  91.     case ZORRO_PROD_CBM_A4091_2:
  92. if (request_mem_region(address+0x800000, 0x1000, "ncr53c710")) {
  93.     address = (unsigned long)ioremap(address, size);
  94.     options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 |
  95.       OPTION_INTFLY | OPTION_SYNCHRONOUS |
  96.       OPTION_ALWAYS_SYNCHRONOUS | OPTION_DISCONNECT;
  97.     clock = 50000000; /* 50MHz SCSI Clock */
  98.     ncr53c7xx_init(tpnt, 0, 710, address+0x800000, 0,
  99.    IRQ_AMIGA_PORTS, DMA_NONE, options, clock);
  100.     num++;
  101. }
  102. break;
  103. #endif
  104. #ifdef CONFIG_GVP_TURBO_SCSI
  105.          case ZORRO_PROD_GVP_GFORCE_040_060:
  106. if (request_mem_region(address+0x40000, 0x1000, "ncr53c710")) {
  107.     address = ZTWO_VADDR(address);
  108.     options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 |
  109.       OPTION_INTFLY | OPTION_SYNCHRONOUS |
  110.       OPTION_ALWAYS_SYNCHRONOUS | OPTION_DISCONNECT;
  111.     clock = 50000000; /* 50MHz SCSI Clock */
  112.     ncr53c7xx_init(tpnt, 0, 710, address+0x40000, 0,
  113.    IRQ_AMIGA_PORTS, DMA_NONE, options, clock);
  114.     num++;
  115. }
  116. #endif
  117. }
  118.     }
  119.     called = 1;
  120.     return num;
  121. }
  122. static Scsi_Host_Template driver_template = AMIGA7XX_SCSI;
  123. #include "scsi_module.c"