omap24xx: Fix missing symbols for mac80211
[openwrt.git] / target / linux / omap24xx / patches-2.6.38 / 301-nokia-board-additional.patch
1 Index: linux-2.6.38-rc6/arch/arm/mach-omap2/board-n8x0.c
2 ===================================================================
3 --- linux-2.6.38-rc6.orig/arch/arm/mach-omap2/board-n8x0.c      2011-02-28 16:48:12.972504055 +0100
4 +++ linux-2.6.38-rc6/arch/arm/mach-omap2/board-n8x0.c   2011-02-28 21:03:41.761254167 +0100
5 @@ -23,6 +23,9 @@
6  #include <linux/spi/spi.h>
7  #include <linux/usb/musb.h>
8  #include <sound/tlv320aic3x.h>
9 +#include <linux/input.h>
10 +#include <linux/i2c/lm8323.h>
11 +#include <linux/spi/tsc2005.h>
12  
13  #include <asm/mach/arch.h>
14  #include <asm/mach-types.h>
15 @@ -36,6 +39,7 @@
16  #include <plat/mmc.h>
17  #include <plat/serial.h>
18  #include <plat/cbus.h>
19 +#include <plat/gpio-switch.h>
20  
21  #include "mux.h"
22  
23 @@ -43,6 +47,221 @@ static int slot1_cover_open;
24  static int slot2_cover_open;
25  static struct device *mmc_device;
26  
27 +/* We map the FN key as LALT to workaround an X keycode problem.
28 + * The XKB map needs to be adjusted to support this. */
29 +#define MAP_FN_AS_LEFTALT
30 +
31 +static s16 rx44_keymap[LM8323_KEYMAP_SIZE] = {
32 +       [0x01] = KEY_Q,
33 +       [0x02] = KEY_K,
34 +       [0x03] = KEY_O,
35 +       [0x04] = KEY_P,
36 +       [0x05] = KEY_BACKSPACE,
37 +       [0x06] = KEY_A,
38 +       [0x07] = KEY_S,
39 +       [0x08] = KEY_D,
40 +       [0x09] = KEY_F,
41 +       [0x0a] = KEY_G,
42 +       [0x0b] = KEY_H,
43 +       [0x0c] = KEY_J,
44 +
45 +       [0x11] = KEY_W,
46 +       [0x12] = KEY_F4,
47 +       [0x13] = KEY_L,
48 +       [0x14] = KEY_APOSTROPHE,
49 +       [0x16] = KEY_Z,
50 +       [0x17] = KEY_X,
51 +       [0x18] = KEY_C,
52 +       [0x19] = KEY_V,
53 +       [0x1a] = KEY_B,
54 +       [0x1b] = KEY_N,
55 +       [0x1c] = KEY_LEFTSHIFT, /* Actually, this is both shift keys */
56 +       [0x1f] = KEY_F7,
57 +
58 +       [0x21] = KEY_E,
59 +       [0x22] = KEY_SEMICOLON,
60 +       [0x23] = KEY_MINUS,
61 +       [0x24] = KEY_EQUAL,
62 +#ifdef MAP_FN_AS_LEFTALT
63 +       [0x2b] = KEY_LEFTALT,
64 +#else
65 +       [0x2b] = KEY_FN,
66 +#endif
67 +       [0x2c] = KEY_M,
68 +       [0x2f] = KEY_F8,
69 +
70 +       [0x31] = KEY_R,
71 +       [0x32] = KEY_RIGHTCTRL,
72 +       [0x34] = KEY_SPACE,
73 +       [0x35] = KEY_COMMA,
74 +       [0x37] = KEY_UP,
75 +       [0x3c] = KEY_COMPOSE,
76 +       [0x3f] = KEY_F6,
77 +
78 +       [0x41] = KEY_T,
79 +       [0x44] = KEY_DOT,
80 +       [0x46] = KEY_RIGHT,
81 +       [0x4f] = KEY_F5,
82 +       [0x51] = KEY_Y,
83 +       [0x53] = KEY_DOWN,
84 +       [0x55] = KEY_ENTER,
85 +       [0x5f] = KEY_ESC,
86 +
87 +       [0x61] = KEY_U,
88 +       [0x64] = KEY_LEFT,
89 +
90 +       [0x71] = KEY_I,
91 +       [0x75] = KEY_KPENTER,
92 +};
93 +
94 +static struct lm8323_platform_data lm8323_pdata = {
95 +       .repeat         = 0, /* Repeat is handled in userspace for now. */
96 +       .keymap         = rx44_keymap,
97 +       .size_x         = 8,
98 +       .size_y         = 12,
99 +       .debounce_time  = 12,
100 +       .active_time    = 500,
101 +
102 +       .name           = "Internal keyboard",
103 +       .pwm_names[0]   = "n810::keyboard",
104 +       .pwm_names[1]   = "n810::cover",
105 +};
106 +
107 +#define OMAP_TAG_NOKIA_BT      0x4e01
108 +
109 +struct omap_bluetooth_config {
110 +       u8    chip_type;
111 +       u8    bt_wakeup_gpio;
112 +       u8    host_wakeup_gpio;
113 +       u8    reset_gpio;
114 +       u8    bt_uart;
115 +       u8    bd_addr[6];
116 +       u8    bt_sysclk;
117 +};
118 +
119 +static struct platform_device n8x0_bt_device = {
120 +       .name           = "hci_h4p",
121 +       .id             = -1,
122 +       .num_resources  = 0,
123 +};
124 +
125 +void __init n8x0_bt_init(void)
126 +{
127 +       const struct omap_bluetooth_config *bt_config;
128 +
129 +       bt_config = (void *) omap_get_config(OMAP_TAG_NOKIA_BT,
130 +                                            struct omap_bluetooth_config);
131 +       n8x0_bt_device.dev.platform_data = (void *) bt_config;
132 +       if (platform_device_register(&n8x0_bt_device) < 0)
133 +               BUG();
134 +}
135 +
136 +#define        RX51_TSC2005_RESET_GPIO 94
137 +#define        RX51_TSC2005_IRQ_GPIO   106
138 +
139 +#ifdef CONFIG_TOUCHSCREEN_TSC2005
140 +static struct tsc2005_platform_data tsc2005_config;
141 +static void rx51_tsc2005_set_reset(bool enable)
142 +{
143 +       gpio_set_value(RX51_TSC2005_RESET_GPIO, enable);
144 +}
145 +
146 +static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
147 +       .turbo_mode     = 0,
148 +       .single_channel = 1,
149 +};
150 +#endif
151 +
152 +static void __init tsc2005_set_config(void)
153 +{
154 +       const struct omap_lcd_config *conf;
155 +
156 +       conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
157 +       if (conf != NULL) {
158 +#ifdef CONFIG_TOUCHSCREEN_TSC2005
159 +               if (strcmp(conf->panel_name, "lph8923") == 0) {
160 +                       tsc2005_config.ts_x_plate_ohm = 180;
161 +                       tsc2005_config.ts_hw_avg = 0;
162 +                       tsc2005_config.ts_ignore_last = 0;
163 +                       tsc2005_config.ts_touch_pressure = 1500;
164 +                       tsc2005_config.ts_stab_time = 100;
165 +                       tsc2005_config.ts_pressure_max = 2048;
166 +                       tsc2005_config.ts_pressure_fudge = 2;
167 +                       tsc2005_config.ts_x_max = 4096;
168 +                       tsc2005_config.ts_x_fudge = 4;
169 +                       tsc2005_config.ts_y_max = 4096;
170 +                       tsc2005_config.ts_y_fudge = 7;
171 +                       tsc2005_config.set_reset = rx51_tsc2005_set_reset;
172 +               } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
173 +                       tsc2005_config.ts_x_plate_ohm = 280;
174 +                       tsc2005_config.ts_hw_avg = 0;
175 +                       tsc2005_config.ts_ignore_last = 0;
176 +                       tsc2005_config.ts_touch_pressure = 1500;
177 +                       tsc2005_config.ts_stab_time = 1000;
178 +                       tsc2005_config.ts_pressure_max = 2048;
179 +                       tsc2005_config.ts_pressure_fudge = 2;
180 +                       tsc2005_config.ts_x_max = 4096;
181 +                       tsc2005_config.ts_x_fudge = 4;
182 +                       tsc2005_config.ts_y_max = 4096;
183 +                       tsc2005_config.ts_y_fudge = 7;
184 +                       tsc2005_config.set_reset = rx51_tsc2005_set_reset;
185 +               } else {
186 +                       printk(KERN_ERR "Unknown panel type, set default "
187 +                              "touchscreen configuration\n");
188 +                       tsc2005_config.ts_x_plate_ohm = 200;
189 +                       tsc2005_config.ts_stab_time = 100;
190 +               }
191 +#endif
192 +       }
193 +}
194 +
195 +static struct omap2_mcspi_device_config mipid_mcspi_config = {
196 +       .turbo_mode     = 0,
197 +       .single_channel = 1,
198 +};
199 +
200 +extern struct mipid_platform_data n8x0_mipid_platform_data;
201 +
202 +extern void n8x0_mipid_init(void);
203 +extern void n8x0_blizzard_init(void);
204 +
205 +static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
206 +       {
207 +               .name                   = "headphone",
208 +               .gpio                   = -1,
209 +               .debounce_rising        = 200,
210 +               .debounce_falling       = 200,
211 +       }, {
212 +               .name                   = "cam_act",
213 +               .gpio                   = -1,
214 +               .debounce_rising        = 200,
215 +               .debounce_falling       = 200,
216 +       }, {
217 +               .name                   = "cam_turn",
218 +               .gpio                   = -1,
219 +               .debounce_rising        = 100,
220 +               .debounce_falling       = 100,
221 +       }, {
222 +               .name                   = "slide",
223 +               .gpio                   = -1,
224 +               .debounce_rising        = 200,
225 +               .debounce_falling       = 200,
226 +       }, {
227 +               .name                   = "kb_lock",
228 +               .gpio                   = -1,
229 +               .debounce_rising        = 200,
230 +               .debounce_falling       = 200,
231 +       },
232 +};
233 +
234 +static void __init n8x0_gpio_switches_init(void)
235 +{
236 +       /* The switches are actually registered through ATAG mechanism.
237 +        * This just updates the parameters (thus .gpio is -1) */
238 +       omap_register_gpio_switches(n8x0_gpio_switches,
239 +                                   ARRAY_SIZE(n8x0_gpio_switches));
240 +}
241 +
242  #define TUSB6010_ASYNC_CS      1
243  #define TUSB6010_SYNC_CS       4
244  #define TUSB6010_GPIO_INT      58
245 @@ -146,12 +365,29 @@ static struct omap2_mcspi_device_config
246  
247  static struct spi_board_info n800_spi_board_info[] __initdata = {
248         {
249 +               .modalias       = "lcd_mipid",
250 +               .bus_num        = 1,
251 +               .chip_select    = 1,
252 +               .max_speed_hz   = 4000000,
253 +               .controller_data= &mipid_mcspi_config,
254 +               .platform_data  = &n8x0_mipid_platform_data,
255 +       },
256 +       {
257                 .modalias       = "p54spi",
258                 .bus_num        = 2,
259                 .chip_select    = 0,
260                 .max_speed_hz   = 48000000,
261                 .controller_data = &p54spi_mcspi_config,
262         },
263 +       {
264 +               .modalias        = "tsc2005",
265 +               .bus_num         = 1,
266 +               .chip_select     = 0,
267 +               .irq             = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),
268 +               .max_speed_hz    = 6000000,
269 +               .controller_data = &tsc2005_mcspi_config,
270 +               .platform_data   = &tsc2005_config,
271 +       },
272  };
273  
274  #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
275 @@ -727,6 +963,11 @@ static struct aic3x_pdata n810_aic33_dat
276  };
277  
278  static struct i2c_board_info n810_i2c_board_info_2[] __initdata = {
279 +       {
280 +               I2C_BOARD_INFO("lm8323", 0x45),
281 +               .irq            = OMAP_GPIO_IRQ(109),
282 +               .platform_data  = &lm8323_pdata,
283 +       },
284         {
285                 I2C_BOARD_INFO("tlv320aic3x", 0x18),
286                 .platform_data = &n810_aic33_data,
287 @@ -796,9 +1037,12 @@ static inline void board_serial_init(voi
288  static void __init n8x0_init_machine(void)
289  {
290         omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
291 +       n8x0_gpio_switches_init();
292         n8x0_cbus_init();
293 +       n8x0_bt_init();
294  
295         /* FIXME: add n810 spi devices */
296 +       tsc2005_set_config();
297         spi_register_board_info(n800_spi_board_info,
298                                 ARRAY_SIZE(n800_spi_board_info));
299         omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
300 @@ -808,6 +1052,8 @@ static void __init n8x0_init_machine(voi
301                 i2c_register_board_info(2, n810_i2c_board_info_2,
302                                         ARRAY_SIZE(n810_i2c_board_info_2));
303         board_serial_init();
304 +       n8x0_mipid_init();
305 +       n8x0_blizzard_init();
306         gpmc_onenand_init(board_onenand_data);
307         n8x0_mmc_init();
308         n8x0_usb_init();
309 Index: linux-2.6.38-rc6/arch/arm/mach-omap2/board-n8x0-lcd.c
310 ===================================================================
311 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
312 +++ linux-2.6.38-rc6/arch/arm/mach-omap2/board-n8x0-lcd.c       2011-02-28 21:08:50.105894872 +0100
313 @@ -0,0 +1,141 @@
314 +/*
315 + * linux/arch/arm/mach-omap2/board-n8x0.c
316 + *
317 + * Copyright (C) 2005-2009 Nokia Corporation
318 + * Author: Juha Yrjola <juha.yrjola@nokia.com>
319 + *
320 + * Modified from mach-omap2/board-generic.c
321 + *
322 + * This program is free software; you can redistribute it and/or modify
323 + * it under the terms of the GNU General Public License version 2 as
324 + * published by the Free Software Foundation.
325 + */
326 +
327 +#include <linux/clk.h>
328 +#include <linux/delay.h>
329 +#include <linux/gpio.h>
330 +#include <linux/omapfb.h>
331 +
332 +#include <plat/lcd_mipid.h>
333 +#include <plat/blizzard.h>
334 +
335 +#include <../drivers/cbus/tahvo.h>
336 +
337 +#define N8X0_BLIZZARD_POWERDOWN_GPIO   15
338 +
339 +// MIPID LCD Panel
340 +
341 +static void mipid_shutdown(struct mipid_platform_data *pdata)
342 +{
343 +       if (pdata->nreset_gpio != -1) {
344 +               pr_info("shutdown LCD\n");
345 +               gpio_set_value(pdata->nreset_gpio, 0);
346 +               msleep(120);
347 +       }
348 +}
349 +
350 +struct mipid_platform_data n8x0_mipid_platform_data = {
351 +       .shutdown = mipid_shutdown,
352 +};
353 +
354 +void __init n8x0_mipid_init(void)
355 +{
356 +       const struct omap_lcd_config *conf;
357 +       int err;
358 +
359 +       conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
360 +       if (conf != NULL) {
361 +               n8x0_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
362 +               n8x0_mipid_platform_data.data_lines = conf->data_lines;
363 +               if (conf->nreset_gpio != -1) {
364 +                       err = gpio_request(conf->nreset_gpio, "MIPID nreset");
365 +                       if (err) {
366 +                               printk(KERN_ERR "N8x0 MIPID failed to request nreset GPIO %d\n",
367 +                                      conf->nreset_gpio);
368 +                       } else {
369 +                               err = gpio_direction_output(conf->nreset_gpio, 1);
370 +                               if (err) {
371 +                                       printk(KERN_ERR "N8x0 MIPID failed to set nreset GPIO %d\n",
372 +                                              conf->nreset_gpio);
373 +                               }
374 +                       }
375 +               }
376 +               printk(KERN_INFO "N8x0 MIPID config loaded");
377 +       }
378 +       else
379 +               printk(KERN_INFO "N8x0 MIPID config not provided");
380 +}
381 +
382 +
383 +// Epson Blizzard LCD Controller
384 +
385 +static struct {
386 +       struct clk *sys_ck;
387 +} blizzard;
388 +
389 +static int blizzard_get_clocks(void)
390 +{
391 +       blizzard.sys_ck = clk_get(0, "osc_ck");
392 +       if (IS_ERR(blizzard.sys_ck)) {
393 +               printk(KERN_ERR "can't get Blizzard clock\n");
394 +               return PTR_ERR(blizzard.sys_ck);
395 +       }
396 +       return 0;
397 +}
398 +
399 +static unsigned long blizzard_get_clock_rate(struct device *dev)
400 +{
401 +       return clk_get_rate(blizzard.sys_ck);
402 +}
403 +
404 +static void blizzard_enable_clocks(int enable)
405 +{
406 +       if (enable)
407 +               clk_enable(blizzard.sys_ck);
408 +       else
409 +               clk_disable(blizzard.sys_ck);
410 +}
411 +
412 +static void blizzard_power_up(struct device *dev)
413 +{
414 +       /* Vcore to 1.475V */
415 +       tahvo_set_clear_reg_bits(0x07, 0, 0xf);
416 +       msleep(10);
417 +
418 +       blizzard_enable_clocks(1);
419 +       gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
420 +}
421 +
422 +static void blizzard_power_down(struct device *dev)
423 +{
424 +       gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 0);
425 +       blizzard_enable_clocks(0);
426 +
427 +       /* Vcore to 1.005V */
428 +       tahvo_set_clear_reg_bits(0x07, 0xf, 0);
429 +}
430 +
431 +static struct blizzard_platform_data n8x0_blizzard_data = {
432 +       .power_up       = blizzard_power_up,
433 +       .power_down     = blizzard_power_down,
434 +       .get_clock_rate = blizzard_get_clock_rate,
435 +       .te_connected   = 1,
436 +};
437 +
438 +void __init n8x0_blizzard_init(void)
439 +{
440 +       int r;
441 +
442 +       r = gpio_request(N8X0_BLIZZARD_POWERDOWN_GPIO, "Blizzard pd");
443 +       if (r < 0)
444 +       {
445 +               printk(KERN_ERR "Can't get N8x0 Blizzard powerdown GPIO %d\n", N8X0_BLIZZARD_POWERDOWN_GPIO);
446 +               return;
447 +       }
448 +       gpio_direction_output(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
449 +
450 +       blizzard_get_clocks();
451 +       omapfb_set_ctrl_platform_data(&n8x0_blizzard_data);
452 +
453 +       printk(KERN_INFO "N8x0 Blizzard initialized");
454 +}
455 Index: linux-2.6.38-rc6/arch/arm/mach-omap2/Makefile
456 ===================================================================
457 --- linux-2.6.38-rc6.orig/arch/arm/mach-omap2/Makefile  2011-02-28 16:45:53.321456871 +0100
458 +++ linux-2.6.38-rc6/arch/arm/mach-omap2/Makefile       2011-02-28 16:48:12.997503690 +0100
459 @@ -177,6 +177,7 @@ obj-$(CONFIG_MACH_OMAP_3430SDP)             += boar
460                                            hsmmc.o \
461                                            board-flash.o
462  obj-$(CONFIG_MACH_NOKIA_N8X0)          += board-n8x0.o
463 +obj-$(CONFIG_MACH_NOKIA_N8X0)          += board-n8x0-lcd.o
464  obj-$(CONFIG_MACH_NOKIA_RM680)         += board-rm680.o \
465                                            sdram-nokia.o \
466                                            hsmmc.o
467 Index: linux-2.6.38-rc6/arch/arm/plat-omap/include/plat/cbus.h
468 ===================================================================
469 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
470 +++ linux-2.6.38-rc6/arch/arm/plat-omap/include/plat/cbus.h     2011-02-28 16:48:12.997503690 +0100
471 @@ -0,0 +1,40 @@
472 +/*
473 + * cbus.h - CBUS platform_data definition
474 + *
475 + * Copyright (C) 2004 - 2009 Nokia Corporation
476 + *
477 + * Written by Felipe Balbi <felipe.balbi@nokia.com>
478 + *
479 + * This file is subject to the terms and conditions of the GNU General
480 + * Public License. See the file "COPYING" in the main directory of this
481 + * archive for more details.
482 + *
483 + * This program is distributed in the hope that it will be useful,
484 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
485 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
486 + * GNU General Public License for more details.
487 + *
488 + * You should have received a copy of the GNU General Public License
489 + * along with this program; if not, write to the Free Software
490 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
491 + */
492 +
493 +#ifndef __PLAT_CBUS_H
494 +#define __PLAT_CBUS_H
495 +
496 +#define CBUS_RETU_DEVICE_ID    0x01
497 +#define CBUS_TAHVO_DEVICE_ID   0x02
498 +
499 +struct cbus_host_platform_data {
500 +       int     dat_gpio;
501 +       int     clk_gpio;
502 +       int     sel_gpio;
503 +};
504 +
505 +struct cbus_retu_platform_data {
506 +       int     irq_base;
507 +       int     irq_end;
508 +       int     devid;
509 +};
510 +
511 +#endif /* __PLAT_CBUS_H */
512 Index: linux-2.6.38-rc6/arch/arm/plat-omap/include/plat/irqs.h
513 ===================================================================
514 --- linux-2.6.38-rc6.orig/arch/arm/plat-omap/include/plat/irqs.h        2011-02-28 16:45:53.350456485 +0100
515 +++ linux-2.6.38-rc6/arch/arm/plat-omap/include/plat/irqs.h     2011-02-28 16:48:12.998503676 +0100
516 @@ -411,7 +411,20 @@
517  #define TWL_IRQ_END            TWL6030_IRQ_END
518  #endif
519  
520 -#define NR_IRQS                        TWL_IRQ_END
521 +/* GPMC related */
522 +#define OMAP_GPMC_IRQ_BASE     (TWL_IRQ_END)
523 +#define OMAP_GPMC_NR_IRQS      7
524 +#define OMAP_GPMC_IRQ_END      (OMAP_GPMC_IRQ_BASE + OMAP_GPMC_NR_IRQS)
525 +
526 +#define CBUS_RETU_IRQ_BASE     OMAP_GPMC_IRQ_END
527 +#ifdef CONFIG_CBUS_RETU
528 +#define CBUS_RETU_NR_IRQS      16
529 +#else
530 +#define CBUS_RETU_NR_IRQS      0
531 +#endif
532 +#define CBUS_RETU_IRQ_END      (CBUS_RETU_IRQ_BASE + CBUS_RETU_NR_IRQS)
533 +
534 +#define NR_IRQS                        CBUS_RETU_IRQ_END
535  
536  #define OMAP_IRQ_BIT(irq)      (1 << ((irq) % 32))
537  
538 Index: linux-2.6.38-rc6/arch/arm/mach-omap2/omap_hwmod_2420_data.c
539 ===================================================================
540 --- linux-2.6.38-rc6.orig/arch/arm/mach-omap2/omap_hwmod_2420_data.c    2011-02-28 21:09:41.170169165 +0100
541 +++ linux-2.6.38-rc6/arch/arm/mach-omap2/omap_hwmod_2420_data.c 2011-02-28 21:10:33.434425329 +0100
542 @@ -673,6 +673,7 @@ static struct omap_hwmod_ocp_if *omap242
543  
544  static struct omap_hwmod omap2420_gpio1_hwmod = {
545         .name           = "gpio1",
546 +       .flags          = HWMOD_INIT_NO_RESET, /* Workaround: Don't reset the n810 MIPID */
547         .mpu_irqs       = omap242x_gpio1_irqs,
548         .mpu_irqs_cnt   = ARRAY_SIZE(omap242x_gpio1_irqs),
549         .main_clk       = "gpios_fck",