mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 23:51:02 +02:00
spi: Fixes for v7.3
A small collection of driver specific fixes, all quite important if you have the relevant hardware. -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQReagvpf3TrrA7BoYYv73Ows9A4iQUCatTACAAKCRAv73Ows9A4 if2lAQDfQLZHMIvrU2wGNFBX2CUe2repS3JyRnmRalP9nXSVkAEAgS4wY/wU8wzQ o+7ajrnUAZjgx/IK3HKoV0fXMOvlTAw= =1PL3 -----END PGP SIGNATURE----- Merge tag 'spi-fix-v7.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Pull spi fixes from Mark Brown: "A small collection of driver specific fixes, all quite important if you have the relevant hardware" * tag 'spi-fix-v7.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: spi-fsl-lpspi: directly return ret in fsl_lpspi_transfer_one() spi: spi-fsl-lpspi: pass struct fsl_lpspi_data instead of struct spi_controller if possible spi: imx: fix slab corruption from undersized DMA bounce buffers spi: tegra114: assert CS GPIO for every transfer in a message
This commit is contained in:
commit
8486d35712
|
|
@ -550,11 +550,8 @@ static int fsl_lpspi_target_abort(struct spi_controller *controller)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int fsl_lpspi_wait_for_completion(struct spi_controller *controller)
|
||||
static int fsl_lpspi_wait_for_completion(struct fsl_lpspi_data *fsl_lpspi)
|
||||
{
|
||||
struct fsl_lpspi_data *fsl_lpspi =
|
||||
spi_controller_get_devdata(controller);
|
||||
|
||||
if (fsl_lpspi->is_target) {
|
||||
if (wait_for_completion_interruptible(&fsl_lpspi->xfer_done) ||
|
||||
fsl_lpspi->target_aborted) {
|
||||
|
|
@ -758,11 +755,9 @@ static int fsl_lpspi_dma_init(struct device *dev,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int fsl_lpspi_pio_transfer(struct spi_controller *controller,
|
||||
static int fsl_lpspi_pio_transfer(struct fsl_lpspi_data *fsl_lpspi,
|
||||
struct spi_transfer *t)
|
||||
{
|
||||
struct fsl_lpspi_data *fsl_lpspi =
|
||||
spi_controller_get_devdata(controller);
|
||||
int ret;
|
||||
|
||||
fsl_lpspi->tx_buf = t->tx_buf;
|
||||
|
|
@ -774,7 +769,7 @@ static int fsl_lpspi_pio_transfer(struct spi_controller *controller,
|
|||
|
||||
fsl_lpspi_write_tx_fifo(fsl_lpspi);
|
||||
|
||||
ret = fsl_lpspi_wait_for_completion(controller);
|
||||
ret = fsl_lpspi_wait_for_completion(fsl_lpspi);
|
||||
|
||||
fsl_lpspi_reset(fsl_lpspi);
|
||||
|
||||
|
|
@ -803,11 +798,9 @@ static int fsl_lpspi_transfer_one(struct spi_controller *controller,
|
|||
if (fsl_lpspi->usedma)
|
||||
ret = fsl_lpspi_dma_transfer(controller, fsl_lpspi, t);
|
||||
else
|
||||
ret = fsl_lpspi_pio_transfer(controller, t);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = fsl_lpspi_pio_transfer(fsl_lpspi, t);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static irqreturn_t fsl_lpspi_isr(int irq, void *dev_id)
|
||||
|
|
|
|||
|
|
@ -1578,11 +1578,13 @@ static int spi_imx_dma_tx_data_handle(struct spi_imx_data *spi_imx,
|
|||
dma_data->dma_len = ALIGN(dma_data->data_len, BYTES_PER_32BITS_WORD);
|
||||
}
|
||||
|
||||
dma_data->dma_tx_buf = kzalloc(dma_data->dma_len, GFP_KERNEL);
|
||||
dma_data->dma_tx_buf = kzalloc(DMA_CACHE_ALIGNED_LEN(dma_data->dma_len),
|
||||
GFP_KERNEL);
|
||||
if (!dma_data->dma_tx_buf)
|
||||
return -ENOMEM;
|
||||
|
||||
dma_data->dma_rx_buf = kzalloc(dma_data->dma_len, GFP_KERNEL);
|
||||
dma_data->dma_rx_buf = kzalloc(DMA_CACHE_ALIGNED_LEN(dma_data->dma_len),
|
||||
GFP_KERNEL);
|
||||
if (!dma_data->dma_rx_buf) {
|
||||
kfree(dma_data->dma_tx_buf);
|
||||
return -ENOMEM;
|
||||
|
|
@ -1920,7 +1922,8 @@ static int spi_imx_dma_package_transfer(struct spi_imx_data *spi_imx,
|
|||
|
||||
/* Trim the DMA RX buffer and copy the actual data to rx_buf */
|
||||
dma_sync_single_for_cpu(controller->dma_rx->device->dev, dma_data->dma_rx_addr,
|
||||
dma_data->dma_len, DMA_FROM_DEVICE);
|
||||
DMA_CACHE_ALIGNED_LEN(dma_data->dma_len),
|
||||
DMA_FROM_DEVICE);
|
||||
spi_imx_dma_rx_data_handle(spi_imx, dma_data, transfer->rx_buf + spi_imx->rx_offset,
|
||||
word_delay);
|
||||
spi_imx->rx_offset += dma_data->data_len;
|
||||
|
|
|
|||
|
|
@ -859,6 +859,13 @@ static u32 tegra_spi_setup_transfer_one(struct spi_device *spi,
|
|||
command1 |= SPI_BIT_LENGTH(bits_per_word - 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Re-assert the CS GPIO for every transfer: transfer_end() drops it
|
||||
* on cs_change, and the assert above only covers is_first_of_msg.
|
||||
*/
|
||||
if (spi_get_csgpiod(spi, 0))
|
||||
gpiod_set_value(spi_get_csgpiod(spi, 0), 1);
|
||||
|
||||
return command1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user