linux/drivers/scsi/mvme16x_scsi.c
<<
lue=.6lue=.6>>lulue=lue=.6 ">lue=.6lue=.6Searchlue=.6Prefs6 .6lulu ">le=.6 66
6 61/*6 62 * Detec v2 routine for the NCR53c710 based MVME16x SCSI Controllers for Linux.6 63 *6 64 * Based v2 work by Ala2 Hourihane6 65 *6 66 * Rewritten to use 53c700.c by Kars de Jong <jongk@linux-m68k.org>6 67 */6 68l6 69#include <linux/module.h>l6 /opta>#include <linux/blkdev.h>l6 11pta>#include <linux/device.h>l6 12pta>#include <linux/platform_device.h>l6 13pta>#include <linux/init.h>l6 14pta>#include <linux/interrupt.h>l6 15pta>#include <linux/slab.h>l6 16pta>#include <asm/mvme16xhw.h>l6 17pta>#include <scsi/scsi_host.h>l6 18pta>#include <scsi/scsi_device.h>l6 19#include <scsi/scsi_transport.h>l6 2opta>#include <scsi/scsi_transport_spi.h>l6 21l6 22pta>#include "53c700.h"l6 23l6 24MODULE_AUTHOR("Kars de Jong <jongk@linux-m68k.org>"6 25MODULE_DESCRIPTION("MVME16x NCR53C710 driver"6 26MODULE_LICENSE("GPL"6 27l6 28pta>static struct scsi_host_templatepta> mvme16x_scsi_driver_templatepta> = {l6 29 .nam = "MVME16x NCR53c710 SCSI"6 30 .proc_nam = "MVME16x"6 31 .this_id = 7,66 32 .module = THIS_MODULE,66 33};l6 34l6 35pta>static struct platform_device *mvme16x_scsi_device;l6 36l6 37pta>static int mvme16x_probe(struct platform_device *dev)l6 38pta>{l6 39 struct Scsi_Host * host = NULL;l6 40 struct NCR_700_Host_Param ters *hostdata;l6 41l6 42 if (!MACH_IS_MVME16x)l6 43 goto out;l6 44l6 45 if (mvme16x_config & MVME16x_CONFIG_NO_SCSICHIP) {l6 46 printk(KERN_INFOpta> "mvme16x-scsi: detec v2 disabled, "6 47 "SCSI chip not present\n"6 48 goto out;l6 49 }66 50l6 51 hostdata = kzalloc(sizeof(struct NCR_700_Host_Param ters), GFP_KERNEL);l6 52 if (hostdata == NULL) {l6 53 printk(KERN_ERRpta> "mvme16x-scsi: "6 54 "Failed to allocate host data\n"6 55 goto out;l6 56 }66 57l6 58 /* Fill in the required pieces of hostdata */6 59 hostdata->base = (void __iomem *)0xfff47000UL;l6 60 hostdata->clock = 50; /* XXX - depends v2 the CPU clock! */6 61 hostdata->chip710 = 1;l6 62 hostdata->dmode_extra = DMODE_FC2;l6 63 hostdata->dcntl_extra = EA_710;l6 64 hostdata->ctest7_extra = CTEST7_TT1;l6 65l6 66 /* and register the chip */6 67 host = NCR_700_detec (&mvme16x_scsi_driver_templatepta>, hostdata,66 68 &dev->dev);l6 69 if (!host) {l6 70 printk(KERN_ERRpta> "mvme16x-scsi: No host detec ed; "6 71 "board configura v2 problem?\n"6 72 goto out_free;l6 73 }66 74 host->this_id = 7;l6 75 host->base = 0xfff47000UL;l6 76 host->irq = MVME16x_IRQ_SCSI;l6 77 if (request_irq(host->irq, NCR_700_intr, 0, "mvme16x-scsi"host)) {l6 78 printk(KERN_ERRpta> "mvme16x-scsi: request_irq failed\n"6 79 goto out_put_host;l6 80 }66 81l6 82 /* Enable scsi chip ints */6 83 {l6 84 volatile unsigned long v;l6 85l6 86 /* Enable scsi interrupts at level 4 in PCCchip2 */6 87 v = in_be32(0xfff4202c);l6 88 v = (v & ~0xff) | 0x10 | 4;l6 89 out_be32(0xfff4202c, v);l6 90 }66 91l6 92 platform_set_drvdata(dev, host);l6 93 scsi_scan_host(host);l6 94l6 95 return 0;l6 96l6 97 out_put_host:l6 98 scsi_host_put(host);l6 99 out_free:l6100 kfree(hostdata);l6101 out:l6102 return -ENODEV;l6103}l6104l6105pta>static int mvme16x_device_remove(struct platform_device *dev)l6106{l6107 struct Scsi_Host *host = platform_get_drvdata(dev);l6108 struct NCR_700_Host_Param ters *hostdata = shost_priv(host);l6109l6110 /* Disable scsi chip ints */6111 {l6112 volatile unsigned long v;l6113l6114 v = in_be32(0xfff4202c);l6115 v &= ~0x10;l6116 out_be32(0xfff4202c, v);l6117 }l6118 scsi_remove_host(host);l6119 NCR_700_release(host);l6120 kfree(hostdata);l6121 free_irq(host->irq, host);l6122pta>l6123 return 0;l6124}l6125l6126static struct platform_driver mvme16x_scsi_driver = {l6127 .driver = {l6128 .nam = "mvme16x-scsi"6129 .owner = THIS_MODULE,66130 },66131 .probe = mvme16x_probe,66132 .remove = mvme16x_device_remove,66133};l6134l6135pta>static int __init mvme16x_scsi_init(void)l6136{l6137 int err;l6138l6139 err = platform_driver_register(&mvme16x_scsi_driver);l6140 if (err)l6141 return err;l6142pta>l6143 mvme16x_scsi_device = platform_device_register_simple("mvme16x-scsi"6144 -1, NULL, 0);l6145 if (IS_ERR(mvme16x_scsi_device)) {l6146 platform_driver_unregister(&mvme16x_scsi_driver);l6147 return PTR_ERR(mvme16x_scsi_device);l6148 }l6149l6150 return 0;l6151}l6152pta>l6153static void __exit mvme16x_scsi_exit(void)l6154{l6155 platform_device_unregister(mvme16x_scsi_device);l6156 platform_driver_unregister(&mvme16x_scsi_driver);l6157}l6158l6159module_init(mvme16x_scsi_init);l6160module_exit(mvme16x_scsi_exit);l6161 The original LXR software by the LXR community, this experimental vers v2 by lxr@linux.no. lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and opera v2s services since 1995.