lantiq: fix falcon build breakage
[openwrt/svn-archive/archive.git] / target / linux / lantiq / patches / 211-devices.patch
1 Index: linux-3.1.1/arch/mips/lantiq/devices.c
2 ===================================================================
3 --- linux-3.1.1.orig/arch/mips/lantiq/devices.c 2011-11-14 20:22:33.588135463 +0100
4 +++ linux-3.1.1/arch/mips/lantiq/devices.c 2011-11-14 20:22:34.328135495 +0100
5 @@ -18,6 +18,7 @@
6 #include <linux/time.h>
7 #include <linux/io.h>
8 #include <linux/gpio.h>
9 +#include <linux/dma-mapping.h>
10
11 #include <asm/bootinfo.h>
12 #include <asm/irq.h>
13 @@ -100,3 +101,20 @@
14 pr_err("kernel is compiled without PCI support\n");
15 }
16 #endif
17 +
18 +static unsigned int *cp1_base = 0;
19 +unsigned int*
20 +ltq_get_cp1_base(void)
21 +{
22 + return cp1_base;
23 +}
24 +EXPORT_SYMBOL(ltq_get_cp1_base);
25 +
26 +void __init
27 +ltq_register_tapi(void)
28 +{
29 +#define CP1_SIZE (1 << 20)
30 + dma_addr_t dma;
31 + cp1_base =
32 + (void*)CPHYSADDR(dma_alloc_coherent(NULL, CP1_SIZE, &dma, GFP_ATOMIC));
33 +}
34 Index: linux-3.1.1/arch/mips/lantiq/devices.h
35 ===================================================================
36 --- linux-3.1.1.orig/arch/mips/lantiq/devices.h 2011-11-14 20:22:33.588135463 +0100
37 +++ linux-3.1.1/arch/mips/lantiq/devices.h 2011-11-14 20:22:34.328135495 +0100
38 @@ -23,5 +23,6 @@
39 extern void ltq_register_wdt(void);
40 extern void ltq_register_asc(int port);
41 extern void ltq_register_pci(struct ltq_pci_data *data);
42 +extern void ltq_register_tapi(void);
43
44 #endif
45 Index: linux-3.1.1/arch/mips/lantiq/xway/Makefile
46 ===================================================================
47 --- linux-3.1.1.orig/arch/mips/lantiq/xway/Makefile 2011-11-14 20:22:34.304135491 +0100
48 +++ linux-3.1.1/arch/mips/lantiq/xway/Makefile 2011-11-14 20:39:51.404179655 +0100
49 @@ -1,5 +1,7 @@
50 obj-y := sysctrl.o reset.o gpio.o gpio_stp.o gpio_ebu.o devices.o dma.o nand.o timer.o
51
52 +obj-y += dev-dwc_otg.o dev-wifi-rt2x00.o
53 +
54 obj-$(CONFIG_SOC_XWAY) += clk-xway.o prom-xway.o
55 obj-$(CONFIG_SOC_AMAZON_SE) += clk-ase.o prom-ase.o
56 obj-$(CONFIG_SOC_VR9) += clk-vr9.o prom-vr9.o
57 Index: linux-3.1.1/arch/mips/lantiq/xway/devices.c
58 ===================================================================
59 --- linux-3.1.1.orig/arch/mips/lantiq/xway/devices.c 2011-11-14 20:22:34.092135483 +0100
60 +++ linux-3.1.1/arch/mips/lantiq/xway/devices.c 2011-11-14 20:22:34.328135495 +0100
61 @@ -19,6 +19,7 @@
62 #include <linux/time.h>
63 #include <linux/io.h>
64 #include <linux/gpio.h>
65 +#include <linux/spi/spi.h>
66
67 #include <asm/bootinfo.h>
68 #include <asm/irq.h>
69 @@ -99,3 +100,98 @@
70 platform_device_register(&ltq_etop);
71 }
72 }
73 +
74 +/* madwifi */
75 +int lantiq_emulate_madwifi_eep = 0;
76 +EXPORT_SYMBOL(lantiq_emulate_madwifi_eep);
77 +
78 +int lantiq_madwifi_eep_addr = 0;
79 +EXPORT_SYMBOL(lantiq_madwifi_eep_addr);
80 +
81 +void __init
82 +ltq_register_madwifi_eep(unsigned long long addr)
83 +{
84 + lantiq_madwifi_eep_addr = addr;
85 + lantiq_emulate_madwifi_eep = 1;
86 +}
87 +
88 +/* ebu */
89 +static struct resource ltq_ebu_resource =
90 +{
91 + .name = "gpio_ebu",
92 + .start = LTQ_EBU_GPIO_START,
93 + .end = LTQ_EBU_GPIO_START + LTQ_EBU_GPIO_SIZE - 1,
94 + .flags = IORESOURCE_MEM,
95 +};
96 +
97 +static struct platform_device ltq_ebu =
98 +{
99 + .name = "ltq_ebu",
100 + .resource = &ltq_ebu_resource,
101 + .num_resources = 1,
102 +};
103 +
104 +void __init
105 +ltq_register_gpio_ebu(unsigned int value)
106 +{
107 + ltq_ebu.dev.platform_data = (void*) value;
108 + platform_device_register(&ltq_ebu);
109 +}
110 +
111 +/* gpio buttons */
112 +static struct gpio_buttons_platform_data ltq_gpio_buttons_platform_data;
113 +
114 +static struct platform_device ltq_gpio_buttons_platform_device =
115 +{
116 + .name = "gpio-buttons",
117 + .id = 0,
118 + .dev = {
119 + .platform_data = (void *) &ltq_gpio_buttons_platform_data,
120 + },
121 +};
122 +
123 +void __init
124 +ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt)
125 +{
126 + ltq_gpio_buttons_platform_data.buttons = buttons;
127 + ltq_gpio_buttons_platform_data.nbuttons = cnt;
128 + platform_device_register(&ltq_gpio_buttons_platform_device);
129 +}
130 +
131 +static struct resource ltq_spi_resources[] = {
132 + {
133 + .start = LTQ_SSC_BASE_ADDR,
134 + .end = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1,
135 + .flags = IORESOURCE_MEM,
136 + },
137 + IRQ_RES(spi_tx, LTQ_SSC_TIR),
138 + IRQ_RES(spi_rx, LTQ_SSC_RIR),
139 + IRQ_RES(spi_err, LTQ_SSC_EIR),
140 +};
141 +
142 +static struct resource ltq_spi_resources_ar9[] = {
143 + {
144 + .start = LTQ_SSC_BASE_ADDR,
145 + .end = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1,
146 + .flags = IORESOURCE_MEM,
147 + },
148 + IRQ_RES(spi_tx, LTQ_SSC_TIR_AR9),
149 + IRQ_RES(spi_rx, LTQ_SSC_RIR_AR9),
150 + IRQ_RES(spi_err, LTQ_SSC_EIR),
151 +};
152 +
153 +static struct platform_device ltq_spi = {
154 + .name = "ltq-spi",
155 + .resource = ltq_spi_resources,
156 + .num_resources = ARRAY_SIZE(ltq_spi_resources),
157 +};
158 +
159 +void __init ltq_register_spi(struct ltq_spi_platform_data *pdata,
160 + struct spi_board_info const *info, unsigned n)
161 +{
162 + if(ltq_is_ar9())
163 + ltq_spi.resource = ltq_spi_resources_ar9;
164 + spi_register_board_info(info, n);
165 + ltq_spi.dev.platform_data = pdata;
166 + platform_device_register(&ltq_spi);
167 +}
168 Index: linux-3.1.1/arch/mips/lantiq/xway/devices.h
169 ===================================================================
170 --- linux-3.1.1.orig/arch/mips/lantiq/xway/devices.h 2011-11-11 21:19:27.000000000 +0100
171 +++ linux-3.1.1/arch/mips/lantiq/xway/devices.h 2011-11-14 20:22:34.328135495 +0100
172 @@ -11,10 +11,17 @@
173
174 #include "../devices.h"
175 #include <linux/phy.h>
176 +#include <linux/spi/spi.h>
177 +#include <linux/gpio_buttons.h>
178
179 extern void ltq_register_gpio(void);
180 extern void ltq_register_gpio_stp(void);
181 extern void ltq_register_ase_asc(void);
182 extern void ltq_register_etop(struct ltq_eth_data *eth);
183 +extern void ltq_register_gpio_ebu(unsigned int value);
184 +extern void ltq_register_spi(struct ltq_spi_platform_data *pdata,
185 + struct spi_board_info const *info, unsigned n);
186 +extern void ltq_register_madwifi_eep(unsigned long long addr);
187 +extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt);
188
189 #endif
190 Index: linux-3.1.1/arch/mips/lantiq/Makefile
191 ===================================================================
192 --- linux-3.1.1.orig/arch/mips/lantiq/Makefile 2011-11-14 20:22:33.640135462 +0100
193 +++ linux-3.1.1/arch/mips/lantiq/Makefile 2011-11-14 20:39:09.852178049 +0100
194 @@ -4,7 +4,7 @@
195 # under the terms of the GNU General Public License version 2 as published
196 # by the Free Software Foundation.
197
198 -obj-y := irq.o setup.o clk.o prom.o devices.o
199 +obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-leds.o dev-gpio-buttons.o
200
201 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
202