Skip to content

Commit

Permalink
bcm2708: Add support for MAX7301 over SPI
Browse files Browse the repository at this point in the history
Signed-off-by: Franz Pletz <fpletz@fnordicwalking.de>
  • Loading branch information
fpletz committed Sep 7, 2013
1 parent d747469 commit 655678d
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 8 deletions.
34 changes: 29 additions & 5 deletions arch/arm/mach-bcm2708/Kconfig
Expand Up @@ -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
27 changes: 24 additions & 3 deletions arch/arm/mach-bcm2708/bcm2708.c
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 655678d

Please sign in to comment.