Skip to contentSkip to conversation

spi: bcm2835: Implement shutdown callback

PATCH In review Florian Fainelli 3 participants 6 messages May 28, 2020 – May 29, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: bcm2835: Implement shutdown callback

Make sure we clear the FIFOs, stop the block, disable the clock and release the DMA channel.

---
 drivers/spi/spi-bcm2835.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/spi/spi-bcm2835.c +10 -0
index 20d8581fdf88..237bd306c268 100644
@@ -1391,6 +1391,15 @@ static int bcm2835_spi_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static void bcm2835_spi_shutdown(struct platform_device *pdev)
+{
+	int ret;
+
+	ret = bcm2835_spi_remove(pdev);
+	if (ret)
+		dev_err(&pdev->dev, "failed to shutdown\n");
+}
+
 static const struct of_device_id bcm2835_spi_match[] = {
 	{ .compatible = "brcm,bcm2835-spi", },
 	{}
@@ -1404,6 +1413,7 @@ static struct platform_driver bcm2835_spi_driver = {
 	},
 	.probe		= bcm2835_spi_probe,
 	.remove		= bcm2835_spi_remove,
+	.shutdown	= bcm2835_spi_shutdown,
 };
 module_platform_driver(bcm2835_spi_driver);
 
Signature · 7 lines
2.17.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer
#1 lore raw
Quoted 2 lines · Florian Fainelli

Make sure we clear the FIFOs, stop the block, disable the clock and release the DMA channel.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: bcm2835: Implement shutdown callback

      commit: 118eb0e52eb74b899053a0f46dfe7e178788d23b

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

#2 lore raw
In reply to Florian Fainelli
Quoted 2 lines · Florian Fainelli

Make sure we clear the FIFOs, stop the block, disable the clock and release the DMA channel.

To what end? Why is this change necessary? Sorry but this seems like an awfully terse commit message.

Thanks,

Lukas

Quoted 37 lines
---
 drivers/spi/spi-bcm2835.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/spi/spi-bcm2835.c +10 -0
index 20d8581fdf88..237bd306c268 100644
@@ -1391,6 +1391,15 @@ static int bcm2835_spi_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static void bcm2835_spi_shutdown(struct platform_device *pdev)
+{
+	int ret;
+
+	ret = bcm2835_spi_remove(pdev);
+	if (ret)
+		dev_err(&pdev->dev, "failed to shutdown\n");
+}
+
 static const struct of_device_id bcm2835_spi_match[] = {
 	{ .compatible = "brcm,bcm2835-spi", },
 	{}
@@ -1404,6 +1413,7 @@ static struct platform_driver bcm2835_spi_driver = {
 	},
 	.probe		= bcm2835_spi_probe,
 	.remove		= bcm2835_spi_remove,
+	.shutdown	= bcm2835_spi_shutdown,
 };
 module_platform_driver(bcm2835_spi_driver);
 
Signature · 1 line
2.17.1
#3 lore raw
Quoted 6 lines · Lukas Wunner
Quoted 2 lines · Florian Fainelli

Make sure we clear the FIFOs, stop the block, disable the clock and release the DMA channel.

To what end? Why is this change necessary? Sorry but this seems like an awfully terse commit message.

To ensure clocks are disabled and to save power in low power modes used on 7211 for instance.

Signature · 1 line
Florian
#4 lore raw
Quoted 10 lines · Florian Fainelli
Quoted 6 lines · Lukas Wunner
Quoted 2 lines · Florian Fainelli

Make sure we clear the FIFOs, stop the block, disable the clock and release the DMA channel.

To what end? Why is this change necessary? Sorry but this seems like an awfully terse commit message.

To ensure clocks are disabled and to save power in low power modes used on 7211 for instance.

Thanks for the explanation, that's an important tidbit. I wasn't even aware that this SPI controller is used on SoCs beyond the Raspberry Pi ones. Does the BCM7211 use shared interrupts for this controller? Does it have DMA DREQ attached?

#5 lore raw
Quoted 9 lines · Lukas Wunner
Quoted 8 lines · Florian Fainelli
Quoted 6 lines · Lukas Wunner
Quoted 2 lines · Florian Fainelli

Make sure we clear the FIFOs, stop the block, disable the clock and release the DMA channel.

To what end? Why is this change necessary? Sorry but this seems like an awfully terse commit message.

Quoted 7 lines
Quoted 2 lines

To ensure clocks are disabled and to save power in low power modes used on 7211 for instance.

Thanks for the explanation, that's an important tidbit. I wasn't even aware that this SPI controller is used on SoCs beyond the Raspberry Pi ones. Does the BCM7211 use shared interrupts for this controller? Does it have DMA DREQ attached?

For all practical purposes you can consider that 7211 is identical to a 2711, it does use shared interrupts for this controller and there is a DRAM DREQ attached as well. Where they differ are on the display, video, and memory controller MAC.

Signature · 1 line
Florian