make oldconfig will rebuild these...
[linux-2.4.21-pre4.git] / drivers / scsi / amiga7xx.c
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
18 #include <asm/setup.h>
19 #include <asm/page.h>
20 #include <asm/pgtable.h>
21 #include <asm/amigaints.h>
22 #include <asm/amigahw.h>
23
24 #include <asm/irq.h>
25
26 #include "scsi.h"
27 #include "hosts.h"
28 #include "53c7xx.h"
29 #include "amiga7xx.h"
30
31 #include<linux/stat.h>
32
33 extern int ncr53c7xx_init (Scsi_Host_Template *tpnt, int board, int chip, 
34                            u32 base, int io_port, int irq, int dma,
35                            long long options, int clock);
36
37 int __init amiga7xx_detect(Scsi_Host_Template *tpnt)
38 {
39     static unsigned char called = 0;
40     int num = 0, clock;
41     long long options;
42     struct zorro_dev *z = NULL;
43     unsigned long address;
44
45     if (called || !MACH_IS_AMIGA)
46         return 0;
47
48     tpnt->proc_name = "Amiga7xx";
49
50 #ifdef CONFIG_A4000T_SCSI
51     if (AMIGAHW_PRESENT(A4000_SCSI)) {
52         address = 0xdd0040;
53         if (request_mem_region(address, 0x1000, "ncr53c710")) { 
54             address = ZTWO_VADDR(address);
55             options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 |
56                       OPTION_INTFLY | OPTION_SYNCHRONOUS |
57                       OPTION_ALWAYS_SYNCHRONOUS | OPTION_DISCONNECT;
58             clock = 50000000;   /* 50MHz SCSI Clock */
59             ncr53c7xx_init(tpnt, 0, 710, address, 0, IRQ_AMIGA_PORTS, DMA_NONE,
60                            options, clock);
61             num++;
62         }
63     }
64 #endif
65
66     while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
67         unsigned long address = z->resource.start;
68         unsigned long size = z->resource.end-z->resource.start+1;
69         switch (z->id) {
70 #ifdef CONFIG_BLZ603EPLUS_SCSI
71             case ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS:
72                 address = 0xf40000;
73                 if (request_mem_region(address, 0x1000, "ncr53c710")) {
74                     address = ZTWO_VADDR(address);
75                     options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 |
76                               OPTION_INTFLY | OPTION_SYNCHRONOUS | 
77                               OPTION_ALWAYS_SYNCHRONOUS | OPTION_DISCONNECT;
78                     clock = 50000000;   /* 50MHz SCSI Clock */
79                     ncr53c7xx_init(tpnt, 0, 710, address, 0, IRQ_AMIGA_PORTS,
80                                    DMA_NONE, options, clock);
81                     num++;
82                 }
83                 break;
84 #endif
85
86 #ifdef CONFIG_WARPENGINE_SCSI
87             case ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE_40xx:
88                 if (request_mem_region(address+0x40000, 0x1000, "ncr53c710")) {
89                     address = (unsigned long)ioremap(address, size);
90                     options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 |
91                               OPTION_INTFLY | OPTION_SYNCHRONOUS |
92                               OPTION_ALWAYS_SYNCHRONOUS | OPTION_DISCONNECT;
93                     clock = 50000000;   /* 50MHz SCSI Clock */
94                     ncr53c7xx_init(tpnt, 0, 710, address+0x40000, 0,
95                                    IRQ_AMIGA_PORTS, DMA_NONE, options, clock);
96                     num++;
97                 }
98                 break;
99 #endif
100
101 #ifdef CONFIG_A4091_SCSI
102             case ZORRO_PROD_CBM_A4091_1:
103             case ZORRO_PROD_CBM_A4091_2:
104                 if (request_mem_region(address+0x800000, 0x1000, "ncr53c710")) {
105                     address = (unsigned long)ioremap(address, size);
106                     options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 |
107                               OPTION_INTFLY | OPTION_SYNCHRONOUS |
108                               OPTION_ALWAYS_SYNCHRONOUS | OPTION_DISCONNECT;
109                     clock = 50000000;   /* 50MHz SCSI Clock */
110                     ncr53c7xx_init(tpnt, 0, 710, address+0x800000, 0,
111                                    IRQ_AMIGA_PORTS, DMA_NONE, options, clock);
112                     num++;
113                 }
114                 break;
115 #endif
116
117 #ifdef CONFIG_GVP_TURBO_SCSI
118             case ZORRO_PROD_GVP_GFORCE_040_060:
119                 if (request_mem_region(address+0x40000, 0x1000, "ncr53c710")) {
120                     address = ZTWO_VADDR(address);
121                     options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 |
122                               OPTION_INTFLY | OPTION_SYNCHRONOUS |
123                               OPTION_ALWAYS_SYNCHRONOUS | OPTION_DISCONNECT;
124                     clock = 50000000;   /* 50MHz SCSI Clock */
125                     ncr53c7xx_init(tpnt, 0, 710, address+0x40000, 0,
126                                    IRQ_AMIGA_PORTS, DMA_NONE, options, clock);
127                     num++;
128                 }
129 #endif
130         }
131     }
132
133     called = 1;
134     return num;
135 }
136
137 static Scsi_Host_Template driver_template = AMIGA7XX_SCSI;
138 #include "scsi_module.c"