pandora: defconfig: update
[pandora-kernel.git] / arch / arm / mach-omap2 / board-omap3pandora.c
1 /*
2  * board-omap3pandora.c (Pandora Handheld Console)
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * version 2 as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
16  * 02110-1301 USA
17  *
18  */
19
20 #include <linux/init.h>
21 #include <linux/kernel.h>
22 #include <linux/platform_device.h>
23
24 #include <linux/spi/spi.h>
25 #include <linux/regulator/machine.h>
26 #include <linux/i2c/twl.h>
27 #include <linux/wl12xx.h>
28 #include <linux/mtd/partitions.h>
29 #include <linux/mtd/nand.h>
30 #include <linux/leds.h>
31 #include <linux/leds_pwm.h>
32 #include <linux/input.h>
33 #include <linux/input/matrix_keypad.h>
34 #include <linux/gpio.h>
35 #include <linux/gpio_keys.h>
36 #include <linux/mmc/host.h>
37 #include <linux/mmc/card.h>
38 #include <linux/regulator/fixed.h>
39 #include <linux/i2c/vsense.h>
40 #include <linux/dma-mapping.h>
41 #include <linux/dma-contiguous.h>
42
43 #include <asm/mach-types.h>
44 #include <asm/mach/arch.h>
45 #include <asm/mach/map.h>
46
47 #include <plat/board.h>
48 #include <plat/common.h>
49 #include <mach/hardware.h>
50 #include <plat/mcspi.h>
51 #include <plat/usb.h>
52 #include <video/omapdss.h>
53 #include <plat/nand.h>
54
55 #include "mux.h"
56 #include "sdram-micron-mt46h32m32lf-6.h"
57 #include "sdram-micron-mt29c4g96mazapcjg-5.h"
58 #include "hsmmc.h"
59 #include "common-board-devices.h"
60
61 #define PANDORA_WIFI_IRQ_GPIO           21
62 #define PANDORA_WIFI_NRESET_GPIO        23
63 #define OMAP3_PANDORA_TS_GPIO           94
64 #define PANDORA_EN_USB_5V_GPIO          164
65
66 static struct mtd_partition omap3pandora_nand_partitions[] = {
67         {
68                 .name           = "xloader",
69                 .offset         = 0,
70                 .size           = 4 * NAND_BLOCK_SIZE,
71                 .mask_flags     = MTD_WRITEABLE
72         }, {
73                 .name           = "uboot",
74                 .offset         = MTDPART_OFS_APPEND,
75                 .size           = 15 * NAND_BLOCK_SIZE,
76         }, {
77                 .name           = "uboot-env",
78                 .offset         = MTDPART_OFS_APPEND,
79                 .size           = 1 * NAND_BLOCK_SIZE,
80         }, {
81                 .name           = "boot",
82                 .offset         = MTDPART_OFS_APPEND,
83                 .size           = 80 * NAND_BLOCK_SIZE,
84         }, {
85                 .name           = "rootfs",
86                 .offset         = MTDPART_OFS_APPEND,
87                 .size           = MTDPART_SIZ_FULL,
88         },
89 };
90
91 static struct omap_nand_platform_data pandora_nand_data = {
92         .cs             = 0,
93         .devsize        = NAND_BUSWIDTH_16,
94         .xfer_type      = NAND_OMAP_PREFETCH_DMA,
95         .parts          = omap3pandora_nand_partitions,
96         .nr_parts       = ARRAY_SIZE(omap3pandora_nand_partitions),
97         .dev_ready      = true,
98 };
99
100 static struct gpio_led pandora_gpio_leds[] = {
101         {
102                 .name                   = "pandora::sd1",
103                 .default_trigger        = "mmc0",
104                 .gpio                   = 128,
105         }, {
106                 .name                   = "pandora::sd2",
107                 .default_trigger        = "mmc1",
108                 .gpio                   = 129,
109         }, {
110                 .name                   = "pandora::bluetooth",
111                 .gpio                   = 158,
112         }, {
113                 .name                   = "pandora::wifi",
114                 .gpio                   = 159,
115         },
116 };
117
118 static struct gpio_led_platform_data pandora_gpio_led_data = {
119         .leds           = pandora_gpio_leds,
120         .num_leds       = ARRAY_SIZE(pandora_gpio_leds),
121 };
122
123 static struct platform_device pandora_leds_gpio = {
124         .name   = "leds-gpio",
125         .id     = -1,
126         .dev    = {
127                 .platform_data  = &pandora_gpio_led_data,
128         },
129 };
130
131 static struct led_pwm pandora_pwm_leds[] = {
132         {
133                 .name                   = "pandora::keypad_bl",
134                 .pwm_id                 = 0, /* LEDA */
135         }, {
136                 .name                   = "pandora::power",
137                 .default_trigger        = "default-on",
138                 .pwm_id                 = 1, /* LEDB */
139         }, {
140                 .name                   = "pandora::charger",
141                 .default_trigger        = "twl4030_bci-charging",
142                 .pwm_id                 = 3, /* PWM1 */
143         }
144 };
145
146 static struct led_pwm_platform_data pandora_pwm_led_data = {
147         .leds           = pandora_pwm_leds,
148         .num_leds       = ARRAY_SIZE(pandora_pwm_leds),
149 };
150
151 static struct platform_device pandora_leds_pwm = {
152         .name   = "leds-twl4030-pwm",
153         .id     = -1,
154         .dev    = {
155                 .platform_data  = &pandora_pwm_led_data,
156         },
157 };
158
159 static struct platform_device pandora_bl = {
160         .name   = "pandora-backlight",
161         .id     = -1,
162 };
163
164 #define GPIO_BUTTON(gpio_num, ev_type, ev_code, act_low, descr) \
165 {                                                               \
166         .gpio           = gpio_num,                             \
167         .type           = ev_type,                              \
168         .code           = ev_code,                              \
169         .active_low     = act_low,                              \
170         .debounce_interval = 4,                                 \
171         .desc           = "btn " descr,                         \
172 }
173
174 #define GPIO_BUTTON_LOW(gpio_num, event_code, description)      \
175         GPIO_BUTTON(gpio_num, EV_KEY, event_code, 1, description)
176
177 static struct gpio_keys_button pandora_gpio_keys[] = {
178         GPIO_BUTTON_LOW(110,    KEY_UP,         "up"),
179         GPIO_BUTTON_LOW(103,    KEY_DOWN,       "down"),
180         GPIO_BUTTON_LOW(96,     KEY_LEFT,       "left"),
181         GPIO_BUTTON_LOW(98,     KEY_RIGHT,      "right"),
182         GPIO_BUTTON_LOW(109,    KEY_PAGEUP,     "game 1"),
183         GPIO_BUTTON_LOW(111,    KEY_END,        "game 2"),
184         GPIO_BUTTON_LOW(106,    KEY_PAGEDOWN,   "game 3"),
185         GPIO_BUTTON_LOW(101,    KEY_HOME,       "game 4"),
186         GPIO_BUTTON_LOW(102,    KEY_RIGHTSHIFT, "l"),
187         GPIO_BUTTON_LOW(97,     KEY_KPPLUS,     "l2"),
188         GPIO_BUTTON_LOW(105,    KEY_RIGHTCTRL,  "r"),
189         GPIO_BUTTON_LOW(107,    KEY_KPMINUS,    "r2"),
190         GPIO_BUTTON_LOW(104,    KEY_LEFTCTRL,   "ctrl"),
191         GPIO_BUTTON_LOW(99,     KEY_MENU,       "menu"),
192         GPIO_BUTTON_LOW(176,    KEY_COFFEE,     "hold"),
193         GPIO_BUTTON(100, EV_KEY, KEY_LEFTALT, 0, "alt"),
194         GPIO_BUTTON(108, EV_SW, SW_LID, 1, "lid"),
195 };
196
197 static struct gpio_keys_platform_data pandora_gpio_key_info = {
198         .buttons        = pandora_gpio_keys,
199         .nbuttons       = ARRAY_SIZE(pandora_gpio_keys),
200 };
201
202 static struct platform_device pandora_keys_gpio = {
203         .name   = "gpio-keys",
204         .id     = -1,
205         .dev    = {
206                 .platform_data  = &pandora_gpio_key_info,
207         },
208 };
209
210 /* HACK: this requires patched twl4030_keypad driver */
211 #define FNKEY(row, col, code) KEY((row + 8), col, code)
212
213 static const uint32_t board_keymap[] = {
214         /* row, col, code */
215         KEY(0, 0, KEY_9),
216         KEY(0, 1, KEY_8),
217         KEY(0, 2, KEY_I),
218         KEY(0, 3, KEY_J),
219         KEY(0, 4, KEY_N),
220         KEY(0, 5, KEY_M),
221         KEY(1, 0, KEY_0),
222         KEY(1, 1, KEY_7),
223         KEY(1, 2, KEY_U),
224         KEY(1, 3, KEY_H),
225         KEY(1, 4, KEY_B),
226         KEY(1, 5, KEY_SPACE),
227         KEY(2, 0, KEY_BACKSPACE),
228         KEY(2, 1, KEY_6),
229         KEY(2, 2, KEY_Y),
230         KEY(2, 3, KEY_G),
231         KEY(2, 4, KEY_V),
232         KEY(2, 5, KEY_FN),
233         KEY(3, 0, KEY_O),
234         KEY(3, 1, KEY_5),
235         KEY(3, 2, KEY_T),
236         KEY(3, 3, KEY_F),
237         KEY(3, 4, KEY_C),
238         KEY(4, 0, KEY_P),
239         KEY(4, 1, KEY_4),
240         KEY(4, 2, KEY_R),
241         KEY(4, 3, KEY_D),
242         KEY(4, 4, KEY_X),
243         KEY(5, 0, KEY_K),
244         KEY(5, 1, KEY_3),
245         KEY(5, 2, KEY_E),
246         KEY(5, 3, KEY_S),
247         KEY(5, 4, KEY_Z),
248         KEY(6, 0, KEY_L),
249         KEY(6, 1, KEY_2),
250         KEY(6, 2, KEY_W),
251         KEY(6, 3, KEY_A),
252         KEY(6, 4, KEY_DOT),
253         KEY(7, 0, KEY_ENTER),
254         KEY(7, 1, KEY_1),
255         KEY(7, 2, KEY_Q),
256         KEY(7, 3, KEY_LEFTSHIFT),
257         KEY(7, 4, KEY_COMMA),
258         /* Fn keys */
259         FNKEY(0, 0, KEY_F9),
260         FNKEY(0, 1, KEY_F8),
261         FNKEY(0, 2, KEY_BRIGHTNESSUP),
262         FNKEY(0, 3, KEY_F13),           /* apostrophe, differs from Fn-A? */
263         FNKEY(0, 4, KEY_F22),
264         FNKEY(0, 5, KEY_F23),
265         FNKEY(1, 0, KEY_F10),
266         FNKEY(1, 1, KEY_F7),
267         FNKEY(1, 2, KEY_BRIGHTNESSDOWN),
268         FNKEY(1, 3, KEY_GRAVE),
269         FNKEY(1, 4, KEY_F14),           /* pipe/bar */
270         FNKEY(1, 5, KEY_TAB),
271         FNKEY(2, 0, KEY_INSERT),
272         FNKEY(2, 1, KEY_F6),
273         FNKEY(2, 2, KEY_F15),           /* dash */
274         FNKEY(2, 3, KEY_EQUAL),
275         FNKEY(2, 4, KEY_F16),           /* # (pound/hash) */
276         FNKEY(2, 5, KEY_FN),
277         FNKEY(3, 0, KEY_F11),
278         FNKEY(3, 1, KEY_F5),
279         FNKEY(3, 2, KEY_F17),           /* ! */
280         FNKEY(3, 3, KEY_KPPLUS),
281         FNKEY(3, 4, KEY_BACKSLASH),
282         FNKEY(4, 0, KEY_F12),
283         FNKEY(4, 1, KEY_F4),
284         FNKEY(4, 2, KEY_RIGHTBRACE),
285         FNKEY(4, 3, KEY_KPMINUS),
286         FNKEY(4, 4, KEY_QUESTION),
287         FNKEY(5, 0, KEY_F18),           /* Â£ (pound) */
288         FNKEY(5, 1, KEY_F3),
289         FNKEY(5, 2, KEY_LEFTBRACE),
290         FNKEY(5, 3, KEY_F19),           /* " */
291         FNKEY(5, 4, KEY_SLASH),
292         FNKEY(6, 0, KEY_YEN),
293         FNKEY(6, 1, KEY_F2),
294         FNKEY(6, 2, KEY_F20),           /* @ */
295         FNKEY(6, 3, KEY_APOSTROPHE),
296         FNKEY(6, 4, KEY_F21),           /* : */
297         FNKEY(7, 0, KEY_ENTER),
298         FNKEY(7, 1, KEY_F1),
299         FNKEY(7, 2, KEY_ESC),
300         FNKEY(7, 3, KEY_CAPSLOCK),
301         FNKEY(7, 4, KEY_SEMICOLON),
302 };
303
304 static struct matrix_keymap_data board_map_data = {
305         .keymap                 = board_keymap,
306         .keymap_size            = ARRAY_SIZE(board_keymap),
307 };
308
309 static struct twl4030_keypad_data pandora_kp_data = {
310         .keymap_data    = &board_map_data,
311         .rows           = 8,
312         .cols           = 6,
313         .rep            = 1,
314 };
315
316 static struct omap_dss_device pandora_lcd_device = {
317         .name                   = "lcd",
318         .driver_name            = "tpo_td043mtea1_panel",
319         .type                   = OMAP_DISPLAY_TYPE_DPI,
320         .phy.dpi.data_lines     = 24,
321         .reset_gpio             = 157,
322 };
323
324 static struct omap_dss_device pandora_tv_device = {
325         .name                   = "tv",
326         .driver_name            = "venc",
327         .type                   = OMAP_DISPLAY_TYPE_VENC,
328         .phy.venc.type          = OMAP_DSS_VENC_TYPE_SVIDEO,
329 };
330
331 static struct omap_dss_device *pandora_dss_devices[] = {
332         &pandora_lcd_device,
333         &pandora_tv_device,
334 };
335
336 static struct omap_dss_board_info pandora_dss_data = {
337         .num_devices    = ARRAY_SIZE(pandora_dss_devices),
338         .devices        = pandora_dss_devices,
339         .default_device = &pandora_lcd_device,
340 };
341
342 static void pandora_wl1251_init_card(struct mmc_card *card)
343 {
344         /*
345          * We have TI wl1251 attached to MMC3. Pass this information to
346          * SDIO core because it can't be probed by normal methods.
347          */
348         card->quirks |= MMC_QUIRK_NONSTD_SDIO;
349         card->cccr.wide_bus = 1;
350         card->cis.vendor = 0x104c;
351         card->cis.device = 0x9066;
352         card->cis.blksize = 512;
353         card->cis.max_dtr = 24000000;
354 }
355
356 static struct omap2_hsmmc_info omap3pandora_mmc[] = {
357         {
358                 .mmc            = 1,
359                 .caps           = MMC_CAP_4_BIT_DATA,
360                 .gpio_cd        = -EINVAL,
361                 //.gpio_wp      = 126,
362                 .gpio_wp        = -EINVAL,
363                 .ext_clock      = 0,
364         },
365         {
366                 .mmc            = 2,
367                 .caps           = MMC_CAP_4_BIT_DATA,
368                 .gpio_cd        = -EINVAL,
369                 //.gpio_wp      = 127,
370                 .gpio_wp        = -EINVAL,
371                 .ext_clock      = 1,
372                 .transceiver    = true,
373         },
374         {
375                 .mmc            = 3,
376                 .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
377                 .gpio_cd        = -EINVAL,
378                 .gpio_wp        = -EINVAL,
379                 .init_card      = pandora_wl1251_init_card,
380         },
381         {}      /* Terminator */
382 };
383
384 static int omap3pandora_twl_gpio_setup(struct device *dev,
385                 unsigned gpio, unsigned ngpio)
386 {
387         int ret, gpio_32khz;
388
389         /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */
390         omap3pandora_mmc[0].gpio_cd = gpio + 0;
391         omap3pandora_mmc[1].gpio_cd = gpio + 1;
392         omap2_hsmmc_init(omap3pandora_mmc);
393
394         /* gpio + 13 drives 32kHz buffer for wifi module */
395         gpio_32khz = gpio + 13;
396         ret = gpio_request_one(gpio_32khz, GPIOF_OUT_INIT_HIGH, "wifi 32kHz");
397         if (ret < 0) {
398                 pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret);
399                 return -ENODEV;
400         }
401
402         return 0;
403 }
404
405 static struct twl4030_gpio_platform_data omap3pandora_gpio_data = {
406         .gpio_base      = OMAP_MAX_GPIO_LINES,
407         .irq_base       = TWL4030_GPIO_IRQ_BASE,
408         .irq_end        = TWL4030_GPIO_IRQ_END,
409         .setup          = omap3pandora_twl_gpio_setup,
410         /* note: never set PU/PD for gpio2, it's connected to vaux2 */
411         .pulldowns      = BIT(8) | BIT(15) | BIT(16) | BIT(17),
412         .debounce       = BIT(0) | BIT(1),
413 };
414
415 static struct regulator_consumer_supply pandora_vmmc1_supply[] = {
416         REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
417 };
418
419 static struct regulator_consumer_supply pandora_vmmc2_supply[] = {
420         REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1")
421 };
422
423 static struct regulator_consumer_supply pandora_vmmc3_supply[] = {
424         REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"),
425 };
426
427 static struct regulator_consumer_supply pandora_vdds_supplies[] = {
428         REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
429         REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
430         REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
431 };
432
433 static struct regulator_consumer_supply pandora_vcc_lcd_supply[] = {
434         REGULATOR_SUPPLY("vcc", "display0"),
435         /* on non-CC units only, must be last */
436         REGULATOR_SUPPLY("vdd", "display0"),
437 };
438
439 static struct regulator_consumer_supply pandora_usb_phy_supply[] = {
440         REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"),
441 };
442
443 static struct regulator_consumer_supply pandora_exp_supply[] = {
444         REGULATOR_SUPPLY("exp", NULL),
445 };
446
447 /* ads7846 on SPI and 2 nub controllers on I2C */
448 static struct regulator_consumer_supply pandora_vaux4_supplies[] = {
449         REGULATOR_SUPPLY("vcc", "spi1.0"),
450         REGULATOR_SUPPLY("vcc", "3-0066"),
451         REGULATOR_SUPPLY("vcc", "3-0067"),
452 };
453
454 static struct regulator_consumer_supply pandora_adac_supply[] = {
455         REGULATOR_SUPPLY("vcc", "soc-audio"),
456         REGULATOR_SUPPLY("lidsw", NULL),
457 };
458
459 static struct regulator_consumer_supply pandora_5v_supplies[] = {
460         REGULATOR_SUPPLY("v5v_force", NULL),
461         REGULATOR_SUPPLY("vdd_amp", "soc-audio"),
462         REGULATOR_SUPPLY("hsusb1_vbus", "ehci-omap.0"),
463         REGULATOR_SUPPLY("vdd", "display0"), /* on CC units, must be last */
464 };
465
466 /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
467 static struct regulator_init_data pandora_vmmc1 = {
468         .constraints = {
469                 .min_uV                 = 1850000,
470                 .max_uV                 = 3150000,
471                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
472                                         | REGULATOR_MODE_STANDBY,
473                 .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
474                                         | REGULATOR_CHANGE_MODE
475                                         | REGULATOR_CHANGE_STATUS,
476         },
477         .num_consumer_supplies  = ARRAY_SIZE(pandora_vmmc1_supply),
478         .consumer_supplies      = pandora_vmmc1_supply,
479 };
480
481 /* VMMC2 for MMC2 pins CMD, CLK, DAT0..DAT3 (max 100 mA) */
482 static struct regulator_init_data pandora_vmmc2 = {
483         .constraints = {
484                 .min_uV                 = 1850000,
485                 .max_uV                 = 3150000,
486                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
487                                         | REGULATOR_MODE_STANDBY,
488                 .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
489                                         | REGULATOR_CHANGE_MODE
490                                         | REGULATOR_CHANGE_STATUS,
491         },
492         .num_consumer_supplies  = ARRAY_SIZE(pandora_vmmc2_supply),
493         .consumer_supplies      = pandora_vmmc2_supply,
494 };
495
496 /* VAUX1 for LCD */
497 static struct regulator_init_data pandora_vaux1 = {
498         .constraints = {
499                 .min_uV                 = 3000000,
500                 .max_uV                 = 3000000,
501                 .apply_uV               = true,
502                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
503                                         | REGULATOR_MODE_STANDBY,
504                 .valid_ops_mask         = REGULATOR_CHANGE_MODE
505                                         | REGULATOR_CHANGE_STATUS,
506         },
507         .num_consumer_supplies  = ARRAY_SIZE(pandora_vcc_lcd_supply),
508         .consumer_supplies      = pandora_vcc_lcd_supply,
509 };
510
511 /* VAUX2 for USB host PHY */
512 static struct regulator_init_data pandora_vaux2 = {
513         .constraints = {
514                 .min_uV                 = 1800000,
515                 .max_uV                 = 1800000,
516                 .apply_uV               = true,
517                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
518                                         | REGULATOR_MODE_STANDBY,
519                 .valid_ops_mask         = REGULATOR_CHANGE_MODE
520                                         | REGULATOR_CHANGE_STATUS,
521                 /* turning it off wastes power for unknown reason */
522                 .always_on              = true,
523         },
524         .num_consumer_supplies  = ARRAY_SIZE(pandora_usb_phy_supply),
525         .consumer_supplies      = pandora_usb_phy_supply,
526 };
527
528 /* VAUX3 goes to the expansion port */
529 static struct regulator_init_data pandora_vaux3 = {
530         .constraints = {
531                 .min_uV                 = 1500000,
532                 .max_uV                 = 3000000,
533                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
534                                         | REGULATOR_MODE_STANDBY,
535                 .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
536                                         | REGULATOR_CHANGE_MODE
537                                         | REGULATOR_CHANGE_STATUS,
538         },
539         .num_consumer_supplies  = ARRAY_SIZE(pandora_exp_supply),
540         .consumer_supplies      = pandora_exp_supply,
541 };
542
543 /* VAUX4 for ads7846 and nubs */
544 static struct regulator_init_data pandora_vaux4 = {
545         .constraints = {
546                 .min_uV                 = 3000000,
547                 .max_uV                 = 3000000,
548                 .apply_uV               = true,
549                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
550                                         | REGULATOR_MODE_STANDBY,
551                 .valid_ops_mask         = REGULATOR_CHANGE_MODE
552                                         | REGULATOR_CHANGE_STATUS,
553                 /* turning it off wastes power for unknown reason */
554                 .always_on              = true,
555         },
556         .num_consumer_supplies  = ARRAY_SIZE(pandora_vaux4_supplies),
557         .consumer_supplies      = pandora_vaux4_supplies,
558 };
559
560 /* VSIM for audio DAC */
561 static struct regulator_init_data pandora_vsim = {
562         .constraints = {
563                 .min_uV                 = 2800000,
564                 .max_uV                 = 2800000,
565                 .apply_uV               = true,
566                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
567                                         | REGULATOR_MODE_STANDBY,
568                 .valid_ops_mask         = REGULATOR_CHANGE_MODE
569                                         | REGULATOR_CHANGE_STATUS,
570         },
571         .num_consumer_supplies  = ARRAY_SIZE(pandora_adac_supply),
572         .consumer_supplies      = pandora_adac_supply,
573 };
574
575 /* REGEN enables the 5V supply */
576 static struct regulator_init_data pandora_regen = {
577         .constraints = {
578                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
579                                         | REGULATOR_MODE_STANDBY,
580                 .valid_ops_mask         = REGULATOR_CHANGE_MODE
581                                         | REGULATOR_CHANGE_STATUS,
582         },
583 };
584
585 /* 5V supply that feeds EHCI VBUS, audio amp, and (on CC only) the LCD */
586 static struct regulator_init_data pandora_v5v_data = {
587         .supply_regulator       = "REGEN",
588         .num_consumer_supplies  = ARRAY_SIZE(pandora_5v_supplies),
589         .consumer_supplies      = pandora_5v_supplies,
590 };
591
592 static struct fixed_voltage_config pandora_v5v = {
593         .supply_name            = "v5v",
594         .microvolts             = 5000000,
595         .gpio                   = -EINVAL,
596         .startup_delay          = 5000, /* just a guess */
597         .enabled_at_boot        = 1,
598         .init_data              = &pandora_v5v_data,
599 };
600
601 static struct platform_device pandora_v5v_device = {
602         .name           = "reg-fixed-voltage",
603         .id             = 0,
604         .dev = {
605                 .platform_data = &pandora_v5v,
606         },
607 };
608
609 /* Fixed regulator internal to Wifi module */
610 static struct regulator_init_data pandora_vmmc3 = {
611         .constraints = {
612                 .valid_ops_mask         = REGULATOR_CHANGE_STATUS,
613         },
614         .num_consumer_supplies  = ARRAY_SIZE(pandora_vmmc3_supply),
615         .consumer_supplies      = pandora_vmmc3_supply,
616 };
617
618 static struct fixed_voltage_config pandora_vwlan = {
619         .supply_name            = "vwlan",
620         .microvolts             = 1800000, /* 1.8V */
621         .gpio                   = PANDORA_WIFI_NRESET_GPIO,
622         .startup_delay          = 50000, /* 50ms */
623         .enable_high            = 1,
624         .enabled_at_boot        = 0,
625         .init_data              = &pandora_vmmc3,
626 };
627
628 static struct platform_device pandora_vwlan_device = {
629         .name           = "reg-fixed-voltage",
630         .id             = 1,
631         .dev = {
632                 .platform_data = &pandora_vwlan,
633         },
634 };
635
636 static char *pandora_power_supplied_to[] = {
637         "bq27500-0",
638 };
639
640 static struct twl4030_bci_platform_data pandora_bci_data = {
641         .supplied_to            = pandora_power_supplied_to,
642         .num_supplicants        = ARRAY_SIZE(pandora_power_supplied_to),
643 };
644
645 static struct twl4030_ins sleep_on_seq[] = {
646         { MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2 },
647 };
648
649 static struct twl4030_script sleep_on_script = {
650         .script = sleep_on_seq,
651         .size   = ARRAY_SIZE(sleep_on_seq),
652         .flags  = TWL4030_SLEEP_SCRIPT,
653 };
654
655 static struct twl4030_ins wakeup_p3_seq[] = {
656         { MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2 },
657 };
658
659 static struct twl4030_script wakeup_p3_script = {
660         .script = wakeup_p3_seq,
661         .size   = ARRAY_SIZE(wakeup_p3_seq),
662         .flags  = TWL4030_WAKEUP3_SCRIPT,
663 };
664
665 static struct twl4030_script *twl4030_scripts[] = {
666         /* wakeup script should be loaded before sleep script, otherwise a
667            board might hit retention before loading of wakeup script is
668            completed. This can cause boot failures depending on timing issues.
669         */
670         &wakeup_p3_script,
671         &sleep_on_script,
672 };
673
674 static struct twl4030_resconfig twl4030_rconfig[] = {
675         {
676                 .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
677                 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
678         },
679         { 0, 0},
680 };
681
682 static struct twl4030_power_data pandora_power_data = {
683         .scripts        = twl4030_scripts,
684         .num            = ARRAY_SIZE(twl4030_scripts),
685         .resource_config = twl4030_rconfig,
686
687         .use_poweroff   = 1,
688 };
689
690 static struct twl4030_platform_data omap3pandora_twldata = {
691         .gpio           = &omap3pandora_gpio_data,
692         .vmmc1          = &pandora_vmmc1,
693         .vmmc2          = &pandora_vmmc2,
694         .vaux1          = &pandora_vaux1,
695         .vaux2          = &pandora_vaux2,
696         .vaux3          = &pandora_vaux3,
697         .vaux4          = &pandora_vaux4,
698         .vsim           = &pandora_vsim,
699         .regen          = &pandora_regen,
700         .keypad         = &pandora_kp_data,
701         .bci            = &pandora_bci_data,
702         .power          = &pandora_power_data,
703
704         .dep_device     = &pandora_v5v_device,
705 };
706
707 static struct vsense_platform_data omap3pandora_nub1_data = {
708         .gpio_irq       = 161,
709         .gpio_reset     = 156,
710 };
711
712 static struct vsense_platform_data omap3pandora_nub2_data = {
713         .gpio_irq       = 162,
714         .gpio_reset     = 156,
715 };
716
717 static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {
718         {
719                 I2C_BOARD_INFO("vsense", 0x66),
720                 .flags = I2C_CLIENT_WAKE,
721                 .platform_data = &omap3pandora_nub1_data,
722         }, {
723                 I2C_BOARD_INFO("vsense", 0x67),
724                 .flags = I2C_CLIENT_WAKE,
725                 .platform_data = &omap3pandora_nub2_data,
726         }, {
727                 I2C_BOARD_INFO("bq27500", 0x55),
728                 .flags = I2C_CLIENT_WAKE,
729         },
730 };
731
732 static int __init omap3pandora_i2c_init(void)
733 {
734         omap3_pmic_get_config(&omap3pandora_twldata,
735                         TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_AUDIO,
736                         TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
737
738         omap3pandora_twldata.vdac->constraints.apply_uV = true;
739
740         omap3pandora_twldata.vpll2->constraints.apply_uV = true;
741         omap3pandora_twldata.vpll2->num_consumer_supplies =
742                                         ARRAY_SIZE(pandora_vdds_supplies);
743         omap3pandora_twldata.vpll2->consumer_supplies = pandora_vdds_supplies;
744
745         /* LCD vdd is connected differently on CC */
746         if (cpu_is_omap3630() || omap_rev() >= OMAP3430_REV_ES3_0)
747                 pandora_v5v_data.num_consumer_supplies--;
748         else
749                 pandora_vaux1.num_consumer_supplies--;
750
751         omap3_pmic_init("tps65950", &omap3pandora_twldata);
752         /* i2c2 pins are not connected */
753         omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo,
754                         ARRAY_SIZE(omap3pandora_i2c3_boardinfo));
755         return 0;
756 }
757
758 static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
759         {
760                 .modalias               = "tpo_td043mtea1_panel_spi",
761                 .bus_num                = 1,
762                 .chip_select            = 1,
763                 .max_speed_hz           = 375000,
764                 .platform_data          = &pandora_lcd_device,
765         }
766 };
767
768 static void __init pandora_wl1251_init(void)
769 {
770         struct wl12xx_platform_data pandora_wl1251_pdata;
771         int ret;
772
773         memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
774
775         ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq");
776         if (ret < 0)
777                 goto fail;
778
779         pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
780         if (pandora_wl1251_pdata.irq < 0)
781                 goto fail_irq;
782
783         pandora_wl1251_pdata.use_eeprom = true;
784         ret = wl12xx_set_platform_data(&pandora_wl1251_pdata);
785         if (ret < 0)
786                 goto fail_irq;
787
788         return;
789
790 fail_irq:
791         gpio_free(PANDORA_WIFI_IRQ_GPIO);
792 fail:
793         printk(KERN_ERR "wl1251 board initialisation failed\n");
794 }
795
796 static void __init pandora_usb_host_init(void)
797 {
798         int ret;
799
800         ret = gpio_request_one(PANDORA_EN_USB_5V_GPIO, GPIOF_OUT_INIT_HIGH,
801                 "ehci vbus");
802         if (ret < 0)
803                 pr_err("Cannot set vbus GPIO, ret=%d\n", ret);
804 }
805
806 #include <linux/spi/ads7846.h>
807 #include <asm/system.h>
808
809 static DECLARE_COMPLETION(ts_completion);
810 static struct timespec ts_last_framedone;
811 static int pendown_state;
812
813 static void vsync_irq_wait_handler(void *data, u32 mask)
814 {
815         getnstimeofday(&ts_last_framedone);
816
817         /* reliable to read here */
818         pendown_state = !gpio_get_value(OMAP3_PANDORA_TS_GPIO);
819
820         complete(&ts_completion);
821 }
822
823 static void ads7846_wait_for_sync(void)
824 {
825         struct timespec now, diff;
826         u32 diff_us;
827
828         getnstimeofday(&now);
829         diff = timespec_sub(now, ts_last_framedone);
830         diff_us = diff.tv_nsec / NSEC_PER_USEC + diff.tv_sec * USEC_PER_SEC;
831         if (diff_us < 1023 || diff_us > 40000)
832                 /* still blanking or display inactive */
833                 return;
834
835         /* wait for blanking period */
836         disable_hlt();
837         wait_for_completion_timeout(&ts_completion, HZ / 30);
838         enable_hlt();
839 }
840
841 static int pandora_pendown_state(void)
842 {
843         static int val_old;
844         struct timespec now, diff;
845         u32 diff_us;
846         int val;
847         int ret;
848         
849         /* This line is a noisy mess. It doesn't trigger spuriously, i.e.
850          * there is no signal when pen is up, but when it's down we have
851          * white noise of sorts. */
852         val = !gpio_get_value(OMAP3_PANDORA_TS_GPIO);
853         pendown_state |= val;
854
855         if (in_irq() || in_atomic())
856                 /* no time to fight noise.. */
857                 return val | pendown_state;
858
859         if (val == 0) {
860                 getnstimeofday(&now);
861                 diff = timespec_sub(now, ts_last_framedone);
862                 diff_us = diff.tv_nsec / NSEC_PER_USEC + diff.tv_sec * USEC_PER_SEC;
863
864                 if (diff_us < 40000)
865                         /* assume pendown_state is up-to-date */
866                         val = pendown_state;
867                 else
868                         pendown_state = 0;
869         }
870
871         if (val != val_old) {
872                 init_completion(&ts_completion);
873                 dispc_runtime_get();
874                 if (val)
875                         ret = omap_dispc_register_isr(vsync_irq_wait_handler,
876                                 NULL, DISPC_IRQ_VSYNC);
877                 else
878                         ret = omap_dispc_unregister_isr(vsync_irq_wait_handler,
879                                 NULL, DISPC_IRQ_VSYNC);
880                 dispc_runtime_put();
881                 if (ret != 0)
882                         pr_err("%s: can't (un)register isr: %d %d\n",
883                                 __func__, val, ret);
884                 val_old = val;
885         }
886
887         return val;
888 }
889
890 static struct ads7846_platform_data pandora_ads7846_cfg = {
891         .x_max                  = 0x0fff,
892         .y_max                  = 0x0fff,
893         .x_plate_ohms           = 180,
894         .pressure_max           = 255,
895         .debounce_max           = 10,
896         .debounce_tol           = 3,
897         .debounce_rep           = 1,
898         .gpio_pendown           = OMAP3_PANDORA_TS_GPIO,
899         .keep_vref_on           = 1,
900         .wait_for_sync          = ads7846_wait_for_sync,
901         .get_pendown_state      = pandora_pendown_state,
902 };
903
904 static struct platform_device pandora_ram_console = {
905         .name   = "ram_console",
906         .id     = -1,
907 };
908
909 static struct platform_device pandora_c64_tools = {
910         .name   = "c64_tools",
911         .dev    = {
912                 .coherent_dma_mask = DMA_BIT_MASK(32),
913         },
914 };
915
916 static struct platform_device *omap3pandora_devices[] __initdata = {
917         &pandora_leds_gpio,
918         &pandora_leds_pwm,
919         &pandora_bl,
920         &pandora_keys_gpio,
921         &pandora_vwlan_device,
922         &pandora_ram_console,
923         &pandora_c64_tools,
924 };
925
926 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
927
928         .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
929         .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
930         .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
931
932         .phy_reset  = true,
933         .reset_gpio_port[0]  = -EINVAL,
934         .reset_gpio_port[1]  = 16,
935         .reset_gpio_port[2]  = -EINVAL
936 };
937
938 #ifdef CONFIG_OMAP_MUX
939 static struct omap_board_mux board_mux[] __initdata = {
940         /* enable wakeup for pandora button (GPIO99) */
941         OMAP3_MUX(CAM_D0, OMAP_INPUT_EN | OMAP_WAKEUP_EN | OMAP_MUX_MODE4),
942         /* noisy unused signal from LCD cable */
943         OMAP3_MUX(CAM_VS, OMAP_INPUT_EN | OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_MUX_MODE7),
944         { .reg_offset = OMAP_MUX_TERMINATOR },
945 };
946 #endif
947
948 static struct regulator *lid_switch_power;
949 static struct regulator *v5v_power;
950 static struct regulator *exp_power;
951 static bool v5v_power_disable_needed;
952 static bool exp_power_disable_needed;
953 static struct delayed_work disable_regulators_work;
954
955 #ifdef CONFIG_PM_SLEEP
956 static int pandora_pm_suspend(struct device *dev)
957 {
958         if (!IS_ERR_OR_NULL(lid_switch_power))
959                 regulator_disable(lid_switch_power);
960
961         return 0;
962 }
963
964 static int pandora_pm_resume(struct device *dev)
965 {
966         if (!IS_ERR_OR_NULL(lid_switch_power))
967                 regulator_enable(lid_switch_power);
968
969         return 0;
970 }
971 #endif
972
973 static SIMPLE_DEV_PM_OPS(pandora_pm, pandora_pm_suspend, pandora_pm_resume);
974
975 static void pandora_disable_regulators(struct work_struct *work)
976 {
977         if (v5v_power_disable_needed)
978                 regulator_disable(v5v_power);
979
980         if (exp_power_disable_needed)
981                 regulator_disable(exp_power);
982 }
983
984 static int __devinit pandora_pm_probe(struct platform_device *pdev)
985 {
986         lid_switch_power = regulator_get(NULL, "lidsw");
987         if (!IS_ERR(lid_switch_power))
988                 regulator_enable(lid_switch_power);
989         else
990                 dev_err(&pdev->dev, "regulator_get lidsw: %ld\n",
991                         PTR_ERR(lid_switch_power));
992
993         /* if regulators are enabled by the bootloaders, take a reference and
994          * disable them later, after the boot scripts have a chance to
995          * reconfigure things if they want to, otherwise leave them off */
996         v5v_power = regulator_get(NULL, "v5v_force");
997         if (!IS_ERR(v5v_power)) {
998                 if (regulator_is_enabled(v5v_power) > 0) {
999                         v5v_power_disable_needed = true;
1000                         regulator_enable(v5v_power);
1001                 }
1002         }
1003         else {
1004                 dev_err(&pdev->dev, "regulator_get v5v_force: %ld\n",
1005                         PTR_ERR(v5v_power));
1006         }
1007
1008         exp_power = regulator_get(NULL, "exp");
1009         if (!IS_ERR(exp_power)) {
1010                 if (regulator_is_enabled(exp_power) > 0) {
1011                         exp_power_disable_needed = true;
1012                         regulator_enable(exp_power);
1013                 }
1014         }
1015         else {
1016                 dev_err(&pdev->dev, "regulator_get exp: %ld\n",
1017                         PTR_ERR(exp_power));
1018         }
1019
1020         INIT_DELAYED_WORK(&disable_regulators_work,
1021                 pandora_disable_regulators);
1022         schedule_delayed_work(&disable_regulators_work, 30 * HZ);
1023
1024         return 0;
1025 }
1026
1027 static struct platform_driver pandora_pm_driver = {
1028         .probe          = pandora_pm_probe,
1029         .driver         = {
1030                 .name   = "pandora-pm",
1031                 .pm     = &pandora_pm,
1032         },
1033 };
1034
1035 static struct platform_device pandora_pm_dev = {
1036         .name   = "pandora-pm",
1037         .id     = -1,
1038 };
1039
1040 static int __init pandora_pm_drv_reg(void)
1041 {
1042         platform_device_register(&pandora_pm_dev);
1043         return platform_driver_register(&pandora_pm_driver);
1044 }
1045 late_initcall(pandora_pm_drv_reg);
1046
1047 static void __init omap3pandora_init(void)
1048 {
1049         struct omap_sdrc_params *sdrc_params;
1050
1051         omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
1052         pandora_usb_host_init();
1053         omap3pandora_i2c_init();
1054         pandora_wl1251_init();
1055         platform_add_devices(omap3pandora_devices,
1056                         ARRAY_SIZE(omap3pandora_devices));
1057         omap_display_init(&pandora_dss_data);
1058         omap_serial_init();
1059
1060         sdrc_params = mt46h32m32lf6_sdrc_params;
1061         if (cpu_is_omap3630() || omap_rev() >= OMAP3430_REV_ES3_0)
1062                 sdrc_params = mt29c4g96mazapcjg5_sdrc_params;
1063         omap_sdrc_init(sdrc_params, sdrc_params);
1064
1065         spi_register_board_info(omap3pandora_spi_board_info,
1066                         ARRAY_SIZE(omap3pandora_spi_board_info));
1067         omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 31, &pandora_ads7846_cfg);
1068         usbhs_init(&usbhs_bdata);
1069         usb_musb_init(NULL);
1070         gpmc_nand_init(&pandora_nand_data);
1071
1072         /* Ensure SDRC pins are mux'd for self-refresh */
1073         omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
1074         omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
1075 }
1076
1077 #ifdef CONFIG_PROC_FS
1078 #include <linux/proc_fs.h>
1079 #include <linux/uaccess.h>
1080
1081 static bool v5v_power_proc_enabled;
1082 static bool exp_power_proc_enabled;
1083
1084 static int v5v_enable_read(char *page, char **start, off_t off,
1085                 int count, int *eof, void *data)
1086 {
1087         if (IS_ERR_OR_NULL(v5v_power))
1088                 return -ENODEV;
1089
1090         *eof = 1;
1091         return sprintf(page, "%d\n", v5v_power_proc_enabled);
1092 }
1093
1094 static int v5v_enable_write(struct file *file, const char __user *buffer,
1095                 unsigned long count, void *data)
1096 {
1097         char buff[32];
1098         long val;
1099         int ret;
1100
1101         if (IS_ERR_OR_NULL(v5v_power))
1102                 return -ENODEV;
1103
1104         count = strncpy_from_user(buff, buffer,
1105                         count < sizeof(buff) ? count : sizeof(buff) - 1);
1106         buff[count] = 0;
1107
1108         ret = strict_strtol(buff, 0, &val);
1109         if (ret < 0)
1110                 return ret;
1111
1112         val = !!val;
1113         if (val == v5v_power_proc_enabled)
1114                 return count;
1115         if (val)
1116                 ret = regulator_enable(v5v_power);
1117         else
1118                 ret = regulator_disable(v5v_power);
1119         if (ret < 0)
1120                 return ret;
1121
1122         v5v_power_proc_enabled = val;
1123         return count;
1124 }
1125
1126 static int exp_power_read(char *page, char **start, off_t off,
1127                 int count, int *eof, void *data)
1128 {
1129         int ret = 0;
1130
1131         if (IS_ERR_OR_NULL(exp_power))
1132                 return -ENODEV;
1133
1134         if (regulator_is_enabled(exp_power) > 0) {
1135                 ret = regulator_get_voltage(exp_power);
1136                 if (ret < 0)
1137                         return ret;
1138                 ret /= 1000;
1139         }
1140
1141         *eof = 1;
1142         return sprintf(page, "%d\n", ret);
1143 }
1144
1145 static int exp_power_write(struct file *file, const char __user *buffer,
1146                 unsigned long count, void *data)
1147 {
1148         char buff[32];
1149         bool enable;
1150         long val;
1151         int ret;
1152
1153         if (IS_ERR_OR_NULL(exp_power))
1154                 return -ENODEV;
1155
1156         count = strncpy_from_user(buff, buffer,
1157                         count < sizeof(buff) ? count : sizeof(buff) - 1);
1158         buff[count] = 0;
1159
1160         ret = strict_strtol(buff, 0, &val);
1161         if (ret < 0)
1162                 return ret;
1163
1164         if (val != 0) {
1165                 val *= 1000;
1166                 ret = regulator_set_voltage(exp_power, val, val);
1167                 if (ret < 0)
1168                         return ret;
1169         }
1170         enable = !!val;
1171         if (enable == exp_power_proc_enabled)
1172                 return count;
1173         if (enable)
1174                 ret = regulator_enable(exp_power);
1175         else
1176                 ret = regulator_disable(exp_power);
1177         if (ret < 0)
1178                 return ret;
1179
1180         exp_power_proc_enabled = enable;
1181         return count;
1182 }
1183
1184 static int __init proc_pandora_init(void)
1185 {
1186         struct proc_dir_entry *root, *ret;
1187
1188         /* HACK: create it here, so that others don't need to bother */
1189         root = proc_mkdir("pandora", NULL);
1190         if (root == NULL)
1191                 return -ENOMEM;
1192
1193         ret = create_proc_entry("always_enable_5v", S_IWUSR | S_IRUGO, root);
1194         if (ret != NULL) {
1195                 ret->read_proc = v5v_enable_read;
1196                 ret->write_proc = v5v_enable_write;
1197         }
1198
1199         ret = create_proc_entry("exp_power_mv", S_IWUSR | S_IRUGO, root);
1200         if (ret != NULL) {
1201                 ret->read_proc = exp_power_read;
1202                 ret->write_proc = exp_power_write;
1203         }
1204
1205         return 0;
1206 }
1207 fs_initcall(proc_pandora_init);
1208 #endif
1209
1210 /* for debug.. */
1211 #include <../drivers/staging/android/persistent_ram.h>
1212
1213 struct persistent_ram_descriptor ram_console_desc = {
1214         .name           = "ram_console",
1215         .size           = 0x20000,
1216 };
1217
1218 struct persistent_ram ram_console_ram = {
1219         .start          = 0x80fe0000,
1220         .size           = 0x20000,
1221         .num_descs      = 1,
1222         .descs          = &ram_console_desc,
1223 };
1224
1225 void __init pandora_reserve(void)
1226 {
1227         omap_reserve();
1228         dma_declare_contiguous(&pandora_c64_tools.dev, 4 * SZ_1M, 0x86000000, 0);
1229 #ifdef CONFIG_ANDROID_PERSISTENT_RAM
1230         persistent_ram_early_init(&ram_console_ram);
1231 #endif
1232 }
1233
1234 MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
1235         .atag_offset    = 0x100,
1236         .reserve        = pandora_reserve,
1237         .map_io         = omap3_map_io,
1238         .init_early     = omap35xx_init_early,
1239         .init_irq       = omap3_init_irq,
1240         .init_machine   = omap3pandora_init,
1241         .timer          = &omap3_timer,
1242 MACHINE_END