openwrtv3/target/linux/ixp4xx/patches-4.9/310-gtwx5717_spi_bus.patch

58 lines
1.8 KiB
Diff
Raw Normal View History

--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -27,6 +27,8 @@
#include <linux/serial.h>
#include <linux/tty.h>
#include <linux/serial_8250.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/spi_gpio.h>
#include <asm/types.h>
#include <asm/setup.h>
#include <asm/memory.h>
@@ -146,9 +148,37 @@ static struct platform_device gtwx5715_f
.resource = &gtwx5715_flash_resource,
};
+static struct spi_gpio_platform_data gtwx5715_spi_platform_data = {
+ .sck = GTWX5715_KSSPI_CLOCK,
+ .mosi = GTWX5715_KSSPI_TXD,
+ .miso = GTWX5715_KSSPI_RXD,
+ .num_chipselect = 1,
+};
+
+static struct platform_device gtwx5715_spi_device = {
+ .name = "spi_gpio",
+ .id = 1,
+ .dev = {
+ .platform_data = &gtwx5715_spi_platform_data,
+ }
+};
+
+static struct spi_board_info gtwx5715_spi_devices[] __initdata = {
+ {
+ .modalias = "spi-ks8995",
+ .max_speed_hz = 5000000,
+ .mode = SPI_MODE_0,
+ .bus_num = 1,
+ .chip_select = 0,
+ .controller_data = (void *)GTWX5715_KSSPI_SELECT,
+ }
+};
+
+
static struct platform_device *gtwx5715_devices[] __initdata = {
&gtwx5715_uart_device,
&gtwx5715_flash,
+ &gtwx5715_spi_device,
};
static void __init gtwx5715_init(void)
@@ -158,6 +188,7 @@ static void __init gtwx5715_init(void)
gtwx5715_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
gtwx5715_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1;
+ spi_register_board_info(gtwx5715_spi_devices, ARRAY_SIZE(gtwx5715_spi_devices));
platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices));
}