1 /* SPDX-License-Identifier: GPL-2.0 */
3 * OF helpers for DMA request / controller
7 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
10 #ifndef __LINUX_OF_DMA_H
11 #define __LINUX_OF_DMA_H
14 #include <linux/dmaengine.h>
19 struct list_head of_dma_controllers
;
20 struct device_node
*of_node
;
21 struct dma_chan
*(*of_dma_xlate
)
22 (struct of_phandle_args
*, struct of_dma
*);
23 void *(*of_dma_route_allocate
)
24 (struct of_phandle_args
*, struct of_dma
*);
25 struct dma_router
*dma_router
;
29 struct of_dma_filter_info
{
30 dma_cap_mask_t dma_cap
;
31 dma_filter_fn filter_fn
;
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
*),
39 extern void of_dma_controller_free(struct device_node
*np
);
41 extern int of_dma_router_register(struct device_node
*np
,
42 void *(*of_dma_route_allocate
)
43 (struct of_phandle_args
*, struct of_dma
*),
44 struct dma_router
*dma_router
);
45 #define of_dma_router_free of_dma_controller_free
47 extern struct dma_chan
*of_dma_request_slave_channel(struct device_node
*np
,
49 extern struct dma_chan
*of_dma_simple_xlate(struct of_phandle_args
*dma_spec
,
50 struct of_dma
*ofdma
);
51 extern struct dma_chan
*of_dma_xlate_by_chan_id(struct of_phandle_args
*dma_spec
,
52 struct of_dma
*ofdma
);
55 static inline int of_dma_controller_register(struct device_node
*np
,
56 struct dma_chan
*(*of_dma_xlate
)
57 (struct of_phandle_args
*, struct of_dma
*),
63 static inline void of_dma_controller_free(struct device_node
*np
)
67 static inline int of_dma_router_register(struct device_node
*np
,
68 void *(*of_dma_route_allocate
)
69 (struct of_phandle_args
*, struct of_dma
*),
70 struct dma_router
*dma_router
)
75 #define of_dma_router_free of_dma_controller_free
77 static inline struct dma_chan
*of_dma_request_slave_channel(struct device_node
*np
,
80 return ERR_PTR(-ENODEV
);
83 static inline struct dma_chan
*of_dma_simple_xlate(struct of_phandle_args
*dma_spec
,
89 #define of_dma_xlate_by_chan_id NULL
93 #endif /* __LINUX_OF_DMA_H */