Files
kernel/include/linux/of_dma.h
T

94 lines
2.3 KiB
C
Raw Normal View History

2017-12-27 12:55:14 -06:00
/* SPDX-License-Identifier: GPL-2.0 */
2012-09-14 17:41:56 -05:00
/*
* OF helpers for DMA request / controller
*
* Based on of_gpio.h
*
* Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
*/
#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;
struct dma_chan *(*of_dma_xlate)
(struct of_phandle_args *, struct of_dma *);
2015-04-09 12:35:47 +03:00
void *(*of_dma_route_allocate)
(struct of_phandle_args *, struct of_dma *);
struct dma_router *dma_router;
2012-09-14 17:41:56 -05:00
void *of_dma_data;
};
struct of_dma_filter_info {
dma_cap_mask_t dma_cap;
dma_filter_fn filter_fn;
};
#ifdef CONFIG_DMA_OF
2012-09-14 17:41:56 -05:00
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);
extern void of_dma_controller_free(struct device_node *np);
2015-04-09 12:35:47 +03:00
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
2012-09-14 17:41:56 -05:00
extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
2013-02-24 16:36:09 +01:00
const char *name);
2012-09-14 17:41:56 -05:00
extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
struct of_dma *ofdma);
extern struct dma_chan *of_dma_xlate_by_chan_id(struct of_phandle_args *dma_spec,
struct of_dma *ofdma);
2015-04-09 12:35:47 +03:00
2012-09-25 09:57:36 +05:30
#else
2012-11-29 12:17:22 +05:30
static inline int of_dma_controller_register(struct device_node *np,
2012-09-25 09:57:36 +05:30
struct dma_chan *(*of_dma_xlate)
(struct of_phandle_args *, struct of_dma *),
void *data)
{
return -ENODEV;
}
static inline void of_dma_controller_free(struct device_node *np)
2012-09-25 09:57:36 +05:30
{
}
2015-04-09 12:35:47 +03:00
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
2012-11-29 12:17:22 +05:30
static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
2013-02-24 16:36:09 +01:00
const char *name)
2012-09-25 09:57:36 +05:30
{
return ERR_PTR(-ENODEV);
2012-09-25 09:57:36 +05:30
}
2012-11-29 12:17:22 +05:30
static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
2012-09-25 09:57:36 +05:30
struct of_dma *ofdma)
{
return NULL;
}
#define of_dma_xlate_by_chan_id NULL
2012-09-25 09:57:36 +05:30
#endif
2012-09-14 17:41:56 -05:00
#endif /* __LINUX_OF_DMA_H */