1 /* -*- mode: c; c-basic-offset: 8 -*- */
3 /* PARISC LASI driver for the 53c700 chip
5 * Copyright (C) 2001 by James.Bottomley@HansenPartnership.com
6 **-----------------------------------------------------------------------------
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.
22 **-----------------------------------------------------------------------------
26 * Many thanks to Richard Hirst <rhirst@linuxcare.com> for patiently
27 * debugging this driver on the parisc architecture and suggesting
28 * many improvements and bug fixes.
30 * Thanks also go to Linuxcare Inc. for providing several PARISC
31 * machines for me to debug the driver on.
34 #include <linux/kernel.h>
35 #include <linux/module.h>
36 #include <linux/init.h>
37 #include <linux/types.h>
38 #include <linux/stat.h>
40 #include <linux/blkdev.h>
41 #include <linux/sched.h>
42 #include <linux/ioport.h>
43 #include <linux/dma-mapping.h>
46 #include <asm/pgtable.h>
48 #include <asm/hardware.h>
49 #include <asm/parisc-device.h>
50 #include <asm/delay.h>
52 #include <scsi/scsi_host.h>
57 MODULE_AUTHOR("James Bottomley");
58 MODULE_DESCRIPTION("lasi700 SCSI Driver");
59 MODULE_LICENSE("GPL");
61 static struct parisc_device_id lasi700_ids[] = {
67 static struct scsi_host_template lasi700_template = {
68 .name = "LASI SCSI 53c700",
69 .proc_name = "lasi700",
71 .module = THIS_MODULE,
73 MODULE_DEVICE_TABLE(parisc, lasi700_ids);
76 lasi700_probe(struct parisc_device *dev)
78 unsigned long base = dev->hpa + LASI_SCSI_CORE_OFFSET;
79 struct NCR_700_Host_Parameters *hostdata;
80 struct Scsi_Host *host;
82 hostdata = kmalloc(sizeof(*hostdata), GFP_KERNEL);
84 printk(KERN_ERR "%s: Failed to allocate host data\n",
88 memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));
90 hostdata->dev = &dev->dev;
91 dma_set_mask(&dev->dev, 0xffffffffUL);
92 hostdata->base = base;
93 hostdata->differential = 0;
95 if (dev->id.sversion == LASI_700_SVERSION) {
96 hostdata->clock = LASI700_CLOCK;
97 hostdata->force_le_on_be = 1;
99 hostdata->clock = LASI710_CLOCK;
100 hostdata->force_le_on_be = 0;
101 hostdata->chip710 = 1;
102 hostdata->dmode_extra = DMODE_FC2;
105 NCR_700_set_mem_mapped(hostdata);
107 host = NCR_700_detect(&lasi700_template, hostdata);
111 host->irq = dev->irq;
112 if (request_irq(dev->irq, NCR_700_intr, SA_SHIRQ,
113 dev->dev.bus_id, host)) {
114 printk(KERN_ERR "%s: irq problem, detaching\n",
119 if (scsi_add_host(host, &dev->dev))
121 dev_set_drvdata(&dev->dev, host);
122 scsi_scan_host(host);
127 free_irq(host->irq, host);
136 lasi700_driver_remove(struct parisc_device *dev)
138 struct Scsi_Host *host = dev_get_drvdata(&dev->dev);
139 struct NCR_700_Host_Parameters *hostdata =
140 (struct NCR_700_Host_Parameters *)host->hostdata[0];
142 scsi_remove_host(host);
143 NCR_700_release(host);
144 free_irq(host->irq, host);
150 static struct parisc_driver lasi700_driver = {
152 .id_table = lasi700_ids,
153 .probe = lasi700_probe,
154 .remove = __devexit_p(lasi700_driver_remove),
160 return register_parisc_driver(&lasi700_driver);
166 unregister_parisc_driver(&lasi700_driver);
169 module_init(lasi700_init);
170 module_exit(lasi700_exit);