1 /* SPDX-License-Identifier: GPL-2.0 */ << 2 /* 1 /* 3 * OF helpers for DMA request / controller 2 * OF helpers for DMA request / controller 4 * 3 * 5 * Based on of_gpio.h 4 * Based on of_gpio.h 6 * 5 * 7 * Copyright (C) 2012 Texas Instruments Incorp 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. 8 */ 11 */ 9 12 10 #ifndef __LINUX_OF_DMA_H 13 #ifndef __LINUX_OF_DMA_H 11 #define __LINUX_OF_DMA_H 14 #define __LINUX_OF_DMA_H 12 15 13 #include <linux/of.h> 16 #include <linux/of.h> 14 #include <linux/dmaengine.h> 17 #include <linux/dmaengine.h> 15 18 16 struct device_node; 19 struct device_node; 17 20 18 struct of_dma { 21 struct of_dma { 19 struct list_head of_dma_control 22 struct list_head of_dma_controllers; 20 struct device_node *of_node; 23 struct device_node *of_node; 21 struct dma_chan *(*of_dma_xlat 24 struct dma_chan *(*of_dma_xlate) 22 (struct of_pha 25 (struct of_phandle_args *, struct of_dma *); 23 void *(*of_dma_rout 26 void *(*of_dma_route_allocate) 24 (struct of_pha 27 (struct of_phandle_args *, struct of_dma *); 25 struct dma_router *dma_router; 28 struct dma_router *dma_router; 26 void *of_dma_data; 29 void *of_dma_data; 27 }; 30 }; 28 31 29 struct of_dma_filter_info { 32 struct of_dma_filter_info { 30 dma_cap_mask_t dma_cap; 33 dma_cap_mask_t dma_cap; 31 dma_filter_fn filter_fn; 34 dma_filter_fn filter_fn; 32 }; 35 }; 33 36 34 #ifdef CONFIG_DMA_OF 37 #ifdef CONFIG_DMA_OF 35 extern int of_dma_controller_register(struct d 38 extern int of_dma_controller_register(struct device_node *np, 36 struct dma_chan *(*of_dma_xlat 39 struct dma_chan *(*of_dma_xlate) 37 (struct of_phandle_args *, str 40 (struct of_phandle_args *, struct of_dma *), 38 void *data); 41 void *data); 39 extern void of_dma_controller_free(struct devi 42 extern void of_dma_controller_free(struct device_node *np); 40 43 41 extern int of_dma_router_register(struct devic 44 extern int of_dma_router_register(struct device_node *np, 42 void *(*of_dma_route_allocate) 45 void *(*of_dma_route_allocate) 43 (struct of_phandle_args *, str 46 (struct of_phandle_args *, struct of_dma *), 44 struct dma_router *dma_router) 47 struct dma_router *dma_router); 45 #define of_dma_router_free of_dma_controller_f 48 #define of_dma_router_free of_dma_controller_free 46 49 47 extern struct dma_chan *of_dma_request_slave_c 50 extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np, 48 51 const char *name); 49 extern struct dma_chan *of_dma_simple_xlate(st 52 extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec, 50 struct of_dma *ofdma); 53 struct of_dma *ofdma); 51 extern struct dma_chan *of_dma_xlate_by_chan_i 54 extern struct dma_chan *of_dma_xlate_by_chan_id(struct of_phandle_args *dma_spec, 52 struct of_dma *ofdma); 55 struct of_dma *ofdma); 53 56 54 #else 57 #else 55 static inline int of_dma_controller_register(s 58 static inline int of_dma_controller_register(struct device_node *np, 56 struct dma_chan *(*of_dma_xlat 59 struct dma_chan *(*of_dma_xlate) 57 (struct of_phandle_args *, str 60 (struct of_phandle_args *, struct of_dma *), 58 void *data) 61 void *data) 59 { 62 { 60 return -ENODEV; 63 return -ENODEV; 61 } 64 } 62 65 63 static inline void of_dma_controller_free(stru 66 static inline void of_dma_controller_free(struct device_node *np) 64 { 67 { 65 } 68 } 66 69 67 static inline int of_dma_router_register(struc 70 static inline int of_dma_router_register(struct device_node *np, 68 void *(*of_dma_route_allocate) 71 void *(*of_dma_route_allocate) 69 (struct of_phandle_args *, str 72 (struct of_phandle_args *, struct of_dma *), 70 struct dma_router *dma_router) 73 struct dma_router *dma_router) 71 { 74 { 72 return -ENODEV; 75 return -ENODEV; 73 } 76 } 74 77 75 #define of_dma_router_free of_dma_controller_f 78 #define of_dma_router_free of_dma_controller_free 76 79 77 static inline struct dma_chan *of_dma_request_ 80 static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np, 78 81 const char *name) 79 { 82 { 80 return ERR_PTR(-ENODEV); 83 return ERR_PTR(-ENODEV); 81 } 84 } 82 85 83 static inline struct dma_chan *of_dma_simple_x 86 static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec, 84 struct of_dma *ofdma) 87 struct of_dma *ofdma) 85 { 88 { 86 return NULL; 89 return NULL; 87 } 90 } 88 91 89 #define of_dma_xlate_by_chan_id NULL 92 #define of_dma_xlate_by_chan_id NULL 90 93 91 #endif 94 #endif 92 95 93 #endif /* __LINUX_OF_DMA_H */ 96 #endif /* __LINUX_OF_DMA_H */ 94 97
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.