[PATCH 2/2] spi: bcm2835: Allow platform to set realtime priority

Lukas Wunner lukas at wunner.de
Thu Mar 23 03:36:45 PDT 2017


Revolution Pi (a set of IoT products based on the Raspberry Pi and
geared towards industrial usage) uses the bcm2835's SPI master to
interface with an IEC 61158 fieldbus, which requires its kworker thread
to run at a realtime priority.  To this end, allow the platform to
specify the desired priority.

Cc: Mark Brown <broonie at kernel.org>
Cc: Stephen Warren <swarren at wwwdotorg.org>
Cc: Eric Anholt <eric at anholt.net>
Cc: Mathias Duckeck <m.duckeck at kunbus.de>
Signed-off-by: Lukas Wunner <lukas at wunner.de>
---
 Documentation/devicetree/bindings/spi/brcm,bcm2835-spi.txt | 4 ++++
 drivers/spi/spi-bcm2835.c                                  | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/spi/brcm,bcm2835-spi.txt b/Documentation/devicetree/bindings/spi/brcm,bcm2835-spi.txt
index f11f295c8450..13ffc2b15e7d 100644
--- a/Documentation/devicetree/bindings/spi/brcm,bcm2835-spi.txt
+++ b/Documentation/devicetree/bindings/spi/brcm,bcm2835-spi.txt
@@ -10,6 +10,10 @@ Required properties:
 - interrupts: Should contain interrupt.
 - clocks: The clock feeding the SPI controller.
 
+Optional properties:
+- bcm2835,rt_prio: Realtime priority of the message pump to minimize latency
+                   on the bus (0..99).
+
 Example:
 
 spi at 20204000 {
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index f35cc10772f6..319523686f73 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -755,6 +755,8 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
 	master->handle_err = bcm2835_spi_handle_err;
 	master->prepare_message = bcm2835_spi_prepare_message;
 	master->dev.of_node = pdev->dev.of_node;
+	of_property_read_u32(pdev->dev.of_node,
+			     "bcm2835,rt_prio", &master->rt_prio);
 
 	bs = spi_master_get_devdata(master);
 
-- 
2.11.0




More information about the linux-rpi-kernel mailing list