From b8ec30a01b0fb626612bbcf350abf1d461144738 Mon Sep 17 00:00:00 2001 From: Viorel Suman Date: Tue, 13 Apr 2021 18:18:51 +0300 Subject: [PATCH] imx8m: add support for SDMA2 and SAI1 Add SDMA2 and SAI1 related info. Signed-off-by: Viorel Suman --- src/platform/imx8m/include/platform/lib/dma.h | 2 +- .../imx8m/include/platform/lib/memory.h | 3 +++ src/platform/imx8m/lib/dai.c | 18 ++++++++++++++++++ src/platform/imx8m/lib/dma.c | 15 +++++++++++++++ src/platform/imx8m/platform.c | 3 ++- 5 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/platform/imx8m/include/platform/lib/dma.h b/src/platform/imx8m/include/platform/lib/dma.h index e5cc5a137..812042c9c 100644 --- a/src/platform/imx8m/include/platform/lib/dma.h +++ b/src/platform/imx8m/include/platform/lib/dma.h @@ -10,7 +10,7 @@ #ifndef __PLATFORM_LIB_DMA_H__ #define __PLATFORM_LIB_DMA_H__ -#define PLATFORM_NUM_DMACS 2 +#define PLATFORM_NUM_DMACS 3 /* max number of supported DMA channels */ #define PLATFORM_MAX_DMA_CHAN 32 diff --git a/src/platform/imx8m/include/platform/lib/memory.h b/src/platform/imx8m/include/platform/lib/memory.h index fe3b21222..9dab55065 100644 --- a/src/platform/imx8m/include/platform/lib/memory.h +++ b/src/platform/imx8m/include/platform/lib/memory.h @@ -41,6 +41,9 @@ #define SDMA3_BASE 0x30e00000 #define SDMA3_SIZE 0x10000 +#define SAI_1_BASE 0x30c10000 +#define SAI_1_SIZE 0x00010000 + #define SAI_3_BASE 0x30c30000 #define SAI_3_SIZE 0x00010000 diff --git a/src/platform/imx8m/lib/dai.c b/src/platform/imx8m/lib/dai.c index a300bd9d6..c6e94fbb3 100644 --- a/src/platform/imx8m/lib/dai.c +++ b/src/platform/imx8m/lib/dai.c @@ -14,6 +14,24 @@ #include static SHARED_DATA struct dai sai[] = { +{ + .index = 1, + .plat_data = { + .base = SAI_1_BASE, + .fifo[SOF_IPC_STREAM_PLAYBACK] = { + .offset = SAI_1_BASE + REG_SAI_TDR0, + .depth = 128, /* in 4 bytes words */ + /* Handshake is SDMA hardware event */ + .handshake = 1, + }, + .fifo[SOF_IPC_STREAM_CAPTURE] = { + .offset = SAI_1_BASE + REG_SAI_RDR0, + .depth = 128, /* in 4 bytes words */ + .handshake = 0, + }, + }, + .drv = &sai_driver, +}, { .index = 3, .plat_data = { diff --git a/src/platform/imx8m/lib/dma.c b/src/platform/imx8m/lib/dma.c index 58e63548f..274fe0b69 100644 --- a/src/platform/imx8m/lib/dma.c +++ b/src/platform/imx8m/lib/dma.c @@ -24,6 +24,21 @@ SHARED_DATA struct dma dma[PLATFORM_NUM_DMACS] = { }, .ops = &dummy_dma_ops, }, +{ + .plat_data = { + .id = DMA_ID_SDMA2, + /* Note: support is available for MEM_TO_MEM but not + * enabled as it is unneeded + */ + .dir = DMA_DIR_MEM_TO_DEV | DMA_DIR_DEV_TO_MEM, + .devs = DMA_DEV_SAI, + .base = SDMA2_BASE, + .channels = 32, + .irq = SDMA2_IRQ, + .irq_name = SDMA2_IRQ_NAME, + }, + .ops = &sdma_ops, +}, { .plat_data = { .id = DMA_ID_SDMA3, diff --git a/src/platform/imx8m/platform.c b/src/platform/imx8m/platform.c index 3c3e3ff77..ed0180cf5 100644 --- a/src/platform/imx8m/platform.c +++ b/src/platform/imx8m/platform.c @@ -173,7 +173,8 @@ int platform_init(struct sof *sof) /* Init SDMA platform domain */ sof->platform_dma_domain = dma_multi_chan_domain_init(&sof->dma_info->dma_array[1], - 1, PLATFORM_DEFAULT_CLOCK, true); + PLATFORM_NUM_DMACS - 1, + PLATFORM_DEFAULT_CLOCK, true); /* i.MX platform DMA domain will be full synchronous, no time dependent */ sof->platform_dma_domain->full_sync = true;