You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
dmaengine: hisilicon: Disable channels when unregister hisi_dma
[ Upstream commite3bdaa04ad] When hisi_dma is unloaded or unbinded, all of channels should be disabled. This patch disables DMA channels when driver is unloaded or unbinded. Fixes:e9f08b6525("dmaengine: hisilicon: Add Kunpeng DMA engine support") Signed-off-by: Jie Hai <haijie1@huawei.com> Acked-by: Zhou Wang <wangzhou1@hisilicon.com> Link: https://lore.kernel.org/r/20220830062251.52993-2-haijie1@huawei.com Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f59861946f
commit
d5065ca461
@@ -185,7 +185,8 @@ static void hisi_dma_reset_qp_point(struct hisi_dma_dev *hdma_dev, u32 index)
|
||||
hisi_dma_chan_write(hdma_dev->base, HISI_DMA_CQ_HEAD_PTR, index, 0);
|
||||
}
|
||||
|
||||
static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan)
|
||||
static void hisi_dma_reset_or_disable_hw_chan(struct hisi_dma_chan *chan,
|
||||
bool disable)
|
||||
{
|
||||
struct hisi_dma_dev *hdma_dev = chan->hdma_dev;
|
||||
u32 index = chan->qp_num, tmp;
|
||||
@@ -206,8 +207,11 @@ static void hisi_dma_reset_hw_chan(struct hisi_dma_chan *chan)
|
||||
hisi_dma_do_reset(hdma_dev, index);
|
||||
hisi_dma_reset_qp_point(hdma_dev, index);
|
||||
hisi_dma_pause_dma(hdma_dev, index, false);
|
||||
hisi_dma_enable_dma(hdma_dev, index, true);
|
||||
hisi_dma_unmask_irq(hdma_dev, index);
|
||||
|
||||
if (!disable) {
|
||||
hisi_dma_enable_dma(hdma_dev, index, true);
|
||||
hisi_dma_unmask_irq(hdma_dev, index);
|
||||
}
|
||||
|
||||
ret = readl_relaxed_poll_timeout(hdma_dev->base +
|
||||
HISI_DMA_Q_FSM_STS + index * HISI_DMA_OFFSET, tmp,
|
||||
@@ -223,7 +227,7 @@ static void hisi_dma_free_chan_resources(struct dma_chan *c)
|
||||
struct hisi_dma_chan *chan = to_hisi_dma_chan(c);
|
||||
struct hisi_dma_dev *hdma_dev = chan->hdma_dev;
|
||||
|
||||
hisi_dma_reset_hw_chan(chan);
|
||||
hisi_dma_reset_or_disable_hw_chan(chan, false);
|
||||
vchan_free_chan_resources(&chan->vc);
|
||||
|
||||
memset(chan->sq, 0, sizeof(struct hisi_dma_sqe) * hdma_dev->chan_depth);
|
||||
@@ -399,7 +403,7 @@ static void hisi_dma_enable_qp(struct hisi_dma_dev *hdma_dev, u32 qp_index)
|
||||
|
||||
static void hisi_dma_disable_qp(struct hisi_dma_dev *hdma_dev, u32 qp_index)
|
||||
{
|
||||
hisi_dma_reset_hw_chan(&hdma_dev->chan[qp_index]);
|
||||
hisi_dma_reset_or_disable_hw_chan(&hdma_dev->chan[qp_index], true);
|
||||
}
|
||||
|
||||
static void hisi_dma_enable_qps(struct hisi_dma_dev *hdma_dev)
|
||||
|
||||
Reference in New Issue
Block a user