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