]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/board-n800.c
Merge branch 'omap-fixes'
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / board-n800.c
1 /*
2  * linux/arch/arm/mach-omap2/board-n800.c
3  *
4  * Copyright (C) 2005-2007 Nokia Corporation
5  * Author: Juha Yrjola <juha.yrjola@nokia.com>
6  *
7  * Modified from mach-omap2/board-generic.c
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2 as
11  * published by the Free Software Foundation.
12  */
13
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16 #include <linux/clk.h>
17 #include <linux/device.h>
18 #include <linux/platform_device.h>
19 #include <linux/spi/spi.h>
20 #include <linux/spi/tsc2301.h>
21 #include <linux/spi/tsc2005.h>
22 #include <linux/input.h>
23 #include <linux/delay.h>
24 #include <linux/interrupt.h>
25 #include <linux/irq.h>
26 #include <linux/i2c.h>
27 #include <linux/i2c/lm8323.h>
28 #include <linux/i2c/menelaus.h>
29 #include <linux/i2c/lp5521.h>
30 #include <mach/hardware.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
34 #include <mach/gpio.h>
35 #include <mach/usb.h>
36 #include <mach/board.h>
37 #include <mach/common.h>
38 #include <mach/mcspi.h>
39 #include <mach/lcd_mipid.h>
40 #include <mach/clock.h>
41 #include <mach/gpio-switch.h>
42 #include <mach/omapfb.h>
43 #include <mach/blizzard.h>
44 #include <mach/board-nokia.h>
45
46 #include <../drivers/cbus/tahvo.h>
47 #include <../drivers/media/video/tcm825x.h>
48
49 #define N800_BLIZZARD_POWERDOWN_GPIO    15
50 #define N800_STI_GPIO                   62
51 #define N800_KEYB_IRQ_GPIO              109
52 #define N800_DAV_IRQ_GPIO               103
53 #define N800_TSC2301_RESET_GPIO         118
54
55 #ifdef CONFIG_MACH_NOKIA_N810
56 static s16 rx44_keymap[LM8323_KEYMAP_SIZE] = {
57         [0x01] = KEY_Q,
58         [0x02] = KEY_K,
59         [0x03] = KEY_O,
60         [0x04] = KEY_P,
61         [0x05] = KEY_BACKSPACE,
62         [0x06] = KEY_A,
63         [0x07] = KEY_S,
64         [0x08] = KEY_D,
65         [0x09] = KEY_F,
66         [0x0a] = KEY_G,
67         [0x0b] = KEY_H,
68         [0x0c] = KEY_J,
69
70         [0x11] = KEY_W,
71         [0x12] = KEY_F4,
72         [0x13] = KEY_L,
73         [0x14] = KEY_APOSTROPHE,
74         [0x16] = KEY_Z,
75         [0x17] = KEY_X,
76         [0x18] = KEY_C,
77         [0x19] = KEY_V,
78         [0x1a] = KEY_B,
79         [0x1b] = KEY_N,
80         [0x1c] = KEY_LEFTSHIFT, /* Actually, this is both shift keys */
81         [0x1f] = KEY_F7,
82
83         [0x21] = KEY_E,
84         [0x22] = KEY_SEMICOLON,
85         [0x23] = KEY_MINUS,
86         [0x24] = KEY_EQUAL,
87         [0x2b] = KEY_FN,
88         [0x2c] = KEY_M,
89         [0x2f] = KEY_F8,
90
91         [0x31] = KEY_R,
92         [0x32] = KEY_RIGHTCTRL,
93         [0x34] = KEY_SPACE,
94         [0x35] = KEY_COMMA,
95         [0x37] = KEY_UP,
96         [0x3c] = KEY_COMPOSE,
97         [0x3f] = KEY_F6,
98
99         [0x41] = KEY_T,
100         [0x44] = KEY_DOT,
101         [0x46] = KEY_RIGHT,
102         [0x4f] = KEY_F5,
103         [0x51] = KEY_Y,
104         [0x53] = KEY_DOWN,
105         [0x55] = KEY_ENTER,
106         [0x5f] = KEY_ESC,
107
108         [0x61] = KEY_U,
109         [0x64] = KEY_LEFT,
110
111         [0x71] = KEY_I,
112         [0x75] = KEY_KPENTER,
113 };
114
115 static struct lm8323_platform_data lm8323_pdata = {
116         .repeat         = 0, /* Repeat is handled in userspace for now. */
117         .keymap         = rx44_keymap,
118         .size_x         = 8,
119         .size_y         = 8,
120         .debounce_time  = 12,
121         .active_time    = 500,
122
123         .name           = "Internal keyboard",
124         .pwm1_name      = "n810::keyboard",
125         .pwm2_name      = "n810::cover",
126 };
127 #endif
128
129 void __init nokia_n800_init_irq(void)
130 {
131         omap2_init_common_hw(NULL);
132         omap_init_irq();
133         omap_gpio_init();
134
135 #ifdef CONFIG_OMAP_STI
136         if (gpio_request(N800_STI_GPIO, "STI") < 0) {
137                 printk(KERN_ERR "Failed to request GPIO %d for STI\n",
138                        N800_STI_GPIO);
139                 return;
140         }
141
142         gpio_direction_output(N800_STI_GPIO, 0);
143 #endif
144 }
145
146 #if defined(CONFIG_MENELAUS) && defined(CONFIG_SENSORS_TMP105)
147
148 static int n800_tmp105_set_power(int enable)
149 {
150         return menelaus_set_vaux(enable ? 2800 : 0);
151 }
152
153 #else
154
155 #define n800_tmp105_set_power NULL
156
157 #endif
158
159 static struct omap_uart_config n800_uart_config __initdata = {
160         .enabled_uarts = (1 << 0) | (1 << 2),
161 };
162
163 #include "../../../drivers/cbus/retu.h"
164
165 static struct omap_fbmem_config n800_fbmem0_config __initdata = {
166         .size = 752 * 1024,
167 };
168
169 static struct omap_fbmem_config n800_fbmem1_config __initdata = {
170         .size = 752 * 1024,
171 };
172
173 static struct omap_fbmem_config n800_fbmem2_config __initdata = {
174         .size = 752 * 1024,
175 };
176
177 static struct omap_tmp105_config n800_tmp105_config __initdata = {
178         .tmp105_irq_pin = 125,
179         .set_power = n800_tmp105_set_power,
180 };
181
182 static void mipid_shutdown(struct mipid_platform_data *pdata)
183 {
184         if (pdata->nreset_gpio != -1) {
185                 pr_info("shutdown LCD\n");
186                 gpio_set_value(pdata->nreset_gpio, 0);
187                 msleep(120);
188         }
189 }
190
191 static struct mipid_platform_data n800_mipid_platform_data = {
192         .shutdown = mipid_shutdown,
193 };
194
195 static void __init mipid_dev_init(void)
196 {
197         const struct omap_lcd_config *conf;
198
199         conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
200         if (conf != NULL) {
201                 n800_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
202                 n800_mipid_platform_data.data_lines = conf->data_lines;
203         }
204 }
205
206 static struct {
207         struct clk *sys_ck;
208 } blizzard;
209
210 static int blizzard_get_clocks(void)
211 {
212         blizzard.sys_ck = clk_get(0, "osc_ck");
213         if (IS_ERR(blizzard.sys_ck)) {
214                 printk(KERN_ERR "can't get Blizzard clock\n");
215                 return PTR_ERR(blizzard.sys_ck);
216         }
217         return 0;
218 }
219
220 static unsigned long blizzard_get_clock_rate(struct device *dev)
221 {
222         return clk_get_rate(blizzard.sys_ck);
223 }
224
225 static void blizzard_enable_clocks(int enable)
226 {
227         if (enable)
228                 clk_enable(blizzard.sys_ck);
229         else
230                 clk_disable(blizzard.sys_ck);
231 }
232
233 static void blizzard_power_up(struct device *dev)
234 {
235         /* Vcore to 1.475V */
236         tahvo_set_clear_reg_bits(0x07, 0, 0xf);
237         msleep(10);
238
239         blizzard_enable_clocks(1);
240         gpio_set_value(N800_BLIZZARD_POWERDOWN_GPIO, 1);
241 }
242
243 static void blizzard_power_down(struct device *dev)
244 {
245         gpio_set_value(N800_BLIZZARD_POWERDOWN_GPIO, 0);
246         blizzard_enable_clocks(0);
247
248         /* Vcore to 1.005V */
249         tahvo_set_clear_reg_bits(0x07, 0xf, 0);
250 }
251
252 static struct blizzard_platform_data n800_blizzard_data = {
253         .power_up       = blizzard_power_up,
254         .power_down     = blizzard_power_down,
255         .get_clock_rate = blizzard_get_clock_rate,
256         .te_connected   = 1,
257 };
258
259 static void __init blizzard_dev_init(void)
260 {
261         int r;
262
263         r = gpio_request(N800_BLIZZARD_POWERDOWN_GPIO, "Blizzard pd");
264         if (r < 0)
265                 return;
266         gpio_direction_output(N800_BLIZZARD_POWERDOWN_GPIO, 1);
267
268         blizzard_get_clocks();
269         omapfb_set_ctrl_platform_data(&n800_blizzard_data);
270 }
271
272 static struct omap_board_config_kernel n800_config[] __initdata = {
273         { OMAP_TAG_UART,                        &n800_uart_config },
274         { OMAP_TAG_FBMEM,                       &n800_fbmem0_config },
275         { OMAP_TAG_FBMEM,                       &n800_fbmem1_config },
276         { OMAP_TAG_FBMEM,                       &n800_fbmem2_config },
277         { OMAP_TAG_TMP105,                      &n800_tmp105_config },
278 };
279
280 static struct tsc2301_platform_data tsc2301_config = {
281         .reset_gpio     = N800_TSC2301_RESET_GPIO,
282         .keymap = {
283                 -1,             /* Event for bit 0 */
284                 KEY_UP,         /* Event for bit 1 (up) */
285                 KEY_F5,         /* Event for bit 2 (home) */
286                 -1,             /* Event for bit 3 */
287                 KEY_LEFT,       /* Event for bit 4 (left) */
288                 KEY_ENTER,      /* Event for bit 5 (enter) */
289                 KEY_RIGHT,      /* Event for bit 6 (right) */
290                 -1,             /* Event for bit 7 */
291                 KEY_ESC,        /* Event for bit 8 (cycle) */
292                 KEY_DOWN,       /* Event for bit 9 (down) */
293                 KEY_F4,         /* Event for bit 10 (menu) */
294                 -1,             /* Event for bit 11 */
295                 KEY_F8,         /* Event for bit 12 (Zoom-) */
296                 KEY_F6,         /* Event for bit 13 (FS) */
297                 KEY_F7,         /* Event for bit 14 (Zoom+) */
298                 -1,             /* Event for bit 15 */
299         },
300         .kp_rep         = 0,
301         .keyb_name      = "Internal keypad",
302 };
303
304 static void tsc2301_dev_init(void)
305 {
306         int r;
307         int gpio = N800_KEYB_IRQ_GPIO;
308
309         r = gpio_request(gpio, "tsc2301 KBD IRQ");
310         if (r >= 0) {
311                 gpio_direction_input(gpio);
312                 tsc2301_config.keyb_int = gpio_to_irq(gpio);
313         } else {
314                 printk(KERN_ERR "unable to get KBD GPIO");
315         }
316
317         gpio = N800_DAV_IRQ_GPIO;
318         r = gpio_request(gpio, "tsc2301 DAV IRQ");
319         if (r >= 0) {
320                 gpio_direction_input(gpio);
321                 tsc2301_config.dav_int = gpio_to_irq(gpio);
322         } else {
323                 printk(KERN_ERR "unable to get DAV GPIO");
324         }
325 }
326
327 static int __init tea5761_dev_init(void)
328 {
329         const struct omap_tea5761_config *info;
330         int enable_gpio = 0;
331
332         info = omap_get_config(OMAP_TAG_TEA5761, struct omap_tea5761_config);
333         if (info)
334                 enable_gpio = info->enable_gpio;
335
336         if (enable_gpio) {
337                 pr_debug("Enabling tea5761 at GPIO %d\n",
338                          enable_gpio);
339
340                 if (gpio_request(enable_gpio, "TEA5761 enable") < 0) {
341                         printk(KERN_ERR "Can't request GPIO %d\n",
342                                enable_gpio);
343                         return -ENODEV;
344                 }
345
346                 gpio_direction_output(enable_gpio, 0);
347                 udelay(50);
348                 gpio_set_value(enable_gpio, 1);
349         }
350
351         return 0;
352 }
353
354 static struct omap2_mcspi_device_config tsc2301_mcspi_config = {
355         .turbo_mode     = 0,
356         .single_channel = 1,
357 };
358
359 static struct omap2_mcspi_device_config mipid_mcspi_config = {
360         .turbo_mode     = 0,
361         .single_channel = 1,
362 };
363
364 static struct omap2_mcspi_device_config cx3110x_mcspi_config = {
365         .turbo_mode     = 0,
366         .single_channel = 1,
367 };
368
369 #ifdef CONFIG_TOUCHSCREEN_TSC2005
370 static struct tsc2005_platform_data tsc2005_config = {
371         .reset_gpio = 94,
372         .dav_gpio = 106
373 };
374
375 static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
376         .turbo_mode     = 0,
377         .single_channel = 1,
378 };
379 #endif
380
381 static struct spi_board_info n800_spi_board_info[] __initdata = {
382         {
383                 .modalias       = "lcd_mipid",
384                 .bus_num        = 1,
385                 .chip_select    = 1,
386                 .max_speed_hz   = 4000000,
387                 .controller_data= &mipid_mcspi_config,
388                 .platform_data  = &n800_mipid_platform_data,
389         }, {
390                 .modalias       = "cx3110x",
391                 .bus_num        = 2,
392                 .chip_select    = 0,
393                 .max_speed_hz   = 48000000,
394                 .controller_data= &cx3110x_mcspi_config,
395         },
396         {
397                 .modalias       = "tsc2301",
398                 .bus_num        = 1,
399                 .chip_select    = 0,
400                 .max_speed_hz   = 6000000,
401                 .controller_data= &tsc2301_mcspi_config,
402                 .platform_data  = &tsc2301_config,
403         },
404 };
405
406 static struct spi_board_info n810_spi_board_info[] __initdata = {
407         {
408                 .modalias        = "lcd_mipid",
409                 .bus_num         = 1,
410                 .chip_select     = 1,
411                 .max_speed_hz    = 4000000,
412                 .controller_data = &mipid_mcspi_config,
413                 .platform_data   = &n800_mipid_platform_data,
414         },
415         {
416                 .modalias        = "cx3110x",
417                 .bus_num         = 2,
418                 .chip_select     = 0,
419                 .max_speed_hz    = 48000000,
420                 .controller_data = &cx3110x_mcspi_config,
421         },
422         {
423                 .modalias        = "tsc2005",
424                 .bus_num         = 1,
425                 .chip_select     = 0,
426                 .max_speed_hz    = 6000000,
427                 .controller_data = &tsc2005_mcspi_config,
428                 .platform_data   = &tsc2005_config,
429         },
430 };
431
432 static void __init tsc2005_set_config(void)
433 {
434         const struct omap_lcd_config *conf;
435
436         conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
437         if (conf != NULL) {
438 #ifdef CONFIG_TOUCHSCREEN_TSC2005
439                 if (strcmp(conf->panel_name, "lph8923") == 0) {
440                         tsc2005_config.ts_x_plate_ohm = 180;
441                         tsc2005_config.ts_hw_avg = 0;
442                         tsc2005_config.ts_ignore_last = 0;
443                         tsc2005_config.ts_touch_pressure = 1500;
444                         tsc2005_config.ts_stab_time = 100;
445                         tsc2005_config.ts_pressure_max = 2048;
446                         tsc2005_config.ts_pressure_fudge = 2;
447                         tsc2005_config.ts_x_max = 4096;
448                         tsc2005_config.ts_x_fudge = 4;
449                         tsc2005_config.ts_y_max = 4096;
450                         tsc2005_config.ts_y_fudge = 7;
451                 } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
452                         tsc2005_config.ts_x_plate_ohm = 280;
453                         tsc2005_config.ts_hw_avg = 0;
454                         tsc2005_config.ts_ignore_last = 0;
455                         tsc2005_config.ts_touch_pressure = 1500;
456                         tsc2005_config.ts_stab_time = 1000;
457                         tsc2005_config.ts_pressure_max = 2048;
458                         tsc2005_config.ts_pressure_fudge = 2;
459                         tsc2005_config.ts_x_max = 4096;
460                         tsc2005_config.ts_x_fudge = 4;
461                         tsc2005_config.ts_y_max = 4096;
462                         tsc2005_config.ts_y_fudge = 7;
463                 } else {
464                         printk(KERN_ERR "Unknown panel type, set default "
465                                "touchscreen configuration\n");
466                         tsc2005_config.ts_x_plate_ohm = 200;
467                         tsc2005_config.ts_stab_time = 100;
468                 }
469 #endif
470         }
471 }
472
473 #if defined(CONFIG_CBUS_RETU) && defined(CONFIG_LEDS_OMAP_PWM)
474
475 void retu_keypad_led_set_power(struct omap_pwm_led_platform_data *self,
476                                int on_off)
477 {
478         if (on_off) {
479                 retu_write_reg(RETU_REG_CTRL_SET, 1 << 6);
480                 msleep(2);
481                 retu_write_reg(RETU_REG_CTRL_SET, 1 << 3);
482         } else {
483                 retu_write_reg(RETU_REG_CTRL_CLR, (1 << 6) | (1 << 3));
484         }
485 }
486
487 static struct omap_pwm_led_platform_data n800_keypad_led_data = {
488         .name = "keypad",
489         .intensity_timer = 10,
490         .blink_timer = 9,
491         .set_power = retu_keypad_led_set_power,
492 };
493
494 static struct platform_device n800_keypad_led_device = {
495         .name           = "omap_pwm_led",
496         .id             = -1,
497         .dev            = {
498                 .platform_data = &n800_keypad_led_data,
499         },
500 };
501 #endif
502
503 #if defined(CONFIG_TOUCHSCREEN_TSC2301)
504 static void __init n800_ts_set_config(void)
505 {
506         const struct omap_lcd_config *conf;
507
508         conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
509         if (conf != NULL) {
510                 if (strcmp(conf->panel_name, "lph8923") == 0) {
511                         tsc2301_config.ts_x_plate_ohm   = 180;
512                         tsc2301_config.ts_hw_avg        = 8;
513                         tsc2301_config.ts_max_pressure  = 2048;
514                         tsc2301_config.ts_touch_pressure = 400;
515                         tsc2301_config.ts_stab_time     = 100;
516                         tsc2301_config.ts_pressure_fudge = 2;
517                         tsc2301_config.ts_x_max         = 4096;
518                         tsc2301_config.ts_x_fudge       = 4;
519                         tsc2301_config.ts_y_max         = 4096;
520                         tsc2301_config.ts_y_fudge       = 7;
521                 } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
522                         tsc2301_config.ts_x_plate_ohm   = 280;
523                         tsc2301_config.ts_hw_avg        = 8;
524                         tsc2301_config.ts_touch_pressure = 400;
525                         tsc2301_config.ts_max_pressure  = 2048;
526                         tsc2301_config.ts_stab_time     = 1000;
527                         tsc2301_config.ts_pressure_fudge = 2;
528                         tsc2301_config.ts_x_max         = 4096;
529                         tsc2301_config.ts_x_fudge       = 4;
530                         tsc2301_config.ts_y_max         = 4096;
531                         tsc2301_config.ts_y_fudge       = 7;
532                 } else {
533                         printk(KERN_ERR "Unknown panel type, set default "
534                                "touchscreen configuration\n");
535                         tsc2301_config.ts_x_plate_ohm   = 200;
536                         tsc2301_config.ts_stab_time     = 100;
537                 }
538         }
539 }
540 #else
541 static inline void n800_ts_set_config(void)
542 {
543 }
544 #endif
545
546 static struct omap_gpio_switch n800_gpio_switches[] __initdata = {
547         {
548                 .name                   = "bat_cover",
549                 .gpio                   = -1,
550                 .debounce_rising        = 100,
551                 .debounce_falling       = 0,
552                 .notify                 = n800_mmc_slot1_cover_handler,
553                 .notify_data            = NULL,
554         }, {
555                 .name                   = "headphone",
556                 .gpio                   = -1,
557                 .debounce_rising        = 200,
558                 .debounce_falling       = 200,
559         }, {
560                 .name                   = "cam_act",
561                 .gpio                   = -1,
562                 .debounce_rising        = 200,
563                 .debounce_falling       = 200,
564         }, {
565                 .name                   = "cam_turn",
566                 .gpio                   = -1,
567                 .debounce_rising        = 100,
568                 .debounce_falling       = 100,
569         },
570 };
571
572 #if defined(CONFIG_CBUS_RETU_HEADSET)
573 static struct platform_device retu_headset_device = {
574         .name   = "retu-headset",
575         .id     = -1,
576 };
577 #endif
578
579 static struct platform_device *n800_devices[] __initdata = {
580 #if defined(CONFIG_CBUS_RETU) && defined(CONFIG_LEDS_OMAP_PWM)
581         &n800_keypad_led_device,
582 #endif
583 #if defined(CONFIG_CBUS_RETU_HEADSET)
584         &retu_headset_device,
585 #endif
586 };
587
588 #ifdef CONFIG_MENELAUS
589 static int n800_auto_sleep_regulators(void)
590 {
591         u32 val;
592         int ret;
593
594         val = EN_VPLL_SLEEP | EN_VMMC_SLEEP    \
595                 | EN_VAUX_SLEEP | EN_VIO_SLEEP \
596                 | EN_VMEM_SLEEP | EN_DC3_SLEEP \
597                 | EN_VC_SLEEP | EN_DC2_SLEEP;
598
599         ret = menelaus_set_regulator_sleep(1, val);
600         if (ret < 0) {
601                 printk(KERN_ERR "Could not set regulators to sleep on "
602                         "menelaus: %u\n", ret);
603                 return ret;
604         }
605         return 0;
606 }
607
608 static int n800_auto_voltage_scale(void)
609 {
610         int ret;
611
612         ret = menelaus_set_vcore_hw(1400, 1050);
613         if (ret < 0) {
614                 printk(KERN_ERR "Could not set VCORE voltage on "
615                         "menelaus: %u\n", ret);
616                 return ret;
617         }
618         return 0;
619 }
620
621 static int n800_menelaus_init(struct device *dev)
622 {
623         int ret;
624
625         ret = n800_auto_voltage_scale();
626         if (ret < 0)
627                 return ret;
628         ret = n800_auto_sleep_regulators();
629         if (ret < 0)
630                 return ret;
631         return 0;
632 }
633
634 static struct menelaus_platform_data n800_menelaus_platform_data = {
635         .late_init = n800_menelaus_init,
636 };
637 #endif
638
639 static struct i2c_board_info __initdata n800_i2c_board_info_1[] = {
640         {
641                 I2C_BOARD_INFO("menelaus", 0x72),
642                 .irq = INT_24XX_SYS_NIRQ,
643                 .platform_data = &n800_menelaus_platform_data,
644         },
645 };
646
647 static struct lp5521_platform_data n810_lp5521_platform_data = {
648         .mode           = LP5521_MODE_DIRECT_CONTROL,
649         .label          = "n810",
650         .red_present    = true,
651         .green_present  = true,
652         .blue_present   = true,
653 };
654
655 extern struct tcm825x_platform_data n800_tcm825x_platform_data;
656
657 static struct i2c_board_info __initdata_or_module n8x0_i2c_board_info_2[] = {
658         {
659                 I2C_BOARD_INFO(TCM825X_NAME, TCM825X_I2C_ADDR),
660 #if defined (CONFIG_VIDEO_TCM825X) || defined (CONFIG_VIDEO_TCM825X_MODULE)
661                 .platform_data = &n800_tcm825x_platform_data,
662 #endif
663         },
664 };
665
666
667 static struct i2c_board_info __initdata_or_module n800_i2c_board_info_2[] = {
668         {
669                 I2C_BOARD_INFO("tea5761", 0x10),
670         },
671 };
672
673 static struct i2c_board_info __initdata_or_module n810_i2c_board_info_2[] = {
674         {
675                 I2C_BOARD_INFO("lm8323", 0x45),
676                 .irq            = OMAP_GPIO_IRQ(109),
677                 .platform_data  = &lm8323_pdata,
678         },
679         {
680                 I2C_BOARD_INFO("tsl2563", 0x29),
681         },
682         {
683                 I2C_BOARD_INFO("lp5521", 0x32),
684                 .platform_data = &n810_lp5521_platform_data,
685         },
686 };
687
688 void __init nokia_n800_common_init(void)
689 {
690         platform_add_devices(n800_devices, ARRAY_SIZE(n800_devices));
691
692         n800_flash_init();
693         n800_mmc_init();
694         n800_bt_init();
695         n800_dsp_init();
696         n800_usb_init();
697         n800_cam_init();
698         if (machine_is_nokia_n800())
699                 spi_register_board_info(n800_spi_board_info,
700                                 ARRAY_SIZE(n800_spi_board_info));
701         if (machine_is_nokia_n810()) {
702                 tsc2005_set_config();
703                 spi_register_board_info(n810_spi_board_info,
704                                 ARRAY_SIZE(n810_spi_board_info));
705         }
706         omap_serial_init();
707         omap_register_i2c_bus(1, 400, n800_i2c_board_info_1,
708                               ARRAY_SIZE(n800_i2c_board_info_1));
709         omap_register_i2c_bus(2, 400, n8x0_i2c_board_info_2,
710                               ARRAY_SIZE(n8x0_i2c_board_info_2));
711         if (machine_is_nokia_n800())
712                 i2c_register_board_info(2, n800_i2c_board_info_2,
713                         ARRAY_SIZE(n800_i2c_board_info_2));
714         if (machine_is_nokia_n810())
715                 i2c_register_board_info(2, n810_i2c_board_info_2,
716                         ARRAY_SIZE(n810_i2c_board_info_2));
717                 
718         mipid_dev_init();
719         blizzard_dev_init();
720 }
721
722 static void __init nokia_n800_init(void)
723 {
724         nokia_n800_common_init();
725
726         n800_ts_set_config();
727         tsc2301_dev_init();
728         tea5761_dev_init();
729         omap_register_gpio_switches(n800_gpio_switches,
730                                     ARRAY_SIZE(n800_gpio_switches));
731 }
732
733 void __init nokia_n800_map_io(void)
734 {
735         omap_board_config = n800_config;
736         omap_board_config_size = ARRAY_SIZE(n800_config);
737
738         omap2_set_globals_242x();
739         omap2_map_common_io();
740 }
741
742 MACHINE_START(NOKIA_N800, "Nokia N800")
743         .phys_io        = 0x48000000,
744         .io_pg_offst    = ((0xd8000000) >> 18) & 0xfffc,
745         .boot_params    = 0x80000100,
746         .map_io         = nokia_n800_map_io,
747         .init_irq       = nokia_n800_init_irq,
748         .init_machine   = nokia_n800_init,
749         .timer          = &omap_timer,
750 MACHINE_END