diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/scsi/amiga7xx.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'drivers/scsi/amiga7xx.c')
-rw-r--r-- | drivers/scsi/amiga7xx.c | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/drivers/scsi/amiga7xx.c b/drivers/scsi/amiga7xx.c new file mode 100644 index 000000000000..5f13546d6392 --- /dev/null +++ b/drivers/scsi/amiga7xx.c | |||
@@ -0,0 +1,141 @@ | |||
1 | /* | ||
2 | * Detection routine for the NCR53c710 based Amiga SCSI Controllers for Linux. | ||
3 | * Amiga MacroSystemUS WarpEngine SCSI controller. | ||
4 | * Amiga Technologies A4000T SCSI controller. | ||
5 | * Amiga Technologies/DKB A4091 SCSI controller. | ||
6 | * | ||
7 | * Written 1997 by Alan Hourihane <alanh@fairlite.demon.co.uk> | ||
8 | * plus modifications of the 53c7xx.c driver to support the Amiga. | ||
9 | */ | ||
10 | #include <linux/types.h> | ||
11 | #include <linux/mm.h> | ||
12 | #include <linux/blkdev.h> | ||
13 | #include <linux/sched.h> | ||
14 | #include <linux/version.h> | ||
15 | #include <linux/config.h> | ||
16 | #include <linux/zorro.h> | ||
17 | #include <linux/stat.h> | ||
18 | |||
19 | #include <asm/setup.h> | ||
20 | #include <asm/page.h> | ||
21 | #include <asm/pgtable.h> | ||
22 | #include <asm/amigaints.h> | ||
23 | #include <asm/amigahw.h> | ||
24 | #include <asm/dma.h> | ||
25 | #include <asm/irq.h> | ||
26 | |||
27 | #include "scsi.h" | ||
28 | #include <scsi/scsi_host.h> | ||
29 | #include "53c7xx.h" | ||
30 | #include "amiga7xx.h" | ||
31 | |||
32 | |||
33 | static int amiga7xx_register_one(Scsi_Host_Template *tpnt, | ||
34 | unsigned long address) | ||
35 | { | ||
36 | long long options; | ||
37 | int clock; | ||
38 | |||
39 | if (!request_mem_region(address, 0x1000, "ncr53c710")) | ||
40 | return 0; | ||
41 | |||
42 | address = (unsigned long)z_ioremap(address, 0x1000); | ||
43 | options = OPTION_MEMORY_MAPPED | OPTION_DEBUG_TEST1 | OPTION_INTFLY | | ||
44 | OPTION_SYNCHRONOUS | OPTION_ALWAYS_SYNCHRONOUS | | ||
45 | OPTION_DISCONNECT; | ||
46 | clock = 50000000; /* 50 MHz SCSI Clock */ | ||
47 | ncr53c7xx_init(tpnt, 0, 710, address, 0, IRQ_AMIGA_PORTS, DMA_NONE, | ||
48 | options, clock); | ||
49 | return 1; | ||
50 | } | ||
51 | |||
52 | |||
53 | #ifdef CONFIG_ZORRO | ||
54 | |||
55 | static struct { | ||
56 | zorro_id id; | ||
57 | unsigned long offset; | ||
58 | int absolute; /* offset is absolute address */ | ||
59 | } amiga7xx_table[] = { | ||
60 | { .id = ZORRO_PROD_PHASE5_BLIZZARD_603E_PLUS, .offset = 0xf40000, | ||
61 | .absolute = 1 }, | ||
62 | { .id = ZORRO_PROD_MACROSYSTEMS_WARP_ENGINE_40xx, .offset = 0x40000 }, | ||
63 | { .id = ZORRO_PROD_CBM_A4091_1, .offset = 0x800000 }, | ||
64 | { .id = ZORRO_PROD_CBM_A4091_2, .offset = 0x800000 }, | ||
65 | { .id = ZORRO_PROD_GVP_GFORCE_040_060, .offset = 0x40000 }, | ||
66 | { 0 } | ||
67 | }; | ||
68 | |||
69 | static int __init amiga7xx_zorro_detect(Scsi_Host_Template *tpnt) | ||
70 | { | ||
71 | int num = 0, i; | ||
72 | struct zorro_dev *z = NULL; | ||
73 | unsigned long address; | ||
74 | |||
75 | while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { | ||
76 | for (i = 0; amiga7xx_table[i].id; i++) | ||
77 | if (z->id == amiga7xx_table[i].id) | ||
78 | break; | ||
79 | if (!amiga7xx_table[i].id) | ||
80 | continue; | ||
81 | if (amiga7xx_table[i].absolute) | ||
82 | address = amiga7xx_table[i].offset; | ||
83 | else | ||
84 | address = z->resource.start + amiga7xx_table[i].offset; | ||
85 | num += amiga7xx_register_one(tpnt, address); | ||
86 | } | ||
87 | return num; | ||
88 | } | ||
89 | |||
90 | #endif /* CONFIG_ZORRO */ | ||
91 | |||
92 | |||
93 | int __init amiga7xx_detect(Scsi_Host_Template *tpnt) | ||
94 | { | ||
95 | static unsigned char called = 0; | ||
96 | int num = 0; | ||
97 | |||
98 | if (called || !MACH_IS_AMIGA) | ||
99 | return 0; | ||
100 | |||
101 | tpnt->proc_name = "Amiga7xx"; | ||
102 | |||
103 | if (AMIGAHW_PRESENT(A4000_SCSI)) | ||
104 | num += amiga7xx_register_one(tpnt, 0xdd0040); | ||
105 | |||
106 | #ifdef CONFIG_ZORRO | ||
107 | num += amiga7xx_zorro_detect(tpnt); | ||
108 | #endif | ||
109 | |||
110 | called = 1; | ||
111 | return num; | ||
112 | } | ||
113 | |||
114 | static int amiga7xx_release(struct Scsi_Host *shost) | ||
115 | { | ||
116 | if (shost->irq) | ||
117 | free_irq(shost->irq, NULL); | ||
118 | if (shost->dma_channel != 0xff) | ||
119 | free_dma(shost->dma_channel); | ||
120 | if (shost->io_port && shost->n_io_port) | ||
121 | release_region(shost->io_port, shost->n_io_port); | ||
122 | scsi_unregister(shost); | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | static Scsi_Host_Template driver_template = { | ||
127 | .name = "Amiga NCR53c710 SCSI", | ||
128 | .detect = amiga7xx_detect, | ||
129 | .release = amiga7xx_release, | ||
130 | .queuecommand = NCR53c7xx_queue_command, | ||
131 | .abort = NCR53c7xx_abort, | ||
132 | .reset = NCR53c7xx_reset, | ||
133 | .can_queue = 24, | ||
134 | .this_id = 7, | ||
135 | .sg_tablesize = 63, | ||
136 | .cmd_per_lun = 3, | ||
137 | .use_clustering = DISABLE_CLUSTERING | ||
138 | }; | ||
139 | |||
140 | |||
141 | #include "scsi_module.c" | ||