USB: bcma: support old USB 2.0 controller on Northstar devices
[linux-2.6/btrfs-unstable.git] / include / linux / of_dma.h
blobb90d8ec57c1fb43fcc182b59e3d3267c79c68865
1 /*
2 * OF helpers for DMA request / controller
4 * Based on of_gpio.h
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
16 #include <linux/of.h>
17 #include <linux/dmaengine.h>
19 struct device_node;
21 struct of_dma {
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;
29 void *of_dma_data;
32 struct of_dma_filter_info {
33 dma_cap_mask_t dma_cap;
34 dma_filter_fn filter_fn;
37 #ifdef CONFIG_DMA_OF
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 *),
41 void *data);
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,
51 const char *name);
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);
57 #else
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 *),
61 void *data)
63 return -ENODEV;
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)
75 return -ENODEV;
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,
81 const char *name)
83 return ERR_PTR(-ENODEV);
86 static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
87 struct of_dma *ofdma)
89 return NULL;
92 #define of_dma_xlate_by_chan_id NULL
94 #endif
96 #endif /* __LINUX_OF_DMA_H */