From: Lukas Wunner <lukas@wunner.de>
To: Mark Brown <broonie@kernel.org>
Cc: "Nicolas Saenz Julienne" <nsaenzjulienne@suse.de>,
Martin Sperl <kernel@martin.sperl.org>,
linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org
Subject: [PATCH 4/5] spi: bcm2835: Tear down DMA before turning off SPI controller
Date: Fri, 15 May 2020 17:58:04 +0200 [thread overview]
Message-ID: <ac79f1e3d6fd9a1f5e0cb4008c43b98ea70be3c2.1589557526.git.lukas@wunner.de> (raw)
In-Reply-To: <cover.1589557526.git.lukas@wunner.de>
On unbind of the BCM2835 SPI driver, the SPI controller is disabled
first and the DMA channels are terminated and torn down afterwards.
This seems backwards: In the theoretical case that DMA is active,
it might try to fill the SPI FIFOs even after the controller has
been disabled.
Reverse the order, thereby mirroring what's done on ->probe().
Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
drivers/spi/spi-bcm2835.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index 06d2782d38ec..20d8581fdf88 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -1380,14 +1380,14 @@ static int bcm2835_spi_remove(struct platform_device *pdev)
spi_unregister_controller(ctlr);
+ bcm2835_dma_release(ctlr, bs);
+
/* Clear FIFOs, and disable the HW block */
bcm2835_wr(bs, BCM2835_SPI_CS,
BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);
clk_disable_unprepare(bs->clk);
- bcm2835_dma_release(ctlr, bs);
-
return 0;
}
--
2.26.2
next prev parent reply other threads:[~2020-05-15 16:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 15:58 [PATCH 0/5] Raspberry Pi SPI unbind fixes Lukas Wunner
2020-05-15 15:58 ` [PATCH 1/5] spi: Fix controller unregister order Lukas Wunner
2020-05-15 16:27 ` Mark Brown
2020-05-15 16:31 ` Lukas Wunner
2020-05-15 21:37 ` Andy Shevchenko
2020-05-16 6:45 ` Lukas Wunner
2020-05-16 9:45 ` Andy Shevchenko
2020-05-15 15:58 ` [PATCH 2/5] spi: bcm2835: " Lukas Wunner
2020-05-15 16:29 ` Mark Brown
2020-05-15 16:44 ` Lukas Wunner
2020-05-15 21:33 ` Andy Shevchenko
2020-05-16 6:56 ` Lukas Wunner
2020-05-16 9:40 ` Andy Shevchenko
2020-05-15 15:58 ` [PATCH 3/5] spi: bcm2835aux: " Lukas Wunner
2020-05-15 15:58 ` Lukas Wunner [this message]
2020-05-15 15:58 ` [PATCH 5/5] spi: Document devm_spi_register_controller() gotcha Lukas Wunner
2020-05-15 16:30 ` Mark Brown
2020-05-20 17:17 ` [PATCH 0/5] Raspberry Pi SPI unbind fixes Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ac79f1e3d6fd9a1f5e0cb4008c43b98ea70be3c2.1589557526.git.lukas@wunner.de \
--to=lukas@wunner.de \
--cc=broonie@kernel.org \
--cc=kernel@martin.sperl.org \
--cc=linux-rpi-kernel@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=nsaenzjulienne@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).