Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm...
[linux-2.6.git] / include / linux / of_dma.h
blobae36298ba076eb5187b1fff7bffc96f8c0b6a28a
1 /*
2 * OF helpers for DMA request / controller
4 * Based on of_gpio.h
6 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
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.
13 #ifndef __LINUX_OF_DMA_H
14 #define __LINUX_OF_DMA_H
16 #include <linux/of.h>
17 #include <linux/dmaengine.h>
19 struct device_node;
21 struct of_dma {
22 struct list_head of_dma_controllers;
23 struct device_node *of_node;
24 struct dma_chan *(*of_dma_xlate)
25 (struct of_phandle_args *, struct of_dma *);
26 void *of_dma_data;
29 struct of_dma_filter_info {
30 dma_cap_mask_t dma_cap;
31 dma_filter_fn filter_fn;
34 #ifdef CONFIG_OF
35 extern int of_dma_controller_register(struct device_node *np,
36 struct dma_chan *(*of_dma_xlate)
37 (struct of_phandle_args *, struct of_dma *),
38 void *data);
39 extern void of_dma_controller_free(struct device_node *np);
40 extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
41 const char *name);
42 extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
43 struct of_dma *ofdma);
44 #else
45 static inline int of_dma_controller_register(struct device_node *np,
46 struct dma_chan *(*of_dma_xlate)
47 (struct of_phandle_args *, struct of_dma *),
48 void *data)
50 return -ENODEV;
53 static inline void of_dma_controller_free(struct device_node *np)
57 static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
58 const char *name)
60 return NULL;
63 static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
64 struct of_dma *ofdma)
66 return NULL;
69 #endif
71 #endif /* __LINUX_OF_DMA_H */