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