Path: blob/master/arch/arm/mach-imx/include/mach/dma-v1.h
10820 views
/*1* linux/arch/arm/mach-imx/include/mach/dma-v1.h2*3* i.MX DMA registration and IRQ dispatching4*5* Copyright 2006 Pavel Pisa <[email protected]>6* Copyright 2008 Juergen Beisert, <[email protected]>7* Copyright 2008 Sascha Hauer, <[email protected]>8*9* This program is free software; you can redistribute it and/or10* modify it under the terms of the GNU General Public License11* as published by the Free Software Foundation; either version 212* of the License, or (at your option) any later version.13* This program is distributed in the hope that it will be useful,14* but WITHOUT ANY WARRANTY; without even the implied warranty of15* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16* GNU General Public License for more details.17*18* You should have received a copy of the GNU General Public License19* along with this program; if not, write to the Free Software20* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,21* MA 02110-1301, USA.22*/2324#ifndef __MACH_DMA_V1_H__25#define __MACH_DMA_V1_H__2627#define imx_has_dma_v1() (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27())2829#include <mach/dma.h>3031#define IMX_DMA_CHANNELS 163233#define DMA_MODE_READ 034#define DMA_MODE_WRITE 135#define DMA_MODE_MASK 13637#define MX1_DMA_REG(offset) MX1_IO_ADDRESS(MX1_DMA_BASE_ADDR + (offset))3839/* DMA Interrupt Mask Register */40#define MX1_DMA_DIMR MX1_DMA_REG(0x08)4142/* Channel Control Register */43#define MX1_DMA_CCR(x) MX1_DMA_REG(0x8c + ((x) << 6))4445#define IMX_DMA_MEMSIZE_32 (0 << 4)46#define IMX_DMA_MEMSIZE_8 (1 << 4)47#define IMX_DMA_MEMSIZE_16 (2 << 4)48#define IMX_DMA_TYPE_LINEAR (0 << 10)49#define IMX_DMA_TYPE_2D (1 << 10)50#define IMX_DMA_TYPE_FIFO (2 << 10)5152#define IMX_DMA_ERR_BURST (1 << 0)53#define IMX_DMA_ERR_REQUEST (1 << 1)54#define IMX_DMA_ERR_TRANSFER (1 << 2)55#define IMX_DMA_ERR_BUFFER (1 << 3)56#define IMX_DMA_ERR_TIMEOUT (1 << 4)5758int59imx_dma_config_channel(int channel, unsigned int config_port,60unsigned int config_mem, unsigned int dmareq, int hw_chaining);6162void63imx_dma_config_burstlen(int channel, unsigned int burstlen);6465int66imx_dma_setup_single(int channel, dma_addr_t dma_address,67unsigned int dma_length, unsigned int dev_addr,68unsigned int dmamode);697071/*72* Use this flag as the dma_length argument to imx_dma_setup_sg()73* to create an endless running dma loop. The end of the scatterlist74* must be linked to the beginning for this to work.75*/76#define IMX_DMA_LENGTH_LOOP ((unsigned int)-1)7778int79imx_dma_setup_sg(int channel, struct scatterlist *sg,80unsigned int sgcount, unsigned int dma_length,81unsigned int dev_addr, unsigned int dmamode);8283int84imx_dma_setup_handlers(int channel,85void (*irq_handler) (int, void *),86void (*err_handler) (int, void *, int), void *data);8788int89imx_dma_setup_progression_handler(int channel,90void (*prog_handler) (int, void*, struct scatterlist*));9192void imx_dma_enable(int channel);9394void imx_dma_disable(int channel);9596int imx_dma_request(int channel, const char *name);9798void imx_dma_free(int channel);99100int imx_dma_request_by_prio(const char *name, enum imx_dma_prio prio);101102#endif /* __MACH_DMA_V1_H__ */103104105