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