diff options
author | Mark Brown <broonie@kernel.org> | 2018-09-10 18:55:12 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-09-10 18:55:12 +0100 |
commit | 54a3da1c105ca91c4d32f25c3d9c57a61e9a3467 (patch) | |
tree | 5be69ff9ccab03760f2ae17cbaecbfea0b016087 /sound/soc/amd/acp-pcm-dma.c | |
parent | 1c8bc7b3de5e76cb89aacdc7be1475a028af505f (diff) | |
parent | 90a3b7f8aba3011badacd6d8121e03aa24ac79d1 (diff) | |
download | linux-54a3da1c105ca91c4d32f25c3d9c57a61e9a3467.tar.gz linux-54a3da1c105ca91c4d32f25c3d9c57a61e9a3467.tar.bz2 linux-54a3da1c105ca91c4d32f25c3d9c57a61e9a3467.zip |
Merge branch 'asoc-4.19' into asoc-4.20 Cirrus conflict
Diffstat (limited to 'sound/soc/amd/acp-pcm-dma.c')
-rw-r--r-- | sound/soc/amd/acp-pcm-dma.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index 8f3bc6e37f26..c7e972b17c90 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c @@ -16,6 +16,7 @@ #include <linux/module.h> #include <linux/delay.h> #include <linux/io.h> +#include <linux/iopoll.h> #include <linux/sizes.h> #include <linux/pm_runtime.h> @@ -184,6 +185,24 @@ static void config_dma_descriptor_in_sram(void __iomem *acp_mmio, acp_reg_write(descr_info->xfer_val, acp_mmio, mmACP_SRBM_Targ_Idx_Data); } +static void pre_config_reset(void __iomem *acp_mmio, u16 ch_num) +{ + u32 dma_ctrl; + int ret; + + /* clear the reset bit */ + dma_ctrl = acp_reg_read(acp_mmio, mmACP_DMA_CNTL_0 + ch_num); + dma_ctrl &= ~ACP_DMA_CNTL_0__DMAChRst_MASK; + acp_reg_write(dma_ctrl, acp_mmio, mmACP_DMA_CNTL_0 + ch_num); + /* check the reset bit before programming configuration registers */ + ret = readl_poll_timeout(acp_mmio + ((mmACP_DMA_CNTL_0 + ch_num) * 4), + dma_ctrl, + !(dma_ctrl & ACP_DMA_CNTL_0__DMAChRst_MASK), + 100, ACP_DMA_RESET_TIME); + if (ret < 0) + pr_err("Failed to clear reset of channel : %d\n", ch_num); +} + /* * Initialize the DMA descriptor information for transfer between * system memory <-> ACP SRAM @@ -236,6 +255,7 @@ static void set_acp_sysmem_dma_descriptors(void __iomem *acp_mmio, config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx, &dmadscr[i]); } + pre_config_reset(acp_mmio, ch); config_acp_dma_channel(acp_mmio, ch, dma_dscr_idx - 1, NUM_DSCRS_PER_CHANNEL, @@ -275,6 +295,7 @@ static void set_acp_to_i2s_dma_descriptors(void __iomem *acp_mmio, u32 size, config_dma_descriptor_in_sram(acp_mmio, dma_dscr_idx, &dmadscr[i]); } + pre_config_reset(acp_mmio, ch); /* Configure the DMA channel with the above descriptore */ config_acp_dma_channel(acp_mmio, ch, dma_dscr_idx - 1, NUM_DSCRS_PER_CHANNEL, |