blob: 114178268b75e70d8e25e5035d893d81c8d8f60b [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;
21 struct property *dt_dmach_prop;
22 struct s3c2410_dma_client *client;
23};
24
25struct samsung_dma_prep {
Boojin Kimc4e16622011-09-02 09:44:35 +090026 enum dma_transaction_type cap;
Vinod Koul20dd5a32011-10-14 10:35:16 +053027 enum dma_transfer_direction direction;
Boojin Kimc4e16622011-09-02 09:44:35 +090028 dma_addr_t buf;
29 unsigned long period;
30 unsigned long len;
31 void (*fp)(void *data);
32 void *fp_param;
33};
34
Boojin Kimfbb20e82012-06-19 13:26:53 +090035struct samsung_dma_config {
Vinod Koul20dd5a32011-10-14 10:35:16 +053036 enum dma_transfer_direction direction;
Boojin Kimc4e16622011-09-02 09:44:35 +090037 enum dma_slave_buswidth width;
38 dma_addr_t fifo;
Boojin Kimc4e16622011-09-02 09:44:35 +090039};
40
41struct samsung_dma_ops {
Padmavathi Vennae7ba5f12013-01-18 17:17:02 +053042 unsigned (*request)(enum dma_ch ch, struct samsung_dma_req *param,
43 struct device *dev, char *ch_name);
Boojin Kimfbb20e82012-06-19 13:26:53 +090044 int (*release)(unsigned ch, void *param);
45 int (*config)(unsigned ch, struct samsung_dma_config *param);
46 int (*prepare)(unsigned ch, struct samsung_dma_prep *param);
Boojin Kimc4e16622011-09-02 09:44:35 +090047 int (*trigger)(unsigned ch);
48 int (*started)(unsigned ch);
49 int (*flush)(unsigned ch);
50 int (*stop)(unsigned ch);
51};
52
53extern void *samsung_dmadev_get_ops(void);
54extern void *s3c_dma_get_ops(void);
55
56static inline void *__samsung_dma_get_ops(void)
57{
58 if (samsung_dma_is_dmadev())
59 return samsung_dmadev_get_ops();
60 else
61 return s3c_dma_get_ops();
62}
63
64/*
65 * samsung_dma_get_ops
66 * get the set of samsung dma operations
67 */
68#define samsung_dma_get_ops() __samsung_dma_get_ops()
69
70#endif /* __SAMSUNG_DMA_OPS_H_ */