spi: dw: Make DMA request line assignments explicit for Intel Medfield
PATCH 1/2 spi: dw: Make DMA request line assignments explicit for Intel Medfield
The 2afccbd283ae ("spi: dw: Discard static DW DMA slave structures") did a clean up of global variables, which is fine, but messed up with the carefully provided information in the custom DMA slave structures. There reader can find an assignment of the DMA request lines in use.
Partially revert the above mentioned commit to restore readability and maintainability of the code.
--- drivers/spi/spi-dw-mid.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/spi/spi-dw-mid.c +6 -8
@@ -33,10 +33,8 @@ static bool mid_spi_dma_chan_filter(struct dma_chan *chan, void *param)static int mid_spi_dma_init_mfld (struct device *dev,struct dw_spi *dws) { -struct dw_dma_slave slave = { - .src_id =0 , - .dst_id =0 - }; +struct dw_dma_slave tx = { .dst_id =1 }; +struct dw_dma_slave rx = { .src_id =0 };struct pci_dev *dma_dev;dma_cap_mask_t mask;
@@ -52,14 +50,14 @@ static int mid_spi_dma_init_mfld(struct device *dev, struct dw_spi *dws)dma_cap_set (DMA_SLAVE , mask);/* 1. Init rx channel */ - slave.dma_dev = &dma_dev->dev; - dws->rxchan =dma_request_channel (mask, mid_spi_dma_chan_filter, &slave); + rx->dma_dev = &dma_dev->dev; + dws->rxchan =dma_request_channel (mask, mid_spi_dma_chan_filter, rx);if (!dws->rxchan) goto err_exit;/* 2. Init tx channel */ - slave.dst_id =1 ; - dws->txchan =dma_request_channel (mask, mid_spi_dma_chan_filter, &slave); + tx->dma_dev = &dma_dev->dev; + dws->txchan =dma_request_channel (mask, mid_spi_dma_chan_filter, tx);if (!dws->txchan) goto free_rxchan;
Signature · 1 line
2.26.2
PATCH 2/2 spi: dw: Refactor mid_spi_dma_setup() to separate DMA and IRQ config
It's better to understand what bits are set for DMA and for IRQ handling in mid_spi_dma_setup() if they are grouped accordingly. Thus, refactor mid_spi_dma_setup() to separate DMA and IRQ configuration.
--- drivers/spi/spi-dw-mid.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/spi/spi-dw-mid.c +6 -6
@@ -245,17 +245,17 @@ static int mid_spi_dma_setup(struct dw_spi *dws, struct spi_transfer *xfer)dw_writel (dws,DW_SPI_DMARDLR ,0xf );dw_writel (dws,DW_SPI_DMATDLR ,0x10 ); -if (xfer->tx_buf) { +if (xfer->tx_buf) dma_ctrl |=SPI_DMA_TDMAE ; - imr |=SPI_INT_TXOI ; - } -if (xfer->rx_buf) { +if (xfer->rx_buf) dma_ctrl |=SPI_DMA_RDMAE ; - imr |=SPI_INT_RXUI |SPI_INT_RXOI ; - }dw_writel (dws,DW_SPI_DMACR , dma_ctrl);/* Set the interrupt mask */ +if (xfer->tx_buf) + imr |=SPI_INT_TXOI ; +if (xfer->rx_buf) + imr |=SPI_INT_RXUI |SPI_INT_RXOI ;spi_umask_intr (dws, imr); dws->transfer_handler = dma_transfer;
Signature · 1 line
2.26.2
Mark Brown
maintainerQuoted 4 lines · Andy Shevchenko
The
2afccbd283ae("spi: dw: Discard static DW DMA slave structures") did a clean up of global variables, which is fine, but messed up with the carefully provided information in the custom DMA slave structures. There reader can find an assignment of the DMA request lines in use.
This doesn't apply against current code, please rebase and resend.
Mark Brown
maintainerQuoted 7 lines · Andy Shevchenko
The
2afccbd283ae("spi: dw: Discard static DW DMA slave structures") did a clean up of global variables, which is fine, but messed up with the carefully provided information in the custom DMA slave structures. There reader can find an assignment of the DMA request lines in use.Partially revert the above mentioned commit to restore readability and maintainability of the code.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/2] spi: dw: Make DMA request line assignments explicit for Intel Medfield
commit: b3f82dc26c0d4e1348ef81e0189cb8838b8b0d22
[2/2] spi: dw: Refactor mid_spi_dma_setup() to separate DMA and IRQ config
commit: 3d7db0f11c7ad19979a1a01cac1d379ff040e886All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark