dma-ops.h 1.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/* arch/arm/plat-samsung/include/plat/dma-ops.h
 *
 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
 *		http://www.samsung.com
 *
 * Samsung 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.
 */

#ifndef __SAMSUNG_DMA_OPS_H_
#define __SAMSUNG_DMA_OPS_H_ __FILE__

#include <linux/dmaengine.h>
17
#include <mach/dma.h>
18 19 20

struct samsung_dma_prep_info {
	enum dma_transaction_type cap;
21
	enum dma_transfer_direction direction;
22 23 24 25 26 27 28 29 30
	dma_addr_t buf;
	unsigned long period;
	unsigned long len;
	void (*fp)(void *data);
	void *fp_param;
};

struct samsung_dma_info {
	enum dma_transaction_type cap;
31
	enum dma_transfer_direction direction;
32 33 34
	enum dma_slave_buswidth width;
	dma_addr_t fifo;
	struct s3c2410_dma_client *client;
35
	struct property *dt_dmach_prop;
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
};

struct samsung_dma_ops {
	unsigned (*request)(enum dma_ch ch, struct samsung_dma_info *info);
	int (*release)(unsigned ch, struct s3c2410_dma_client *client);
	int (*prepare)(unsigned ch, struct samsung_dma_prep_info *info);
	int (*trigger)(unsigned ch);
	int (*started)(unsigned ch);
	int (*flush)(unsigned ch);
	int (*stop)(unsigned ch);
};

extern void *samsung_dmadev_get_ops(void);
extern void *s3c_dma_get_ops(void);

static inline void *__samsung_dma_get_ops(void)
{
	if (samsung_dma_is_dmadev())
		return samsung_dmadev_get_ops();
	else
		return s3c_dma_get_ops();
}

/*
 * samsung_dma_get_ops
 * get the set of samsung dma operations
 */
#define samsung_dma_get_ops() __samsung_dma_get_ops()

#endif /* __SAMSUNG_DMA_OPS_H_ */