提交 47b7de2f 编写于 作者: E Evgeniy Didin 提交者: Ulf Hansson

mmc: dw_mmc: fix falling from idmac to PIO mode when dw_mci_reset occurs

It was found that in IDMAC mode after soft-reset driver switches
to PIO mode.

That's what happens in case of DTO timeout overflow calculation failure:
1. soft-reset is called
2. driver restarts dma
3. descriptors states are checked, one of descriptor is owned by the IDMAC.
4. driver can't use DMA and then switches to PIO mode.

Failure was already fixed in:
https://www.spinics.net/lists/linux-mmc/msg48125.html.

Behaviour while soft-reset is not something we except or
even want to happen. So we switch from dw_mci_idmac_reset
to dw_mci_idmac_init, so descriptors are cleaned before starting dma.

And while at it explicitly zero des0 which otherwise might
contain garbage as being allocated by dmam_alloc_coherent().
Signed-off-by: NEvgeniy Didin <Evgeniy.Didin@synopsys.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jisheng Zhang <Jisheng.Zhang@synaptics.com>
Cc: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Cc: linux-snps-arc@lists.infradead.org
Cc: <stable@vger.kernel.org> # 4.4+
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 c658dc58
...@@ -564,6 +564,7 @@ static int dw_mci_idmac_init(struct dw_mci *host) ...@@ -564,6 +564,7 @@ static int dw_mci_idmac_init(struct dw_mci *host)
(sizeof(struct idmac_desc_64addr) * (sizeof(struct idmac_desc_64addr) *
(i + 1))) >> 32; (i + 1))) >> 32;
/* Initialize reserved and buffer size fields to "0" */ /* Initialize reserved and buffer size fields to "0" */
p->des0 = 0;
p->des1 = 0; p->des1 = 0;
p->des2 = 0; p->des2 = 0;
p->des3 = 0; p->des3 = 0;
...@@ -586,6 +587,7 @@ static int dw_mci_idmac_init(struct dw_mci *host) ...@@ -586,6 +587,7 @@ static int dw_mci_idmac_init(struct dw_mci *host)
i++, p++) { i++, p++) {
p->des3 = cpu_to_le32(host->sg_dma + p->des3 = cpu_to_le32(host->sg_dma +
(sizeof(struct idmac_desc) * (i + 1))); (sizeof(struct idmac_desc) * (i + 1)));
p->des0 = 0;
p->des1 = 0; p->des1 = 0;
} }
...@@ -1801,8 +1803,8 @@ static bool dw_mci_reset(struct dw_mci *host) ...@@ -1801,8 +1803,8 @@ static bool dw_mci_reset(struct dw_mci *host)
} }
if (host->use_dma == TRANS_MODE_IDMAC) if (host->use_dma == TRANS_MODE_IDMAC)
/* It is also recommended that we reset and reprogram idmac */ /* It is also required that we reinit idmac */
dw_mci_idmac_reset(host); dw_mci_idmac_init(host);
ret = true; ret = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册