2 * board-omap3pandora.c (Pandora Handheld Console)
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.
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.
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
20 #include <linux/init.h>
21 #include <linux/kernel.h>
22 #include <linux/platform_device.h>
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>
43 #include <asm/mach-types.h>
44 #include <asm/mach/arch.h>
45 #include <asm/mach/map.h>
47 #include <plat/board.h>
48 #include <plat/common.h>
49 #include <mach/hardware.h>
50 #include <plat/mcspi.h>
52 #include <video/omapdss.h>
53 #include <plat/nand.h>
56 #include "sdram-micron-mt46h32m32lf-6.h"
57 #include "sdram-micron-mt29c4g96mazapcjg-5.h"
59 #include "common-board-devices.h"
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
66 static struct mtd_partition omap3pandora_nand_partitions[] = {
70 .size = 4 * NAND_BLOCK_SIZE,
71 .mask_flags = MTD_WRITEABLE
74 .offset = MTDPART_OFS_APPEND,
75 .size = 15 * NAND_BLOCK_SIZE,
78 .offset = MTDPART_OFS_APPEND,
79 .size = 1 * NAND_BLOCK_SIZE,
82 .offset = MTDPART_OFS_APPEND,
83 .size = 80 * NAND_BLOCK_SIZE,
86 .offset = MTDPART_OFS_APPEND,
87 .size = MTDPART_SIZ_FULL,
91 static struct omap_nand_platform_data pandora_nand_data = {
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),
100 static struct gpio_led pandora_gpio_leds[] = {
102 .name = "pandora::sd1",
103 .default_trigger = "mmc0",
106 .name = "pandora::sd2",
107 .default_trigger = "mmc1",
110 .name = "pandora::bluetooth",
113 .name = "pandora::wifi",
118 static struct gpio_led_platform_data pandora_gpio_led_data = {
119 .leds = pandora_gpio_leds,
120 .num_leds = ARRAY_SIZE(pandora_gpio_leds),
123 static struct platform_device pandora_leds_gpio = {
127 .platform_data = &pandora_gpio_led_data,
131 static struct led_pwm pandora_pwm_leds[] = {
133 .name = "pandora::keypad_bl",
134 .pwm_id = 0, /* LEDA */
136 .name = "pandora::power",
137 .default_trigger = "default-on",
138 .pwm_id = 1, /* LEDB */
140 .name = "pandora::charger",
141 .default_trigger = "twl4030_bci-charging",
142 .pwm_id = 3, /* PWM1 */
146 static struct led_pwm_platform_data pandora_pwm_led_data = {
147 .leds = pandora_pwm_leds,
148 .num_leds = ARRAY_SIZE(pandora_pwm_leds),
151 static struct platform_device pandora_leds_pwm = {
152 .name = "leds-twl4030-pwm",
155 .platform_data = &pandora_pwm_led_data,
159 static struct platform_device pandora_bl = {
160 .name = "pandora-backlight",
164 #define GPIO_BUTTON(gpio_num, ev_type, ev_code, act_low, descr) \
169 .active_low = act_low, \
170 .debounce_interval = 4, \
171 .desc = "btn " descr, \
174 #define GPIO_BUTTON_LOW(gpio_num, event_code, description) \
175 GPIO_BUTTON(gpio_num, EV_KEY, event_code, 1, description)
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"),
197 static struct gpio_keys_platform_data pandora_gpio_key_info = {
198 .buttons = pandora_gpio_keys,
199 .nbuttons = ARRAY_SIZE(pandora_gpio_keys),
202 static struct platform_device pandora_keys_gpio = {
206 .platform_data = &pandora_gpio_key_info,
210 /* HACK: this requires patched twl4030_keypad driver */
211 #define FNKEY(row, col, code) KEY((row + 8), col, code)
213 static const uint32_t board_keymap[] = {
226 KEY(1, 5, KEY_SPACE),
227 KEY(2, 0, KEY_BACKSPACE),
253 KEY(7, 0, KEY_ENTER),
256 KEY(7, 3, KEY_LEFTSHIFT),
257 KEY(7, 4, KEY_COMMA),
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),
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),
273 FNKEY(2, 2, KEY_F15), /* dash */
274 FNKEY(2, 3, KEY_EQUAL),
275 FNKEY(2, 4, KEY_F16), /* # (pound/hash) */
277 FNKEY(3, 0, KEY_F11),
279 FNKEY(3, 2, KEY_F17), /* ! */
280 FNKEY(3, 3, KEY_KPPLUS),
281 FNKEY(3, 4, KEY_BACKSLASH),
282 FNKEY(4, 0, KEY_F12),
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) */
289 FNKEY(5, 2, KEY_LEFTBRACE),
290 FNKEY(5, 3, KEY_F19), /* " */
291 FNKEY(5, 4, KEY_SLASH),
292 FNKEY(6, 0, KEY_YEN),
294 FNKEY(6, 2, KEY_F20), /* @ */
295 FNKEY(6, 3, KEY_APOSTROPHE),
296 FNKEY(6, 4, KEY_F21), /* : */
297 FNKEY(7, 0, KEY_ENTER),
299 FNKEY(7, 2, KEY_ESC),
300 FNKEY(7, 3, KEY_CAPSLOCK),
301 FNKEY(7, 4, KEY_SEMICOLON),
304 static struct matrix_keymap_data board_map_data = {
305 .keymap = board_keymap,
306 .keymap_size = ARRAY_SIZE(board_keymap),
309 static struct twl4030_keypad_data pandora_kp_data = {
310 .keymap_data = &board_map_data,
316 static struct omap_dss_device pandora_lcd_device = {
318 .driver_name = "tpo_td043mtea1_panel",
319 .type = OMAP_DISPLAY_TYPE_DPI,
320 .phy.dpi.data_lines = 24,
324 static struct omap_dss_device pandora_tv_device = {
326 .driver_name = "venc",
327 .type = OMAP_DISPLAY_TYPE_VENC,
328 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
331 static struct omap_dss_device *pandora_dss_devices[] = {
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,
342 static void pandora_wl1251_init_card(struct mmc_card *card)
345 * We have TI wl1251 attached to MMC3. Pass this information to
346 * SDIO core because it can't be probed by normal methods.
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;
356 static struct omap2_hsmmc_info omap3pandora_mmc[] = {
359 .caps = MMC_CAP_4_BIT_DATA,
367 .caps = MMC_CAP_4_BIT_DATA,
376 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
379 .init_card = pandora_wl1251_init_card,
384 static int omap3pandora_twl_gpio_setup(struct device *dev,
385 unsigned gpio, unsigned ngpio)
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);
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");
398 pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret);
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,
412 static struct regulator_consumer_supply pandora_vmmc1_supply[] = {
413 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
416 static struct regulator_consumer_supply pandora_vmmc2_supply[] = {
417 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1")
420 static struct regulator_consumer_supply pandora_vmmc3_supply[] = {
421 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"),
424 static struct regulator_consumer_supply pandora_vdds_supplies[] = {
425 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
426 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
427 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
430 static struct regulator_consumer_supply pandora_vcc_lcd_supply[] = {
431 REGULATOR_SUPPLY("vcc", "display0"),
434 static struct regulator_consumer_supply pandora_usb_phy_supply[] = {
435 REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"),
438 /* ads7846 on SPI and 2 nub controllers on I2C */
439 static struct regulator_consumer_supply pandora_vaux4_supplies[] = {
440 REGULATOR_SUPPLY("vcc", "spi1.0"),
441 REGULATOR_SUPPLY("vcc", "3-0066"),
442 REGULATOR_SUPPLY("vcc", "3-0067"),
445 static struct regulator_consumer_supply pandora_adac_supply[] = {
446 REGULATOR_SUPPLY("vcc", "soc-audio"),
447 REGULATOR_SUPPLY("lidsw", NULL),
450 /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
451 static struct regulator_init_data pandora_vmmc1 = {
455 .valid_modes_mask = REGULATOR_MODE_NORMAL
456 | REGULATOR_MODE_STANDBY,
457 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
458 | REGULATOR_CHANGE_MODE
459 | REGULATOR_CHANGE_STATUS,
461 .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc1_supply),
462 .consumer_supplies = pandora_vmmc1_supply,
465 /* VMMC2 for MMC2 pins CMD, CLK, DAT0..DAT3 (max 100 mA) */
466 static struct regulator_init_data pandora_vmmc2 = {
470 .valid_modes_mask = REGULATOR_MODE_NORMAL
471 | REGULATOR_MODE_STANDBY,
472 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
473 | REGULATOR_CHANGE_MODE
474 | REGULATOR_CHANGE_STATUS,
476 .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc2_supply),
477 .consumer_supplies = pandora_vmmc2_supply,
481 static struct regulator_init_data pandora_vaux1 = {
486 .valid_modes_mask = REGULATOR_MODE_NORMAL
487 | REGULATOR_MODE_STANDBY,
488 .valid_ops_mask = REGULATOR_CHANGE_MODE
489 | REGULATOR_CHANGE_STATUS,
491 .num_consumer_supplies = ARRAY_SIZE(pandora_vcc_lcd_supply),
492 .consumer_supplies = pandora_vcc_lcd_supply,
495 /* VAUX2 for USB host PHY */
496 static struct regulator_init_data pandora_vaux2 = {
501 .valid_modes_mask = REGULATOR_MODE_NORMAL
502 | REGULATOR_MODE_STANDBY,
503 .valid_ops_mask = REGULATOR_CHANGE_MODE
504 | REGULATOR_CHANGE_STATUS,
506 .num_consumer_supplies = ARRAY_SIZE(pandora_usb_phy_supply),
507 .consumer_supplies = pandora_usb_phy_supply,
510 /* VAUX4 for ads7846 and nubs */
511 static struct regulator_init_data pandora_vaux4 = {
516 .valid_modes_mask = REGULATOR_MODE_NORMAL
517 | REGULATOR_MODE_STANDBY,
518 .valid_ops_mask = REGULATOR_CHANGE_MODE
519 | REGULATOR_CHANGE_STATUS,
521 .num_consumer_supplies = ARRAY_SIZE(pandora_vaux4_supplies),
522 .consumer_supplies = pandora_vaux4_supplies,
525 /* VSIM for audio DAC */
526 static struct regulator_init_data pandora_vsim = {
531 .valid_modes_mask = REGULATOR_MODE_NORMAL
532 | REGULATOR_MODE_STANDBY,
533 .valid_ops_mask = REGULATOR_CHANGE_MODE
534 | REGULATOR_CHANGE_STATUS,
536 .num_consumer_supplies = ARRAY_SIZE(pandora_adac_supply),
537 .consumer_supplies = pandora_adac_supply,
540 /* Fixed regulator internal to Wifi module */
541 static struct regulator_init_data pandora_vmmc3 = {
543 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
545 .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc3_supply),
546 .consumer_supplies = pandora_vmmc3_supply,
549 static struct fixed_voltage_config pandora_vwlan = {
550 .supply_name = "vwlan",
551 .microvolts = 1800000, /* 1.8V */
552 .gpio = PANDORA_WIFI_NRESET_GPIO,
553 .startup_delay = 50000, /* 50ms */
555 .enabled_at_boot = 0,
556 .init_data = &pandora_vmmc3,
559 static struct platform_device pandora_vwlan_device = {
560 .name = "reg-fixed-voltage",
563 .platform_data = &pandora_vwlan,
567 static char *pandora_power_supplied_to[] = {
571 static struct twl4030_bci_platform_data pandora_bci_data = {
572 .supplied_to = pandora_power_supplied_to,
573 .num_supplicants = ARRAY_SIZE(pandora_power_supplied_to),
576 static struct twl4030_power_data pandora_power_data = {
580 static struct twl4030_platform_data omap3pandora_twldata = {
581 .gpio = &omap3pandora_gpio_data,
582 .vmmc1 = &pandora_vmmc1,
583 .vmmc2 = &pandora_vmmc2,
584 .vaux1 = &pandora_vaux1,
585 .vaux2 = &pandora_vaux2,
586 .vaux4 = &pandora_vaux4,
587 .vsim = &pandora_vsim,
588 .keypad = &pandora_kp_data,
589 .bci = &pandora_bci_data,
590 .power = &pandora_power_data,
593 static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = {
595 I2C_BOARD_INFO("tps65950", 0x48),
596 .flags = I2C_CLIENT_WAKE,
597 .irq = INT_34XX_SYS_NIRQ,
598 .platform_data = &omap3pandora_twldata,
602 static struct vsense_platform_data omap3pandora_nub1_data = {
607 static struct vsense_platform_data omap3pandora_nub2_data = {
612 static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {
614 I2C_BOARD_INFO("vsense", 0x66),
615 .flags = I2C_CLIENT_WAKE,
616 .platform_data = &omap3pandora_nub1_data,
618 I2C_BOARD_INFO("vsense", 0x67),
619 .flags = I2C_CLIENT_WAKE,
620 .platform_data = &omap3pandora_nub2_data,
622 I2C_BOARD_INFO("bq27500", 0x55),
623 .flags = I2C_CLIENT_WAKE,
627 static int __init omap3pandora_i2c_init(void)
629 omap3_pmic_get_config(&omap3pandora_twldata,
630 TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_AUDIO,
631 TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
633 omap3pandora_twldata.vdac->constraints.apply_uV = true;
635 omap3pandora_twldata.vpll2->constraints.apply_uV = true;
636 omap3pandora_twldata.vpll2->num_consumer_supplies =
637 ARRAY_SIZE(pandora_vdds_supplies);
638 omap3pandora_twldata.vpll2->consumer_supplies = pandora_vdds_supplies;
640 omap3_pmic_init("tps65950", &omap3pandora_twldata);
641 /* i2c2 pins are not connected */
642 omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo,
643 ARRAY_SIZE(omap3pandora_i2c3_boardinfo));
647 static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
649 .modalias = "tpo_td043mtea1_panel_spi",
652 .max_speed_hz = 375000,
653 .platform_data = &pandora_lcd_device,
657 static void __init pandora_wl1251_init(void)
659 struct wl12xx_platform_data pandora_wl1251_pdata;
662 memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
664 ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq");
668 pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
669 if (pandora_wl1251_pdata.irq < 0)
672 pandora_wl1251_pdata.use_eeprom = true;
673 ret = wl12xx_set_platform_data(&pandora_wl1251_pdata);
680 gpio_free(PANDORA_WIFI_IRQ_GPIO);
682 printk(KERN_ERR "wl1251 board initialisation failed\n");
685 static void __init pandora_usb_host_init(void)
689 ret = gpio_request_one(PANDORA_EN_USB_5V_GPIO, GPIOF_OUT_INIT_HIGH,
692 pr_err("Cannot set vbus GPIO, ret=%d\n", ret);
695 #include <linux/spi/ads7846.h>
696 #include <asm/system.h>
698 static DECLARE_COMPLETION(ts_completion);
699 static struct timespec ts_last_framedone;
700 static int pendown_state;
702 static void vsync_irq_wait_handler(void *data, u32 mask)
704 getnstimeofday(&ts_last_framedone);
706 /* reliable to read here */
707 pendown_state = !gpio_get_value(OMAP3_PANDORA_TS_GPIO);
709 complete(&ts_completion);
712 static void ads7846_wait_for_sync(void)
714 struct timespec now, diff;
717 getnstimeofday(&now);
718 diff = timespec_sub(now, ts_last_framedone);
719 diff_us = diff.tv_nsec / NSEC_PER_USEC + diff.tv_sec * USEC_PER_SEC;
720 if (diff_us < 1023 || diff_us > 40000)
721 /* still blanking or display inactive */
724 /* wait for blanking period */
726 wait_for_completion_timeout(&ts_completion, HZ / 30);
730 static int pandora_pendown_state(void)
733 struct timespec now, diff;
738 /* This line is a noisy mess. It doesn't trigger spuriously, i.e.
739 * there is no signal when pen is up, but when it's down we have
740 * white noise of sorts. */
741 val = !gpio_get_value(OMAP3_PANDORA_TS_GPIO);
742 pendown_state |= val;
744 if (in_irq() || in_atomic())
745 /* no time to fight noise.. */
746 return val | pendown_state;
749 getnstimeofday(&now);
750 diff = timespec_sub(now, ts_last_framedone);
751 diff_us = diff.tv_nsec / NSEC_PER_USEC + diff.tv_sec * USEC_PER_SEC;
754 /* assume pendown_state is up-to-date */
760 if (val != val_old) {
761 init_completion(&ts_completion);
764 ret = omap_dispc_register_isr(vsync_irq_wait_handler,
765 NULL, DISPC_IRQ_VSYNC);
767 ret = omap_dispc_unregister_isr(vsync_irq_wait_handler,
768 NULL, DISPC_IRQ_VSYNC);
771 pr_err("%s: can't (un)register isr: %d %d\n",
779 static struct ads7846_platform_data pandora_ads7846_cfg = {
787 .gpio_pendown = OMAP3_PANDORA_TS_GPIO,
789 .wait_for_sync = ads7846_wait_for_sync,
790 .get_pendown_state = pandora_pendown_state,
793 static struct platform_device pandora_ram_console = {
794 .name = "ram_console",
798 static struct platform_device pandora_c64_tools = {
801 .coherent_dma_mask = DMA_BIT_MASK(32),
805 static struct platform_device *omap3pandora_devices[] __initdata = {
810 &pandora_vwlan_device,
811 &pandora_ram_console,
815 static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
817 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
818 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
819 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
822 .reset_gpio_port[0] = -EINVAL,
823 .reset_gpio_port[1] = 16,
824 .reset_gpio_port[2] = -EINVAL
827 #ifdef CONFIG_OMAP_MUX
828 static struct omap_board_mux board_mux[] __initdata = {
829 /* enable wakeup for pandora button (GPIO99) */
830 OMAP3_MUX(CAM_D0, OMAP_INPUT_EN | OMAP_WAKEUP_EN | OMAP_MUX_MODE4),
831 /* noisy unused signal from LCD cable */
832 OMAP3_MUX(CAM_VS, OMAP_INPUT_EN | OMAP_PULL_ENA | OMAP_PULL_UP | OMAP_MUX_MODE7),
833 { .reg_offset = OMAP_MUX_TERMINATOR },
837 static struct regulator *lid_switch_power;
839 #ifdef CONFIG_PM_SLEEP
840 static int pandora_pm_suspend(struct device *dev)
842 if (!IS_ERR_OR_NULL(lid_switch_power))
843 regulator_disable(lid_switch_power);
848 static int pandora_pm_resume(struct device *dev)
850 if (!IS_ERR_OR_NULL(lid_switch_power))
851 regulator_enable(lid_switch_power);
857 static SIMPLE_DEV_PM_OPS(pandora_pm, pandora_pm_suspend, pandora_pm_resume);
859 static int __devinit pandora_pm_probe(struct platform_device *pdev)
861 lid_switch_power = regulator_get(NULL, "lidsw");
862 if (!IS_ERR(lid_switch_power))
863 regulator_enable(lid_switch_power);
868 static struct platform_driver pandora_pm_driver = {
869 .probe = pandora_pm_probe,
871 .name = "pandora-pm",
876 static struct platform_device pandora_pm_dev = {
877 .name = "pandora-pm",
881 static int __init pandora_pm_drv_reg(void)
883 platform_device_register(&pandora_pm_dev);
884 return platform_driver_register(&pandora_pm_driver);
886 late_initcall(pandora_pm_drv_reg);
888 static void __init omap3pandora_init(void)
890 struct omap_sdrc_params *sdrc_params;
892 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
893 pandora_usb_host_init();
894 omap3pandora_i2c_init();
895 pandora_wl1251_init();
896 platform_add_devices(omap3pandora_devices,
897 ARRAY_SIZE(omap3pandora_devices));
898 omap_display_init(&pandora_dss_data);
901 sdrc_params = mt46h32m32lf6_sdrc_params;
902 if (cpu_is_omap3630() || omap_rev() >= OMAP3430_REV_ES3_0)
903 sdrc_params = mt29c4g96mazapcjg5_sdrc_params;
904 omap_sdrc_init(sdrc_params, sdrc_params);
906 spi_register_board_info(omap3pandora_spi_board_info,
907 ARRAY_SIZE(omap3pandora_spi_board_info));
908 omap_ads7846_init(1, OMAP3_PANDORA_TS_GPIO, 31, &pandora_ads7846_cfg);
909 usbhs_init(&usbhs_bdata);
911 gpmc_nand_init(&pandora_nand_data);
913 /* Ensure SDRC pins are mux'd for self-refresh */
914 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
915 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
918 /* HACK: create it here, so that others don't need to bother */
919 #ifdef CONFIG_PROC_FS
920 #include <linux/proc_fs.h>
922 static int __init proc_pandora_init(void)
924 struct proc_dir_entry *ret;
926 ret = proc_mkdir("pandora", NULL);
931 fs_initcall(proc_pandora_init);
935 #include <../drivers/staging/android/persistent_ram.h>
937 struct persistent_ram_descriptor ram_console_desc = {
938 .name = "ram_console",
942 struct persistent_ram ram_console_ram = {
946 .descs = &ram_console_desc,
949 void __init pandora_reserve(void)
952 dma_declare_contiguous(&pandora_c64_tools.dev, 4 * SZ_1M, 0x86000000, 0);
953 #ifdef CONFIG_ANDROID_PERSISTENT_RAM
954 persistent_ram_early_init(&ram_console_ram);
958 MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
959 .atag_offset = 0x100,
960 .reserve = pandora_reserve,
961 .map_io = omap3_map_io,
962 .init_early = omap35xx_init_early,
963 .init_irq = omap3_init_irq,
964 .init_machine = omap3pandora_init,
965 .timer = &omap3_timer,