^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*======================================================================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) A driver for the Qlogic SCSI card
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) qlogic_cs.c 1.79 2000/06/12 21:27:26
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) The contents of this file are subject to the Mozilla Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) License Version 1.1 (the "License"); you may not use this file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) except in compliance with the License. You may obtain a copy of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) the License at http://www.mozilla.org/MPL/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) Software distributed under the License is distributed on an "AS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) implied. See the License for the specific language governing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) rights and limitations under the License.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) The initial developer of the original code is David A. Hinds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) Alternatively, the contents of this file may be used under the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) terms of the GNU General Public License version 2 (the "GPL"), in which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) case the provisions of the GPL are applicable instead of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) above. If you wish to allow the use of your version of this file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) only under the terms of the GPL and not to allow others to use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) your version of this file under the MPL, indicate your decision
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) by deleting the provisions above and replace them with the notice
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) and other provisions required by the GPL. If you do not delete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) the provisions above, a recipient may use your version of this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) file under either the MPL or the GPL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ======================================================================*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #include <linux/ioport.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) #include <scsi/scsi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #include <linux/major.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #include <linux/blkdev.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #include <scsi/scsi_ioctl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #include "scsi.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #include <scsi/scsi_host.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #include "../qlogicfas408.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #include <pcmcia/cistpl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #include <pcmcia/ds.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) #include <pcmcia/ciscode.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) /* Set the following to 2 to use normal interrupt (active high/totempole-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * tristate), otherwise use 0 (REQUIRED FOR PCMCIA) for active low, open
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) * drain
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #define INT_TYPE 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) static char qlogic_name[] = "qlogic_cs";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) static struct scsi_host_template qlogicfas_driver_template = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) .module = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) .name = qlogic_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) .proc_name = qlogic_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) .info = qlogicfas408_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) .queuecommand = qlogicfas408_queuecommand,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) .eh_abort_handler = qlogicfas408_abort,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) .eh_host_reset_handler = qlogicfas408_host_reset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) .bios_param = qlogicfas408_biosparam,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) .can_queue = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) .this_id = -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) .sg_tablesize = SG_ALL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) .dma_boundary = PAGE_SIZE - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /*====================================================================*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) typedef struct scsi_info_t {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) struct pcmcia_device *p_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) struct Scsi_Host *host;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) unsigned short manf_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) } scsi_info_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) static void qlogic_release(struct pcmcia_device *link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) static void qlogic_detach(struct pcmcia_device *p_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) static int qlogic_config(struct pcmcia_device * link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) static struct Scsi_Host *qlogic_detect(struct scsi_host_template *host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) struct pcmcia_device *link, int qbase, int qlirq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) int qltyp; /* type of chip */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) int qinitid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) struct Scsi_Host *shost; /* registered host structure */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) struct qlogicfas408_priv *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) qltyp = qlogicfas408_get_chip_type(qbase, INT_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) qinitid = host->this_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) if (qinitid < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) qinitid = 7; /* if no ID, use 7 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) qlogicfas408_setup(qbase, qinitid, INT_TYPE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) host->name = qlogic_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) shost = scsi_host_alloc(host, sizeof(struct qlogicfas408_priv));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) if (!shost)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) goto err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) shost->io_port = qbase;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) shost->n_io_port = 16;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) shost->dma_channel = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) if (qlirq != -1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) shost->irq = qlirq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) priv = get_priv_by_host(shost);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) priv->qlirq = qlirq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) priv->qbase = qbase;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) priv->qinitid = qinitid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) priv->shost = shost;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) priv->int_type = INT_TYPE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) if (request_irq(qlirq, qlogicfas408_ihandl, 0, qlogic_name, shost))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) goto free_scsi_host;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) sprintf(priv->qinfo,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) "Qlogicfas Driver version 0.46, chip %02X at %03X, IRQ %d, TPdma:%d",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) qltyp, qbase, qlirq, QL_TURBO_PDMA);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) if (scsi_add_host(shost, NULL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) goto free_interrupt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) scsi_scan_host(shost);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) return shost;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) free_interrupt:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) free_irq(qlirq, shost);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) free_scsi_host:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) scsi_host_put(shost);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) err:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) static int qlogic_probe(struct pcmcia_device *link)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) scsi_info_t *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) dev_dbg(&link->dev, "qlogic_attach()\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /* Create new SCSI device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) info = kzalloc(sizeof(*info), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) if (!info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) info->p_dev = link;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) link->priv = info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) link->config_regs = PRESENT_OPTION;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) return qlogic_config(link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) } /* qlogic_attach */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) /*====================================================================*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) static void qlogic_detach(struct pcmcia_device *link)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) dev_dbg(&link->dev, "qlogic_detach\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) qlogic_release(link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) kfree(link->priv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) } /* qlogic_detach */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) /*====================================================================*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) static int qlogic_config_check(struct pcmcia_device *p_dev, void *priv_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) p_dev->io_lines = 10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) if (p_dev->resource[0]->start == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) return pcmcia_request_io(p_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) static int qlogic_config(struct pcmcia_device * link)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) scsi_info_t *info = link->priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) struct Scsi_Host *host;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) dev_dbg(&link->dev, "qlogic_config\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) ret = pcmcia_loop_config(link, qlogic_config_check, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) goto failed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) if (!link->irq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) goto failed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) ret = pcmcia_enable_device(link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) goto failed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) if ((info->manf_id == MANFID_MACNICA) || (info->manf_id == MANFID_PIONEER) || (info->manf_id == 0x0098)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) /* set ATAcmd */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) outb(0xb4, link->resource[0]->start + 0xd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) outb(0x24, link->resource[0]->start + 0x9);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) outb(0x04, link->resource[0]->start + 0xd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) /* The KXL-810AN has a bigger IO port window */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) if (resource_size(link->resource[0]) == 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) host = qlogic_detect(&qlogicfas_driver_template, link,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) link->resource[0]->start + 16, link->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) host = qlogic_detect(&qlogicfas_driver_template, link,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) link->resource[0]->start, link->irq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) if (!host) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) printk(KERN_INFO "%s: no SCSI devices found\n", qlogic_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) goto failed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) info->host = host;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) failed:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) pcmcia_disable_device(link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) } /* qlogic_config */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) /*====================================================================*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) static void qlogic_release(struct pcmcia_device *link)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) scsi_info_t *info = link->priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) dev_dbg(&link->dev, "qlogic_release\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) scsi_remove_host(info->host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) free_irq(link->irq, info->host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) pcmcia_disable_device(link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) scsi_host_put(info->host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) /*====================================================================*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) static int qlogic_resume(struct pcmcia_device *link)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) scsi_info_t *info = link->priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) ret = pcmcia_enable_device(link);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) if ((info->manf_id == MANFID_MACNICA) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) (info->manf_id == MANFID_PIONEER) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) (info->manf_id == 0x0098)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) outb(0x80, link->resource[0]->start + 0xd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) outb(0x24, link->resource[0]->start + 0x9);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) outb(0x04, link->resource[0]->start + 0xd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) /* Ugggglllyyyy!!! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) qlogicfas408_host_reset(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) static const struct pcmcia_device_id qlogic_ids[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) PCMCIA_DEVICE_PROD_ID12("EIger Labs", "PCMCIA-to-SCSI Adapter", 0x88395fa7, 0x33b7a5e6),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) PCMCIA_DEVICE_PROD_ID12("EPSON", "SCSI-2 PC Card SC200", 0xd361772f, 0x299d1751),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) PCMCIA_DEVICE_PROD_ID12("MACNICA", "MIRACLE SCSI-II mPS110", 0x20841b68, 0xab3c3b6d),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) PCMCIA_DEVICE_PROD_ID12("MIDORI ELECTRONICS ", "CN-SC43", 0x6534382a, 0xd67eee79),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) PCMCIA_DEVICE_PROD_ID12("NEC", "PC-9801N-J03R", 0x18df0ba0, 0x24662e8a),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) PCMCIA_DEVICE_PROD_ID12("KME ", "KXLC003", 0x82375a27, 0xf68e5bf7),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) PCMCIA_DEVICE_PROD_ID12("KME ", "KXLC004", 0x82375a27, 0x68eace54),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) PCMCIA_DEVICE_PROD_ID12("KME", "KXLC101", 0x3faee676, 0x194250ec),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) PCMCIA_DEVICE_PROD_ID12("QLOGIC CORPORATION", "pc05", 0xd77b2930, 0xa85b2735),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) PCMCIA_DEVICE_PROD_ID12("QLOGIC CORPORATION", "pc05 rev 1.10", 0xd77b2930, 0x70f8b5f8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) PCMCIA_DEVICE_PROD_ID123("KME", "KXLC002", "00", 0x3faee676, 0x81896b61, 0xf99f065f),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) PCMCIA_DEVICE_PROD_ID12("RATOC System Inc.", "SCSI2 CARD 37", 0x85c10e17, 0x1a2640c1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "SCSC200A PC CARD SCSI", 0xb4585a1a, 0xa6f06ebe),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) PCMCIA_DEVICE_PROD_ID12("TOSHIBA", "SCSC200B PC CARD SCSI-10", 0xb4585a1a, 0x0a88dea0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) /* these conflict with other cards! */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) /* PCMCIA_DEVICE_PROD_ID123("MACNICA", "MIRACLE SCSI", "mPS100", 0x20841b68, 0xf8dedaeb, 0x89f7fafb), */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) /* PCMCIA_DEVICE_PROD_ID123("MACNICA", "MIRACLE SCSI", "mPS100", 0x20841b68, 0xf8dedaeb, 0x89f7fafb), */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) PCMCIA_DEVICE_NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) MODULE_DEVICE_TABLE(pcmcia, qlogic_ids);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) static struct pcmcia_driver qlogic_cs_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) .name = "qlogic_cs",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) .probe = qlogic_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) .remove = qlogic_detach,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) .id_table = qlogic_ids,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) .resume = qlogic_resume,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) MODULE_AUTHOR("Tom Zerucha, Michael Griffith");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) MODULE_DESCRIPTION("Driver for the PCMCIA Qlogic FAS SCSI controllers");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) module_pcmcia_driver(qlogic_cs_driver);