2010-01-29 17:02:15 +08:00
|
|
|
/* arch/arm/plat-samsung/include/plat/dma.h
|
2009-03-19 23:02:37 +08:00
|
|
|
*
|
2009-11-14 06:54:14 +08:00
|
|
|
* Copyright (C) 2003-2006 Simtec Electronics
|
2009-03-19 23:02:37 +08:00
|
|
|
* Ben Dooks <ben@simtec.co.uk>
|
|
|
|
*
|
|
|
|
* Samsung S3C DMA support
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
2011-12-26 19:28:23 +08:00
|
|
|
#ifndef __PLAT_DMA_H
|
|
|
|
#define __PLAT_DMA_H
|
|
|
|
|
2011-09-02 08:44:44 +08:00
|
|
|
#include <linux/dma-mapping.h>
|
|
|
|
|
2009-03-19 23:02:37 +08:00
|
|
|
enum s3c2410_dma_buffresult {
|
|
|
|
S3C2410_RES_OK,
|
|
|
|
S3C2410_RES_ERR,
|
|
|
|
S3C2410_RES_ABORT
|
|
|
|
};
|
|
|
|
|
|
|
|
/* enum s3c2410_chan_op
|
|
|
|
*
|
|
|
|
* operation codes passed to the DMA code by the user, and also used
|
|
|
|
* to inform the current channel owner of any changes to the system state
|
|
|
|
*/
|
|
|
|
|
|
|
|
enum s3c2410_chan_op {
|
|
|
|
S3C2410_DMAOP_START,
|
|
|
|
S3C2410_DMAOP_STOP,
|
|
|
|
S3C2410_DMAOP_PAUSE,
|
|
|
|
S3C2410_DMAOP_RESUME,
|
|
|
|
S3C2410_DMAOP_FLUSH,
|
|
|
|
S3C2410_DMAOP_TIMEOUT, /* internal signal to handler */
|
|
|
|
S3C2410_DMAOP_STARTED, /* indicate channel started */
|
|
|
|
};
|
|
|
|
|
|
|
|
struct s3c2410_dma_client {
|
|
|
|
char *name;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct s3c2410_dma_chan;
|
2011-07-16 14:50:19 +08:00
|
|
|
enum dma_ch;
|
2009-03-19 23:02:37 +08:00
|
|
|
|
|
|
|
/* s3c2410_dma_cbfn_t
|
|
|
|
*
|
|
|
|
* buffer callback routine type
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef void (*s3c2410_dma_cbfn_t)(struct s3c2410_dma_chan *,
|
|
|
|
void *buf, int size,
|
|
|
|
enum s3c2410_dma_buffresult result);
|
|
|
|
|
|
|
|
typedef int (*s3c2410_dma_opfn_t)(struct s3c2410_dma_chan *,
|
|
|
|
enum s3c2410_chan_op );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* s3c2410_dma_request
|
|
|
|
*
|
|
|
|
* request a dma channel exclusivley
|
|
|
|
*/
|
|
|
|
|
2011-07-16 14:50:19 +08:00
|
|
|
extern int s3c2410_dma_request(enum dma_ch channel,
|
2009-03-19 23:02:37 +08:00
|
|
|
struct s3c2410_dma_client *, void *dev);
|
|
|
|
|
|
|
|
|
|
|
|
/* s3c2410_dma_ctrl
|
|
|
|
*
|
|
|
|
* change the state of the dma channel
|
|
|
|
*/
|
|
|
|
|
2011-07-16 14:50:19 +08:00
|
|
|
extern int s3c2410_dma_ctrl(enum dma_ch channel, enum s3c2410_chan_op op);
|
2009-03-19 23:02:37 +08:00
|
|
|
|
|
|
|
/* s3c2410_dma_setflags
|
|
|
|
*
|
|
|
|
* set the channel's flags to a given state
|
|
|
|
*/
|
|
|
|
|
2011-07-16 14:50:19 +08:00
|
|
|
extern int s3c2410_dma_setflags(enum dma_ch channel,
|
2009-03-19 23:02:37 +08:00
|
|
|
unsigned int flags);
|
|
|
|
|
|
|
|
/* s3c2410_dma_free
|
|
|
|
*
|
|
|
|
* free the dma channel (will also abort any outstanding operations)
|
|
|
|
*/
|
|
|
|
|
2011-07-16 14:50:19 +08:00
|
|
|
extern int s3c2410_dma_free(enum dma_ch channel, struct s3c2410_dma_client *);
|
2009-03-19 23:02:37 +08:00
|
|
|
|
|
|
|
/* s3c2410_dma_enqueue
|
|
|
|
*
|
|
|
|
* place the given buffer onto the queue of operations for the channel.
|
|
|
|
* The buffer must be allocated from dma coherent memory, or the Dcache/WB
|
|
|
|
* drained before the buffer is given to the DMA system.
|
|
|
|
*/
|
|
|
|
|
2011-07-16 14:50:19 +08:00
|
|
|
extern int s3c2410_dma_enqueue(enum dma_ch channel, void *id,
|
2009-03-19 23:02:37 +08:00
|
|
|
dma_addr_t data, int size);
|
|
|
|
|
|
|
|
/* s3c2410_dma_config
|
|
|
|
*
|
|
|
|
* configure the dma channel
|
|
|
|
*/
|
|
|
|
|
2011-07-16 14:50:19 +08:00
|
|
|
extern int s3c2410_dma_config(enum dma_ch channel, int xferunit);
|
2009-03-19 23:02:37 +08:00
|
|
|
|
|
|
|
/* s3c2410_dma_devconfig
|
|
|
|
*
|
|
|
|
* configure the device we're talking to
|
|
|
|
*/
|
|
|
|
|
2011-07-16 14:50:19 +08:00
|
|
|
extern int s3c2410_dma_devconfig(enum dma_ch channel,
|
2011-09-02 08:44:44 +08:00
|
|
|
enum dma_data_direction source, unsigned long devaddr);
|
2009-03-19 23:02:37 +08:00
|
|
|
|
|
|
|
/* s3c2410_dma_getposition
|
|
|
|
*
|
|
|
|
* get the position that the dma transfer is currently at
|
|
|
|
*/
|
|
|
|
|
2011-07-16 14:50:19 +08:00
|
|
|
extern int s3c2410_dma_getposition(enum dma_ch channel,
|
2009-03-19 23:02:37 +08:00
|
|
|
dma_addr_t *src, dma_addr_t *dest);
|
|
|
|
|
2011-07-16 14:50:19 +08:00
|
|
|
extern int s3c2410_dma_set_opfn(enum dma_ch, s3c2410_dma_opfn_t rtn);
|
|
|
|
extern int s3c2410_dma_set_buffdone_fn(enum dma_ch, s3c2410_dma_cbfn_t rtn);
|
2009-03-19 23:02:37 +08:00
|
|
|
|
2011-09-02 08:44:35 +08:00
|
|
|
#include <plat/dma-ops.h>
|
2011-12-26 19:28:23 +08:00
|
|
|
|
|
|
|
#endif
|