5 #include <linux/kernel.h>
6 #include <linux/module.h>
7 #include <linux/errno.h>
11 #include <arch/system.h>
14 #define SETS(var, reg, field, val) var = (var & ~IO_MASK_(reg##_, field##_)) | \
15 IO_STATE_(reg##_, field##_, _##val)
25 unsigned long int gens;
34 if (used_dma_channels[dmanr]) {
37 printk(
KERN_CRIT "Failed to request DMA %i for %s, already allocated by %s\n", dmanr, device_id, used_dma_channels_users[dmanr]);
40 panic(
"request_dma error!");
58 SETS(gens, R_GEN_CONFIG, dma6, serial0);
60 SETS(gens, R_GEN_CONFIG, dma7, serial0);
68 SETS(gens, R_GEN_CONFIG, dma8, serial1);
70 SETS(gens, R_GEN_CONFIG, dma9, serial1);
78 SETS(gens, R_GEN_CONFIG, dma2, serial2);
80 SETS(gens, R_GEN_CONFIG, dma3, serial2);
88 SETS(gens, R_GEN_CONFIG, dma4, serial3);
90 SETS(gens, R_GEN_CONFIG, dma5, serial3);
98 SETS(gens, R_GEN_CONFIG, dma2, ata);
100 SETS(gens, R_GEN_CONFIG, dma3, ata);
108 SETS(gens, R_GEN_CONFIG, dma4, extdma0);
110 SETS(gens, R_GEN_CONFIG, dma5, extdma0);
118 SETS(gens, R_GEN_CONFIG, dma6, extdma1);
120 SETS(gens, R_GEN_CONFIG, dma7, extdma1);
128 SETS(gens, R_GEN_CONFIG, dma7, intdma6);
136 SETS(gens, R_GEN_CONFIG, dma6, intdma7);
144 SETS(gens, R_GEN_CONFIG, dma8,
usb);
146 SETS(gens, R_GEN_CONFIG, dma9,
usb);
154 SETS(gens, R_GEN_CONFIG, dma2, scsi0);
156 SETS(gens, R_GEN_CONFIG, dma3, scsi0);
164 SETS(gens, R_GEN_CONFIG, dma4, scsi1);
166 SETS(gens, R_GEN_CONFIG, dma5, scsi1);
174 SETS(gens, R_GEN_CONFIG, dma2, par0);
176 SETS(gens, R_GEN_CONFIG, dma3, par0);
184 SETS(gens, R_GEN_CONFIG, dma4, par1);
186 SETS(gens, R_GEN_CONFIG, dma5, par1);
197 used_dma_channels[dmanr] = 1;
198 used_dma_channels_users[dmanr] =
device_id;
205 for(i = 6; i > 0; i--)
223 if (!used_dma_channels[dmanr]) {
224 printk(
KERN_CRIT "cris_free_dma: DMA channel %u not allocated\n", dmanr);
225 }
else if (device_id != used_dma_channels_users[dmanr]) {
226 printk(
KERN_CRIT "cris_free_dma: DMA channel %u not allocated by device\n", dmanr);
281 used_dma_channels[dmanr] = 0;