spicc: fix the condition issue of dma [1/1]
authorSunny Luo <sunny.luo@amlogic.com>
Thu, 19 Sep 2019 11:21:34 +0000 (19:21 +0800)
committerTao Zeng <tao.zeng@amlogic.com>
Fri, 18 Oct 2019 07:22:05 +0000 (00:22 -0700)
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 <sunny.luo@amlogic.com>
drivers/spi/spi-meson-spicc.c

index ea35284..987316a 100644 (file)
@@ -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;