[lantiq] bump kernel to 3.2.12
[openwrt.git] / target / linux / lantiq / patches-3.2 / 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,84 @@ 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 platform_device ltq_spi = {
133 +       .name           = "ltq-spi",
134 +       .resource       = ltq_spi_resources,
135 +       .num_resources  = ARRAY_SIZE(ltq_spi_resources),
136 +};
137 +
138 +void __init ltq_register_spi(struct ltq_spi_platform_data *pdata,
139 +               struct spi_board_info const *info, unsigned n)
140 +{
141 +       if(ltq_is_ar9())
142 +               ltq_spi.resource = ltq_spi_resources_ar9;
143 +       spi_register_board_info(info, n);
144 +       ltq_spi.dev.platform_data = pdata;
145 +       platform_device_register(&ltq_spi);
146 +}
147 --- a/arch/mips/lantiq/xway/devices.h
148 +++ b/arch/mips/lantiq/xway/devices.h
149 @@ -11,6 +11,8 @@
150  
151  #include "../devices.h"
152  #include <linux/phy.h>
153 +#include <linux/spi/spi.h>
154 +#include <linux/gpio_buttons.h>
155  
156  extern void ltq_register_gpio(void);
157  extern void ltq_register_gpio_stp(void);
158 @@ -18,5 +20,9 @@ extern void ltq_register_ase_asc(void);
159  extern void ltq_register_etop(struct ltq_eth_data *eth);
160  extern void xway_register_nand(struct mtd_partition *parts, int count);
161  extern void ltq_register_vrx200(struct ltq_eth_data *eth);
162 +extern void ltq_register_gpio_ebu(unsigned int value);
163 +extern void ltq_register_spi(struct ltq_spi_platform_data *pdata,
164 +       struct spi_board_info const *info, unsigned n);
165 +extern void ltq_register_gpio_buttons(struct gpio_button *buttons, int cnt);
166  
167  #endif
168 --- a/arch/mips/lantiq/Makefile
169 +++ b/arch/mips/lantiq/Makefile
170 @@ -4,7 +4,7 @@
171  # under the terms of the GNU General Public License version 2 as published
172  # by the Free Software Foundation.
173  
174 -obj-y := irq.o setup.o clk.o prom.o devices.o
175 +obj-y := irq.o setup.o clk.o prom.o devices.o dev-gpio-leds.o dev-gpio-buttons.o
176  
177  obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
178