blob: ce6d7634b6cb0d8f6be56046ca55638ca8bd0747 [file] [log] [blame]
Boojin Kimc4e16622011-09-02 09:44:35 +09001/* arch/arm/plat-samsung/include/plat/dma-ops.h
2 *
3 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Samsung DMA support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __SAMSUNG_DMA_OPS_H_
14#define __SAMSUNG_DMA_OPS_H_ __FILE__
15
16#include <linux/dmaengine.h>
Mark Brown6fd9dd32011-12-26 20:28:57 +090017#include <mach/dma.h>
Boojin Kimc4e16622011-09-02 09:44:35 +090018
Boojin Kimfbb20e82012-06-19 13:26:53 +090019struct samsung_dma_req {
20 enum dma_transaction_type cap;
Boojin Kimfbb20e82012-06-19 13:26:53 +090021 struct s3c2410_dma_client *client;
22};
23
24struct samsung_dma_prep {
Boojin Kimc4e16622011-09-02 09:44:35 +090025 enum dma_transaction_type cap;
Vinod Koul20dd5a32011-10-14 10:35:16 +053026 enum dma_transfer_direction direction;
Boojin Kimc4e16622011-09-02 09:44:35 +090027 dma_addr_t buf;
28 unsigned long period;
29 unsigned long len;
30 void (*fp)(void *data);
31 void *fp_param;
32};
33
Boojin Kimfbb20e82012-06-19 13:26:53 +090034struct samsung_dma_config {
Vinod Koul20dd5a32011-10-14 10:35:16 +053035 enum dma_transfer_direction direction;
Boojin Kimc4e16622011-09-02 09:44:35 +090036 enum dma_slave_buswidth width;
37 dma_addr_t fifo;
Boojin Kimc4e16622011-09-02 09:44:35 +090038};
39
40struct samsung_dma_ops {
Padmavathi Vennae7ba5f12013-01-18 17:17:02 +053041 unsigned (*request)(enum dma_ch ch, struct samsung_dma_req *param,
42 struct device *dev, char *ch_name);
Boojin Kimfbb20e82012-06-19 13:26:53 +090043 int (*release)(unsigned ch, void *param);
44 int (*config)(unsigned ch, struct samsung_dma_config *param);
45 int (*prepare)(unsigned ch, struct samsung_dma_prep *param);
Boojin Kimc4e16622011-09-02 09:44:35 +090046 int (*trigger)(unsigned ch);
47 int (*started)(unsigned ch);
48 int (*flush)(unsigned ch);
49 int (*stop)(unsigned ch);
50};
51
52extern void *samsung_dmadev_get_ops(void);
53extern void *s3c_dma_get_ops(void);
54
55static inline void *__samsung_dma_get_ops(void)
56{
57 if (samsung_dma_is_dmadev())
58 return samsung_dmadev_get_ops();
59 else
60 return s3c_dma_get_ops();
61}
62
63/*
64 * samsung_dma_get_ops
65 * get the set of samsung dma operations
66 */
67#define samsung_dma_get_ops() __samsung_dma_get_ops()
68
69#endif /* __SAMSUNG_DMA_OPS_H_ */