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