[PATCH] libata-hp-prep: store attached SCSI device
[linux-2.6] / drivers / scsi / bvme6000.c
1 /*
2  * Detection routine for the NCR53c710 based BVME6000 SCSI Controllers for Linux.
3  *
4  * Based on work by Alan Hourihane
5  */
6 #include <linux/types.h>
7 #include <linux/mm.h>
8 #include <linux/blkdev.h>
9 #include <linux/sched.h>
10 #include <linux/zorro.h>
11
12 #include <asm/setup.h>
13 #include <asm/page.h>
14 #include <asm/pgtable.h>
15 #include <asm/bvme6000hw.h>
16 #include <asm/irq.h>
17
18 #include "scsi.h"
19 #include <scsi/scsi_host.h>
20 #include "53c7xx.h"
21 #include "bvme6000.h"
22
23 #include<linux/stat.h>
24
25
26 int bvme6000_scsi_detect(struct scsi_host_template *tpnt)
27 {
28     static unsigned char called = 0;
29     int clock;
30     long long options;
31
32     if (called)
33         return 0;
34     if (!MACH_IS_BVME6000)
35         return 0;
36
37     tpnt->proc_name = "BVME6000";
38
39     options = OPTION_MEMORY_MAPPED|OPTION_DEBUG_TEST1|OPTION_INTFLY|OPTION_SYNCHRONOUS|OPTION_ALWAYS_SYNCHRONOUS|OPTION_DISCONNECT;
40
41     clock = 40000000;   /* 66MHz SCSI Clock */
42
43     ncr53c7xx_init(tpnt, 0, 710, (unsigned long)BVME_NCR53C710_BASE,
44                         0, BVME_IRQ_SCSI, DMA_NONE,
45                         options, clock);
46     called = 1;
47     return 1;
48 }
49
50 static int bvme6000_scsi_release(struct Scsi_Host *shost)
51 {
52         if (shost->irq)
53                 free_irq(shost->irq, NULL);
54         if (shost->dma_channel != 0xff)
55                 free_dma(shost->dma_channel);
56         if (shost->io_port && shost->n_io_port)
57                 release_region(shost->io_port, shost->n_io_port);
58         scsi_unregister(shost);
59         return 0;
60 }
61
62 static struct scsi_host_template driver_template = {
63         .name                   = "BVME6000 NCR53c710 SCSI",
64         .detect                 = bvme6000_scsi_detect,
65         .release                = bvme6000_scsi_release,
66         .queuecommand           = NCR53c7xx_queue_command,
67         .abort                  = NCR53c7xx_abort,
68         .reset                  = NCR53c7xx_reset,
69         .can_queue              = 24,
70         .this_id                = 7,
71         .sg_tablesize           = 63,
72         .cmd_per_lun            = 3,
73         .use_clustering         = DISABLE_CLUSTERING
74 };
75
76
77 #include "scsi_module.c"