- Kai Germaschewski: ISDN update (including Makefiles)
[davej-history.git] / drivers / scsi / dmx3191d.c
blobb369c0618b1beb624460e3fe2b8e3505f597ed42
2 /*
3 dmx3191d.c - midlevel driver for the Domex DMX3191D SCSI card.
4 Copyright (C) 2000 by Massimo Piccioni <dafastidio@libero.it>
6 Based on the generic NCR5380 driver by Drew Eckhardt et al.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include <asm/io.h>
24 #include <asm/system.h>
25 #include <linux/blk.h>
26 #include <linux/init.h>
27 #include <linux/ioport.h>
28 #include <linux/module.h>
29 #include <linux/pci.h>
30 #include <linux/sched.h>
31 #include <linux/signal.h>
32 #include <linux/stat.h>
33 #include <linux/version.h>
35 #include "scsi.h"
36 #include "hosts.h"
37 #include "constants.h"
38 #include "sd.h"
40 #include "dmx3191d.h"
42 /* play with these values to tune up your system performances */
43 /* default setting from g_NCR5380.c */
45 #define USLEEP
46 #define USLEEP_POLL 1
47 #define USLEEP_SLEEP 20
48 #define USLEEP_WAITLONG 500
51 #define AUTOSENSE
52 #include "NCR5380.h"
53 #include "NCR5380.c"
56 int __init dmx3191d_detect(Scsi_Host_Template *tmpl) {
57 int boards = 0;
58 struct Scsi_Host *instance = NULL;
59 struct pci_dev *pdev = NULL;
61 if (!pci_present()) {
62 dmx3191d_printk("PCI support not enabled\n");
63 return 0;
66 tmpl->proc_name = DMX3191D_DRIVER_NAME;
68 while ((pdev = pci_find_device(PCI_VENDOR_ID_DOMEX,
69 PCI_DEVICE_ID_DOMEX_DMX3191D, pdev))) {
71 unsigned long port = pci_resource_start (pdev, 0);
73 if (pci_enable_device(pdev))
74 continue;
76 if (check_region(port, DMX3191D_REGION)) {
77 dmx3191d_printk("region 0x%lx-0x%lx already reserved\n",
78 port, port + DMX3191D_REGION);
79 continue;
82 request_region(port, DMX3191D_REGION, DMX3191D_DRIVER_NAME);
84 instance = scsi_register(tmpl, sizeof(struct NCR5380_hostdata));
85 if(instance == NULL)
87 release_region(port, DMX3191D_REGION);
88 continue;
90 instance->io_port = port;
91 instance->irq = pdev->irq;
92 NCR5380_init(instance, FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E);
94 if (request_irq(pdev->irq, dmx3191d_do_intr, SA_SHIRQ,
95 DMX3191D_DRIVER_NAME, instance)) {
96 dmx3191d_printk("irq %d not available\n", pdev->irq);
97 /* Steam powered scsi controllers run without an IRQ
98 anyway */
99 instance->irq = IRQ_NONE;
102 boards++;
104 return boards;
107 const char * dmx3191d_info(struct Scsi_Host *host) {
108 static const char *info ="Domex DMX3191D";
110 return info;
113 int dmx3191d_release_resources(struct Scsi_Host *instance)
115 release_region(instance->io_port, DMX3191D_REGION);
116 if(instance->irq!=IRQ_NONE)
117 free_irq(instance->irq, instance);
119 return 0;
123 static Scsi_Host_Template driver_template = DMX3191D;
124 #include "scsi_module.c"