ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / arch / sh / drivers / dma / dma-isa.c
1 /*
2  * arch/sh/drivers/dma/dma-isa.c
3  *
4  * Generic ISA DMA wrapper for SH DMA API
5  *
6  * Copyright (C) 2003  Paul Mundt
7  *
8  * This file is subject to the terms and conditions of the GNU General Public
9  * License.  See the file "COPYING" in the main directory of this archive
10  * for more details.
11  */ 
12 #include <linux/kernel.h>
13 #include <asm/dma.h>
14
15 /*
16  * This implements a small wrapper set to make code using the old ISA DMA API
17  * work with the SH DMA API. Since most of the work in the new API happens
18  * at ops->xfer() time, we simply use the various set_dma_xxx() routines to
19  * fill in per-channel info, and then hand hand this off to ops->xfer() at
20  * enable_dma() time.
21  *
22  * For channels that are doing on-demand data transfer via cascading, the
23  * channel itself will still need to be configured through the new API. As
24  * such, this code is meant for only the simplest of tasks (and shouldn't be
25  * used in any new drivers at all).
26  *
27  * It should also be noted that various functions here are labelled as
28  * being deprecated. This is due to the fact that the ops->xfer() method is
29  * the preferred way of doing things (as well as just grabbing the spinlock
30  * directly). As such, any users of this interface will be warned rather
31  * loudly.
32  */
33
34 unsigned long __deprecated claim_dma_lock(void)
35 {
36         unsigned long flags;
37
38         spin_lock_irqsave(&dma_spin_lock, flags);
39
40         return flags;
41 }
42
43 void __deprecated release_dma_lock(unsigned long flags)
44 {
45         spin_unlock_irqrestore(&dma_spin_lock, flags);
46 }
47
48 void __deprecated disable_dma(unsigned int chan)
49 {
50         /* Nothing */
51 }
52
53 void __deprecated enable_dma(unsigned int chan)
54 {
55         struct dma_info *info = get_dma_info(chan);
56
57         info->ops->xfer(info);
58 }
59
60 void clear_dma_ff(unsigned int chan)
61 {
62         /* Nothing */
63 }
64
65 void set_dma_mode(unsigned int chan, char mode)
66 {
67         struct dma_info *info = get_dma_info(chan);
68
69         info->mode = mode;
70 }
71
72 void set_dma_addr(unsigned int chan, unsigned int addr)
73 {
74         struct dma_info *info = get_dma_info(chan);
75
76         /*
77          * Single address mode is the only thing supported through
78          * this interface.
79          */
80         if ((info->mode & DMA_MODE_MASK) == DMA_MODE_READ) {
81                 info->sar = addr;
82         } else {
83                 info->dar = addr;
84         }
85 }
86
87 void set_dma_count(unsigned int chan, unsigned int count)
88 {
89         struct dma_info *info = get_dma_info(chan);
90
91         info->count = count;
92 }
93