2 * OF helpers for DMA request / controller
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
17 #include <linux/dmaengine.h>
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_route_allocate
)
27 (struct of_phandle_args
*, struct of_dma
*);
28 struct dma_router
*dma_router
;
32 struct of_dma_filter_info
{
33 dma_cap_mask_t dma_cap
;
34 dma_filter_fn filter_fn
;
38 extern int of_dma_controller_register(struct device_node
*np
,
39 struct dma_chan
*(*of_dma_xlate
)
40 (struct of_phandle_args
*, struct of_dma
*),
42 extern void of_dma_controller_free(struct device_node
*np
);
44 extern int of_dma_router_register(struct device_node
*np
,
45 void *(*of_dma_route_allocate
)
46 (struct of_phandle_args
*, struct of_dma
*),
47 struct dma_router
*dma_router
);
48 #define of_dma_router_free of_dma_controller_free
50 extern struct dma_chan
*of_dma_request_slave_channel(struct device_node
*np
,
52 extern struct dma_chan
*of_dma_simple_xlate(struct of_phandle_args
*dma_spec
,
53 struct of_dma
*ofdma
);
54 extern struct dma_chan
*of_dma_xlate_by_chan_id(struct of_phandle_args
*dma_spec
,
55 struct of_dma
*ofdma
);
58 static inline int of_dma_controller_register(struct device_node
*np
,
59 struct dma_chan
*(*of_dma_xlate
)
60 (struct of_phandle_args
*, struct of_dma
*),
66 static inline void of_dma_controller_free(struct device_node
*np
)
70 static inline int of_dma_router_register(struct device_node
*np
,
71 void *(*of_dma_route_allocate
)
72 (struct of_phandle_args
*, struct of_dma
*),
73 struct dma_router
*dma_router
)
78 #define of_dma_router_free of_dma_controller_free
80 static inline struct dma_chan
*of_dma_request_slave_channel(struct device_node
*np
,
83 return ERR_PTR(-ENODEV
);
86 static inline struct dma_chan
*of_dma_simple_xlate(struct of_phandle_args
*dma_spec
,
92 #define of_dma_xlate_by_chan_id NULL
96 #endif /* __LINUX_OF_DMA_H */