spi: pxa2xx: Introduce DMA burst size support
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 19 Mar 2019 15:48:42 +0000 (17:48 +0200)
committerMark Brown <broonie@kernel.org>
Wed, 20 Mar 2019 17:21:17 +0000 (17:21 +0000)
Some masters may have different DMA burst size than hard coded default.
In such case respect the value given by DMA burst size provided via
platform data.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-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-pci.c
drivers/spi/spi-pxa2xx.c
include/linux/spi/pxa2xx_spi.h

index 15592598273ea905b05a2a5de072eee2ec4d35b8..e5c26c1779ab8e5435378e95d918d6b5618bc032 100644 (file)
@@ -239,13 +239,15 @@ int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip,
                                           u32 *threshold)
 {
        struct pxa2xx_spi_chip *chip_info = spi->controller_data;
+       struct driver_data *drv_data = spi_controller_get_devdata(spi->controller);
+       u32 dma_burst_size = drv_data->controller_info->dma_burst_size;
 
        /*
         * If the DMA burst size is given in chip_info we use that,
         * otherwise we use the default. Also we use the default FIFO
         * thresholds for now.
         */
-       *burst_code = chip_info ? chip_info->dma_burst_size : 1;
+       *burst_code = chip_info ? chip_info->dma_burst_size : dma_burst_size;
        *threshold = SSCR1_RxTresh(RX_THRESH_DFLT)
                   | SSCR1_TxTresh(TX_THRESH_DFLT);
 
index 4b162fdca35f9fbbe5d6650934a8bd82ea48a5e8..d456c5251b5d229706367d5401ee3d4fd10f00cb 100644 (file)
@@ -34,6 +34,8 @@ struct pxa_spi_info {
        void *tx_param;
        void *rx_param;
 
+       int dma_burst_size;
+
        int (*setup)(struct pci_dev *pdev, struct pxa_spi_info *c);
 };
 
@@ -132,6 +134,7 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa_spi_info *c)
        rx->dma_dev = &dma_dev->dev;
 
        c->dma_filter = lpss_dma_filter;
+       c->dma_burst_size = 8;
        return 0;
 }
 
@@ -222,6 +225,7 @@ static int pxa2xx_spi_pci_probe(struct pci_dev *dev,
        spi_pdata.tx_param = c->tx_param;
        spi_pdata.rx_param = c->rx_param;
        spi_pdata.enable_dma = c->rx_param && c->tx_param;
+       spi_pdata.dma_burst_size = c->dma_burst_size ? c->dma_burst_size : 1;
 
        ssp = &spi_pdata.ssp;
        ssp->phys_base = pci_resource_start(dev, 0);
index b6ddba833d021968858d22bd8cb6a7b55c08993e..461c6b796b8f78dbf13a320ecb5acd06174d2f73 100644 (file)
@@ -1564,6 +1564,7 @@ pxa2xx_spi_init_pdata(struct platform_device *pdev)
        pdata->is_slave = of_property_read_bool(pdev->dev.of_node, "spi-slave");
        pdata->num_chipselect = 1;
        pdata->enable_dma = true;
+       pdata->dma_burst_size = 1;
 
        return pdata;
 }
index c1c59473cef96b602bc8c1db0bc941dc9bb37242..6005f01266315c3059d09fba5358b6354c769643 100644 (file)
@@ -25,6 +25,7 @@ struct dma_chan;
 struct pxa2xx_spi_controller {
        u16 num_chipselect;
        u8 enable_dma;
+       u8 dma_burst_size;
        bool is_slave;
 
        /* DMA engine specific config */