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>
31 #include <asm/pgtable.h>
33 #include <asm/delay.h>
35 #include <scsi/scsi_host.h>
36 #include <scsi/scsi_device.h>
37 #include <scsi/scsi_transport.h>
38 #include <scsi/scsi_transport_spi.h>
42 MODULE_AUTHOR("Thomas Bogendörfer");
43 MODULE_DESCRIPTION("SNI RM 53c710 SCSI Driver");
44 MODULE_LICENSE("GPL");
45 MODULE_ALIAS("platform:snirm_53c710");
47 #define SNIRM710_CLOCK 32
49 static struct scsi_host_template snirm710_template
= {
50 .name
= "SNI RM SCSI 53c710",
51 .proc_name
= "snirm_53c710",
53 .module
= THIS_MODULE
,
56 static int snirm710_probe(struct platform_device
*dev
)
59 struct NCR_700_Host_Parameters
*hostdata
;
60 struct Scsi_Host
*host
;
63 res
= platform_get_resource(dev
, IORESOURCE_MEM
, 0);
68 hostdata
= kzalloc(sizeof(*hostdata
), GFP_KERNEL
);
72 hostdata
->dev
= &dev
->dev
;
73 dma_set_mask(&dev
->dev
, DMA_BIT_MASK(32));
74 hostdata
->base
= ioremap(base
, 0x100);
75 hostdata
->differential
= 0;
77 hostdata
->clock
= SNIRM710_CLOCK
;
78 hostdata
->force_le_on_be
= 1;
79 hostdata
->chip710
= 1;
80 hostdata
->burst_length
= 4;
82 host
= NCR_700_detect(&snirm710_template
, hostdata
, &dev
->dev
);
87 host
->irq
= platform_get_irq(dev
, 0);
88 if(request_irq(host
->irq
, NCR_700_intr
, IRQF_SHARED
, "snirm710", host
)) {
89 printk(KERN_ERR
"snirm710: request_irq failed!\n");
93 dev_set_drvdata(&dev
->dev
, host
);
101 iounmap(hostdata
->base
);
106 static int snirm710_driver_remove(struct platform_device
*dev
)
108 struct Scsi_Host
*host
= dev_get_drvdata(&dev
->dev
);
109 struct NCR_700_Host_Parameters
*hostdata
=
110 (struct NCR_700_Host_Parameters
*)host
->hostdata
[0];
112 scsi_remove_host(host
);
113 NCR_700_release(host
);
114 free_irq(host
->irq
, host
);
115 iounmap(hostdata
->base
);
121 static struct platform_driver snirm710_driver
= {
122 .probe
= snirm710_probe
,
123 .remove
= snirm710_driver_remove
,
125 .name
= "snirm_53c710",
129 static int __init
snirm710_init(void)
131 return platform_driver_register(&snirm710_driver
);
134 static void __exit
snirm710_exit(void)
136 platform_driver_unregister(&snirm710_driver
);
139 module_init(snirm710_init
);
140 module_exit(snirm710_exit
);