spi: Fixes for v4.5
A few driver specific fixes for the Rockchip and i.MX SPI controllers, especially for the i.MX they're annoying bugs if you run into them. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJW4POVAAoJECTWi3JdVIfQMRYH/R3bNmMQHZB+qBm6vVL28Pdo OXNejqStZLJfvdP6+xNXKijomMmvL/Xd+Jf2XMhDcEH8FZDVyemp9WIfQg8LMsy8 uSYxfNIitL7T4xfPkKF8J0z3E81lc6EDGtv9M/7XWYJM1FrfMibQB3lUv1OK6+Gd z3Q6lpTblh6o6sqN0m2g23uSv3FGhoSdTNMhLeT3Wo5L3SfGFupO35Um5pbX8nHZ ZKmVNu1wmnWvf879NsaRs8W7btP/l/lcaz+aKB0HlJfzjUjyojsgSZu+EYTBXEDF ZOe3YZnodXhnFjyHLAcI09aXeDbtLlx4QHGv36OL8ObWHX9M8UYG9pQUuh5/Ujc= =gJMG -----END PGP SIGNATURE----- Merge tag 'spi-fix-v4.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Pull spi fixes from Mark Brown: "A few driver specific fixes for the Rockchip and i.MX SPI controllers, especially for the i.MX they're annoying bugs if you run into them" * tag 'spi-fix-v4.5-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: imx: fix spi resource leak with dma transfer spi: imx: allow only WML aligned transfers to use DMA spi: rockchip: add missing spi_master_put spi: rockchip: disable runtime pm when in err case
This commit is contained in:
commit
8e0f93cda4
|
@ -204,8 +204,8 @@ static bool spi_imx_can_dma(struct spi_master *master, struct spi_device *spi,
|
|||
{
|
||||
struct spi_imx_data *spi_imx = spi_master_get_devdata(master);
|
||||
|
||||
if (spi_imx->dma_is_inited &&
|
||||
transfer->len > spi_imx->wml * sizeof(u32))
|
||||
if (spi_imx->dma_is_inited && transfer->len >= spi_imx->wml &&
|
||||
(transfer->len % spi_imx->wml) == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -919,8 +919,6 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx,
|
|||
struct dma_async_tx_descriptor *desc_tx = NULL, *desc_rx = NULL;
|
||||
int ret;
|
||||
unsigned long timeout;
|
||||
u32 dma;
|
||||
int left;
|
||||
struct spi_master *master = spi_imx->bitbang.master;
|
||||
struct sg_table *tx = &transfer->tx_sg, *rx = &transfer->rx_sg;
|
||||
|
||||
|
@ -954,13 +952,6 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx,
|
|||
/* Trigger the cspi module. */
|
||||
spi_imx->dma_finished = 0;
|
||||
|
||||
dma = readl(spi_imx->base + MX51_ECSPI_DMA);
|
||||
dma = dma & (~MX51_ECSPI_DMA_RXT_WML_MASK);
|
||||
/* Change RX_DMA_LENGTH trigger dma fetch tail data */
|
||||
left = transfer->len % spi_imx->wml;
|
||||
if (left)
|
||||
writel(dma | (left << MX51_ECSPI_DMA_RXT_WML_OFFSET),
|
||||
spi_imx->base + MX51_ECSPI_DMA);
|
||||
/*
|
||||
* Set these order to avoid potential RX overflow. The overflow may
|
||||
* happen if we enable SPI HW before starting RX DMA due to rescheduling
|
||||
|
@ -992,10 +983,6 @@ static int spi_imx_dma_transfer(struct spi_imx_data *spi_imx,
|
|||
spi_imx->devtype_data->reset(spi_imx);
|
||||
dmaengine_terminate_all(master->dma_rx);
|
||||
}
|
||||
dma &= ~MX51_ECSPI_DMA_RXT_WML_MASK;
|
||||
writel(dma |
|
||||
spi_imx->wml << MX51_ECSPI_DMA_RXT_WML_OFFSET,
|
||||
spi_imx->base + MX51_ECSPI_DMA);
|
||||
}
|
||||
|
||||
spi_imx->dma_finished = 1;
|
||||
|
|
|
@ -749,6 +749,7 @@ static int rockchip_spi_probe(struct platform_device *pdev)
|
|||
return 0;
|
||||
|
||||
err_register_master:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
if (rs->dma_tx.ch)
|
||||
dma_release_channel(rs->dma_tx.ch);
|
||||
if (rs->dma_rx.ch)
|
||||
|
@ -778,6 +779,8 @@ static int rockchip_spi_remove(struct platform_device *pdev)
|
|||
if (rs->dma_rx.ch)
|
||||
dma_release_channel(rs->dma_rx.ch);
|
||||
|
||||
spi_master_put(master);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue