Skip to content

Commit 32cdb92

Browse files
author
msperl
committed
Make the upstream spi-bcm2835.c driver work also on the raspbian kernel.
Also added option to configure real-time behaviour of the SPI workqueue - RT is enabled by default for low latency. Signed-off-by: Martin Sperl <[email protected]>
1 parent 6a51f6a commit 32cdb92

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

drivers/spi/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ config SPI_ATMEL
7777

7878
config SPI_BCM2835
7979
tristate "BCM2835 SPI controller"
80-
depends on ARCH_BCM2835
80+
depends on (ARCH_BCM2835 || ARCH_BCM2708)
8181
help
8282
This selects a driver for the Broadcom BCM2835 SPI master.
8383

drivers/spi/spi-bcm2835.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@
7575

7676
#define DRV_NAME "spi-bcm2835"
7777

78+
static bool realtime=1;
79+
module_param(realtime, bool, 0);
80+
MODULE_PARM_DESC(realtime, "Run the driver with realtime priority");
81+
7882
struct bcm2835_spi {
7983
void __iomem *regs;
8084
struct clk *clk;
@@ -315,10 +319,15 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
315319

316320
master->mode_bits = BCM2835_SPI_MODE_BITS;
317321
master->bits_per_word_mask = BIT(8 - 1);
322+
#ifdef CONFIG_MACH_BCM2708
323+
master->bus_num = pdev->id;
324+
#else
318325
master->bus_num = -1;
326+
#endif
319327
master->num_chipselect = 3;
320328
master->transfer_one_message = bcm2835_spi_transfer_one;
321329
master->dev.of_node = pdev->dev.of_node;
330+
master->rt = realtime;
322331

323332
bs = spi_master_get_devdata(master);
324333

@@ -345,7 +354,13 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
345354
goto out_master_put;
346355
}
347356

348-
bs->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
357+
#ifdef CONFIG_MACH_BCM2708
358+
if (!(bs->irq=platform_get_irq(pdev, 0))) {
359+
#endif
360+
bs->irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
361+
#ifdef CONFIG_MACH_BCM2708
362+
}
363+
#endif
349364
if (bs->irq <= 0) {
350365
dev_err(&pdev->dev, "could not get IRQ: %d\n", bs->irq);
351366
err = bs->irq ? bs->irq : -ENODEV;
@@ -406,6 +421,15 @@ static const struct of_device_id bcm2835_spi_match[] = {
406421
};
407422
MODULE_DEVICE_TABLE(of, bcm2835_spi_match);
408423

424+
/* and "normal" aliases */
425+
#ifdef CONFIG_MACH_BCM2708
426+
static const struct platform_device_id bcm2835_id_table[] = {
427+
{ "bcm2835_spi", 2835 },
428+
{ "bcm2708_spi", 2708 },
429+
{ },
430+
};
431+
#endif
432+
409433
static struct platform_driver bcm2835_spi_driver = {
410434
.driver = {
411435
.name = DRV_NAME,
@@ -414,6 +438,9 @@ static struct platform_driver bcm2835_spi_driver = {
414438
},
415439
.probe = bcm2835_spi_probe,
416440
.remove = bcm2835_spi_remove,
441+
#ifdef CONFIG_MACH_BCM2708
442+
.id_table = bcm2835_id_table,
443+
#endif
417444
};
418445
module_platform_driver(bcm2835_spi_driver);
419446

0 commit comments

Comments
 (0)