@@ -25,6 +25,7 @@
#include <linux/mtd/partitions.h>
#include <linux/input.h>
#include <linux/input/matrix_keypad.h>
+#include <linux/spi/spi.h>
#include <asm/mach/arch.h>
#include <asm/mach-types.h>
@@ -38,6 +39,7 @@
#define EVM_MMC_WP_GPIO 21
#define EVM_MMC_CD_GPIO 24
+#define EVM_SPI_CS_GPIO 54
static int initialize_gpio(int gpio, char *desc)
{
@@ -215,6 +217,52 @@ static struct tnetv107x_device_info evm_device_info __initconst = {
.ssp_config = &ssp_config,
};
+static void spi_select_device(int cs)
+{
+ static int gpio;
+
+ if (!gpio) {
+ int ret;
+ ret = gpio_request(EVM_SPI_CS_GPIO, "spi chipsel");
+ if (ret < 0) {
+ pr_err("cannot open spi chipsel gpio\n");
+ gpio = -ENOSYS;
+ return;
+ } else {
+ gpio = EVM_SPI_CS_GPIO;
+ gpio_direction_output(gpio, 0);
+ }
+ }
+
+ if (gpio < 0)
+ return;
+
+ return gpio_set_value(gpio, cs ? 1 : 0);
+}
+
+static struct ti_ssp_spi_data spi_master_data = {
+ .port_data = {
+ .ssp_dev_name = "ti-ssp",
+ .port = 1,
+ .iosel = SSP_PIN_SEL(0, SSP_CLOCK) |
+ SSP_PIN_SEL(1, SSP_DATA) |
+ SSP_PIN_SEL(2, SSP_CHIPSEL) |
+ SSP_PIN_SEL(3, SSP_IN) |
+ SSP_INPUT_SEL(3),
+ },
+ .num_cs = 2,
+ .select = spi_select_device,
+};
+
+static struct platform_device spi_master_device = {
+ .name = "ti-ssp-spi",
+ .id = 0,
+ .dev.platform_data = &spi_master_data,
+};
+
+static struct spi_board_info spi_info[] __initconst = {
+};
+
static __init void tnetv107x_evm_board_init(void)
{
davinci_cfg_reg_list(sdio1_pins);
@@ -222,6 +270,9 @@ static __init void tnetv107x_evm_board_init(void)
davinci_cfg_reg_list(ssp_pins);
tnetv107x_devices_init(&evm_device_info);
+
+ platform_device_register(&spi_master_device);
+ spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
}
#ifdef CONFIG_SERIAL_8250_CONSOLE