Permalink
Browse files

bcm2708: Add support for MAX7301 over SPI

Signed-off-by: Franz Pletz <fpletz@fnordicwalking.de>
  • Loading branch information...
1 parent d747469 commit 655678d08e177502f539ed376365edea0b4e84d8 @fpletz fpletz committed Sep 7, 2013
Showing with 53 additions and 8 deletions.
  1. +29 −5 arch/arm/mach-bcm2708/Kconfig
  2. +24 −3 arch/arm/mach-bcm2708/bcm2708.c
@@ -38,11 +38,35 @@ config BCM2708_DMAER
help
Enable DMA helper for accelerating X composition
-config BCM2708_SPIDEV
- bool "Bind spidev to SPI0 master"
+config BCM2708_SPI
+ bool "Bind a driver to SPI0 master"
depends on MACH_BCM2708
depends on SPI
- default y
- help
- Binds spidev driver to the SPI0 master
+ default y
+ help
+ Let's you select which driver to bind to SPI0 master
+
+choice
+ prompt "Bind driver to SPI0 master"
+ depends on BCM2708_SPI
+ default BCM2708_SPI_NONE
+ default BCM2708_SPI_SPIDEV if SPI_SPIDEV
+ default BCM2708_SPI_MAX7301 if GPIO_MAX7301
+
+config BCM2708_SPI_NONE
+ bool "None"
+
+config BCM2708_SPI_MAX7301
+ bool "Bind MAX7301 to SPI0 master"
+ depends on GPIO_MAX7301
+ help
+ Binds gpio-max7301 driver to the SPI0 master
+
+config BCM2708_SPIDEV
+ bool "Bind spidev to SPI0 master"
+ depends on SPI_SPIDEV
+ help
+ Binds spidev driver to the SPI0 master
+endchoice
+
endmenu
@@ -60,6 +60,10 @@
#include "armctrl.h"
#include "clock.h"
+#ifdef CONFIG_BCM2708_SPI_MAX7301
+#include <linux/spi/max7301.h>
+#endif
+
#ifdef CONFIG_BCM_VC_CMA
#include <linux/broadcom/vc_cma.h>
#endif
@@ -546,9 +550,16 @@ static struct platform_device bcm2708_spi_device = {
.resource = bcm2708_spi_resources,
};
-#ifdef CONFIG_BCM2708_SPIDEV
+#ifdef CONFIG_BCM2708_SPI_MAX7301
+static struct max7301_platform_data max7301_pdata = {
+ .base = -1,
+ .input_pullup_active = 0x0,
+};
+#endif
+
+#ifdef CONFIG_BCM2708_SPI
static struct spi_board_info bcm2708_spi_devices[] = {
-#ifdef CONFIG_SPI_SPIDEV
+#ifdef CONFIG_BCM2708_SPI_SPIDEV
{
.modalias = "spidev",
.max_speed_hz = 500000,
@@ -563,6 +574,16 @@ static struct spi_board_info bcm2708_spi_devices[] = {
.mode = SPI_MODE_0,
}
#endif
+#ifdef CONFIG_BCM2708_SPI_MAX7301
+ {
+ .modalias = "max7301",
+ .max_speed_hz = 26000,
+ .bus_num = 0,
+ .chip_select = 0,
+ .mode = SPI_MODE_0,
+ .platform_data = &max7301_pdata,
+ }
+#endif
};
#endif
@@ -746,7 +767,7 @@ void __init bcm2708_init(void)
system_rev = boardrev;
system_serial_low = serial;
-#ifdef CONFIG_BCM2708_SPIDEV
+#ifdef CONFIG_BCM2708_SPI
spi_register_board_info(bcm2708_spi_devices,
ARRAY_SIZE(bcm2708_spi_devices));
#endif

0 comments on commit 655678d

Please sign in to comment.