mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-10-26 10:57:38 +08:00
spi: Merge up fixes
A small collection of driver specific fixes, all quite important if you have the relevant hardware.
This commit is contained in:
3 files changed
+18
-15
No files matched your search
@@ -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 @@ err:
|
||||
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(dmaengine_get_dma_device(controller->dma_rx), 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user