linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] spi: dw: Make DMA request line assignments explicit for Intel Medfield
@ 2020-05-28 10:23 Andy Shevchenko
  2020-05-28 10:23 ` [PATCH v1 2/2] spi: dw: Refactor mid_spi_dma_setup() to separate DMA and IRQ config Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andy Shevchenko @ 2020-05-28 10:23 UTC (permalink / raw)
  To: Mark Brown, linux-spi; +Cc: 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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-dw-mid.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c
index b1710132b7b2..0fd7543dc91a 100644
--- a/drivers/spi/spi-dw-mid.c
+++ b/drivers/spi/spi-dw-mid.c
@@ -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;
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v1 2/2] spi: dw: Refactor mid_spi_dma_setup() to separate DMA and IRQ config
  2020-05-28 10:23 [PATCH v1 1/2] spi: dw: Make DMA request line assignments explicit for Intel Medfield Andy Shevchenko
@ 2020-05-28 10:23 ` Andy Shevchenko
  2020-05-29 17:22 ` [PATCH v1 1/2] spi: dw: Make DMA request line assignments explicit for Intel Medfield Mark Brown
  2020-05-29 21:06 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2020-05-28 10:23 UTC (permalink / raw)
  To: Mark Brown, linux-spi; +Cc: Andy Shevchenko

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.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/spi/spi-dw-mid.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c
index 0fd7543dc91a..20c07f7760ef 100644
--- a/drivers/spi/spi-dw-mid.c
+++ b/drivers/spi/spi-dw-mid.c
@@ -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;
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/2] spi: dw: Make DMA request line assignments explicit for Intel Medfield
  2020-05-28 10:23 [PATCH v1 1/2] spi: dw: Make DMA request line assignments explicit for Intel Medfield Andy Shevchenko
  2020-05-28 10:23 ` [PATCH v1 2/2] spi: dw: Refactor mid_spi_dma_setup() to separate DMA and IRQ config Andy Shevchenko
@ 2020-05-29 17:22 ` Mark Brown
  2020-05-29 21:06 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-05-29 17:22 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-spi

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

On Thu, May 28, 2020 at 01:23:10PM +0300, Andy Shevchenko wrote:
> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/2] spi: dw: Make DMA request line assignments explicit for Intel Medfield
  2020-05-28 10:23 [PATCH v1 1/2] spi: dw: Make DMA request line assignments explicit for Intel Medfield Andy Shevchenko
  2020-05-28 10:23 ` [PATCH v1 2/2] spi: dw: Refactor mid_spi_dma_setup() to separate DMA and IRQ config Andy Shevchenko
  2020-05-29 17:22 ` [PATCH v1 1/2] spi: dw: Make DMA request line assignments explicit for Intel Medfield Mark Brown
@ 2020-05-29 21:06 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-05-29 21:06 UTC (permalink / raw)
  To: linux-spi, Andy Shevchenko

On Thu, 28 May 2020 13:23:10 +0300, Andy Shevchenko wrote:
> 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: 3d7db0f11c7ad19979a1a01cac1d379ff040e886

All 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-29 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-28 10:23 [PATCH v1 1/2] spi: dw: Make DMA request line assignments explicit for Intel Medfield Andy Shevchenko
2020-05-28 10:23 ` [PATCH v1 2/2] spi: dw: Refactor mid_spi_dma_setup() to separate DMA and IRQ config Andy Shevchenko
2020-05-29 17:22 ` [PATCH v1 1/2] spi: dw: Make DMA request line assignments explicit for Intel Medfield Mark Brown
2020-05-29 21:06 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).