[Sound-open-firmware] [PATCH] ipc: dont assume DMAC0 is always used for IPC.

Liam Girdwood liam.r.girdwood at linux.intel.com
Mon Feb 26 12:38:57 CET 2018


Refactor so other DMACs can be used for IPC purposes.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/include/reef/intel-ipc.h                     | 2 +-
 src/ipc/apl-ipc.c                                | 2 +-
 src/ipc/byt-ipc.c                                | 3 +--
 src/ipc/cnl-ipc.c                                | 2 +-
 src/ipc/hsw-ipc.c                                | 2 +-
 src/ipc/intel-ipc.c                              | 6 +++---
 src/platform/haswell/include/platform/platform.h | 2 +-
 7 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/include/reef/intel-ipc.h b/src/include/reef/intel-ipc.h
index c884e44..f89e9b5 100644
--- a/src/include/reef/intel-ipc.h
+++ b/src/include/reef/intel-ipc.h
@@ -36,7 +36,7 @@
 /* private data for IPC */
 struct intel_ipc_data {
 	/* DMA */
-	struct dma *dmac0;
+	struct dma *dmac;
 	uint8_t *page_table;
 	completion_t complete;
 
diff --git a/src/ipc/apl-ipc.c b/src/ipc/apl-ipc.c
index 1332639..167423b 100644
--- a/src/ipc/apl-ipc.c
+++ b/src/ipc/apl-ipc.c
@@ -198,7 +198,7 @@ int platform_ipc_init(struct ipc *ipc)
 		bzero(iipc->page_table, HOST_PAGE_SIZE);
 
 	/* dma */
-	iipc->dmac0 = dma_get(DMA_GP_LP_DMAC0);
+	iipc->dmac = dma_get(DMA_GP_LP_DMAC0);
 
 	/* PM */
 	iipc->pm_prepare_D3 = 0;
diff --git a/src/ipc/byt-ipc.c b/src/ipc/byt-ipc.c
index e7c1d78..91d8f1b 100644
--- a/src/ipc/byt-ipc.c
+++ b/src/ipc/byt-ipc.c
@@ -86,7 +86,6 @@ out:
 	shim_write(SHIM_IMRD, shim_read(SHIM_IMRD) & ~SHIM_IMRD_DONE);
 }
 
-/* test code to check working IRQ */
 static void irq_handler(void *arg)
 {
 	uint32_t isr;
@@ -226,7 +225,7 @@ int platform_ipc_init(struct ipc *ipc)
 		bzero(iipc->page_table, PLATFORM_PAGE_TABLE_SIZE);
 
 	/* dma */
-	iipc->dmac0 = dma_get(DMA_ID_DMAC0);
+	iipc->dmac = dma_get(DMA_ID_DMAC0);
 
 	/* PM */
 	iipc->pm_prepare_D3 = 0;
diff --git a/src/ipc/cnl-ipc.c b/src/ipc/cnl-ipc.c
index 5ccc345..0fcc5be 100644
--- a/src/ipc/cnl-ipc.c
+++ b/src/ipc/cnl-ipc.c
@@ -198,7 +198,7 @@ int platform_ipc_init(struct ipc *ipc)
 		bzero(iipc->page_table, HOST_PAGE_SIZE);
 
 	/* dma */
-	iipc->dmac0 = dma_get(DMA_GP_LP_DMAC0);
+	iipc->dmac = dma_get(DMA_GP_LP_DMAC0);
 
 	/* PM */
 	iipc->pm_prepare_D3 = 0;
diff --git a/src/ipc/hsw-ipc.c b/src/ipc/hsw-ipc.c
index 7a1dd72..6867be4 100644
--- a/src/ipc/hsw-ipc.c
+++ b/src/ipc/hsw-ipc.c
@@ -215,7 +215,7 @@ int platform_ipc_init(struct ipc *ipc)
 		bzero(iipc->page_table, PLATFORM_PAGE_TABLE_SIZE);
 
 	/* dma */
-	iipc->dmac0 = dma_get(DMA_ID_DMAC0);
+	iipc->dmac = dma_get(DMA_ID_DMAC1);
 
 	/* PM */
 	iipc->pm_prepare_D3 = 0;
diff --git a/src/ipc/intel-ipc.c b/src/ipc/intel-ipc.c
index 0cfec42..5e14653 100644
--- a/src/ipc/intel-ipc.c
+++ b/src/ipc/intel-ipc.c
@@ -104,13 +104,13 @@ static int get_page_descriptors(struct intel_ipc_data *iipc,
 	int chan;
 	int ret = 0;
 
-	/* get DMA channel from DMAC0 */
-	chan = dma_channel_get(iipc->dmac0, 0);
+	/* get DMA channel from DMAC */
+	chan = dma_channel_get(iipc->dmac, 0);
 	if (chan < 0) {
 		trace_ipc_error("ePC");
 		return chan;
 	}
-	dma = iipc->dmac0;
+	dma = iipc->dmac;
 
 	/* set up DMA configuration */
 	config.direction = DMA_DIR_HMEM_TO_LMEM;
diff --git a/src/platform/haswell/include/platform/platform.h b/src/platform/haswell/include/platform/platform.h
index 8475e31..2d9315e 100644
--- a/src/platform/haswell/include/platform/platform.h
+++ b/src/platform/haswell/include/platform/platform.h
@@ -91,7 +91,7 @@ struct reef;
 #define DMA_TRACE_RESCHEDULE_TIME	5000
 
 /* DMAC used for trace DMA */
-#define PLATFORM_TRACE_DMAC	DMA_ID_DMAC0
+#define PLATFORM_TRACE_DMAC	DMA_ID_DMAC1
 
 /* DSP should be idle in this time frame */
 #define PLATFORM_IDLE_TIME	750000
-- 
2.14.1



More information about the Sound-open-firmware mailing list