From: Sunny Luo Date: Thu, 19 Sep 2019 11:21:34 +0000 (+0800) Subject: spicc: fix the condition issue of dma [1/1] X-Git-Tag: hardkernel-4.9.236-104~522 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a5f97be7baaeea94fa510ba8c1993fd0b32dff8b;p=platform%2Fkernel%2Flinux-amlogic.git spicc: fix the condition issue of dma [1/1] PD#SH-1213 Problem: spicc will not run dma if bits_per_word isn't 64, though dma mapped by the slave driver. Solution: change to run dma once dma mapped Verify: axg s400 Change-Id: I8625f973bdd5a2d69831e2c766dd43bc0417e0a5 Signed-off-by: Sunny Luo --- diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index ea35284..987316a 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -555,9 +555,9 @@ static void meson_spicc_setup_xfer(struct meson_spicc_device *spicc, meson_spicc_auto_io_delay(spicc); spicc->using_dma = 0; - if ((xfer->bits_per_word == 64) - && (spicc->message->is_dma_mapped - || !meson_spicc_dma_map(spicc, xfer))) { + if (spicc->message->is_dma_mapped || + ((xfer->bits_per_word == 64) && + !meson_spicc_dma_map(spicc, xfer))) { spicc->using_dma = 1; writel_relaxed(xfer->tx_dma, spicc->base + SPICC_DRADDR); writel_relaxed(xfer->rx_dma, spicc->base + SPICC_DWADDR); @@ -585,6 +585,9 @@ static int meson_spicc_transfer_one(struct spi_master *master, spicc->bytes_per_word = DIV_ROUND_UP(spicc->xfer->bits_per_word, 8); + if (spicc->message->is_dma_mapped) + spicc->bytes_per_word = 8; + if (xfer->len % spicc->bytes_per_word) return -EINVAL;