blob: 84b64f857e23cb3b635f6c0536243075944f1176 [file] [log] [blame]
Jon Hunteraa3da642012-09-14 17:41:56 -05001/*
2 * OF helpers for DMA request / controller
3 *
4 * Based on of_gpio.h
5 *
6 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
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 __LINUX_OF_DMA_H
14#define __LINUX_OF_DMA_H
15
16#include <linux/of.h>
17#include <linux/dmaengine.h>
18
19struct device_node;
20
21struct of_dma {
22 struct list_head of_dma_controllers;
23 struct device_node *of_node;
24 int of_dma_nbcells;
25 struct dma_chan *(*of_dma_xlate)
26 (struct of_phandle_args *, struct of_dma *);
27 void *of_dma_data;
Jon Hunter9743a3b2012-10-11 14:43:01 -050028 int use_count;
Jon Hunteraa3da642012-09-14 17:41:56 -050029};
30
31struct of_dma_filter_info {
32 dma_cap_mask_t dma_cap;
33 dma_filter_fn filter_fn;
34};
35
Vinod Koul4c26bc62012-09-25 09:57:36 +053036#ifdef CONFIG_OF
Jon Hunteraa3da642012-09-14 17:41:56 -050037extern int of_dma_controller_register(struct device_node *np,
38 struct dma_chan *(*of_dma_xlate)
39 (struct of_phandle_args *, struct of_dma *),
40 void *data);
Jon Hunter9743a3b2012-10-11 14:43:01 -050041extern int of_dma_controller_free(struct device_node *np);
Jon Hunteraa3da642012-09-14 17:41:56 -050042extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
43 char *name);
44extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
45 struct of_dma *ofdma);
Vinod Koul4c26bc62012-09-25 09:57:36 +053046#else
47static int of_dma_controller_register(struct device_node *np,
48 struct dma_chan *(*of_dma_xlate)
49 (struct of_phandle_args *, struct of_dma *),
50 void *data)
51{
52 return -ENODEV;
53}
54
Jon Hunter9743a3b2012-10-11 14:43:01 -050055static int of_dma_controller_free(struct device_node *np)
Vinod Koul4c26bc62012-09-25 09:57:36 +053056{
57}
58
59static struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
60 char *name)
61{
62 return NULL;
63}
64
65static struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
66 struct of_dma *ofdma)
67{
68 return NULL;
69}
70
71#endif
Jon Hunteraa3da642012-09-14 17:41:56 -050072
73#endif /* __LINUX_OF_DMA_H */