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