blob: 7d964e787299e88f7450d8d0d8b1ebf58d57b78e [file] [log] [blame]
Sascha Hauer1ec1e822010-09-30 13:56:34 +00001/*
2 * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __ASM_ARCH_MXC_DMA_H__
10#define __ASM_ARCH_MXC_DMA_H__
11
12#include <linux/scatterlist.h>
13#include <linux/device.h>
14#include <linux/dmaengine.h>
15
16/*
17 * This enumerates peripheral types. Used for SDMA.
18 */
19enum sdma_peripheral_type {
20 IMX_DMATYPE_SSI, /* MCU domain SSI */
21 IMX_DMATYPE_SSI_SP, /* Shared SSI */
22 IMX_DMATYPE_MMC, /* MMC */
23 IMX_DMATYPE_SDHC, /* SDHC */
24 IMX_DMATYPE_UART, /* MCU domain UART */
25 IMX_DMATYPE_UART_SP, /* Shared UART */
26 IMX_DMATYPE_FIRI, /* FIRI */
27 IMX_DMATYPE_CSPI, /* MCU domain CSPI */
28 IMX_DMATYPE_CSPI_SP, /* Shared CSPI */
29 IMX_DMATYPE_SIM, /* SIM */
30 IMX_DMATYPE_ATA, /* ATA */
31 IMX_DMATYPE_CCM, /* CCM */
32 IMX_DMATYPE_EXT, /* External peripheral */
33 IMX_DMATYPE_MSHC, /* Memory Stick Host Controller */
34 IMX_DMATYPE_MSHC_SP, /* Shared Memory Stick Host Controller */
35 IMX_DMATYPE_DSP, /* DSP */
36 IMX_DMATYPE_MEMORY, /* Memory */
37 IMX_DMATYPE_FIFO_MEMORY,/* FIFO type Memory */
38 IMX_DMATYPE_SPDIF, /* SPDIF */
39 IMX_DMATYPE_IPU_MEMORY, /* IPU Memory */
40 IMX_DMATYPE_ASRC, /* ASRC */
41 IMX_DMATYPE_ESAI, /* ESAI */
Nicolin Chen1a895572013-11-13 22:55:25 +080042 IMX_DMATYPE_SSI_DUAL, /* SSI Dual FIFO */
Nicolin Chenf892afb2014-06-16 11:31:05 +080043 IMX_DMATYPE_ASRC_SP, /* Shared ASRC */
Nicolin Chen29aebfd2014-10-24 12:37:41 -070044 IMX_DMATYPE_SAI, /* SAI */
Sascha Hauer1ec1e822010-09-30 13:56:34 +000045};
46
47enum imx_dma_prio {
48 DMA_PRIO_HIGH = 0,
49 DMA_PRIO_MEDIUM = 1,
50 DMA_PRIO_LOW = 2
51};
52
53struct imx_dma_data {
54 int dma_request; /* DMA request line */
Nicolin Chen94b912e2014-07-29 18:08:52 +080055 int dma_request2; /* secondary DMA request line */
Sascha Hauer1ec1e822010-09-30 13:56:34 +000056 enum sdma_peripheral_type peripheral_type;
57 int priority;
58};
59
60static inline int imx_dma_is_ipu(struct dma_chan *chan)
61{
62 return !strcmp(dev_name(chan->device->dev), "ipu-core");
63}
64
65static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
66{
Markus Pargmann290ad0f2013-05-26 11:53:20 +020067 return !strcmp(chan->device->dev->driver->name, "imx-sdma") ||
68 !strcmp(chan->device->dev->driver->name, "imx-dma");
Sascha Hauer1ec1e822010-09-30 13:56:34 +000069}
70
71#endif