aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ixp4xx/patches-4.9/310-gtwx5717_spi_bus.patch
blob: 51f3f145105d464b6994c08fa39ecb3b64a2f4b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--- 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));
 }