blob: 890e9e232dab9afba81463f0cbe3b04cfbafc406 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Detection routine for the NCR53c710 based MVME16x 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>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
11#include <asm/page.h>
12#include <asm/pgtable.h>
13#include <asm/mvme16xhw.h>
14#include <asm/irq.h>
15
16#include "scsi.h"
17#include <scsi/scsi_host.h>
18#include "53c7xx.h"
19#include "mvme16x.h"
20
21#include<linux/stat.h>
22
23
Christoph Hellwigd0be4a7d2005-10-31 18:31:40 +010024int mvme16x_scsi_detect(struct scsi_host_template *tpnt)
Linus Torvalds1da177e2005-04-16 15:20:36 -070025{
26 static unsigned char called = 0;
27 int clock;
28 long long options;
29
30 if (!MACH_IS_MVME16x)
31 return 0;
32 if (mvme16x_config & MVME16x_CONFIG_NO_SCSICHIP) {
33 printk ("SCSI detection disabled, SCSI chip not present\n");
34 return 0;
35 }
36 if (called)
37 return 0;
38
39 tpnt->proc_name = "MVME16x";
40
41 options = OPTION_MEMORY_MAPPED|OPTION_DEBUG_TEST1|OPTION_INTFLY|OPTION_SYNCHRONOUS|OPTION_ALWAYS_SYNCHRONOUS|OPTION_DISCONNECT;
42
43 clock = 66000000; /* 66MHz SCSI Clock */
44
45 ncr53c7xx_init(tpnt, 0, 710, (unsigned long)0xfff47000,
46 0, MVME16x_IRQ_SCSI, DMA_NONE,
47 options, clock);
48 called = 1;
49 return 1;
50}
51
52static int mvme16x_scsi_release(struct Scsi_Host *shost)
53{
54 if (shost->irq)
55 free_irq(shost->irq, NULL);
56 if (shost->dma_channel != 0xff)
57 free_dma(shost->dma_channel);
58 if (shost->io_port && shost->n_io_port)
59 release_region(shost->io_port, shost->n_io_port);
60 scsi_unregister(shost);
61 return 0;
62}
63
Christoph Hellwigd0be4a7d2005-10-31 18:31:40 +010064static struct scsi_host_template driver_template = {
Linus Torvalds1da177e2005-04-16 15:20:36 -070065 .name = "MVME16x NCR53c710 SCSI",
66 .detect = mvme16x_scsi_detect,
67 .release = mvme16x_scsi_release,
68 .queuecommand = NCR53c7xx_queue_command,
69 .abort = NCR53c7xx_abort,
70 .reset = NCR53c7xx_reset,
71 .can_queue = 24,
72 .this_id = 7,
73 .sg_tablesize = 63,
74 .cmd_per_lun = 3,
75 .use_clustering = DISABLE_CLUSTERING
76};
77
78
79#include "scsi_module.c"