kvm tools, setup: Create private directory
[linux-2.6/next.git] / arch / arm / mach-ep93xx / include / mach / dma.h
blob5e31b2b25da95a4511ddfc431d320c24c7c93211
1 /**
2 * DOC: EP93xx DMA M2P memory to peripheral and peripheral to memory engine
4 * The EP93xx DMA M2P subsystem handles DMA transfers between memory and
5 * peripherals. DMA M2P channels are available for audio, UARTs and IrDA.
6 * See chapter 10 of the EP93xx users guide for full details on the DMA M2P
7 * engine.
9 * See sound/soc/ep93xx/ep93xx-pcm.c for an example use of the DMA M2P code.
13 #ifndef __ASM_ARCH_DMA_H
14 #define __ASM_ARCH_DMA_H
16 #include <linux/list.h>
17 #include <linux/types.h>
19 /**
20 * struct ep93xx_dma_buffer - Information about a buffer to be transferred
21 * using the DMA M2P engine
23 * @list: Entry in DMA buffer list
24 * @bus_addr: Physical address of the buffer
25 * @size: Size of the buffer in bytes
27 struct ep93xx_dma_buffer {
28 struct list_head list;
29 u32 bus_addr;
30 u16 size;
33 /**
34 * struct ep93xx_dma_m2p_client - Information about a DMA M2P client
36 * @name: Unique name for this client
37 * @flags: Client flags
38 * @cookie: User data to pass to callback functions
39 * @buffer_started: Non NULL function to call when a transfer is started.
40 * The arguments are the user data cookie and the DMA
41 * buffer which is starting.
42 * @buffer_finished: Non NULL function to call when a transfer is completed.
43 * The arguments are the user data cookie, the DMA buffer
44 * which has completed, and a boolean flag indicating if
45 * the transfer had an error.
47 struct ep93xx_dma_m2p_client {
48 char *name;
49 u8 flags;
50 void *cookie;
51 void (*buffer_started)(void *cookie,
52 struct ep93xx_dma_buffer *buf);
53 void (*buffer_finished)(void *cookie,
54 struct ep93xx_dma_buffer *buf,
55 int bytes, int error);
57 /* private: Internal use only */
58 void *channel;
61 /* DMA M2P ports */
62 #define EP93XX_DMA_M2P_PORT_I2S1 0x00
63 #define EP93XX_DMA_M2P_PORT_I2S2 0x01
64 #define EP93XX_DMA_M2P_PORT_AAC1 0x02
65 #define EP93XX_DMA_M2P_PORT_AAC2 0x03
66 #define EP93XX_DMA_M2P_PORT_AAC3 0x04
67 #define EP93XX_DMA_M2P_PORT_I2S3 0x05
68 #define EP93XX_DMA_M2P_PORT_UART1 0x06
69 #define EP93XX_DMA_M2P_PORT_UART2 0x07
70 #define EP93XX_DMA_M2P_PORT_UART3 0x08
71 #define EP93XX_DMA_M2P_PORT_IRDA 0x09
72 #define EP93XX_DMA_M2P_PORT_MASK 0x0f
74 /* DMA M2P client flags */
75 #define EP93XX_DMA_M2P_TX 0x00 /* Memory to peripheral */
76 #define EP93XX_DMA_M2P_RX 0x10 /* Peripheral to memory */
79 * DMA M2P client error handling flags. See the EP93xx users guide
80 * documentation on the DMA M2P CONTROL register for more details
82 #define EP93XX_DMA_M2P_ABORT_ON_ERROR 0x20 /* Abort on peripheral error */
83 #define EP93XX_DMA_M2P_IGNORE_ERROR 0x40 /* Ignore peripheral errors */
84 #define EP93XX_DMA_M2P_ERROR_MASK 0x60 /* Mask of error bits */
86 /**
87 * ep93xx_dma_m2p_client_register - Register a client with the DMA M2P
88 * subsystem
90 * @m2p: Client information to register
91 * returns 0 on success
93 * The DMA M2P subsystem allocates a channel and an interrupt line for the DMA
94 * client
96 int ep93xx_dma_m2p_client_register(struct ep93xx_dma_m2p_client *m2p);
98 /**
99 * ep93xx_dma_m2p_client_unregister - Unregister a client from the DMA M2P
100 * subsystem
102 * @m2p: Client to unregister
104 * Any transfers currently in progress will be completed in hardware, but
105 * ignored in software.
107 void ep93xx_dma_m2p_client_unregister(struct ep93xx_dma_m2p_client *m2p);
110 * ep93xx_dma_m2p_submit - Submit a DMA M2P transfer
112 * @m2p: DMA Client to submit the transfer on
113 * @buf: DMA Buffer to submit
115 * If the current or next transfer positions are free on the M2P client then
116 * the transfer is started immediately. If not, the transfer is added to the
117 * list of pending transfers. This function must not be called from the
118 * buffer_finished callback for an M2P channel.
121 void ep93xx_dma_m2p_submit(struct ep93xx_dma_m2p_client *m2p,
122 struct ep93xx_dma_buffer *buf);
125 * ep93xx_dma_m2p_submit_recursive - Put a DMA transfer on the pending list
126 * for an M2P channel
128 * @m2p: DMA Client to submit the transfer on
129 * @buf: DMA Buffer to submit
131 * This function must only be called from the buffer_finished callback for an
132 * M2P channel. It is commonly used to add the next transfer in a chained list
133 * of DMA transfers.
135 void ep93xx_dma_m2p_submit_recursive(struct ep93xx_dma_m2p_client *m2p,
136 struct ep93xx_dma_buffer *buf);
139 * ep93xx_dma_m2p_flush - Flush all pending transfers on a DMA M2P client
141 * @m2p: DMA client to flush transfers on
143 * Any transfers currently in progress will be completed in hardware, but
144 * ignored in software.
147 void ep93xx_dma_m2p_flush(struct ep93xx_dma_m2p_client *m2p);
149 #endif /* __ASM_ARCH_DMA_H */