linux/include/linux/of_dma.h
<<
>>
Prefs
   1/*
   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        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;
  30};
  31
  32struct of_dma_filter_info {
  33        dma_cap_mask_t  dma_cap;
  34        dma_filter_fn   filter_fn;
  35};
  36
  37#ifdef CONFIG_DMA_OF
  38extern 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);
  42extern void of_dma_controller_free(struct device_node *np);
  43
  44extern 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
  49
  50extern struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
  51                                                     const char *name);
  52extern struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
  53                struct of_dma *ofdma);
  54extern struct dma_chan *of_dma_xlate_by_chan_id(struct of_phandle_args *dma_spec,
  55                struct of_dma *ofdma);
  56
  57#else
  58static 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)
  62{
  63        return -ENODEV;
  64}
  65
  66static inline void of_dma_controller_free(struct device_node *np)
  67{
  68}
  69
  70static 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)
  74{
  75        return -ENODEV;
  76}
  77
  78#define of_dma_router_free of_dma_controller_free
  79
  80static inline struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
  81                                                     const char *name)
  82{
  83        return ERR_PTR(-ENODEV);
  84}
  85
  86static inline struct dma_chan *of_dma_simple_xlate(struct of_phandle_args *dma_spec,
  87                struct of_dma *ofdma)
  88{
  89        return NULL;
  90}
  91
  92#define of_dma_xlate_by_chan_id NULL
  93
  94#endif
  95
  96#endif /* __LINUX_OF_DMA_H */
  97