summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornotro <notro@tronnes.org>2014-07-27 20:12:58 +0200
committerpopcornmix <popcornmix@gmail.com>2015-05-18 14:11:10 +0100
commit73da1a3c934193a315915a376dee3b76de984d3f (patch)
tree3045525975a2f1a2842262b4e98ec4c40bb46f41
parenta54d4c766a1ae6d104cf7f3937c7beb2a04c533e (diff)
downloadlinux-73da1a3c934193a315915a376dee3b76de984d3f.tar.gz
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
-rw-r--r--arch/arm/boot/dts/bcm2708.dtsi8
-rw-r--r--arch/arm/mach-bcm2708/bcm2708.c7
-rw-r--r--drivers/spi/Kconfig4
-rw-r--r--drivers/spi/spi-bcm2708.c8
4 files changed, 22 insertions, 5 deletions
diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi
index 96b7311a797b..93f009a5e89b 100644
--- a/arch/arm/boot/dts/bcm2708.dtsi
+++ b/arch/arm/boot/dts/bcm2708.dtsi
@@ -82,5 +82,13 @@
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <0>;
+
+ clk_spi: clock@2 {
+ compatible = "fixed-clock";
+ reg = <2>;
+ #clock-cells = <0>;
+ clock-output-names = "spi";
+ clock-frequency = <250000000>;
+ };
};
};
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index a207ad851d2a..e366bb49eefb 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -836,7 +836,7 @@ void __init bcm2708_init(void)
for (i = 0; i < ARRAY_SIZE(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_bsc1_device);
@@ -876,8 +876,9 @@ void __init bcm2708_init(void)
system_serial_low = serial;
#ifdef CONFIG_BCM2708_SPIDEV
- spi_register_board_info(bcm2708_spi_devices,
- ARRAY_SIZE(bcm2708_spi_devices));
+ if (!use_dt)
+ spi_register_board_info(bcm2708_spi_devices,
+ ARRAY_SIZE(bcm2708_spi_devices));
#endif
}
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 9628e75de77f..113bf643fc3e 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -77,7 +77,7 @@ config SPI_ATMEL
config SPI_BCM2835
tristate "BCM2835 SPI controller"
- depends on ARCH_BCM2835 || COMPILE_TEST
+ depends on ARCH_BCM2835 || ARCH_BCM2708 || ARCH_BCM2709 || COMPILE_TEST
help
This selects a driver for the Broadcom BCM2835 SPI master.
@@ -88,7 +88,7 @@ config SPI_BCM2835
config SPI_BCM2708
tristate "BCM2708 SPI controller driver (SPI0)"
- depends on MACH_BCM2708
+ depends on MACH_BCM2708 || MACH_BCM2709
help
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
diff --git a/drivers/spi/spi-bcm2708.c b/drivers/spi/spi-bcm2708.c
index 349d21fe3fe3..041b5e29ca5d 100644
--- a/drivers/spi/spi-bcm2708.c
+++ b/drivers/spi/spi-bcm2708.c
@@ -512,6 +512,7 @@ static int bcm2708_spi_probe(struct platform_device *pdev)
master->setup = bcm2708_spi_setup;
master->transfer = bcm2708_spi_transfer;
master->cleanup = bcm2708_spi_cleanup;
+ master->dev.of_node = pdev->dev.of_node;
platform_set_drvdata(pdev, master);
bs = spi_master_get_devdata(master);
@@ -596,10 +597,17 @@ static int bcm2708_spi_remove(struct platform_device *pdev)
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 = {
.driver = {
.name = DRV_NAME,
.owner = THIS_MODULE,
+ .of_match_table = bcm2708_spi_match,
},
.probe = bcm2708_spi_probe,
.remove = bcm2708_spi_remove,