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.
35 #error "lasi700 only compiles on hppa architecture"
38 #include <linux/kernel.h>
39 #include <linux/init.h>
40 #include <linux/types.h>
41 #include <linux/stat.h>
43 #include <linux/blk.h>
44 #include <linux/sched.h>
45 #include <linux/version.h>
46 #include <linux/config.h>
47 #include <linux/ioport.h>
50 #include <asm/pgtable.h>
52 #include <asm/hardware.h>
53 #include <asm/delay.h>
56 #include <linux/module.h>
60 #include "constants.h"
67 char *lasi700; /* command line from insmod */
69 MODULE_AUTHOR("James Bottomley");
70 MODULE_DESCRIPTION("lasi700 SCSI Driver");
71 MODULE_LICENSE("GPL");
72 MODULE_PARM(lasi700, "s");
82 static unsigned long __initdata opt_base;
83 static int __initdata opt_irq;
86 param_setup(char *string)
88 char *pos = string, *next;
90 while(pos != NULL && (next = strchr(pos, ':')) != NULL) {
91 int val = (int)simple_strtoul(++next, NULL, 0);
93 if(!strncmp(pos, "addr:", 5))
95 else if(!strncmp(pos, "irq:", 4))
98 if((pos = strchr(pos, ARG_SEP)) != NULL)
105 __setup("lasi700=", param_setup);
108 static Scsi_Host_Template __initdata *host_tpnt = NULL;
109 static int __initdata host_count = 0;
110 static struct parisc_device_id lasi700_scsi_tbl[] = {
116 MODULE_DEVICE_TABLE(parisc, lasi700_scsi_tbl);
118 static struct parisc_driver lasi700_driver = LASI700_DRIVER;
121 lasi700_detect(Scsi_Host_Template *tpnt)
127 param_setup(lasi700);
130 register_parisc_driver(&lasi700_driver);
132 return (host_count != 0);
136 lasi700_driver_callback(struct parisc_device *dev)
138 unsigned long base = dev->hpa + LASI_SCSI_CORE_OFFSET;
140 struct Scsi_Host *host;
141 struct NCR_700_Host_Parameters *hostdata =
142 kmalloc(sizeof(struct NCR_700_Host_Parameters),
144 if(dev->id.sversion == LASI_700_SVERSION) {
145 driver_name = "lasi700";
147 driver_name = "lasi710";
149 if(hostdata == NULL) {
150 printk(KERN_ERR "%s: Failed to allocate host data\n",
154 memset(hostdata, 0, sizeof(struct NCR_700_Host_Parameters));
155 hostdata->base = base;
156 hostdata->differential = 0;
157 if(dev->id.sversion == LASI_700_SVERSION) {
158 hostdata->clock = LASI700_CLOCK;
159 hostdata->force_le_on_be = 1;
161 hostdata->clock = LASI710_CLOCK;
162 hostdata->force_le_on_be = 0;
163 hostdata->chip710 = 1;
164 hostdata->dmode_extra = DMODE_FC2;
166 hostdata->pci_dev = ccio_get_fake(dev);
167 if((host = NCR_700_detect(host_tpnt, hostdata)) == NULL) {
171 host->irq = dev->irq;
172 if(request_irq(dev->irq, NCR_700_intr, SA_SHIRQ, driver_name, host)) {
173 printk(KERN_ERR "%s: irq problem, detaching\n",
175 scsi_unregister(host);
176 NCR_700_release(host);
184 lasi700_release(struct Scsi_Host *host)
186 struct D700_Host_Parameters *hostdata =
187 (struct D700_Host_Parameters *)host->hostdata[0];
189 NCR_700_release(host);
191 free_irq(host->irq, host);
192 unregister_parisc_driver(&lasi700_driver);
196 static Scsi_Host_Template driver_template = LASI700_SCSI;
198 #include "scsi_module.c"