Commit 07c7544b authored by Ville Baillie's avatar Ville Baillie Committed by sanglipeng
Browse files

spi: atmel: Fix PDC transfer setup bug

stable inclusion
from stable-v5.10.206
commit 2df1e1887c6801fdba74dfe03704aa9a40608056
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9O5W8

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2df1e1887c6801fdba74dfe03704aa9a40608056



--------------------------------

commit 75e33c55 upstream.

atmel_spi_dma_map_xfer to never be called in PDC mode. This causes the
driver to silently fail.

This patch changes the conditional to match the behaviour of the
previous commit before the refactor.

Fixes: 5fa5e6de ("spi: atmel: Switch to transfer_one transfer method")
Signed-off-by: default avatarVille Baillie <villeb@bytesnap.co.uk>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210921072132.21831-1-villeb@bytesnap.co.uk


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 4db619e8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1315,7 +1315,7 @@ static int atmel_spi_one_transfer(struct spi_master *master,
	 * DMA map early, for performance (empties dcache ASAP) and
	 * better fault reporting.
	 */
	if ((!master->cur_msg_mapped)
	if ((!master->cur_msg->is_dma_mapped)
		&& as->use_pdc) {
		if (atmel_spi_dma_map_xfer(as, xfer) < 0)
			return -ENOMEM;
@@ -1394,7 +1394,7 @@ static int atmel_spi_one_transfer(struct spi_master *master,
		}
	}

	if (!master->cur_msg_mapped
	if (!master->cur_msg->is_dma_mapped
		&& as->use_pdc)
		atmel_spi_dma_unmap_xfer(master, xfer);