Blame view

include/linux/of_dma.h 2.3 KB
af6074fc9   Rob Herring   of: Use SPDX lice...
1
  /* SPDX-License-Identifier: GPL-2.0 */
aa3da644c   Jon Hunter   of: Add generic d...
2
3
4
5
6
7
  /*
   * OF helpers for DMA request / controller
   *
   * Based on of_gpio.h
   *
   * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
aa3da644c   Jon Hunter   of: Add generic d...
8
9
10
11
12
13
14
15
16
17
18
19
20
   */
  
  #ifndef __LINUX_OF_DMA_H
  #define __LINUX_OF_DMA_H
  
  #include <linux/of.h>
  #include <linux/dmaengine.h>
  
  struct device_node;
  
  struct of_dma {
  	struct list_head	of_dma_controllers;
  	struct device_node	*of_node;
aa3da644c   Jon Hunter   of: Add generic d...
21
22
  	struct dma_chan		*(*of_dma_xlate)
  				(struct of_phandle_args *, struct of_dma *);
56f13c0d9   Peter Ujfalusi   dmaengine: of_dma...
23
24
25
  	void			*(*of_dma_route_allocate)
  				(struct of_phandle_args *, struct of_dma *);
  	struct dma_router	*dma_router;
aa3da644c   Jon Hunter   of: Add generic d...
26
27
28
29
30
31
32
  	void			*of_dma_data;
  };
  
  struct of_dma_filter_info {
  	dma_cap_mask_t	dma_cap;
  	dma_filter_fn	filter_fn;
  };
9290a16cf   Kuninori Morimoto   dmaengine: OF DMA...
33
  #ifdef CONFIG_DMA_OF
aa3da644c   Jon Hunter   of: Add generic d...
34
35
36
37
  extern int of_dma_controller_register(struct device_node *np,
  		struct dma_chan *(*of_dma_xlate)
  		(struct of_phandle_args *, struct of_dma *),
  		void *data);
de61608ac   Lars-Peter Clausen   dma:of: Use a mut...
38
  extern void of_dma_controller_free(struct device_node *np);
56f13c0d9   Peter Ujfalusi   dmaengine: of_dma...
39
40
41
42
43
44
  
  extern int of_dma_router_register(struct device_node *np,
  		void *(*of_dma_route_allocate)
  		(struct of_phandle_args *, struct of_dma *),
  		struct dma_router *dma_router);
  #define of_dma_router_free of_dma_controller_free
aa3da644c   Jon Hunter   of: Add generic d...
45
  extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
bef29ec50   Markus Pargmann   DMA: of: Constant...
46
  						     const char *name);
aa3da644c   Jon Hunter   of: Add generic d...
47
48
  extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
  		struct of_dma *ofdma);
16369efb1   Alexander Popov   dmaengine: of: ad...
49
50
  extern struct dma_chan *of_dma_xlate_by_chan_id(struct of_phandle_args *dma_spec,
  		struct of_dma *ofdma);
56f13c0d9   Peter Ujfalusi   dmaengine: of_dma...
51

4c26bc601   Vinod Koul   of: dma- fix buil...
52
  #else
91f8aecc5   Vinod Koul   dmaengine: fix !o...
53
  static inline int of_dma_controller_register(struct device_node *np,
4c26bc601   Vinod Koul   of: dma- fix buil...
54
55
56
57
58
59
  		struct dma_chan *(*of_dma_xlate)
  		(struct of_phandle_args *, struct of_dma *),
  		void *data)
  {
  	return -ENODEV;
  }
de61608ac   Lars-Peter Clausen   dma:of: Use a mut...
60
  static inline void of_dma_controller_free(struct device_node *np)
4c26bc601   Vinod Koul   of: dma- fix buil...
61
62
  {
  }
56f13c0d9   Peter Ujfalusi   dmaengine: of_dma...
63
64
65
66
67
68
69
70
71
  static inline int of_dma_router_register(struct device_node *np,
  		void *(*of_dma_route_allocate)
  		(struct of_phandle_args *, struct of_dma *),
  		struct dma_router *dma_router)
  {
  	return -ENODEV;
  }
  
  #define of_dma_router_free of_dma_controller_free
91f8aecc5   Vinod Koul   dmaengine: fix !o...
72
  static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
bef29ec50   Markus Pargmann   DMA: of: Constant...
73
  						     const char *name)
4c26bc601   Vinod Koul   of: dma- fix buil...
74
  {
500404ebc   Peter Ujfalusi   dmaengine: of_dma...
75
  	return ERR_PTR(-ENODEV);
4c26bc601   Vinod Koul   of: dma- fix buil...
76
  }
91f8aecc5   Vinod Koul   dmaengine: fix !o...
77
  static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
4c26bc601   Vinod Koul   of: dma- fix buil...
78
79
80
81
  		struct of_dma *ofdma)
  {
  	return NULL;
  }
16369efb1   Alexander Popov   dmaengine: of: ad...
82
  #define of_dma_xlate_by_chan_id NULL
4c26bc601   Vinod Koul   of: dma- fix buil...
83
  #endif
aa3da644c   Jon Hunter   of: Add generic d...
84
85
  
  #endif /* __LINUX_OF_DMA_H */