linux/drivers/scsi/mvme16x_scsi.c
<<
>>
Prefs
   1/*
   2 * Detection routine for the NCR53c710 based MVME16x SCSI Controllers for Linux.
   3 *
   4 * Based on work by Alan Hourihane
   5 *
   6 * Rewritten to use 53c700.c by Kars de Jong <jongk@linux-m68k.org>
   7 */
   8
   9#include <linux/module.h>
  10#include <linux/blkdev.h>
  11#include <linux/device.h>
  12#include <linux/platform_device.h>
  13#include <linux/init.h>
  14#include <linux/interrupt.h>
  15#include <linux/slab.h>
  16#include <asm/mvme16xhw.h>
  17#include <scsi/scsi_host.h>
  18#include <scsi/scsi_device.h>
  19#include <scsi/scsi_transport.h>
  20#include <scsi/scsi_transport_spi.h>
  21
  22#include "53c700.h"
  23
  24MODULE_AUTHOR("Kars de Jong <jongk@linux-m68k.org>");
  25MODULE_DESCRIPTION("MVME16x NCR53C710 driver");
  26MODULE_LICENSE("GPL");
  27
  28static struct scsi_host_template mvme16x_scsi_driver_template = {
  29        .name                   = "MVME16x NCR53c710 SCSI",
  30        .proc_name              = "MVME16x",
  31        .this_id                = 7,
  32        .module                 = THIS_MODULE,
  33};
  34
  35static struct platform_device *mvme16x_scsi_device;
  36
  37static int mvme16x_probe(struct platform_device *dev)
  38{
  39        struct Scsi_Host * host = NULL;
  40        struct NCR_700_Host_Parameters *hostdata;
  41
  42        if (!MACH_IS_MVME16x)
  43                goto out;
  44
  45        if (mvme16x_config & MVME16x_CONFIG_NO_SCSICHIP) {
  46                printk(KERN_INFO "mvme16x-scsi: detection disabled, "
  47                                 "SCSI chip not present\n");
  48                goto out;
  49        }
  50
  51        hostdata = kzalloc(sizeof(struct NCR_700_Host_Parameters), GFP_KERNEL);
  52        if (hostdata == NULL) {
  53                printk(KERN_ERR "mvme16x-scsi: "
  54                                "Failed to allocate host data\n");
  55                goto out;
  56        }
  57
  58        /* Fill in the required pieces of hostdata */
  59        hostdata->base = (void __iomem *)0xfff47000UL;
  60        hostdata->clock = 50;   /* XXX - depends on the CPU clock! */
  61        hostdata->chip710 = 1;
  62        hostdata->dmode_extra = DMODE_FC2;
  63        hostdata->dcntl_extra = EA_710;
  64        hostdata->ctest7_extra = CTEST7_TT1;
  65
  66        /* and register the chip */
  67        host = NCR_700_detect(&mvme16x_scsi_driver_template, hostdata,
  68                              &dev->dev);
  69        if (!host) {
  70                printk(KERN_ERR "mvme16x-scsi: No host detected; "
  71                                "board configuration problem?\n");
  72                goto out_free;
  73        }
  74        host->this_id = 7;
  75        host->base = 0xfff47000UL;
  76        host->irq = MVME16x_IRQ_SCSI;
  77        if (request_irq(host->irq, NCR_700_intr, 0, "mvme16x-scsi", host)) {
  78                printk(KERN_ERR "mvme16x-scsi: request_irq failed\n");
  79                goto out_put_host;
  80        }
  81
  82        /* Enable scsi chip ints */
  83        {
  84                volatile unsigned long v;
  85
  86                /* Enable scsi interrupts at leoption>/* Enable scsi ic hrefit.  77        8f (v;
;
   8
;
  79        8     8 goto h>;
  80        9
  81
  82        9span 9="+code=hostdata" class="sre*,
host)) {
  83        9
host->  84        9     9rs/scsi/mvme16x_scsi.c#L45" id="L45" class="9ine" nam9="L85">  85

  href="+code=mmvme16x_scsi.c#L37" id="L37" class="9ine" nam9="L77">  77        9f (out_put_host;
   8
, hrefphost->   9#include &     99     ut_host" class="sreut_free;
  10#include &
hostdata ==   11#include 01  12#include 02NODEV0;
  13#include 03  14#include 04  15#include 05"+code_remov16x_scsi_driver_template"+code_remov1a href=platform_device" class="sref">platform_device *dev)
  16#include 06  17#include 07Scsi_Host * host = ,
  18#include 08NCR_700_Host_Parameters *hostdata;
;
host->  19#include 09  10#include  <11
"+code=hostda>/* Enable scsi interrupDn>

  11#include &1  12#include  <11 goto v;
  13#include  <11rs/scsi/mvme16x_scsi.c#L24" id="L24" class="1line" namee="L14">  14#include  <11 volatile unsigned loass="sref">v;
;
  15#include  <11 goto   16#include  <11 ;
h>;
  17#include  <11             ssi/mvme16x_scsi.c#L85" id="L85" class="1line" namee="L18">  18#include  <118"+code=hostdata" class="sre,remov1out_put_host;
,remov1out_phost" class="sref">host->  19#include  <11="+code=hostdata" class="sreers relese = 0xfff4700ers relesehost->  20#include1 <12
"+code=hostdata" class="srekut_free;
hostdata ==   21
host->irq, ->  12#include &<1;  23
  24  25  26scsi.orm_device *, ,   27
  28static s1truct12 name                   = "MVME16x"span>,   29        1.nownhr6x_scsi_driver_ownhrgoto THIS_MODULE,
  30        1.  31        1.mvme16x_probe(struct   32        1."+code_remov16x_scsi_driver_template"+code_remov1a hrcsi/mvme16x_scsi.c#L33" id="L33" class="1line" name=="L13">  13#include &"dri1ivers/scsi/mvme16x_scsi.c#L34" id="L34" class="1line" nam1e="L34">  34
  35static s1truct13a href="+codvme16x_probe" class__ef="6x_scsi_driver___ef="     ut_host" class=template,ef="6x_scsi_driver_template,ef="host"__iocsi/mvme16x_scsi.c#L38" id="L38" class="1line" nam1e="L36">  36
  37static i1nt   38{
   8

 *mvi_driver_template,   40        struct1 scsi_driver_errrs/scsi/mvme16x_scsi.c#L38" id="L38" class="1line" name="L411">  41
  42        if (!<1a hre14i/mvme16x_scsi.c#L79" id="L79" class="1line" name="L431">  43              1  got14e=hostdata" class="sre,ste, ;
                ef=get_dreremov1a  class=MVME16x"span>,   44
"tttttttttttttttttttttttttttttt-1ntr" class="sref">) {
  45        if (host, ;
  46              1  printkf="scsi.     uoun>
 *mvi_driver_template,   47              1     1              host, ;
  48              1  got1   49        }
  50
  51          52        if (  53              1  __iomeexcsi_driver___ef="  excst_host" class=template,ef="6xexcsi_driver___ef="te,ef="6xexcs_iocsi/mvme16x_scsi.c#L38" id="L38" class="1line" name="L541">  54              1     1      me16x_scsi.c#L78" id="L78" class="line" 1name="L551">  55              1  got15e=host" class="sref">host
 *host, ;
  56        }
host
 *mvi_driver_template,   57
  58          59        host, ,ef="host"__iocvme16x_scsi.c#L79" id="L79" class="1line" name="L601">  60        host,   61         foohrev>
The original LXR software@lin="dr16x_scsi.http://sourcescsge.net/projects/lxev>LXR terrut"_ycsi/, driv experirupDal 79" >);
lin16x_scsi.mailto:lxe/span>.no">lxe/span>.nocsi/.


Redpilliverpro AScsi/, providerhrefLpan>quotdiv spa/spanoperan>);s ser/scss since 1995.