Blame view

include/linux/of_dma.h 2.45 KB
aa3da644c   Jon Hunter   of: Add generic d...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  /*
   * OF helpers for DMA request / controller
   *
   * Based on of_gpio.h
   *
   * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
  
  #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...
24
25
  	struct dma_chan		*(*of_dma_xlate)
  				(struct of_phandle_args *, struct of_dma *);
56f13c0d9   Peter Ujfalusi   dmaengine: of_dma...
26
27
28
  	void			*(*of_dma_route_allocate)
  				(struct of_phandle_args *, struct of_dma *);
  	struct dma_router	*dma_router;
aa3da644c   Jon Hunter   of: Add generic d...
29
30
31
32
33
34
35
  	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...
36
  #ifdef CONFIG_DMA_OF
aa3da644c   Jon Hunter   of: Add generic d...
37
38
39
40
  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...
41
  extern void of_dma_controller_free(struct device_node *np);
56f13c0d9   Peter Ujfalusi   dmaengine: of_dma...
42
43
44
45
46
47
  
  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...
48
  extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
bef29ec50   Markus Pargmann   DMA: of: Constant...
49
  						     const char *name);
aa3da644c   Jon Hunter   of: Add generic d...
50
51
  extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
  		struct of_dma *ofdma);
16369efb1   Alexander Popov   dmaengine: of: ad...
52
53
  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...
54

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