diff mbox

spi: pxa2xx: use DMA by default if supported

Message ID 1464375468-11510-1-git-send-email-dan@emutex.com (mailing list archive)
State Accepted
Commit c64e1265ae8516c0282b45e099ac5fbdb8486c4c
Headers show

Commit Message

Dan O'Donovan May 27, 2016, 6:57 p.m. UTC
Currently, even if the PXA2xx SPI master supports DMA, it won't be
enabled unless (i) the slave device is enumerated through ACPI, or
(ii) the slave device is registered with board-specific
controller_data specified.  Even then, there isn't a field in the
controller_data that explicitly enables dma - it just gets enabled
if the master supports it and controller_data is non-NULL.

This means that drivers which register SPI devices on a bus without
awareness of this controller cannot avail of DMA performance gains.

This patch allows DMA transfers to be used if supported.

Signed-off-by: Dan O'Donovan <dan@emutex.com>
---
 drivers/spi/spi-pxa2xx.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

Comments

Robert Jarzmik May 27, 2016, 7:21 p.m. UTC | #1
Dan O'Donovan <dan@emutex.com> writes:

Let me add Jarkko and Mika to the review, they were active in the driver's DMA
area lately.

Cheers.

--
Robert

[1] Dan's patch
> Currently, even if the PXA2xx SPI master supports DMA, it won't be
> enabled unless (i) the slave device is enumerated through ACPI, or
> (ii) the slave device is registered with board-specific
> controller_data specified.  Even then, there isn't a field in the
> controller_data that explicitly enables dma - it just gets enabled
> if the master supports it and controller_data is non-NULL.
>
> This means that drivers which register SPI devices on a bus without
> awareness of this controller cannot avail of DMA performance gains.
>
> This patch allows DMA transfers to be used if supported.
>
> Signed-off-by: Dan O'Donovan <dan@emutex.com>
> ---
>  drivers/spi/spi-pxa2xx.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
> index fe07c05..27e0307 100644
> --- a/drivers/spi/spi-pxa2xx.c
> +++ b/drivers/spi/spi-pxa2xx.c
> @@ -1240,7 +1240,7 @@ static int setup(struct spi_device *spi)
>  			chip->frm = spi->chip_select;
>  		} else
>  			chip->gpio_cs = -1;
> -		chip->enable_dma = 0;
> +		chip->enable_dma = drv_data->master_info->enable_dma;
>  		chip->timeout = TIMOUT_DFLT;
>  	}
>  
> @@ -1259,17 +1259,9 @@ static int setup(struct spi_device *spi)
>  			tx_hi_thres = chip_info->tx_hi_threshold;
>  		if (chip_info->rx_threshold)
>  			rx_thres = chip_info->rx_threshold;
> -		chip->enable_dma = drv_data->master_info->enable_dma;
>  		chip->dma_threshold = 0;
>  		if (chip_info->enable_loopback)
>  			chip->cr1 = SSCR1_LBM;
> -	} else if (ACPI_HANDLE(&spi->dev)) {
> -		/*
> -		 * Slave devices enumerated from ACPI namespace don't
> -		 * usually have chip_info but we still might want to use
> -		 * DMA with them.
> -		 */
> -		chip->enable_dma = drv_data->master_info->enable_dma;
>  	}
>  
>  	chip->lpss_rx_threshold = SSIRF_RxThresh(rx_thres);
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jarkko Nikula May 30, 2016, 7:43 a.m. UTC | #2
On 05/27/2016 10:21 PM, Robert Jarzmik wrote:
> Dan O'Donovan <dan@emutex.com> writes:
>
> Let me add Jarkko and Mika to the review, they were active in the driver's DMA
> area lately.
>
> Cheers.
>
> --
> Robert
>
> [1] Dan's patch
>> Currently, even if the PXA2xx SPI master supports DMA, it won't be
>> enabled unless (i) the slave device is enumerated through ACPI, or
>> (ii) the slave device is registered with board-specific
>> controller_data specified.  Even then, there isn't a field in the
>> controller_data that explicitly enables dma - it just gets enabled
>> if the master supports it and controller_data is non-NULL.
>>
>> This means that drivers which register SPI devices on a bus without
>> awareness of this controller cannot avail of DMA performance gains.
>>
>> This patch allows DMA transfers to be used if supported.
>>
Makes sense to me. I've noticed this too but haven't actually touched it 
if some legacy stuff depends on it. Given that legacy PXA DMA support 
has been dropped it's probably time to get this cleanup too.

Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index fe07c05..27e0307 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -1240,7 +1240,7 @@  static int setup(struct spi_device *spi)
 			chip->frm = spi->chip_select;
 		} else
 			chip->gpio_cs = -1;
-		chip->enable_dma = 0;
+		chip->enable_dma = drv_data->master_info->enable_dma;
 		chip->timeout = TIMOUT_DFLT;
 	}
 
@@ -1259,17 +1259,9 @@  static int setup(struct spi_device *spi)
 			tx_hi_thres = chip_info->tx_hi_threshold;
 		if (chip_info->rx_threshold)
 			rx_thres = chip_info->rx_threshold;
-		chip->enable_dma = drv_data->master_info->enable_dma;
 		chip->dma_threshold = 0;
 		if (chip_info->enable_loopback)
 			chip->cr1 = SSCR1_LBM;
-	} else if (ACPI_HANDLE(&spi->dev)) {
-		/*
-		 * Slave devices enumerated from ACPI namespace don't
-		 * usually have chip_info but we still might want to use
-		 * DMA with them.
-		 */
-		chip->enable_dma = drv_data->master_info->enable_dma;
 	}
 
 	chip->lpss_rx_threshold = SSIRF_RxThresh(rx_thres);