Skip to content

Commit 99ba8b9

Browse files
andy-shevvinodkoul
authored andcommitted
dmaengine: dw: Initialize channel before each transfer
In some cases DMA can be used only with a consumer which does runtime power management and on the platforms, that have DMA auto power gating logic (see comments in the drivers/acpi/acpi_lpss.c), may result in DMA losing its context. Simple mitigation of this issue is to initialize channel each time the consumer initiates a transfer. Fixes: cfdf5b6 ("dw_dmac: add support for Lynxpoint DMA controllers") Reported-by: Tsuchiya Yuto <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Viresh Kumar <[email protected]> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206403 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent e312282 commit 99ba8b9

File tree

1 file changed

+0
-12
lines changed

1 file changed

+0
-12
lines changed

drivers/dma/dw/core.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,11 @@ static void dwc_initialize(struct dw_dma_chan *dwc)
118118
{
119119
struct dw_dma *dw = to_dw_dma(dwc->chan.device);
120120

121-
if (test_bit(DW_DMA_IS_INITIALIZED, &dwc->flags))
122-
return;
123-
124121
dw->initialize_chan(dwc);
125122

126123
/* Enable interrupts */
127124
channel_set_bit(dw, MASK.XFER, dwc->mask);
128125
channel_set_bit(dw, MASK.ERROR, dwc->mask);
129-
130-
set_bit(DW_DMA_IS_INITIALIZED, &dwc->flags);
131126
}
132127

133128
/*----------------------------------------------------------------------*/
@@ -954,8 +949,6 @@ static void dwc_issue_pending(struct dma_chan *chan)
954949

955950
void do_dw_dma_off(struct dw_dma *dw)
956951
{
957-
unsigned int i;
958-
959952
dma_writel(dw, CFG, 0);
960953

961954
channel_clear_bit(dw, MASK.XFER, dw->all_chan_mask);
@@ -966,9 +959,6 @@ void do_dw_dma_off(struct dw_dma *dw)
966959

967960
while (dma_readl(dw, CFG) & DW_CFG_DMA_EN)
968961
cpu_relax();
969-
970-
for (i = 0; i < dw->dma.chancnt; i++)
971-
clear_bit(DW_DMA_IS_INITIALIZED, &dw->chan[i].flags);
972962
}
973963

974964
void do_dw_dma_on(struct dw_dma *dw)
@@ -1032,8 +1022,6 @@ static void dwc_free_chan_resources(struct dma_chan *chan)
10321022
/* Clear custom channel configuration */
10331023
memset(&dwc->dws, 0, sizeof(struct dw_dma_slave));
10341024

1035-
clear_bit(DW_DMA_IS_INITIALIZED, &dwc->flags);
1036-
10371025
/* Disable interrupts */
10381026
channel_clear_bit(dw, MASK.XFER, dwc->mask);
10391027
channel_clear_bit(dw, MASK.BLOCK, dwc->mask);

0 commit comments

Comments
 (0)