spi: bcm2708: add device tree support

Add DT support to driver and add to .dtsi file.
Setup pins and spidev in .dts file.
SPI is disabled by default.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>

BCM2708: don't register SPI controller when using DT

The device for the SPI controller is in the Device Tree.
Only register the device when not using DT.

Signed-off-by: Noralf Tronnes <notro@tronnes.org>

spi: bcm2835: make driver available on ARCH_BCM2708

Make this driver available on ARCH_BCM2708

Signed-off-by: Noralf Tronnes <notro@tronnes.org>

bcm2708: Remove the prohibition on mixing SPIDEV and DT
This commit is contained in:
notro
2014-07-27 20:12:58 +02:00
committed by popcornmix
parent bb2aae3fd2
commit 0f6f0a0a6b
4 changed files with 22 additions and 5 deletions

View File

@@ -82,5 +82,13 @@
compatible = "simple-bus"; compatible = "simple-bus";
#address-cells = <1>; #address-cells = <1>;
#size-cells = <0>; #size-cells = <0>;
clk_spi: clock@2 {
compatible = "fixed-clock";
reg = <2>;
#clock-cells = <0>;
clock-output-names = "spi";
clock-frequency = <250000000>;
};
}; };
}; };

View File

@@ -836,7 +836,7 @@ void __init bcm2708_init(void)
for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++) for (i = 0; i < ARRAY_SIZE(bcm2708_alsa_devices); i++)
bcm_register_device(&bcm2708_alsa_devices[i]); bcm_register_device(&bcm2708_alsa_devices[i]);
bcm_register_device(&bcm2708_spi_device); bcm_register_device_dt(&bcm2708_spi_device);
bcm_register_device(&bcm2708_bsc0_device); bcm_register_device(&bcm2708_bsc0_device);
bcm_register_device(&bcm2708_bsc1_device); bcm_register_device(&bcm2708_bsc1_device);
@@ -876,6 +876,7 @@ void __init bcm2708_init(void)
system_serial_low = serial; system_serial_low = serial;
#ifdef CONFIG_BCM2708_SPIDEV #ifdef CONFIG_BCM2708_SPIDEV
if (!use_dt)
spi_register_board_info(bcm2708_spi_devices, spi_register_board_info(bcm2708_spi_devices,
ARRAY_SIZE(bcm2708_spi_devices)); ARRAY_SIZE(bcm2708_spi_devices));
#endif #endif

View File

@@ -77,7 +77,7 @@ config SPI_ATMEL
config SPI_BCM2835 config SPI_BCM2835
tristate "BCM2835 SPI controller" tristate "BCM2835 SPI controller"
depends on ARCH_BCM2835 || COMPILE_TEST depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST
help help
This selects a driver for the Broadcom BCM2835 SPI master. This selects a driver for the Broadcom BCM2835 SPI master.
@@ -88,7 +88,7 @@ config SPI_BCM2835
config SPI_BCM2708 config SPI_BCM2708
tristate "BCM2708 SPI controller driver (SPI0)" tristate "BCM2708 SPI controller driver (SPI0)"
depends on MACH_BCM2708 depends on MACH_BCM2708 || MACH_BCM2709
help help
This selects a driver for the Broadcom BCM2708 SPI master (SPI0). This This selects a driver for the Broadcom BCM2708 SPI master (SPI0). This
driver is not compatible with the "Universal SPI Master" or the SPI slave driver is not compatible with the "Universal SPI Master" or the SPI slave

View File

@@ -512,6 +512,7 @@ static int bcm2708_spi_probe(struct platform_device *pdev)
master->setup = bcm2708_spi_setup; master->setup = bcm2708_spi_setup;
master->transfer = bcm2708_spi_transfer; master->transfer = bcm2708_spi_transfer;
master->cleanup = bcm2708_spi_cleanup; master->cleanup = bcm2708_spi_cleanup;
master->dev.of_node = pdev->dev.of_node;
platform_set_drvdata(pdev, master); platform_set_drvdata(pdev, master);
bs = spi_master_get_devdata(master); bs = spi_master_get_devdata(master);
@@ -596,10 +597,17 @@ static int bcm2708_spi_remove(struct platform_device *pdev)
return 0; return 0;
} }
static const struct of_device_id bcm2708_spi_match[] = {
{ .compatible = "brcm,bcm2708-spi", },
{}
};
MODULE_DEVICE_TABLE(of, bcm2708_spi_match);
static struct platform_driver bcm2708_spi_driver = { static struct platform_driver bcm2708_spi_driver = {
.driver = { .driver = {
.name = DRV_NAME, .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = bcm2708_spi_match,
}, },
.probe = bcm2708_spi_probe, .probe = bcm2708_spi_probe,
.remove = bcm2708_spi_remove, .remove = bcm2708_spi_remove,