linux/drivers/scsi/sni_53c710.c
<<
>>
Prefs
   1/* -*- mode: c; c-basic-offset: 8 -*- */
   2
   3/* SNI RM driver
   4 *
   5 * Copyright (C) 2001 by James.Bottomley@HansenPartnership.com
   6**-----------------------------------------------------------------------------
   7**
   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.
  12**
  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.
  17**
  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.
  21**
  22**-----------------------------------------------------------------------------
  23 */
  24
  25/*
  26 * Based on lasi700.c
  27 */
  28
  29#include <linux/kernel.h>
  30#include <linux/module.h>
  31#include <linux/init.h>
  32#include <linux/types.h>
  33#include <linux/slab.h>
  34#include <linux/stat.h>
  35#include <linux/mm.h>
  36#include <linux/blkdev.h>
  37#include <linux/sched.h>
  38#include <linux/ioport.h>
  39#include <linux/dma-mapping.h>
  40#include <linux/platform_device.h>
  41
  42#include <asm/page.h>
  43#include <asm/pgtable.h>
  44#include <asm/irq.h>
  45#include <asm/delay.h>
  46
  47#include <scsi/scsi_host.h>
  48#include <scsi/scsi_device.h>
  49#include <scsi/scsi_transport.h>
  50#include <scsi/scsi_transport_spi.h>
  51
  52#include "53c700.h"
  53
  54MODULE_AUTHOR("Thomas Bogendörfer");
  55MODULE_DESCRIPTION("SNI RM 53c710 SCSI Driver");
  56MODULE_LICENSE("GPL");
  57MODULE_ALIAS("platform:snirm_53c710");
  58
  59#define SNIRM710_CLOCK  32
  60
  61static struct scsi_host_template snirm710_template = {
  62        .name           = "SNI RM SCSI 53c710",
  63        .proc_name      = "snirm_53c710",
  64        .this_id        = 7,
  65        .module         = THIS_MODULE,
  66};
  67
  68static int __devinit snirm710_probe(struct platform_device *dev)
  69{
  70        unsigned long base;
  71        struct NCR_700_Host_Parameters *hostdata;
  72        struct Scsi_Host *host;
  73        struct  resource *res;
  74
  75        res = platform_get_resource(dev, IORESOURCE_MEM, 0);
  76        if (!res)
  77                return -ENODEV;
  78
  79        base = res->start;
  80        hostdata = kzalloc(sizeof(*hostdata), GFP_KERNEL);
  81        if (!hostdata) {
  82                dev_printk(KERN_ERR, dev, "Failed to allocate host data\n");
  83                return -ENOMEM;
  84        }
  85
  86        hostdata->dev = &dev->dev;
  87        dma_set_mask(&dev->dev, DMA_BIT_MASK(32));
  88        hostdata->base = ioremap_nocache(base, 0x100);
  89        hostdata->differential = 0;
  90
  91        hostdata->clock = SNIRM710_CLOCK;
  92        hostdata->force_le_on_be = 1;
  93        hostdata->chip710 = 1;
  94        hostdata->burst_length = 4;
  95
  96        host = NCR_700_detect(&snirm710_template, hostdata, &dev->dev);
  97        if (!host)
  98                goto out_kfree;
  99        host->this_id = 7;
 100        host->base = base;
 101        host->irq = platform_get_irq(dev, 0);
 102        if(request_irq(host->irq, NCR_700_intr, IRQF_SHARED, "snirm710", host)) {
 10ys/scsi/sni_53c710.c#L84" id="L84" class="line" name="L84">  84        }
  12KERN_ERR, dev, h fn>);
!sni_53c710.c#L83" id="L83" class="line" name="L83">  810**  but04class4out_kfree" class="sref">out_kfree;
 15/a>res" id="L85" class="line" name="L85">  810**  GNU06elass#L47" id="L47" class="line" name="L47">  410**dma_set_maskdev->dev, DMA_BIT_MASK<"drivers/scsi/sni_53c710.c#L1" id="L101" class="line" name="L101"> 1**  You08elassass="sref">hostdata->irm71scanr"drivers/scsi/sni_5irm71scanr"driost->irL1" id="L101" class="line" name="L101"> 1**  alo09elass9L47" id="L47" class="line" name="L47">  410**  thee Fre11"sref">hostENO0" id="L90" class="line" name="L90">  911**  (at class1#L52" id="L52" class="line" name="L52">  512**
<1 href=out_kfree;
  5120ys/scsi/n class="comment">**  Thiis pr11ass="sref">hostdata->irm710_temp hvers/scsi/sni_5irm710_temp host->irL1" id="L101" class="line" name="L101"> 4**  butt WIT1OUT ANout_kfree;
  5125/a>**  MERRCHAN11sref">res = ->base =  4**  GNUU Gen11"sref">host = ->bL1" id="L101" class="line" name="L101"> 4**
<117sref">hostENODEV;
  718**  Youu sho1ld hav" id="L85" class="line" name="L85">  819**  aloong w119L47" id="L47" class="line" name="L47">  410**  Fo1undat1on, Inss="sref">__devinit ;
platform_device *dev)
  611**
