omap24xx: Add support for GPIO switches on the n810
[openwrt/svn-archive/archive.git] / target / linux / omap24xx / patches-2.6.36 / 300-nokia-board.patch
1 ---
2 arch/arm/mach-omap1/board-nokia770.c | 16 +
3 arch/arm/mach-omap2/Kconfig | 10 +
4 arch/arm/mach-omap2/Makefile | 2
5 arch/arm/mach-omap2/board-n8x0-lcd.c | 127 +++++++++++++
6 arch/arm/mach-omap2/board-n8x0-usb.c | 175 +++++++++++++++++++
7 arch/arm/mach-omap2/board-n8x0.c | 318 +++++++++++++++++++++++++----------
8 arch/arm/mach-omap2/control.c | 2
9 arch/arm/mach-omap2/serial.c | 8
10 8 files changed, 571 insertions(+), 87 deletions(-)
11
12 --- linux-2.6.36-rc4.orig/arch/arm/mach-omap1/board-nokia770.c
13 +++ linux-2.6.36-rc4/arch/arm/mach-omap1/board-nokia770.c
14 @@ -36,6 +36,7 @@
15 #include <plat/lcd_mipid.h>
16 #include <plat/mmc.h>
17 #include <plat/clock.h>
18 +#include <plat/cbus.h>
19
20 #define ADS7846_PENDOWN_GPIO 15
21
22 @@ -95,8 +96,23 @@ static struct platform_device nokia770_k
23 .resource = nokia770_kp_resources,
24 };
25
26 +static struct cbus_host_platform_data nokia770_cbus_data = {
27 + .clk_gpio = OMAP_MPUIO(11),
28 + .dat_gpio = OMAP_MPUIO(10),
29 + .sel_gpio = OMAP_MPUIO(9),
30 +};
31 +
32 +static struct platform_device nokia770_cbus_device = {
33 + .name = "cbus",
34 + .id = -1,
35 + .dev = {
36 + .platform_data = &nokia770_cbus_data,
37 + },
38 +};
39 +
40 static struct platform_device *nokia770_devices[] __initdata = {
41 &nokia770_kp_device,
42 + &nokia770_cbus_device,
43 };
44
45 static void mipid_shutdown(struct mipid_platform_data *pdata)
46 --- linux-2.6.36-rc4.orig/arch/arm/mach-omap2/board-n8x0.c
47 +++ linux-2.6.36-rc4/arch/arm/mach-omap2/board-n8x0.c
48 @@ -18,8 +18,12 @@
49 #include <linux/io.h>
50 #include <linux/stddef.h>
51 #include <linux/i2c.h>
52 +#include <linux/platform_device.h>
53 #include <linux/spi/spi.h>
54 +#include <linux/spi/tsc2005.h>
55 +#include <linux/input.h>
56 #include <linux/usb/musb.h>
57 +#include <linux/i2c/lm8323.h>
58
59 #include <asm/mach/arch.h>
60 #include <asm/mach-types.h>
61 @@ -32,6 +36,7 @@
62 #include <plat/onenand.h>
63 #include <plat/mmc.h>
64 #include <plat/serial.h>
65 +#include <plat/cbus.h>
66
67 #include "mux.h"
68
69 @@ -39,109 +44,154 @@ static int slot1_cover_open;
70 static int slot2_cover_open;
71 static struct device *mmc_device;
72
73 -#define TUSB6010_ASYNC_CS 1
74 -#define TUSB6010_SYNC_CS 4
75 -#define TUSB6010_GPIO_INT 58
76 -#define TUSB6010_GPIO_ENABLE 0
77 -#define TUSB6010_DMACHAN 0x3f
78 +#define RX51_TSC2005_RESET_GPIO 94
79 +#define RX51_TSC2005_IRQ_GPIO 106
80 +#define OMAP_TAG_NOKIA_BT 0x4e01
81 +
82 +static s16 rx44_keymap[LM8323_KEYMAP_SIZE] = {
83 + [0x01] = KEY_Q,
84 + [0x02] = KEY_K,
85 + [0x03] = KEY_O,
86 + [0x04] = KEY_P,
87 + [0x05] = KEY_BACKSPACE,
88 + [0x06] = KEY_A,
89 + [0x07] = KEY_S,
90 + [0x08] = KEY_D,
91 + [0x09] = KEY_F,
92 + [0x0a] = KEY_G,
93 + [0x0b] = KEY_H,
94 + [0x0c] = KEY_J,
95 +
96 + [0x11] = KEY_W,
97 + [0x12] = KEY_F4,
98 + [0x13] = KEY_L,
99 + [0x14] = KEY_APOSTROPHE,
100 + [0x16] = KEY_Z,
101 + [0x17] = KEY_X,
102 + [0x18] = KEY_C,
103 + [0x19] = KEY_V,
104 + [0x1a] = KEY_B,
105 + [0x1b] = KEY_N,
106 + [0x1c] = KEY_LEFTSHIFT, /* Actually, this is both shift keys */
107 + [0x1f] = KEY_F7,
108 +
109 + [0x21] = KEY_E,
110 + [0x22] = KEY_SEMICOLON,
111 + [0x23] = KEY_MINUS,
112 + [0x24] = KEY_EQUAL,
113 + [0x2b] = KEY_FN,
114 + [0x2c] = KEY_M,
115 + [0x2f] = KEY_F8,
116 +
117 + [0x31] = KEY_R,
118 + [0x32] = KEY_RIGHTCTRL,
119 + [0x34] = KEY_SPACE,
120 + [0x35] = KEY_COMMA,
121 + [0x37] = KEY_UP,
122 + [0x3c] = KEY_COMPOSE,
123 + [0x3f] = KEY_F6,
124 +
125 + [0x41] = KEY_T,
126 + [0x44] = KEY_DOT,
127 + [0x46] = KEY_RIGHT,
128 + [0x4f] = KEY_F5,
129 + [0x51] = KEY_Y,
130 + [0x53] = KEY_DOWN,
131 + [0x55] = KEY_ENTER,
132 + [0x5f] = KEY_ESC,
133
134 -#if defined(CONFIG_USB_TUSB6010) || \
135 - defined(CONFIG_USB_TUSB6010_MODULE)
136 -/*
137 - * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
138 - * 1.5 V voltage regulators of PM companion chip. Companion chip will then
139 - * provide then PGOOD signal to TUSB6010 which will release it from reset.
140 - */
141 -static int tusb_set_power(int state)
142 -{
143 - int i, retval = 0;
144 -
145 - if (state) {
146 - gpio_set_value(TUSB6010_GPIO_ENABLE, 1);
147 - msleep(1);
148 + [0x61] = KEY_U,
149 + [0x64] = KEY_LEFT,
150
151 - /* Wait until TUSB6010 pulls INT pin down */
152 - i = 100;
153 - while (i && gpio_get_value(TUSB6010_GPIO_INT)) {
154 - msleep(1);
155 - i--;
156 - }
157 -
158 - if (!i) {
159 - printk(KERN_ERR "tusb: powerup failed\n");
160 - retval = -ENODEV;
161 - }
162 - } else {
163 - gpio_set_value(TUSB6010_GPIO_ENABLE, 0);
164 - msleep(10);
165 - }
166 + [0x71] = KEY_I,
167 + [0x75] = KEY_KPENTER,
168 +};
169
170 - return retval;
171 -}
172 +static struct lm8323_platform_data lm8323_pdata = {
173 + .repeat = 0, /* Repeat is handled in userspace for now. */
174 + .keymap = rx44_keymap,
175 + .size_x = 8,
176 + .size_y = 12,
177 + .debounce_time = 12,
178 + .active_time = 500,
179 +
180 + .name = "Internal keyboard",
181 + .pwm_names[0] = "n810::keyboard",
182 + .pwm_names[1] = "n810::cover",
183 + //.pwm1_name = "n810::keyboard",
184 + //.pwm2_name = "n810::cover",
185 +};
186
187 -static struct musb_hdrc_config musb_config = {
188 - .multipoint = 1,
189 - .dyn_fifo = 1,
190 - .num_eps = 16,
191 - .ram_bits = 12,
192 +struct omap_bluetooth_config {
193 + u8 chip_type;
194 + u8 bt_wakeup_gpio;
195 + u8 host_wakeup_gpio;
196 + u8 reset_gpio;
197 + u8 bt_uart;
198 + u8 bd_addr[6];
199 + u8 bt_sysclk;
200 };
201
202 -static struct musb_hdrc_platform_data tusb_data = {
203 -#if defined(CONFIG_USB_MUSB_OTG)
204 - .mode = MUSB_OTG,
205 -#elif defined(CONFIG_USB_MUSB_PERIPHERAL)
206 - .mode = MUSB_PERIPHERAL,
207 -#else /* defined(CONFIG_USB_MUSB_HOST) */
208 - .mode = MUSB_HOST,
209 -#endif
210 - .set_power = tusb_set_power,
211 - .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
212 - .power = 100, /* Max 100 mA VBUS for host mode */
213 - .config = &musb_config,
214 -};
215 -
216 -static void __init n8x0_usb_init(void)
217 -{
218 - int ret = 0;
219 - static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
220 -
221 - /* PM companion chip power control pin */
222 - ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable");
223 - if (ret != 0) {
224 - printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
225 - TUSB6010_GPIO_ENABLE);
226 - return;
227 - }
228 - gpio_direction_output(TUSB6010_GPIO_ENABLE, 0);
229 +static struct platform_device n8x0_bt_device = {
230 + .name = "hci_h4p",
231 + .id = -1,
232 + .num_resources = 0,
233 +};
234
235 - tusb_set_power(0);
236 +void __init n8x0_bt_init(void)
237 +{
238 + const struct omap_bluetooth_config *bt_config;
239
240 - ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
241 - TUSB6010_ASYNC_CS, TUSB6010_SYNC_CS,
242 - TUSB6010_GPIO_INT, TUSB6010_DMACHAN);
243 - if (ret != 0)
244 - goto err;
245 + bt_config = (void *) omap_get_config(OMAP_TAG_NOKIA_BT,
246 + struct omap_bluetooth_config);
247 + n8x0_bt_device.dev.platform_data = (void *) bt_config;
248 + if (platform_device_register(&n8x0_bt_device) < 0)
249 + BUG();
250 +}
251
252 - printk(announce);
253 +static struct omap2_mcspi_device_config mipid_mcspi_config = {
254 + .turbo_mode = 0,
255 + .single_channel = 1,
256 +};
257
258 - return;
259 +static int slot1_cover_open;
260 +static int slot2_cover_open;
261 +static struct device *mmc_device;
262
263 -err:
264 - gpio_free(TUSB6010_GPIO_ENABLE);
265 -}
266 -#else
267
268 -static void __init n8x0_usb_init(void) {}
269 +static struct omap2_mcspi_device_config p54spi_mcspi_config = {
270 + .turbo_mode = 0,
271 + .single_channel = 1,
272 +};
273
274 -#endif /*CONFIG_USB_TUSB6010 */
275 +#ifdef CONFIG_MACH_NOKIA_N8X0_LCD
276 +extern struct mipid_platform_data n8x0_mipid_platform_data;
277 +#endif
278
279 +#ifdef CONFIG_TOUCHSCREEN_TSC2005
280 +static struct tsc2005_platform_data tsc2005_config;
281 +static void rx51_tsc2005_set_reset(bool enable)
282 +{
283 + gpio_set_value(RX51_TSC2005_RESET_GPIO, enable);
284 +}
285
286 -static struct omap2_mcspi_device_config p54spi_mcspi_config = {
287 +static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
288 .turbo_mode = 0,
289 .single_channel = 1,
290 };
291 +#endif
292
293 static struct spi_board_info n800_spi_board_info[] __initdata = {
294 +#ifdef CONFIG_MACH_NOKIA_N8X0_LCD
295 + {
296 + .modalias = "lcd_mipid",
297 + .bus_num = 1,
298 + .chip_select = 1,
299 + .max_speed_hz = 4000000,
300 + .controller_data= &mipid_mcspi_config,
301 + .platform_data = &n8x0_mipid_platform_data,
302 + },
303 +#endif
304 {
305 .modalias = "p54spi",
306 .bus_num = 2,
307 @@ -149,6 +199,68 @@ static struct spi_board_info n800_spi_bo
308 .max_speed_hz = 48000000,
309 .controller_data = &p54spi_mcspi_config,
310 },
311 + {
312 + .modalias = "tsc2005",
313 + .bus_num = 1,
314 + .chip_select = 0,
315 + .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),
316 + .max_speed_hz = 6000000,
317 + .controller_data = &tsc2005_mcspi_config,
318 + .platform_data = &tsc2005_config,
319 + },
320 +};
321 +
322 +static void __init tsc2005_set_config(void)
323 +{
324 + const struct omap_lcd_config *conf;
325 +
326 + conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
327 + if (conf != NULL) {
328 +#ifdef CONFIG_TOUCHSCREEN_TSC2005
329 + if (strcmp(conf->panel_name, "lph8923") == 0) {
330 + tsc2005_config.ts_x_plate_ohm = 180;
331 + tsc2005_config.ts_hw_avg = 0;
332 + tsc2005_config.ts_ignore_last = 0;
333 + tsc2005_config.ts_touch_pressure = 1500;
334 + tsc2005_config.ts_stab_time = 100;
335 + tsc2005_config.ts_pressure_max = 2048;
336 + tsc2005_config.ts_pressure_fudge = 2;
337 + tsc2005_config.ts_x_max = 4096;
338 + tsc2005_config.ts_x_fudge = 4;
339 + tsc2005_config.ts_y_max = 4096;
340 + tsc2005_config.ts_y_fudge = 7;
341 + tsc2005_config.set_reset = rx51_tsc2005_set_reset;
342 + } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
343 + tsc2005_config.ts_x_plate_ohm = 280;
344 + tsc2005_config.ts_hw_avg = 0;
345 + tsc2005_config.ts_ignore_last = 0;
346 + tsc2005_config.ts_touch_pressure = 1500;
347 + tsc2005_config.ts_stab_time = 1000;
348 + tsc2005_config.ts_pressure_max = 2048;
349 + tsc2005_config.ts_pressure_fudge = 2;
350 + tsc2005_config.ts_x_max = 4096;
351 + tsc2005_config.ts_x_fudge = 4;
352 + tsc2005_config.ts_y_max = 4096;
353 + tsc2005_config.ts_y_fudge = 7;
354 + tsc2005_config.set_reset = rx51_tsc2005_set_reset;
355 + } else {
356 + printk(KERN_ERR "Unknown panel type, set default "
357 + "touchscreen configuration\n");
358 + tsc2005_config.ts_x_plate_ohm = 200;
359 + tsc2005_config.ts_stab_time = 100;
360 + }
361 +#endif
362 + }
363 +}
364 +
365 +static struct i2c_board_info __initdata_or_module n8x0_i2c_board_info_2[] = {};
366 +
367 +static struct i2c_board_info __initdata_or_module n810_i2c_board_info_2[] = {
368 + {
369 + I2C_BOARD_INFO("lm8323", 0x45),
370 + .irq = OMAP_GPIO_IRQ(109),
371 + .platform_data = &lm8323_pdata,
372 + },
373 };
374
375 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
376 @@ -183,6 +295,20 @@ static struct mtd_partition onenand_part
377 },
378 };
379
380 +static struct cbus_host_platform_data n8x0_cbus_data = {
381 + .clk_gpio = 66,
382 + .dat_gpio = 65,
383 + .sel_gpio = 64,
384 +};
385 +
386 +static struct platform_device n8x0_cbus_device = {
387 + .name = "cbus",
388 + .id = -1,
389 + .dev = {
390 + .platform_data = &n8x0_cbus_data,
391 + },
392 +};
393 +
394 static struct omap_onenand_platform_data board_onenand_data = {
395 .cs = 0,
396 .gpio_irq = 26,
397 @@ -659,15 +785,41 @@ static struct omap_board_mux board_mux[]
398 #define board_mux NULL
399 #endif
400
401 +#ifdef CONFIG_MACH_NOKIA_N8X0_LCD
402 +extern void n8x0_mipid_init(void);
403 +extern void n8x0_blizzard_init(void);
404 +#else
405 +#define n8x0_mipid_init() 0
406 +#define n8x0_blizzard_init() 0
407 +#endif
408 +
409 +extern void n8x0_usb_init(void);
410 +
411 static void __init n8x0_init_machine(void)
412 {
413 omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
414 +
415 + platform_device_register(&n8x0_cbus_device);
416 +
417 + n8x0_bt_init();
418 +
419 /* FIXME: add n810 spi devices */
420 + tsc2005_set_config();
421 spi_register_board_info(n800_spi_board_info,
422 ARRAY_SIZE(n800_spi_board_info));
423
424 omap_serial_init();
425 n8x0_menelaus_init();
426 +
427 + omap_register_i2c_bus(2, 400, n8x0_i2c_board_info_2,
428 + ARRAY_SIZE(n8x0_i2c_board_info_2));
429 +
430 + i2c_register_board_info(2, n810_i2c_board_info_2,
431 + ARRAY_SIZE(n810_i2c_board_info_2));
432 +
433 + n8x0_mipid_init();
434 + n8x0_blizzard_init();
435 +
436 n8x0_onenand_init();
437 n8x0_mmc_init();
438 n8x0_usb_init();
439 --- /dev/null
440 +++ linux-2.6.36-rc4/arch/arm/mach-omap2/board-n8x0-lcd.c
441 @@ -0,0 +1,127 @@
442 +/*
443 + * linux/arch/arm/mach-omap2/board-n8x0.c
444 + *
445 + * Copyright (C) 2005-2009 Nokia Corporation
446 + * Author: Juha Yrjola <juha.yrjola@nokia.com>
447 + *
448 + * Modified from mach-omap2/board-generic.c
449 + *
450 + * This program is free software; you can redistribute it and/or modify
451 + * it under the terms of the GNU General Public License version 2 as
452 + * published by the Free Software Foundation.
453 + */
454 +
455 +#include <linux/clk.h>
456 +#include <linux/delay.h>
457 +#include <linux/gpio.h>
458 +#include <linux/omapfb.h>
459 +
460 +#include <plat/lcd_mipid.h>
461 +#include <plat/blizzard.h>
462 +
463 +#include <../drivers/cbus/tahvo.h>
464 +
465 +#define N8X0_BLIZZARD_POWERDOWN_GPIO 15
466 +
467 +// MIPID LCD Panel
468 +
469 +static void mipid_shutdown(struct mipid_platform_data *pdata)
470 +{
471 + if (pdata->nreset_gpio != -1) {
472 + pr_info("shutdown LCD\n");
473 + gpio_set_value(pdata->nreset_gpio, 0);
474 + msleep(120);
475 + }
476 +}
477 +
478 +struct mipid_platform_data n8x0_mipid_platform_data = {
479 + .shutdown = mipid_shutdown,
480 +};
481 +
482 +void __init n8x0_mipid_init(void)
483 +{
484 + const struct omap_lcd_config *conf;
485 +
486 + conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
487 + if (conf != NULL) {
488 + n8x0_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
489 + n8x0_mipid_platform_data.data_lines = conf->data_lines;
490 + printk(KERN_INFO "N8x0 MIPID config loaded");
491 + }
492 + else
493 + printk(KERN_INFO "N8x0 MIPID config not provided");
494 +}
495 +
496 +
497 +// Epson Blizzard LCD Controller
498 +
499 +static struct {
500 + struct clk *sys_ck;
501 +} blizzard;
502 +
503 +static int blizzard_get_clocks(void)
504 +{
505 + blizzard.sys_ck = clk_get(0, "osc_ck");
506 + if (IS_ERR(blizzard.sys_ck)) {
507 + printk(KERN_ERR "can't get Blizzard clock\n");
508 + return PTR_ERR(blizzard.sys_ck);
509 + }
510 + return 0;
511 +}
512 +
513 +static unsigned long blizzard_get_clock_rate(struct device *dev)
514 +{
515 + return clk_get_rate(blizzard.sys_ck);
516 +}
517 +
518 +static void blizzard_enable_clocks(int enable)
519 +{
520 + if (enable)
521 + clk_enable(blizzard.sys_ck);
522 + else
523 + clk_disable(blizzard.sys_ck);
524 +}
525 +
526 +static void blizzard_power_up(struct device *dev)
527 +{
528 + /* Vcore to 1.475V */
529 + tahvo_set_clear_reg_bits(0x07, 0, 0xf);
530 + msleep(10);
531 +
532 + blizzard_enable_clocks(1);
533 + gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
534 +}
535 +
536 +static void blizzard_power_down(struct device *dev)
537 +{
538 + gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 0);
539 + blizzard_enable_clocks(0);
540 +
541 + /* Vcore to 1.005V */
542 + tahvo_set_clear_reg_bits(0x07, 0xf, 0);
543 +}
544 +
545 +static struct blizzard_platform_data n8x0_blizzard_data = {
546 + .power_up = blizzard_power_up,
547 + .power_down = blizzard_power_down,
548 + .get_clock_rate = blizzard_get_clock_rate,
549 + .te_connected = 1,
550 +};
551 +
552 +void __init n8x0_blizzard_init(void)
553 +{
554 + int r;
555 +
556 + r = gpio_request(N8X0_BLIZZARD_POWERDOWN_GPIO, "Blizzard pd");
557 + if (r < 0)
558 + {
559 + printk(KERN_ERR "Can't get N8x0 Blizzard powerdown GPIO %d\n", N8X0_BLIZZARD_POWERDOWN_GPIO);
560 + return;
561 + }
562 + gpio_direction_output(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
563 +
564 + blizzard_get_clocks();
565 + omapfb_set_ctrl_platform_data(&n8x0_blizzard_data);
566 +
567 + printk(KERN_INFO "N8x0 Blizzard initialized");
568 +}
569 --- /dev/null
570 +++ linux-2.6.36-rc4/arch/arm/mach-omap2/board-n8x0-usb.c
571 @@ -0,0 +1,175 @@
572 +/*
573 + * linux/arch/arm/mach-omap2/board-n8x0-usb.c
574 + *
575 + * Copyright (C) 2006 Nokia Corporation
576 + * Author: Juha Yrjola
577 + *
578 + * This program is free software; you can redistribute it and/or modify
579 + * it under the terms of the GNU General Public License version 2 as
580 + * published by the Free Software Foundation.
581 + */
582 +
583 +#include <linux/types.h>
584 +#include <linux/delay.h>
585 +#include <linux/platform_device.h>
586 +#include <linux/clk.h>
587 +#include <linux/err.h>
588 +#include <linux/gpio.h>
589 +#include <linux/usb/musb.h>
590 +
591 +#include <plat/gpmc.h>
592 +
593 +#define TUSB_ASYNC_CS 1
594 +#define TUSB_SYNC_CS 4
595 +#define GPIO_TUSB_INT 58
596 +#define GPIO_TUSB_ENABLE 0
597 +
598 +static int tusb_set_power(int state);
599 +static int tusb_set_clock(struct clk *osc_ck, int state);
600 +
601 +#if defined(CONFIG_USB_MUSB_OTG)
602 +# define BOARD_MODE MUSB_OTG
603 +#elif defined(CONFIG_USB_MUSB_PERIPHERAL)
604 +# define BOARD_MODE MUSB_PERIPHERAL
605 +#else /* defined(CONFIG_USB_MUSB_HOST) */
606 +# define BOARD_MODE MUSB_HOST
607 +#endif
608 +
609 +static struct musb_hdrc_eps_bits musb_eps[] = {
610 + { "ep1_tx", 5, },
611 + { "ep1_rx", 5, },
612 + { "ep2_tx", 5, },
613 + { "ep2_rx", 5, },
614 + { "ep3_tx", 3, },
615 + { "ep3_rx", 3, },
616 + { "ep4_tx", 3, },
617 + { "ep4_rx", 3, },
618 + { "ep5_tx", 2, },
619 + { "ep5_rx", 2, },
620 + { "ep6_tx", 2, },
621 + { "ep6_rx", 2, },
622 + { "ep7_tx", 2, },
623 + { "ep7_rx", 2, },
624 + { "ep8_tx", 2, },
625 + { "ep8_rx", 2, },
626 + { "ep9_tx", 2, },
627 + { "ep9_rx", 2, },
628 + { "ep10_tx", 2, },
629 + { "ep10_rx", 2, },
630 + { "ep11_tx", 2, },
631 + { "ep11_rx", 2, },
632 + { "ep12_tx", 2, },
633 + { "ep12_rx", 2, },
634 + { "ep13_tx", 2, },
635 + { "ep13_rx", 2, },
636 + { "ep14_tx", 2, },
637 + { "ep14_rx", 2, },
638 + { "ep15_tx", 2, },
639 + { "ep15_rx", 2, },
640 +};
641 +
642 +static struct musb_hdrc_config musb_config = {
643 + .multipoint = 1,
644 + .dyn_fifo = 1,
645 + .soft_con = 1,
646 + .dma = 1,
647 + .num_eps = 16,
648 + .dma_channels = 7,
649 + .ram_bits = 12,
650 + .eps_bits = musb_eps,
651 +};
652 +
653 +static struct musb_hdrc_platform_data tusb_data = {
654 + .mode = BOARD_MODE,
655 + .set_power = tusb_set_power,
656 + .set_clock = tusb_set_clock,
657 + .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
658 + .power = 100, /* Max 100 mA VBUS for host mode */
659 + .clock = "osc_ck",
660 + .config = &musb_config,
661 +};
662 +
663 +/*
664 + * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
665 + * 1.5 V voltage regulators of PM companion chip. Companion chip will then
666 + * provide then PGOOD signal to TUSB6010 which will release it from reset.
667 + */
668 +static int tusb_set_power(int state)
669 +{
670 + int i, retval = 0;
671 +
672 + if (state) {
673 + gpio_set_value(GPIO_TUSB_ENABLE, 1);
674 + msleep(1);
675 +
676 + /* Wait until TUSB6010 pulls INT pin down */
677 + i = 100;
678 + while (i && gpio_get_value(GPIO_TUSB_INT)) {
679 + msleep(1);
680 + i--;
681 + }
682 +
683 + if (!i) {
684 + printk(KERN_ERR "tusb: powerup failed\n");
685 + retval = -ENODEV;
686 + }
687 + } else {
688 + gpio_set_value(GPIO_TUSB_ENABLE, 0);
689 + msleep(10);
690 + }
691 +
692 + return retval;
693 +}
694 +
695 +static int osc_ck_on;
696 +
697 +static int tusb_set_clock(struct clk *osc_ck, int state)
698 +{
699 + if (state) {
700 + if (osc_ck_on > 0)
701 + return -ENODEV;
702 +
703 + //omap2_block_sleep();
704 + clk_enable(osc_ck);
705 + osc_ck_on = 1;
706 + } else {
707 + if (osc_ck_on == 0)
708 + return -ENODEV;
709 +
710 + clk_disable(osc_ck);
711 + osc_ck_on = 0;
712 + //omap2_allow_sleep();
713 + }
714 +
715 + return 0;
716 +}
717 +
718 +void __init n8x0_usb_init(void)
719 +{
720 + int ret = 0;
721 + static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
722 +
723 + /* PM companion chip power control pin */
724 + ret = gpio_request(GPIO_TUSB_ENABLE, "TUSB6010 enable");
725 + if (ret != 0) {
726 + printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
727 + GPIO_TUSB_ENABLE);
728 + return;
729 + }
730 + gpio_direction_output(GPIO_TUSB_ENABLE, 0);
731 +
732 + tusb_set_power(0);
733 +
734 + ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
735 + TUSB_ASYNC_CS, TUSB_SYNC_CS,
736 + GPIO_TUSB_INT, 0x3f);
737 + if (ret != 0)
738 + goto err;
739 +
740 + printk(announce);
741 +
742 + return;
743 +
744 +err:
745 + gpio_free(GPIO_TUSB_ENABLE);
746 +}
747 --- linux-2.6.36-rc4.orig/arch/arm/mach-omap2/control.c
748 +++ linux-2.6.36-rc4/arch/arm/mach-omap2/control.c
749 @@ -162,6 +162,7 @@ u16 omap_ctrl_readw(u16 offset)
750 return __raw_readw(OMAP_CTRL_REGADDR(offset));
751 }
752
753 +EXPORT_SYMBOL_GPL(omap_ctrl_readl);
754 u32 omap_ctrl_readl(u16 offset)
755 {
756 return __raw_readl(OMAP_CTRL_REGADDR(offset));
757 @@ -177,6 +178,7 @@ void omap_ctrl_writew(u16 val, u16 offse
758 __raw_writew(val, OMAP_CTRL_REGADDR(offset));
759 }
760
761 +EXPORT_SYMBOL_GPL(omap_ctrl_writel);
762 void omap_ctrl_writel(u32 val, u16 offset)
763 {
764 __raw_writel(val, OMAP_CTRL_REGADDR(offset));
765 --- linux-2.6.36-rc4.orig/arch/arm/mach-omap2/Kconfig
766 +++ linux-2.6.36-rc4/arch/arm/mach-omap2/Kconfig
767 @@ -189,6 +189,16 @@ config MACH_NOKIA_N8X0
768 select MACH_NOKIA_N810
769 select MACH_NOKIA_N810_WIMAX
770
771 +config MACH_NOKIA_N8X0_LCD
772 + bool
773 + depends on MACH_NOKIA_N8X0 && FB_OMAP_LCDC_BLIZZARD && FB_OMAP_LCD_MIPID
774 + default y
775 +
776 +config MACH_NOKIA_N8X0_USB
777 + bool
778 + depends on MACH_NOKIA_N8X0 && MACH_OMAP2_TUSB6010
779 + default y
780 +
781 config MACH_NOKIA_RX51
782 bool "Nokia RX-51 board"
783 depends on ARCH_OMAP3
784 --- linux-2.6.36-rc4.orig/arch/arm/mach-omap2/Makefile
785 +++ linux-2.6.36-rc4/arch/arm/mach-omap2/Makefile
786 @@ -125,6 +125,8 @@ obj-$(CONFIG_MACH_OMAP_3430SDP) += boar
787 hsmmc.o \
788 board-flash.o
789 obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o
790 +obj-$(CONFIG_MACH_NOKIA_N8X0_LCD) += board-n8x0-lcd.o
791 +obj-$(CONFIG_MACH_NOKIA_N8X0_USB) += board-n8x0-usb.o
792 obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \
793 board-rx51-sdram.o \
794 board-rx51-peripherals.o \
795 --- linux-2.6.36-rc4.orig/arch/arm/mach-omap2/serial.c
796 +++ linux-2.6.36-rc4/arch/arm/mach-omap2/serial.c
797 @@ -546,10 +546,10 @@ static void omap_uart_idle_init(struct o
798 uart->padconf = 0;
799 }
800
801 - p->irqflags |= IRQF_SHARED;
802 +/* p->irqflags |= IRQF_SHARED;
803 ret = request_irq(p->irq, omap_uart_interrupt, IRQF_SHARED,
804 "serial idle", (void *)uart);
805 - WARN_ON(ret);
806 + WARN_ON(ret); */
807 }
808
809 void omap_uart_enable_irqs(int enable)
810 @@ -557,13 +557,13 @@ void omap_uart_enable_irqs(int enable)
811 int ret;
812 struct omap_uart_state *uart;
813
814 - list_for_each_entry(uart, &uart_list, node) {
815 +/* list_for_each_entry(uart, &uart_list, node) {
816 if (enable)
817 ret = request_irq(uart->p->irq, omap_uart_interrupt,
818 IRQF_SHARED, "serial idle", (void *)uart);
819 else
820 free_irq(uart->p->irq, (void *)uart);
821 - }
822 + } */
823 }
824
825 static ssize_t sleep_timeout_show(struct device *dev,