Path: blob/master/arch/arm/mach-ep93xx/include/mach/dma.h
15157 views
/**1* DOC: EP93xx DMA M2P memory to peripheral and peripheral to memory engine2*3* The EP93xx DMA M2P subsystem handles DMA transfers between memory and4* peripherals. DMA M2P channels are available for audio, UARTs and IrDA.5* See chapter 10 of the EP93xx users guide for full details on the DMA M2P6* engine.7*8* See sound/soc/ep93xx/ep93xx-pcm.c for an example use of the DMA M2P code.9*10*/1112#ifndef __ASM_ARCH_DMA_H13#define __ASM_ARCH_DMA_H1415#include <linux/list.h>16#include <linux/types.h>1718/**19* struct ep93xx_dma_buffer - Information about a buffer to be transferred20* using the DMA M2P engine21*22* @list: Entry in DMA buffer list23* @bus_addr: Physical address of the buffer24* @size: Size of the buffer in bytes25*/26struct ep93xx_dma_buffer {27struct list_head list;28u32 bus_addr;29u16 size;30};3132/**33* struct ep93xx_dma_m2p_client - Information about a DMA M2P client34*35* @name: Unique name for this client36* @flags: Client flags37* @cookie: User data to pass to callback functions38* @buffer_started: Non NULL function to call when a transfer is started.39* The arguments are the user data cookie and the DMA40* buffer which is starting.41* @buffer_finished: Non NULL function to call when a transfer is completed.42* The arguments are the user data cookie, the DMA buffer43* which has completed, and a boolean flag indicating if44* the transfer had an error.45*/46struct ep93xx_dma_m2p_client {47char *name;48u8 flags;49void *cookie;50void (*buffer_started)(void *cookie,51struct ep93xx_dma_buffer *buf);52void (*buffer_finished)(void *cookie,53struct ep93xx_dma_buffer *buf,54int bytes, int error);5556/* private: Internal use only */57void *channel;58};5960/* DMA M2P ports */61#define EP93XX_DMA_M2P_PORT_I2S1 0x0062#define EP93XX_DMA_M2P_PORT_I2S2 0x0163#define EP93XX_DMA_M2P_PORT_AAC1 0x0264#define EP93XX_DMA_M2P_PORT_AAC2 0x0365#define EP93XX_DMA_M2P_PORT_AAC3 0x0466#define EP93XX_DMA_M2P_PORT_I2S3 0x0567#define EP93XX_DMA_M2P_PORT_UART1 0x0668#define EP93XX_DMA_M2P_PORT_UART2 0x0769#define EP93XX_DMA_M2P_PORT_UART3 0x0870#define EP93XX_DMA_M2P_PORT_IRDA 0x0971#define EP93XX_DMA_M2P_PORT_MASK 0x0f7273/* DMA M2P client flags */74#define EP93XX_DMA_M2P_TX 0x00 /* Memory to peripheral */75#define EP93XX_DMA_M2P_RX 0x10 /* Peripheral to memory */7677/*78* DMA M2P client error handling flags. See the EP93xx users guide79* documentation on the DMA M2P CONTROL register for more details80*/81#define EP93XX_DMA_M2P_ABORT_ON_ERROR 0x20 /* Abort on peripheral error */82#define EP93XX_DMA_M2P_IGNORE_ERROR 0x40 /* Ignore peripheral errors */83#define EP93XX_DMA_M2P_ERROR_MASK 0x60 /* Mask of error bits */8485/**86* ep93xx_dma_m2p_client_register - Register a client with the DMA M2P87* subsystem88*89* @m2p: Client information to register90* returns 0 on success91*92* The DMA M2P subsystem allocates a channel and an interrupt line for the DMA93* client94*/95int ep93xx_dma_m2p_client_register(struct ep93xx_dma_m2p_client *m2p);9697/**98* ep93xx_dma_m2p_client_unregister - Unregister a client from the DMA M2P99* subsystem100*101* @m2p: Client to unregister102*103* Any transfers currently in progress will be completed in hardware, but104* ignored in software.105*/106void ep93xx_dma_m2p_client_unregister(struct ep93xx_dma_m2p_client *m2p);107108/**109* ep93xx_dma_m2p_submit - Submit a DMA M2P transfer110*111* @m2p: DMA Client to submit the transfer on112* @buf: DMA Buffer to submit113*114* If the current or next transfer positions are free on the M2P client then115* the transfer is started immediately. If not, the transfer is added to the116* list of pending transfers. This function must not be called from the117* buffer_finished callback for an M2P channel.118*119*/120void ep93xx_dma_m2p_submit(struct ep93xx_dma_m2p_client *m2p,121struct ep93xx_dma_buffer *buf);122123/**124* ep93xx_dma_m2p_submit_recursive - Put a DMA transfer on the pending list125* for an M2P channel126*127* @m2p: DMA Client to submit the transfer on128* @buf: DMA Buffer to submit129*130* This function must only be called from the buffer_finished callback for an131* M2P channel. It is commonly used to add the next transfer in a chained list132* of DMA transfers.133*/134void ep93xx_dma_m2p_submit_recursive(struct ep93xx_dma_m2p_client *m2p,135struct ep93xx_dma_buffer *buf);136137/**138* ep93xx_dma_m2p_flush - Flush all pending transfers on a DMA M2P client139*140* @m2p: DMA client to flush transfers on141*142* Any transfers currently in progress will be completed in hardware, but143* ignored in software.144*145*/146void ep93xx_dma_m2p_flush(struct ep93xx_dma_m2p_client *m2p);147148#endif /* __ASM_ARCH_DMA_H */149150151