<1 href=3" id="L103" class="line" name="L103"> 2**
<12Host" class="sref">Scsi_Host *host;
platform_/evlgss=drv href="+code=dev" c/evlgss=drv href">dev->dev,  3 */
12urce" class="sref">r">NCR_700_intr,  *hostdata;
 3platform_d/a>,  *ho)a>->irq,  35/a>/*
<12#L96" id="L96" class="line" name="L96">  916 * Bas1ed on12"sref">host = ->irL1" id="L101" class="line" name="L101"> 7 */
12" class="sref">dma_set_mask->irL1" id="L101" class="line" name="L101"> 7hostdata->10.cef="+code=host" cla10.cef="ost->irq, NCR_700_intr<"+code=irq" class="sref">irL1" id="L101" class="line" name="L101"> 7host->->base =  0#inc1lude <host->->bL1" id="L101" class="line" name="L101"> 1#inc1lude <  512#inc1lude <ENO0" id="L90" class="line" name="L90">  913#inc1lude <  814#inc1lude <  715#inc1lude <scsi_ho class="srlass=ref="+code=dev" class="srlass=T ANout_kfree;
 6#inc1lude <host      
THIS_MODULE(struct   617#inc1lude <host   remova href="+code=horemovaass=ef">THIS_MODULE->  617host   class= href="+code=hoclass=#L73s="3" id="L103" class="line" name="L103"> 6hosthost   "SNI0",
  610#inc1lude <hosthost   owns= href="+code=hoowns=ce" ref">THIS_MODULE,
  611
host  611#inc1lude <  613#inc1lude <  514#inc1lude <__devinit snirm710_probe(s="+code=snirm710_probe(s="+c#L99/void" id="L69" class="line" name="L69">  615#inc1lude < 6
ENO="sref">scsi_ho class="srlass=_regists=ref="+code=dev" class="srlass=_regists=f">dev-> 7#inc1lude <  818#inc1lude <  719#inc1lude < ;
  610#inc1lude < 1
host->dev-> 2#inc1lude "  813
  514MODULE_AUTHO_MODULs="+code=snirm710_pr_MODULs="+c#L99/a>-> 2#inc1ref="+code=MODULE_DESCRI1PTION1 class="sref">MODULE__MODULsex+code=snirm710_pr_MODULsex+c#L99/a>-> 2
<"+code=foots=r>
The original LXRr modifydess=ge.net/projects/lx=r>LXRri/snu"+cy="srefSoftwexperini_5al lass"drilx=@ldriv.no="sr.
e_contets"><"+code=subfoots=r>
lx=.ldriv.no kindlyvers/3c710c id="L101http://www.redpill-ldrpro.no">Redpill Ldrpro rm:sni,wareviLiceof Ldruxri/nt">
 hrcsi/ oper 0213s serf">ds since 1995.
e_content/bodytet/htmlsu