[lantiq]
[openwrt.git] / target / linux / lantiq / patches-3.0 / 211-devices.patch
1 Index: linux-3.0.3/arch/mips/lantiq/devices.c
2 ===================================================================
3 --- linux-3.0.3.orig/arch/mips/lantiq/devices.c 2011-10-04 20:03:54.000000000 +0200
4 +++ linux-3.0.3/arch/mips/lantiq/devices.c      2011-10-04 20:07:28.514316826 +0200
5 @@ -20,6 +20,7 @@
6  #include <linux/io.h>
7  #include <linux/gpio.h>
8  #include <linux/leds.h>
9 +#include <linux/dma-mapping.h>
10  
11  #include <asm/bootinfo.h>
12  #include <asm/irq.h>
13 @@ -102,3 +103,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.0.3/arch/mips/lantiq/devices.h
35 ===================================================================
36 --- linux-3.0.3.orig/arch/mips/lantiq/devices.h 2011-10-04 20:03:54.000000000 +0200
37 +++ linux-3.0.3/arch/mips/lantiq/devices.h      2011-10-04 20:07:13.362316180 +0200
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.0.3/arch/mips/lantiq/xway/Makefile
46 ===================================================================
47 --- linux-3.0.3.orig/arch/mips/lantiq/xway/Makefile     2011-10-04 20:07:01.000000000 +0200
48 +++ linux-3.0.3/arch/mips/lantiq/xway/Makefile  2011-10-04 20:07:13.362316180 +0200
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
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.0.3/arch/mips/lantiq/xway/devices.c
58 ===================================================================
59 --- linux-3.0.3.orig/arch/mips/lantiq/xway/devices.c    2011-10-04 20:05:44.000000000 +0200
60 +++ linux-3.0.3/arch/mips/lantiq/xway/devices.c 2011-10-04 20:07:44.070317494 +0200
61 @@ -21,6 +21,7 @@
62  #include <linux/io.h>
63  #include <linux/gpio.h>
64  #include <linux/leds.h>
65 +#include <linux/spi/spi.h>
66  
67  #include <asm/bootinfo.h>
68  #include <asm/irq.h>
69 @@ -101,3 +102,94 @@
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 +void __init
79 +ltq_register_madwifi_eep(void)
80 +{
81 +       lantiq_emulate_madwifi_eep = 1;
82 +}
83 +
84 +/* ebu */
85 +static struct resource ltq_ebu_resource =
86 +{
87 +       .name   = "gpio_ebu",
88 +       .start  = LTQ_EBU_GPIO_START,
89 +       .end    = LTQ_EBU_GPIO_START + LTQ_EBU_GPIO_SIZE - 1,
90 +       .flags  = IORESOURCE_MEM,
91 +};
92 +
93 +static struct platform_device ltq_ebu =
94 +{
95 +       .name           = "ltq_ebu",
96 +       .resource       = &ltq_ebu_resource,
97 +       .num_resources  = 1,
98 +};
99 +
100 +void __init
101 +ltq_register_gpio_ebu(unsigned int value)
102 +{
103 +       ltq_ebu.dev.platform_data = (void*) value;
104 +       platform_device_register(&ltq_ebu);
105 +}
106 +
107 +/* gpio buttons */
108 +static struct gpio_buttons_platform_data ltq_gpio_buttons_platform_data;
109 +
110 +static struct platform_device ltq_gpio_buttons_platform_device =
111 +{
112 +       .name = "gpio-buttons",
113 +       .id = 0,
114 +       .dev = {
115 +               .platform_data = (void *) &ltq_gpio_buttons_platform_data,
116 +       },
117 +};
118 +
119 +void __init
120 +ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt)
121 +{
122 +       ltq_gpio_buttons_platform_data.buttons = buttons;
123 +       ltq_gpio_buttons_platform_data.nbuttons = cnt;
124 +       platform_device_register(&ltq_gpio_buttons_platform_device);
125 +}
126 +
127 +static struct resource ltq_spi_resources[] = {
128 +       {
129 +               .start  = LTQ_SSC_BASE_ADDR,
130 +               .end    = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1,
131 +               .flags  = IORESOURCE_MEM,
132 +       },
133 +       IRQ_RES(spi_tx, LTQ_SSC_TIR),
134 +       IRQ_RES(spi_rx, LTQ_SSC_RIR),
135 +       IRQ_RES(spi_err, LTQ_SSC_EIR),
136 +};
137 +
138 +static struct resource ltq_spi_resources_ar9[] = {
139 +       {
140 +               .start  = LTQ_SSC_BASE_ADDR,
141 +               .end    = LTQ_SSC_BASE_ADDR + LTQ_SSC_SIZE - 1,
142 +               .flags  = IORESOURCE_MEM,
143 +       },
144 +       IRQ_RES(spi_tx, LTQ_SSC_TIR_AR9),
145 +       IRQ_RES(spi_rx, LTQ_SSC_RIR_AR9),
146 +       IRQ_RES(spi_err, LTQ_SSC_EIR),
147 +};
148 +
149 +static struct platform_device ltq_spi = {
150 +       .name           = "ltq-spi",
151 +       .resource       = ltq_spi_resources,
152 +       .num_resources  = ARRAY_SIZE(ltq_spi_resources),
153 +};
154 +
155 +void __init ltq_register_spi(struct ltq_spi_platform_data *pdata,
156 +               struct spi_board_info const *info, unsigned n)
157 +{
158 +       if(ltq_is_ar9())
159 +               ltq_spi.resource = ltq_spi_resources_ar9;
160 +       spi_register_board_info(info, n);
161 +       ltq_spi.dev.platform_data = pdata;
162 +       platform_device_register(&ltq_spi);
163 +}
164 Index: linux-3.0.3/arch/mips/lantiq/xway/devices.h
165 ===================================================================
166 --- linux-3.0.3.orig/arch/mips/lantiq/xway/devices.h    2011-08-17 19:57:16.000000000 +0200
167 +++ linux-3.0.3/arch/mips/lantiq/xway/devices.h 2011-10-04 20:07:13.366316178 +0200
168 @@ -11,10 +11,17 @@
169  
170  #include "../devices.h"
171  #include <linux/phy.h>
172 +#include <linux/spi/spi.h>
173 +#include <linux/gpio_buttons.h>
174  
175  extern void ltq_register_gpio(void);
176  extern void ltq_register_gpio_stp(void);
177  extern void ltq_register_ase_asc(void);
178  extern void ltq_register_etop(struct ltq_eth_data *eth);
179 +extern void ltq_register_gpio_ebu(unsigned int value);
180 +extern void ltq_register_spi(struct ltq_spi_platform_data *pdata,
181 +       struct spi_board_info const *info, unsigned n);
182 +extern void ltq_register_madwifi_eep(void);
183 +extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt);
184  
185  #endif
186 Index: linux-3.0.3/arch/mips/lantiq/Makefile
187 ===================================================================
188 --- linux-3.0.3.orig/arch/mips/lantiq/Makefile  2011-10-04 20:03:54.000000000 +0200
189 +++ linux-3.0.3/arch/mips/lantiq/Makefile       2011-10-04 20:08:10.406318621 +0200
190 @@ -4,7 +4,7 @@
191  # under the terms of the GNU General Public License version 2 as published
192  # by the Free Software Foundation.
193  
194 -obj-y := irq.o setup.o clk.o prom.o devices.o
195 +obj-y := irq.o setup.o clk.o prom.o devices.o dev-leds-gpio.o dev-gpio-buttons.o
196  
197  obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
198