2 * arch/arm/kernel/dma-arc.c
4 * Copyright (C) 1998-1999 Dave Gilbert / Russell King
6 * DMA functions specific to Archimedes architecture
8 #include <linux/config.h>
9 #include <linux/sched.h>
10 #include <linux/init.h>
14 #include <asm/hardware.h>
20 int arch_request_dma(dmach_t channel
, dma_t
*dma
, const char * dev_id
)
22 printk("arch_request_dma channel=%d F0=%d F1=%d\n",channel
,DMA_VIRTUAL_FLOPPY0
,DMA_VIRTUAL_FLOPPY1
);
23 if (channel
== DMA_VIRTUAL_FLOPPY0
||
24 channel
== DMA_VIRTUAL_FLOPPY1
)
30 void arch_free_dma(dmach_t channel
, dma_t
*dma
)
34 void arch_enable_dma(dmach_t channel
, dma_t
*dma
)
36 printk("arch_enable_dma channel=%d F0=%d F1=%d\n",channel
,DMA_VIRTUAL_FLOPPY0
,DMA_VIRTUAL_FLOPPY1
);
38 #ifdef CONFIG_BLK_DEV_FD1772
39 case DMA_VIRTUAL_FLOPPY0
: { /* Data DMA */
40 switch (dma
->dma_mode
) {
41 case DMA_MODE_READ
: /* read */
43 extern unsigned char fdc1772_dma_read
, fdc1772_dma_read_end
;
44 extern void fdc1772_setupdma(unsigned int count
,unsigned int addr
);
47 printk("enable_dma fdc1772 data read\n");
52 memcpy ((void *)0x1c, (void *)&fdc1772_dma_read
,
53 &fdc1772_dma_read_end
- &fdc1772_dma_read
);
54 fdc1772_setupdma(dma
->buf
.length
, __bus_to_virt(dma
->buf
.address
)); /* Sets data pointer up */
60 case DMA_MODE_WRITE
: /* write */
62 extern unsigned char fdc1772_dma_write
, fdc1772_dma_write_end
;
63 extern void fdc1772_setupdma(unsigned int count
,unsigned int addr
);
67 printk("enable_dma fdc1772 data write\n");
71 memcpy ((void *)0x1c, (void *)&fdc1772_dma_write
,
72 &fdc1772_dma_write_end
- &fdc1772_dma_write
);
73 fdc1772_setupdma(dma
->buf
.length
, __bus_to_virt(dma
->buf
.address
)); /* Sets data pointer up */
80 printk ("enable_dma: dma%d not initialised\n", channel
);
86 case DMA_VIRTUAL_FLOPPY1
: { /* Command end FIQ - actually just sets a flag */
87 /* Need to build a branch at the FIQ address */
88 extern void fdc1772_comendhandler(void);
91 /*printk("enable_dma fdc1772 command end FIQ\n");*/
95 *((unsigned int *)0x1c)=0xea000000 | (((unsigned int)fdc1772_comendhandler
-(0x1c+8))/4); /* B fdc1772_comendhandler */
104 int arch_get_dma_residue(dmach_t channel
, dma_t
*dma
)
107 #ifdef CONFIG_BLK_DEV_FD1772
108 case DMA_VIRTUAL_FLOPPY0
: { /* Data DMA */
109 extern unsigned int fdc1772_bytestogo
;
111 /* 10/1/1999 DAG - I presume its the number of bytes left? */
112 return fdc1772_bytestogo
;
116 case DMA_VIRTUAL_FLOPPY1
: { /* Command completed */
117 /* 10/1/1999 DAG - Presume whether there is an outstanding command? */
118 extern unsigned int fdc1772_fdc_int_done
;
120 return (fdc1772_fdc_int_done
==0)?1:0; /* Explicit! If the int done is 0 then 1 int to go */
127 printk("dma-arc.c:arch_get_dma_residue called with unknown/unconfigured DMA channel\n");
132 void arch_disable_dma(dmach_t channel
, dma_t
*dma
)
134 if (channel
!= DMA_VIRTUAL_FLOPPY0
&&
135 channel
!= DMA_VIRTUAL_FLOPPY1
)
136 printk("arch_disable_dma: invalid channel %d\n", channel
);
138 disable_irq(dma
->dma_irq
);
141 int arch_set_dma_speed(dmach_t channel
, dma_t
*dma
, int cycle_ns
)
146 void __init
arch_dma_init(dma_t
*dma
)
148 dma
[DMA_VIRTUAL_FLOPPY0
].dma_irq
= 64;
149 dma
[DMA_VIRTUAL_FLOPPY1
].dma_irq
= 65;