blob: 364dda734877d2b9a1d045d8082de2542420a475 [file] [log] [blame]
Jon Hunteraa3da642012-09-14 17:41:56 -05001/*
2 * OF helpers for DMA request / controller
3 *
4 * Based on of_gpio.h
5 *
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.
11 */
12
13#ifndef __LINUX_OF_DMA_H
14#define __LINUX_OF_DMA_H
15
16#include <linux/of.h>
17#include <linux/dmaengine.h>
18
19struct device_node;
20
21struct of_dma {
22 struct list_head of_dma_controllers;
23 struct device_node *of_node;
24 int of_dma_nbcells;
25 struct dma_chan *(*of_dma_xlate)
26 (struct of_phandle_args *, struct of_dma *);
27 void *of_dma_data;
28};
29
30struct of_dma_filter_info {
31 dma_cap_mask_t dma_cap;
32 dma_filter_fn filter_fn;
33};
34
Vinod Koul4c26bc62012-09-25 09:57:36 +053035#ifdef CONFIG_OF
Jon Hunteraa3da642012-09-14 17:41:56 -050036extern int of_dma_controller_register(struct device_node *np,
37 struct dma_chan *(*of_dma_xlate)
38 (struct of_phandle_args *, struct of_dma *),
39 void *data);
Lars-Peter Clausende616082013-04-19 11:42:14 +020040extern void of_dma_controller_free(struct device_node *np);
Jon Hunteraa3da642012-09-14 17:41:56 -050041extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
Markus Pargmannbef29ec2013-02-24 16:36:09 +010042 const char *name);
Jon Hunteraa3da642012-09-14 17:41:56 -050043extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
44 struct of_dma *ofdma);
Vinod Koul4c26bc62012-09-25 09:57:36 +053045#else
Vinod Koul91f8aec2012-11-29 12:17:22 +053046static inline int of_dma_controller_register(struct device_node *np,
Vinod Koul4c26bc62012-09-25 09:57:36 +053047 struct dma_chan *(*of_dma_xlate)
48 (struct of_phandle_args *, struct of_dma *),
49 void *data)
50{
51 return -ENODEV;
52}
53
Lars-Peter Clausende616082013-04-19 11:42:14 +020054static inline void of_dma_controller_free(struct device_node *np)
Vinod Koul4c26bc62012-09-25 09:57:36 +053055{
56}
57
Vinod Koul91f8aec2012-11-29 12:17:22 +053058static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
Markus Pargmannbef29ec2013-02-24 16:36:09 +010059 const char *name)
Vinod Koul4c26bc62012-09-25 09:57:36 +053060{
61 return NULL;
62}
63
Vinod Koul91f8aec2012-11-29 12:17:22 +053064static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
Vinod Koul4c26bc62012-09-25 09:57:36 +053065 struct of_dma *ofdma)
66{
67 return NULL;
68}
69
70#endif
Jon Hunteraa3da642012-09-14 17:41:56 -050071
72#endif /* __LINUX_OF_DMA_H */