spi: spi-imx: add peripheral_config/peripheral_size for config
authorRobin Gong <yibin.gong@nxp.com>
Tue, 23 Mar 2021 17:12:08 +0000 (01:12 +0800)
committerRobin Gong <yibin.gong@nxp.com>
Wed, 21 Apr 2021 17:30:26 +0000 (01:30 +0800)
Add peripheral_config/peripheral_size for sdma, otherwise, the random
value of local variable tx/rx may cause unexpected
peripheral_config and make sdma mess up.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 77e7980fb495193019bf74639ef9198045fb6045)

drivers/spi/spi-imx.c

index fffe0ca..61e0c54 100644 (file)
@@ -1218,6 +1218,8 @@ static int spi_imx_dma_configure(struct spi_master *master)
        tx.dst_addr = spi_imx->base_phys + MXC_CSPITXDATA;
        tx.dst_addr_width = buswidth;
        tx.dst_maxburst = spi_imx->wml;
+       tx.peripheral_config = NULL;
+       tx.peripheral_size = 0;
        ret = dmaengine_slave_config(master->dma_tx, &tx);
        if (ret) {
                dev_err(spi_imx->dev, "TX dma configuration failed with %d\n", ret);
@@ -1228,6 +1230,8 @@ static int spi_imx_dma_configure(struct spi_master *master)
        rx.src_addr = spi_imx->base_phys + MXC_CSPIRXDATA;
        rx.src_addr_width = buswidth;
        rx.src_maxburst = spi_imx->wml;
+       rx.peripheral_config = NULL;
+       rx.peripheral_size = 0;
        ret = dmaengine_slave_config(master->dma_rx, &rx);
        if (ret) {
                dev_err(spi_imx->dev, "RX dma configuration failed with %d\n", ret);