]> git.karo-electronics.de Git - linux-beck.git/commitdiff
spi: pxa2xx: Use dummy buffers provided by SPI core
authorJarkko Nikula <jarkko.nikula@linux.intel.com>
Thu, 24 Mar 2016 13:35:44 +0000 (15:35 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 28 Mar 2016 09:42:00 +0000 (10:42 +0100)
Dummy buffer is used for half duplex transfers that don't have TX or RX
buffer set. Instead of own dummy buffer management here let the SPI core to
handle it by setting the SPI_MASTER_MUST_RX and SPI_MASTER_MUST_TX flags.
Then core makes sure both transfer buffers are set.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-pxa2xx-dma.c
drivers/spi/spi-pxa2xx.c
drivers/spi/spi-pxa2xx.h

index 624cb06bd2e19939756909f2b0afe0a58409b78a..a18a03d0afb709a51eb9515cfee7d8acf181d2e6 100644 (file)
@@ -53,11 +53,7 @@ static int pxa2xx_spi_map_dma_buffer(struct driver_data *drv_data,
        for_each_sg(sgt->sgl, sg, sgt->nents, i) {
                size_t bytes = min_t(size_t, len, SZ_2K);
 
-               if (buf)
-                       sg_set_buf(sg, pbuf, bytes);
-               else
-                       sg_set_buf(sg, drv_data->dummy, bytes);
-
+               sg_set_buf(sg, pbuf, bytes);
                pbuf += bytes;
                len -= bytes;
        }
@@ -312,10 +308,6 @@ int pxa2xx_spi_dma_setup(struct driver_data *drv_data)
        dma_cap_zero(mask);
        dma_cap_set(DMA_SLAVE, mask);
 
-       drv_data->dummy = devm_kzalloc(dev, SZ_2K, GFP_KERNEL);
-       if (!drv_data->dummy)
-               return -ENOMEM;
-
        drv_data->tx_chan = dma_request_slave_channel_compat(mask,
                                pdata->dma_filter, pdata->tx_param, dev, "tx");
        if (!drv_data->tx_chan)
index 47bdbd350a2452fc8d3e0652dae69c3f075efb7d..86c155aea0cfa5bb2eef15a5888ade9e560fc743 100644 (file)
@@ -1562,6 +1562,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
        master->unprepare_transfer_hardware = pxa2xx_spi_unprepare_transfer;
        master->fw_translate_cs = pxa2xx_spi_fw_translate_cs;
        master->auto_runtime_pm = true;
+       master->flags = SPI_MASTER_MUST_RX | SPI_MASTER_MUST_TX;
 
        drv_data->ssp_type = ssp->type;
 
index 85017f9ca67c773aeba9cf273c96da81ef422392..e6b09000ff145f072f0b7e12aaf11a8eeba7624f 100644 (file)
@@ -56,7 +56,6 @@ struct driver_data {
        struct sg_table tx_sgt;
        int rx_nents;
        int tx_nents;
-       void *dummy;
        atomic_t dma_running;
 
        /* Current message transfer state info */