2019-06-04 11:11:33 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2010-09-30 17:56:34 +04:00
|
|
|
/*
|
|
|
|
* Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved.
|
|
|
|
*/
|
|
|
|
|
2022-04-14 19:22:37 +03:00
|
|
|
#ifndef __LINUX_DMA_IMX_H
|
|
|
|
#define __LINUX_DMA_IMX_H
|
2010-09-30 17:56:34 +04:00
|
|
|
|
|
|
|
#include <linux/scatterlist.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/dmaengine.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This enumerates peripheral types. Used for SDMA.
|
|
|
|
*/
|
|
|
|
enum sdma_peripheral_type {
|
|
|
|
IMX_DMATYPE_SSI, /* MCU domain SSI */
|
|
|
|
IMX_DMATYPE_SSI_SP, /* Shared SSI */
|
|
|
|
IMX_DMATYPE_MMC, /* MMC */
|
|
|
|
IMX_DMATYPE_SDHC, /* SDHC */
|
|
|
|
IMX_DMATYPE_UART, /* MCU domain UART */
|
|
|
|
IMX_DMATYPE_UART_SP, /* Shared UART */
|
|
|
|
IMX_DMATYPE_FIRI, /* FIRI */
|
|
|
|
IMX_DMATYPE_CSPI, /* MCU domain CSPI */
|
|
|
|
IMX_DMATYPE_CSPI_SP, /* Shared CSPI */
|
|
|
|
IMX_DMATYPE_SIM, /* SIM */
|
|
|
|
IMX_DMATYPE_ATA, /* ATA */
|
|
|
|
IMX_DMATYPE_CCM, /* CCM */
|
|
|
|
IMX_DMATYPE_EXT, /* External peripheral */
|
|
|
|
IMX_DMATYPE_MSHC, /* Memory Stick Host Controller */
|
|
|
|
IMX_DMATYPE_MSHC_SP, /* Shared Memory Stick Host Controller */
|
|
|
|
IMX_DMATYPE_DSP, /* DSP */
|
|
|
|
IMX_DMATYPE_MEMORY, /* Memory */
|
|
|
|
IMX_DMATYPE_FIFO_MEMORY,/* FIFO type Memory */
|
|
|
|
IMX_DMATYPE_SPDIF, /* SPDIF */
|
|
|
|
IMX_DMATYPE_IPU_MEMORY, /* IPU Memory */
|
|
|
|
IMX_DMATYPE_ASRC, /* ASRC */
|
|
|
|
IMX_DMATYPE_ESAI, /* ESAI */
|
2013-11-13 18:55:25 +04:00
|
|
|
IMX_DMATYPE_SSI_DUAL, /* SSI Dual FIFO */
|
2014-06-16 07:31:05 +04:00
|
|
|
IMX_DMATYPE_ASRC_SP, /* Shared ASRC */
|
2014-10-24 23:37:41 +04:00
|
|
|
IMX_DMATYPE_SAI, /* SAI */
|
2022-04-14 19:22:39 +03:00
|
|
|
IMX_DMATYPE_MULTI_SAI, /* MULTI FIFOs For Audio */
|
2010-09-30 17:56:34 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
enum imx_dma_prio {
|
|
|
|
DMA_PRIO_HIGH = 0,
|
|
|
|
DMA_PRIO_MEDIUM = 1,
|
|
|
|
DMA_PRIO_LOW = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
struct imx_dma_data {
|
|
|
|
int dma_request; /* DMA request line */
|
2014-07-29 14:08:52 +04:00
|
|
|
int dma_request2; /* secondary DMA request line */
|
2010-09-30 17:56:34 +04:00
|
|
|
enum sdma_peripheral_type peripheral_type;
|
|
|
|
int priority;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline int imx_dma_is_ipu(struct dma_chan *chan)
|
|
|
|
{
|
|
|
|
return !strcmp(dev_name(chan->device->dev), "ipu-core");
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int imx_dma_is_general_purpose(struct dma_chan *chan)
|
|
|
|
{
|
2013-05-26 13:53:20 +04:00
|
|
|
return !strcmp(chan->device->dev->driver->name, "imx-sdma") ||
|
|
|
|
!strcmp(chan->device->dev->driver->name, "imx-dma");
|
2010-09-30 17:56:34 +04:00
|
|
|
}
|
|
|
|
|
2022-04-14 19:22:39 +03:00
|
|
|
/**
|
|
|
|
* struct sdma_peripheral_config - SDMA config for audio
|
|
|
|
* @n_fifos_src: Number of FIFOs for recording
|
|
|
|
* @n_fifos_dst: Number of FIFOs for playback
|
|
|
|
* @sw_done: Use software done. Needed for PDM (micfil)
|
|
|
|
*
|
|
|
|
* Some i.MX Audio devices (SAI, micfil) have multiple successive FIFO
|
|
|
|
* registers. For multichannel recording/playback the SAI/micfil have
|
|
|
|
* one FIFO register per channel and the SDMA engine has to read/write
|
|
|
|
* the next channel from/to the next register and wrap around to the
|
|
|
|
* first register when all channels are handled. The number of active
|
|
|
|
* channels must be communicated to the SDMA engine using this struct.
|
|
|
|
*/
|
|
|
|
struct sdma_peripheral_config {
|
|
|
|
int n_fifos_src;
|
|
|
|
int n_fifos_dst;
|
|
|
|
bool sw_done;
|
|
|
|
};
|
|
|
|
|
2022-04-14 19:22:37 +03:00
|
|
|
#endif /* __LINUX_DMA_IMX_H */
|