1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67#include <linux/module.h>
68#include <linux/types.h>
69#include <linux/blkdev.h>
70#include <linux/interrupt.h>
71#include <linux/init.h>
72#include <linux/nvram.h>
73#include <linux/bitops.h>
74#include <linux/wait.h>
75#include <linux/platform_device.h>
76
77#include <asm/setup.h>
78#include <asm/atarihw.h>
79#include <asm/atariints.h>
80#include <asm/atari_stdma.h>
81#include <asm/atari_stram.h>
82#include <asm/io.h>
83
84#include <scsi/scsi_host.h>
85
86
87
88#define REAL_DMA
89#define SUPPORT_TAGS
90#define MAX_TAGS 32
91#define DMA_MIN_SIZE 32
92
93#define NCR5380_implementation_fields
94
95#define NCR5380_read(reg) atari_scsi_reg_read(reg)
96#define NCR5380_write(reg, value) atari_scsi_reg_write(reg, value)
97
98#define NCR5380_queue_command atari_scsi_queue_command
99#define NCR5380_abort atari_scsi_abort
100#define NCR5380_info atari_scsi_info
101
102#define NCR5380_dma_read_setup(instance, data, count) \
103 atari_scsi_dma_setup(instance, data, count, 0)
104#define NCR5380_dma_write_setup(instance, data, count) \
105 atari_scsi_dma_setup(instance, data, count, 1)
106#define NCR5380_dma_residual(instance) \
107 atari_scsi_dma_residual(instance)
108#define NCR5380_dma_xfer_len(instance, cmd, phase) \
109 atari_dma_xfer_len(cmd->SCp.this_residual, cmd, !((phase) & SR_IO))
110
111#define NCR5380_acquire_dma_irq(instance) falcon_get_lock(instance)
112#define NCR5380_release_dma_irq(instance) falcon_release_lock()
113
114#include "NCR5380.h"
115
116
117#define IS_A_TT() ATARIHW_PRESENT(TT_SCSI)
118
119#define SCSI_DMA_WRITE_P(elt,val) \
120 do { \
121 unsigned long v = val; \
122 tt_scsi_dma.elt##_lo = v & 0xff; \
123 v >>= 8; \
124 tt_scsi_dma.elt##_lmd = v & 0xff; \
125 v >>= 8; \
126 tt_scsi_dma.elt##_hmd = v & 0xff; \
127 v >>= 8; \
128 tt_scsi_dma.elt##_hi = v & 0xff; \
129 } while(0)
130
131#define SCSI_DMA_READ_P(elt) \
132 (((((((unsigned long)tt_scsi_dma.elt##_hi << 8) | \
133 (unsigned long)tt_scsi_dma.elt##_hmd) << 8) | \
134 (unsigned long)tt_scsi_dma.elt##_lmd) << 8) | \
135 (unsigned long)tt_scsi_dma.elt##_lo)
136
137
138static inline void SCSI_DMA_SETADR(unsigned long adr)
139{
140 st_dma.dma_lo = (unsigned char)adr;
141 MFPDELAY();
142 adr >>= 8;
143 st_dma.dma_md = (unsigned char)adr;
144 MFPDELAY();
145 adr >>= 8;
146 st_dma.dma_hi = (unsigned char)adr;
147 MFPDELAY();
148}
149
150static inline unsigned long SCSI_DMA_GETADR(void)
151{
152 unsigned long adr;
153 adr = st_dma.dma_lo;
154 MFPDELAY();
155 adr |= (st_dma.dma_md & 0xff) << 8;
156 MFPDELAY();
157 adr |= (st_dma.dma_hi & 0xff) << 16;
158 MFPDELAY();
159 return adr;
160}
161
162#ifdef REAL_DMA
163static void atari_scsi_fetch_restbytes(void);
164#endif
165
166static unsigned char (*atari_scsi_reg_read)(unsigned char reg);
167static void (*atari_scsi_reg_write)(unsigned char reg, unsigned char value);
168
169#ifdef REAL_DMA
170static unsigned long atari_dma_residual, atari_dma_startaddr;
171static short atari_dma_active;
172
173static char *atari_dma_buffer;
174
175static unsigned long atari_dma_phys_buffer;
176
177static char *atari_dma_orig_addr;
178
179
180
181
182
183
184#define STRAM_BUFFER_SIZE (4096)
185
186static unsigned long atari_dma_stram_mask;
187#define STRAM_ADDR(a) (((a) & atari_dma_stram_mask) == 0)
188#endif
189
190static int setup_can_queue = -1;
191module_param(setup_can_queue, int, 0);
192static int setup_cmd_per_lun = -1;
193module_param(setup_cmd_per_lun, int, 0);
194static int setup_sg_tablesize = -1;
195module_param(setup_sg_tablesize, int, 0);
196static int setup_use_tagged_queuing = -1;
197module_param(setup_use_tagged_queuing, int, 0);
198static int setup_hostid = -1;
199module_param(setup_hostid, int, 0);
200static int setup_toshiba_delay = -1;
201module_param(setup_toshiba_delay, int, 0);
202
203
204#if defined(REAL_DMA)
205
206static int scsi_dma_is_ignored_buserr(unsigned char dma_stat)
207{
208 int i;
209 unsigned long addr = SCSI_DMA_READ_P(dma_addr), end_addr;
210
211 if (dma_stat & 0x01) {
212
213
214
215
216
217
218 for (i = 0; i < m68k_num_memory; ++i) {
219 end_addr = m68k_memory[i].addr + m68k_memory[i].size;
220 if (end_addr <= addr && addr <= end_addr + 4)
221 return 1;
222 }
223 }
224 return 0;
225}
226
227
228#if 0
229
230
231
232
233static void scsi_dma_buserr(int irq, void *dummy)
234{
235 unsigned char dma_stat = tt_scsi_dma.dma_ctrl;
236
237
238
239 if (atari_irq_pending(IRQ_TT_MFP_SCSI))
240 return;
241
242 printk("Bad SCSI DMA interrupt! dma_addr=0x%08lx dma_stat=%02x dma_cnt=%08lx\n",
243 SCSI_DMA_READ_P(dma_addr), dma_stat, SCSI_DMA_READ_P(dma_cnt));
244 if (dma_stat & 0x80) {
245 if (!scsi_dma_is_ignored_buserr(dma_stat))
246 printk("SCSI DMA bus error -- bad DMA programming!\n");
247 } else {
248
249
250
251
252
253 printk("SCSI DMA intr ?? -- this shouldn't happen!\n");
254 }
255}
256#endif
257
258#endif
259
260
261static irqreturn_t scsi_tt_intr(int irq, void *dev)
262{
263#ifdef REAL_DMA
264 struct Scsi_Host *instance = dev;
265 struct NCR5380_hostdata *hostdata = shost_priv(instance);
266 int dma_stat;
267
268 dma_stat = tt_scsi_dma.dma_ctrl;
269
270 dsprintk(NDEBUG_INTR, instance, "NCR5380 interrupt, DMA status = %02x\n",
271 dma_stat & 0xff);
272
273
274
275
276 if (dma_stat & 0x80) {
277 if (!scsi_dma_is_ignored_buserr(dma_stat)) {
278 printk(KERN_ERR "SCSI DMA caused bus error near 0x%08lx\n",
279 SCSI_DMA_READ_P(dma_addr));
280 printk(KERN_CRIT "SCSI DMA bus error -- bad DMA programming!");
281 }
282 }
283
284
285
286
287
288
289
290
291
292
293 if ((dma_stat & 0x02) && !(dma_stat & 0x40)) {
294 atari_dma_residual = hostdata->dma_len -
295 (SCSI_DMA_READ_P(dma_addr) - atari_dma_startaddr);
296
297 dprintk(NDEBUG_DMA, "SCSI DMA: There are %ld residual bytes.\n",
298 atari_dma_residual);
299
300 if ((signed int)atari_dma_residual < 0)
301 atari_dma_residual = 0;
302 if ((dma_stat & 1) == 0) {
303
304
305
306
307 atari_scsi_fetch_restbytes();
308 } else {
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327 if (atari_dma_residual & 0x1ff) {
328 dprintk(NDEBUG_DMA, "SCSI DMA: DMA bug corrected, "
329 "difference %ld bytes\n",
330 512 - (atari_dma_residual & 0x1ff));
331 atari_dma_residual = (atari_dma_residual + 511) & ~0x1ff;
332 }
333 }
334 tt_scsi_dma.dma_ctrl = 0;
335 }
336
337
338 if (dma_stat & 0x40) {
339 atari_dma_residual = 0;
340 if ((dma_stat & 1) == 0)
341 atari_scsi_fetch_restbytes();
342 tt_scsi_dma.dma_ctrl = 0;
343 }
344
345#endif
346
347 NCR5380_intr(irq, dev);
348
349 return IRQ_HANDLED;
350}
351
352
353static irqreturn_t scsi_falcon_intr(int irq, void *dev)
354{
355#ifdef REAL_DMA
356 struct Scsi_Host *instance = dev;
357 struct NCR5380_hostdata *hostdata = shost_priv(instance);
358 int dma_stat;
359
360
361
362
363 st_dma.dma_mode_status = 0x90;
364 dma_stat = st_dma.dma_mode_status;
365
366
367
368
369 if (!(dma_stat & 0x01)) {
370
371 printk(KERN_CRIT "SCSI DMA error near 0x%08lx!\n", SCSI_DMA_GETADR());
372 }
373
374
375
376
377
378
379 if (atari_dma_active && (dma_stat & 0x02)) {
380 unsigned long transferred;
381
382 transferred = SCSI_DMA_GETADR() - atari_dma_startaddr;
383
384
385
386
387
388 if (transferred & 15)
389 printk(KERN_ERR "SCSI DMA error: %ld bytes lost in "
390 "ST-DMA fifo\n", transferred & 15);
391
392 atari_dma_residual = hostdata->dma_len - transferred;
393 dprintk(NDEBUG_DMA, "SCSI DMA: There are %ld residual bytes.\n",
394 atari_dma_residual);
395 } else
396 atari_dma_residual = 0;
397 atari_dma_active = 0;
398
399 if (atari_dma_orig_addr) {
400
401
402
403 memcpy(atari_dma_orig_addr, phys_to_virt(atari_dma_startaddr),
404 hostdata->dma_len - atari_dma_residual);
405 atari_dma_orig_addr = NULL;
406 }
407
408#endif
409
410 NCR5380_intr(irq, dev);
411
412 return IRQ_HANDLED;
413}
414
415
416#ifdef REAL_DMA
417static void atari_scsi_fetch_restbytes(void)
418{
419 int nr;
420 char *src, *dst;
421 unsigned long phys_dst;
422
423
424 phys_dst = SCSI_DMA_READ_P(dma_addr);
425 nr = phys_dst & 3;
426 if (nr) {
427
428
429 phys_dst ^= nr;
430 dprintk(NDEBUG_DMA, "SCSI DMA: there are %d rest bytes for phys addr 0x%08lx",
431 nr, phys_dst);
432
433 dst = phys_to_virt(phys_dst);
434 dprintk(NDEBUG_DMA, " = virt addr %p\n", dst);
435 for (src = (char *)&tt_scsi_dma.dma_restdata; nr != 0; --nr)
436 *dst++ = *src++;
437 }
438}
439#endif
440
441
442
443
444
445
446static void falcon_release_lock(void)
447{
448 if (IS_A_TT())
449 return;
450
451 if (stdma_is_locked_by(scsi_falcon_intr))
452 stdma_release();
453}
454
455
456
457
458
459
460
461
462static int falcon_get_lock(struct Scsi_Host *instance)
463{
464 if (IS_A_TT())
465 return 1;
466
467 if (in_interrupt())
468 return stdma_try_lock(scsi_falcon_intr, instance);
469
470 stdma_lock(scsi_falcon_intr, instance);
471 return 1;
472}
473
474#ifndef MODULE
475static int __init atari_scsi_setup(char *str)
476{
477
478
479
480
481
482 int ints[8];
483
484 get_options(str, ARRAY_SIZE(ints), ints);
485
486 if (ints[0] < 1) {
487 printk("atari_scsi_setup: no arguments!\n");
488 return 0;
489 }
490 if (ints[0] >= 1)
491 setup_can_queue = ints[1];
492 if (ints[0] >= 2)
493 setup_cmd_per_lun = ints[2];
494 if (ints[0] >= 3)
495 setup_sg_tablesize = ints[3];
496 if (ints[0] >= 4)
497 setup_hostid = ints[4];
498 if (ints[0] >= 5)
499 setup_use_tagged_queuing = ints[5];
500
501 if (ints[0] >= 7)
502 setup_toshiba_delay = ints[7];
503
504 return 1;
505}
506
507__setup("atascsi=", atari_scsi_setup);
508#endif
509
510
511#if defined(REAL_DMA)
512
513static unsigned long atari_scsi_dma_setup(struct Scsi_Host *instance,
514 void *data, unsigned long count,
515 int dir)
516{
517 unsigned long addr = virt_to_phys(data);
518
519 dprintk(NDEBUG_DMA, "scsi%d: setting up dma, data = %p, phys = %lx, count = %ld, "
520 "dir = %d\n", instance->host_no, data, addr, count, dir);
521
522 if (!IS_A_TT() && !STRAM_ADDR(addr)) {
523
524
525
526
527
528 if (dir)
529 memcpy(atari_dma_buffer, data, count);
530 else
531 atari_dma_orig_addr = data;
532 addr = atari_dma_phys_buffer;
533 }
534
535 atari_dma_startaddr = addr;
536
537
538
539
540
541
542
543
544
545
546 dma_cache_maintenance(addr, count, dir);
547
548 if (count == 0)
549 printk(KERN_NOTICE "SCSI warning: DMA programmed for 0 bytes !\n");
550
551 if (IS_A_TT()) {
552 tt_scsi_dma.dma_ctrl = dir;
553 SCSI_DMA_WRITE_P(dma_addr, addr);
554 SCSI_DMA_WRITE_P(dma_cnt, count);
555 tt_scsi_dma.dma_ctrl = dir | 2;
556 } else {
557
558
559 SCSI_DMA_SETADR(addr);
560
561
562 dir <<= 8;
563 st_dma.dma_mode_status = 0x90 | dir;
564 st_dma.dma_mode_status = 0x90 | (dir ^ 0x100);
565 st_dma.dma_mode_status = 0x90 | dir;
566 udelay(40);
567
568
569 st_dma.fdc_acces_seccount = (count + (dir ? 511 : 0)) >> 9;
570 udelay(40);
571 st_dma.dma_mode_status = 0x10 | dir;
572 udelay(40);
573
574 atari_dma_active = 1;
575 }
576
577 return count;
578}
579
580
581static long atari_scsi_dma_residual(struct Scsi_Host *instance)
582{
583 return atari_dma_residual;
584}
585
586
587#define CMD_SURELY_BLOCK_MODE 0
588#define CMD_SURELY_BYTE_MODE 1
589#define CMD_MODE_UNKNOWN 2
590
591static int falcon_classify_cmd(struct scsi_cmnd *cmd)
592{
593 unsigned char opcode = cmd->cmnd[0];
594
595 if (opcode == READ_DEFECT_DATA || opcode == READ_LONG ||
596 opcode == READ_BUFFER)
597 return CMD_SURELY_BYTE_MODE;
598 else if (opcode == READ_6 || opcode == READ_10 ||
599 opcode == 0xa8 || opcode == READ_REVERSE ||
600 opcode == RECOVER_BUFFERED_DATA) {
601
602
603
604 if (cmd->device->type == TYPE_TAPE && !(cmd->cmnd[1] & 1))
605 return CMD_SURELY_BYTE_MODE;
606 else
607 return CMD_SURELY_BLOCK_MODE;
608 } else
609 return CMD_MODE_UNKNOWN;
610}
611
612
613
614
615
616
617
618
619
620
621
622static unsigned long atari_dma_xfer_len(unsigned long wanted_len,
623 struct scsi_cmnd *cmd, int write_flag)
624{
625 unsigned long possible_len, limit;
626
627 if (IS_A_TT())
628
629 return wanted_len;
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659 if (write_flag) {
660
661
662
663
664 possible_len = wanted_len;
665 } else {
666
667
668
669
670 if (wanted_len & 0x1ff)
671 possible_len = 0;
672 else {
673
674
675 switch (falcon_classify_cmd(cmd)) {
676 case CMD_SURELY_BLOCK_MODE:
677 possible_len = wanted_len;
678 break;
679 case CMD_SURELY_BYTE_MODE:
680 possible_len = 0;
681 break;
682 case CMD_MODE_UNKNOWN:
683 default:
684
685
686 possible_len = (wanted_len < 1024) ? 0 : wanted_len;
687 break;
688 }
689 }
690 }
691
692
693 limit = (atari_dma_buffer && !STRAM_ADDR(virt_to_phys(cmd->SCp.ptr))) ?
694 STRAM_BUFFER_SIZE : 255*512;
695 if (possible_len > limit)
696 possible_len = limit;
697
698 if (possible_len != wanted_len)
699 dprintk(NDEBUG_DMA, "Sorry, must cut DMA transfer size to %ld bytes "
700 "instead of %ld\n", possible_len, wanted_len);
701
702 return possible_len;
703}
704
705
706#endif
707
708
709
710
711
712
713
714
715
716static unsigned char atari_scsi_tt_reg_read(unsigned char reg)
717{
718 return tt_scsi_regp[reg * 2];
719}
720
721static void atari_scsi_tt_reg_write(unsigned char reg, unsigned char value)
722{
723 tt_scsi_regp[reg * 2] = value;
724}
725
726static unsigned char atari_scsi_falcon_reg_read(unsigned char reg)
727{
728 dma_wd.dma_mode_status= (u_short)(0x88 + reg);
729 return (u_char)dma_wd.fdc_acces_seccount;
730}
731
732static void atari_scsi_falcon_reg_write(unsigned char reg, unsigned char value)
733{
734 dma_wd.dma_mode_status = (u_short)(0x88 + reg);
735 dma_wd.fdc_acces_seccount = (u_short)value;
736}
737
738
739#include "atari_NCR5380.c"
740
741static int atari_scsi_bus_reset(struct scsi_cmnd *cmd)
742{
743 int rv;
744 unsigned long flags;
745
746 local_irq_save(flags);
747
748#ifdef REAL_DMA
749
750 if (IS_A_TT()) {
751 tt_scsi_dma.dma_ctrl = 0;
752 } else {
753 st_dma.dma_mode_status = 0x90;
754 atari_dma_active = 0;
755 atari_dma_orig_addr = NULL;
756 }
757#endif
758
759 rv = NCR5380_bus_reset(cmd);
760
761
762
763
764
765
766
767 local_irq_restore(flags);
768
769 return rv;
770}
771
772#define DRV_MODULE_NAME "atari_scsi"
773#define PFX DRV_MODULE_NAME ": "
774
775static struct scsi_host_template atari_scsi_template = {
776 .module = THIS_MODULE,
777 .proc_name = DRV_MODULE_NAME,
778 .name = "Atari native SCSI",
779 .info = atari_scsi_info,
780 .queuecommand = atari_scsi_queue_command,
781 .eh_abort_handler = atari_scsi_abort,
782 .eh_bus_reset_handler = atari_scsi_bus_reset,
783 .this_id = 7,
784 .use_clustering = DISABLE_CLUSTERING,
785 .cmd_size = NCR5380_CMD_SIZE,
786};
787
788static int __init atari_scsi_probe(struct platform_device *pdev)
789{
790 struct Scsi_Host *instance;
791 int error;
792 struct resource *irq;
793 int host_flags = 0;
794
795 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
796 if (!irq)
797 return -ENODEV;
798
799 if (ATARIHW_PRESENT(TT_SCSI)) {
800 atari_scsi_reg_read = atari_scsi_tt_reg_read;
801 atari_scsi_reg_write = atari_scsi_tt_reg_write;
802 } else {
803 atari_scsi_reg_read = atari_scsi_falcon_reg_read;
804 atari_scsi_reg_write = atari_scsi_falcon_reg_write;
805 }
806
807
808
809
810
811
812
813
814
815
816
817
818 if (ATARIHW_PRESENT(TT_SCSI)) {
819 atari_scsi_template.can_queue = 16;
820 atari_scsi_template.cmd_per_lun = 8;
821 atari_scsi_template.sg_tablesize = SG_ALL;
822 } else {
823 atari_scsi_template.can_queue = 8;
824 atari_scsi_template.cmd_per_lun = 1;
825 atari_scsi_template.sg_tablesize = SG_NONE;
826 }
827
828 if (setup_can_queue > 0)
829 atari_scsi_template.can_queue = setup_can_queue;
830
831 if (setup_cmd_per_lun > 0)
832 atari_scsi_template.cmd_per_lun = setup_cmd_per_lun;
833
834
835 if (ATARIHW_PRESENT(TT_SCSI) && setup_sg_tablesize >= 0)
836 atari_scsi_template.sg_tablesize = setup_sg_tablesize;
837
838 if (setup_hostid >= 0) {
839 atari_scsi_template.this_id = setup_hostid & 7;
840 } else {
841
842 if (ATARIHW_PRESENT(TT_CLK) && nvram_check_checksum()) {
843 unsigned char b = nvram_read_byte(16);
844
845
846
847
848 if (b & 0x80)
849 atari_scsi_template.this_id = b & 7;
850 }
851 }
852
853
854#ifdef REAL_DMA
855
856
857
858
859
860 if (ATARIHW_PRESENT(ST_SCSI) && !ATARIHW_PRESENT(EXTD_DMA) &&
861 m68k_num_memory > 1) {
862 atari_dma_buffer = atari_stram_alloc(STRAM_BUFFER_SIZE, "SCSI");
863 if (!atari_dma_buffer) {
864 pr_err(PFX "can't allocate ST-RAM double buffer\n");
865 return -ENOMEM;
866 }
867 atari_dma_phys_buffer = atari_stram_to_phys(atari_dma_buffer);
868 atari_dma_orig_addr = 0;
869 }
870#endif
871
872 instance = scsi_host_alloc(&atari_scsi_template,
873 sizeof(struct NCR5380_hostdata));
874 if (!instance) {
875 error = -ENOMEM;
876 goto fail_alloc;
877 }
878
879 instance->irq = irq->start;
880
881 host_flags |= IS_A_TT() ? 0 : FLAG_LATE_DMA_SETUP;
882#ifdef SUPPORT_TAGS
883 host_flags |= setup_use_tagged_queuing > 0 ? FLAG_TAGGED_QUEUING : 0;
884#endif
885 host_flags |= setup_toshiba_delay > 0 ? FLAG_TOSHIBA_DELAY : 0;
886
887 error = NCR5380_init(instance, host_flags);
888 if (error)
889 goto fail_init;
890
891 if (IS_A_TT()) {
892 error = request_irq(instance->irq, scsi_tt_intr, 0,
893 "NCR5380", instance);
894 if (error) {
895 pr_err(PFX "request irq %d failed, aborting\n",
896 instance->irq);
897 goto fail_irq;
898 }
899 tt_mfp.active_edge |= 0x80;
900#ifdef REAL_DMA
901 tt_scsi_dma.dma_ctrl = 0;
902 atari_dma_residual = 0;
903
904
905
906
907
908
909
910
911
912
913
914
915
916 if (MACH_IS_MEDUSA) {
917 struct NCR5380_hostdata *hostdata =
918 shost_priv(instance);
919
920 hostdata->read_overruns = 4;
921 }
922#endif
923 } else {
924
925
926
927#ifdef REAL_DMA
928 atari_dma_residual = 0;
929 atari_dma_active = 0;
930 atari_dma_stram_mask = (ATARIHW_PRESENT(EXTD_DMA) ? 0x00000000
931 : 0xff000000);
932#endif
933 }
934
935 NCR5380_maybe_reset_bus(instance);
936
937 error = scsi_add_host(instance, NULL);
938 if (error)
939 goto fail_host;
940
941 platform_set_drvdata(pdev, instance);
942
943 scsi_scan_host(instance);
944 return 0;
945
946fail_host:
947 if (IS_A_TT())
948 free_irq(instance->irq, instance);
949fail_irq:
950 NCR5380_exit(instance);
951fail_init:
952 scsi_host_put(instance);
953fail_alloc:
954 if (atari_dma_buffer)
955 atari_stram_free(atari_dma_buffer);
956 return error;
957}
958
959static int __exit atari_scsi_remove(struct platform_device *pdev)
960{
961 struct Scsi_Host *instance = platform_get_drvdata(pdev);
962
963 scsi_remove_host(instance);
964 if (IS_A_TT())
965 free_irq(instance->irq, instance);
966 NCR5380_exit(instance);
967 scsi_host_put(instance);
968 if (atari_dma_buffer)
969 atari_stram_free(atari_dma_buffer);
970 return 0;
971}
972
973static struct platform_driver atari_scsi_driver = {
974 .remove = __exit_p(atari_scsi_remove),
975 .driver = {
976 .name = DRV_MODULE_NAME,
977 },
978};
979
980module_platform_driver_probe(atari_scsi_driver, atari_scsi_probe);
981
982MODULE_ALIAS("platform:" DRV_MODULE_NAME);
983MODULE_LICENSE("GPL");
984