1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* -*- mode: c; c-basic-offset: 8 -*- */
6 * Copyright (C) 2001 by James.Bottomley@HansenPartnership.com
7 **-----------------------------------------------------------------------------
10 **-----------------------------------------------------------------------------
17 #include <linux/kernel.h>
18 #include <linux/module.h>
19 #include <linux/init.h>
20 #include <linux/types.h>
21 #include <linux/slab.h>
22 #include <linux/stat.h>
24 #include <linux/blkdev.h>
25 #include <linux/sched.h>
26 #include <linux/ioport.h>
27 #include <linux/dma-mapping.h>
28 #include <linux/platform_device.h>
32 #include <asm/delay.h>
34 #include <scsi/scsi_host.h>
35 #include <scsi/scsi_device.h>
36 #include <scsi/scsi_transport.h>
37 #include <scsi/scsi_transport_spi.h>
41 MODULE_AUTHOR("Thomas Bogendörfer");
42 MODULE_DESCRIPTION("SNI RM 53c710 SCSI Driver");
43 MODULE_LICENSE("GPL");
44 MODULE_ALIAS("platform:snirm_53c710");
46 #define SNIRM710_CLOCK 32
48 static struct scsi_host_template snirm710_template
= {
49 .name
= "SNI RM SCSI 53c710",
50 .proc_name
= "snirm_53c710",
52 .module
= THIS_MODULE
,
55 static int snirm710_probe(struct platform_device
*dev
)
58 struct NCR_700_Host_Parameters
*hostdata
;
59 struct Scsi_Host
*host
;
62 res
= platform_get_resource(dev
, IORESOURCE_MEM
, 0);
67 hostdata
= kzalloc(sizeof(*hostdata
), GFP_KERNEL
);
71 hostdata
->dev
= &dev
->dev
;
72 dma_set_mask(&dev
->dev
, DMA_BIT_MASK(32));
73 hostdata
->base
= ioremap(base
, 0x100);
74 hostdata
->differential
= 0;
76 hostdata
->clock
= SNIRM710_CLOCK
;
77 hostdata
->force_le_on_be
= 1;
78 hostdata
->chip710
= 1;
79 hostdata
->burst_length
= 4;
81 host
= NCR_700_detect(&snirm710_template
, hostdata
, &dev
->dev
);
86 host
->irq
= platform_get_irq(dev
, 0);
87 if(request_irq(host
->irq
, NCR_700_intr
, IRQF_SHARED
, "snirm710", host
)) {
88 printk(KERN_ERR
"snirm710: request_irq failed!\n");
92 dev_set_drvdata(&dev
->dev
, host
);
100 iounmap(hostdata
->base
);
105 static int snirm710_driver_remove(struct platform_device
*dev
)
107 struct Scsi_Host
*host
= dev_get_drvdata(&dev
->dev
);
108 struct NCR_700_Host_Parameters
*hostdata
=
109 (struct NCR_700_Host_Parameters
*)host
->hostdata
[0];
111 scsi_remove_host(host
);
112 NCR_700_release(host
);
113 free_irq(host
->irq
, host
);
114 iounmap(hostdata
->base
);
120 static struct platform_driver snirm710_driver
= {
121 .probe
= snirm710_probe
,
122 .remove
= snirm710_driver_remove
,
124 .name
= "snirm_53c710",
127 module_platform_driver(snirm710_driver
);