summaryrefslogtreecommitdiff
path: root/target/linux/lantiq/patches-3.2/207-devices.patch
blob: 2bc498d1b22e0c89c3d119d8a02fa6b8fe4cbd5c (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
--- a/arch/mips/lantiq/devices.c
+++ b/arch/mips/lantiq/devices.c
@@ -18,6 +18,7 @@
 #include <linux/time.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/bootinfo.h>
 #include <asm/irq.h>
@@ -100,3 +101,20 @@ void __init ltq_register_pci(struct ltq_
 	pr_err("kernel is compiled without PCI support\n");
 }
 #endif
+
+static unsigned int *cp1_base = 0;
+unsigned int*
+ltq_get_cp1_base(void)
+{
+	return cp1_base;
+}
+EXPORT_SYMBOL(ltq_get_cp1_base);
+
+void __init
+ltq_register_tapi(void)
+{
+#define CP1_SIZE       (1 << 20)
+	dma_addr_t dma;
+	cp1_base =
+		(void*)CPHYSADDR(dma_alloc_coherent(NULL, CP1_SIZE, &dma, GFP_ATOMIC));
+}
--- a/arch/mips/lantiq/devices.h
+++ b/arch/mips/lantiq/devices.h
@@ -23,5 +23,6 @@ extern void ltq_register_nor(struct phys
 extern void ltq_register_wdt(void);
 extern void ltq_register_asc(int port);
 extern void ltq_register_pci(struct ltq_pci_data *data);
+extern void ltq_register_tapi(void);
 
 #endif
--- a/arch/mips/lantiq/xway/Makefile
+++ b/arch/mips/lantiq/xway/Makefile
@@ -1,5 +1,8 @@
 obj-y := sysctrl.o reset.o gpio.o gpio_stp.o gpio_ebu.o devices.o dma.o clk.o prom.o nand.o timer.o dev-ifxhcd.o
 
+obj-y += dev-dwc_otg.o
+obj-$(CONFIG_PCI) += dev-wifi-rt2x00.o dev-wifi-athxk.o pci-ath-fixup.o
+
 obj-$(CONFIG_LANTIQ_MACH_EASY50712) += mach-easy50712.o
 obj-$(CONFIG_LANTIQ_MACH_EASY50601) += mach-easy50601.o
 obj-$(CONFIG_LANTIQ_MACH_ARV) += mach-arv.o
--- a/arch/mips/lantiq/xway/devices.c
+++ b/arch/mips/lantiq/xway/devices.c
@@ -19,6 +19,7 @@
 #include <linux/time.h>
 #include <linux/io.h>
 #include <linux/gpio.h>
+#include <linux/spi/spi.h>
 
 #include <asm/bootinfo.h>
 #include <asm/irq.h>
@@ -119,3 +120,84 @@ ltq_register_vrx200(struct ltq_eth_data
 	ltq_vrx200.dev.platform_data = eth;
 	platform_device_register(&ltq_vrx200);
 }
+
+/* ebu */
+static struct resource ltq_ebu_resource =
+{
+	.name   = "gpio_ebu",
+	.start  = LTQ_EBU_GPIO_START,
+	.end    = LTQ_EBU_GPIO_START + LTQ_EBU_GPIO_SIZE - 1,
+	.flags  = IORESOURCE_MEM,
+};
+
+static struct platform_device ltq_ebu =
+{
+	.name           = "ltq_ebu",
+	.resource       = &ltq_ebu_resource,
+	.num_resources  = 1,
+};
+
+void __init
+ltq_register_gpio_ebu(unsigned int value)
+{
+	ltq_ebu.dev.platform_data = (void*) value;
+	platform_device_register(&ltq_ebu);
+}
+
+/* gpio buttons */
+static struct gpio_buttons_platform_data ltq_gpio_buttons_platform_data;
+
+static struct platform_device ltq_gpio_buttons_platform_device =
+{
+	.name = "gpio-buttons",
+	.id = 0,
+	.dev = {
+		.platform_data = (void *) &ltq_gpio_buttons_platform_data,
+	},
+};
+
+void __init
+ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt)
+{
+	ltq_gpio_buttons_platform_data.buttons = buttons;
+	ltq_gpio_buttons_platform_data.nbuttons = cnt;
+	platform_device_register(&ltq_gpio_buttons_platform_device);
+}
+
+static struct resource ltq_spi_resources[] = {
+	{
+		.start  = LTQ_SSC_BASE_ADDR,
+		.end    = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1,
+		.flags  = IORESOURCE_MEM,
+	},
+	IRQ_RES(spi_tx, LTQ_SSC_TIR),
+	IRQ_RES(spi_rx, LTQ_SSC_RIR),
+	IRQ_RES(spi_err, LTQ_SSC_EIR),
+};
+
+static struct resource ltq_spi_resources_ar9[] = {
+	{
+		.start  = LTQ_SSC_BASE_ADDR,
+		.end    = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1,
+		.flags  = IORESOURCE_MEM,
+	},
+	IRQ_RES(spi_tx, LTQ_SSC_TIR_AR9),
+	IRQ_RES(spi_rx, LTQ_SSC_RIR_AR9),
+	IRQ_RES(spi_err, LTQ_SSC_EIR),
+};
+
+static struct platform_device ltq_spi = {
+	.name		= "ltq-spi",
+	.resource	= ltq_spi_resources,
+	.num_resources	= ARRAY_SIZE(ltq_spi_resources),
+};
+
+void __init ltq_register_spi(struct ltq_spi_platform_data *pdata,
+		struct spi_board_info const *info, unsigned n)
+{
+	if(ltq_is_ar9())
+		ltq_spi.resource = ltq_spi_resources_ar9;
+	spi_register_board_info(info, n);
+	ltq_spi.dev.platform_data = pdata;
+	platform_device_register(&ltq_spi);
+}
--- a/arch/mips/lantiq/xway/devices.h
+++ b/arch/mips/lantiq/xway/devices.h
@@ -11,6 +11,8 @@
 
 #include "../devices.h"
 #include <linux/phy.h>
+#include <linux/spi/spi.h>
+#include <linux/gpio_buttons.h>
 
 extern void ltq_register_gpio(void);
 extern void ltq_register_gpio_stp(void);
@@ -18,5 +20,9 @@ extern void ltq_register_ase_asc(void);
 extern void ltq_register_etop(struct ltq_eth_data *eth);
 extern void xway_register_nand(struct mtd_partition *parts, int count);
 extern void ltq_register_vrx200(struct ltq_eth_data *eth);
+extern void ltq_register_gpio_ebu(unsigned int value);
+extern void ltq_register_spi(struct ltq_spi_platform_data *pdata,
+	struct spi_board_info const *info, unsigned n);
+extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt);
 
 #endif
--- a/arch/mips/lantiq/Makefile
+++ b/arch/mips/lantiq/Makefile
@@ -4,7 +4,7 @@
 # under the terms of the GNU General Public License version 2 as published
 # by the Free Software Foundation.
 
-obj-y := irq.o setup.o clk.o prom.o devices.o
+obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-leds.o dev-gpio-buttons.o
 
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o