blob: a58bdef1b4da0628fc4fd923c01c72cd866b8030 [file] [log] [blame]
Grazvydas Ignotasda177242008-12-10 17:36:54 -08001/*
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/spi/ads7846.h>
Grazvydas Ignotas64f535a2009-05-28 14:04:04 -070026#include <linux/regulator/machine.h>
Santosh Shilimkarb07682b2009-12-13 20:05:51 +010027#include <linux/i2c/twl.h>
Grazvydas Ignotas79ccf542010-08-02 13:18:01 +030028#include <linux/spi/wl12xx.h>
29#include <linux/mtd/partitions.h>
30#include <linux/mtd/nand.h>
Grazvydas Ignotas74190452009-05-28 14:15:44 -070031#include <linux/leds.h>
32#include <linux/input.h>
Janusz Krzysztofik61354342009-10-22 14:43:17 -070033#include <linux/input/matrix_keypad.h>
Grazvydas Ignotas74190452009-05-28 14:15:44 -070034#include <linux/gpio_keys.h>
Grazvydas Ignotasda177242008-12-10 17:36:54 -080035
36#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
38#include <asm/mach/map.h>
39
Tony Lindgrence491cf2009-10-20 09:40:47 -070040#include <plat/board.h>
41#include <plat/common.h>
Grazvydas Ignotasda177242008-12-10 17:36:54 -080042#include <mach/gpio.h>
43#include <mach/hardware.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070044#include <plat/mcspi.h>
45#include <plat/usb.h>
Grazvydas Ignotas7b097892010-02-17 14:09:24 -080046#include <plat/display.h>
Grazvydas Ignotas79ccf542010-08-02 13:18:01 +030047#include <plat/nand.h>
Grazvydas Ignotasda177242008-12-10 17:36:54 -080048
Tony Lindgrenca5742b2009-12-11 16:16:32 -080049#include "mux.h"
Paul Walmsley2e12bd72009-05-28 14:03:59 -070050#include "sdram-micron-mt46h32m32lf-6.h"
Adrian Hunterd02a900b2010-02-15 10:03:34 -080051#include "hsmmc.h"
Tony Lindgren90c62bf2008-12-10 17:37:17 -080052
Grazvydas Ignotas79ccf542010-08-02 13:18:01 +030053#define PANDORA_WIFI_IRQ_GPIO 21
54#define PANDORA_WIFI_NRESET_GPIO 23
Grazvydas Ignotasda177242008-12-10 17:36:54 -080055#define OMAP3_PANDORA_TS_GPIO 94
56
Grazvydas Ignotas79ccf542010-08-02 13:18:01 +030057#define NAND_BLOCK_SIZE SZ_128K
58
59static struct mtd_partition omap3pandora_nand_partitions[] = {
60 {
61 .name = "xloader",
62 .offset = 0,
63 .size = 4 * NAND_BLOCK_SIZE,
64 .mask_flags = MTD_WRITEABLE
65 }, {
66 .name = "uboot",
67 .offset = MTDPART_OFS_APPEND,
68 .size = 15 * NAND_BLOCK_SIZE,
69 }, {
70 .name = "uboot-env",
71 .offset = MTDPART_OFS_APPEND,
72 .size = 1 * NAND_BLOCK_SIZE,
73 }, {
74 .name = "boot",
75 .offset = MTDPART_OFS_APPEND,
76 .size = 80 * NAND_BLOCK_SIZE,
77 }, {
78 .name = "rootfs",
79 .offset = MTDPART_OFS_APPEND,
80 .size = MTDPART_SIZ_FULL,
81 },
82};
83
84static struct omap_nand_platform_data pandora_nand_data = {
85 .cs = 0,
86 .devsize = 1, /* '0' for 8-bit, '1' for 16-bit device */
87 .parts = omap3pandora_nand_partitions,
88 .nr_parts = ARRAY_SIZE(omap3pandora_nand_partitions),
89};
90
Grazvydas Ignotas74190452009-05-28 14:15:44 -070091static struct gpio_led pandora_gpio_leds[] = {
92 {
93 .name = "pandora::sd1",
94 .default_trigger = "mmc0",
95 .gpio = 128,
96 }, {
97 .name = "pandora::sd2",
98 .default_trigger = "mmc1",
99 .gpio = 129,
100 }, {
101 .name = "pandora::bluetooth",
102 .gpio = 158,
103 }, {
104 .name = "pandora::wifi",
105 .gpio = 159,
106 },
107};
108
109static struct gpio_led_platform_data pandora_gpio_led_data = {
110 .leds = pandora_gpio_leds,
111 .num_leds = ARRAY_SIZE(pandora_gpio_leds),
112};
113
114static struct platform_device pandora_leds_gpio = {
115 .name = "leds-gpio",
116 .id = -1,
117 .dev = {
118 .platform_data = &pandora_gpio_led_data,
119 },
120};
121
122#define GPIO_BUTTON(gpio_num, ev_type, ev_code, act_low, descr) \
123{ \
124 .gpio = gpio_num, \
125 .type = ev_type, \
126 .code = ev_code, \
127 .active_low = act_low, \
Grazvydas Ignotasad74db62010-08-02 13:18:01 +0300128 .debounce_interval = 4, \
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700129 .desc = "btn " descr, \
130}
131
132#define GPIO_BUTTON_LOW(gpio_num, event_code, description) \
133 GPIO_BUTTON(gpio_num, EV_KEY, event_code, 1, description)
134
135static struct gpio_keys_button pandora_gpio_keys[] = {
136 GPIO_BUTTON_LOW(110, KEY_UP, "up"),
137 GPIO_BUTTON_LOW(103, KEY_DOWN, "down"),
138 GPIO_BUTTON_LOW(96, KEY_LEFT, "left"),
139 GPIO_BUTTON_LOW(98, KEY_RIGHT, "right"),
Grazvydas Ignotasad74db62010-08-02 13:18:01 +0300140 GPIO_BUTTON_LOW(109, KEY_PAGEUP, "game 1"),
141 GPIO_BUTTON_LOW(111, KEY_END, "game 2"),
142 GPIO_BUTTON_LOW(106, KEY_PAGEDOWN, "game 3"),
143 GPIO_BUTTON_LOW(101, KEY_HOME, "game 4"),
144 GPIO_BUTTON_LOW(102, KEY_RIGHTSHIFT, "l"),
145 GPIO_BUTTON_LOW(97, KEY_KPPLUS, "l2"),
146 GPIO_BUTTON_LOW(105, KEY_RIGHTCTRL, "r"),
147 GPIO_BUTTON_LOW(107, KEY_KPMINUS, "r2"),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700148 GPIO_BUTTON_LOW(104, KEY_LEFTCTRL, "ctrl"),
149 GPIO_BUTTON_LOW(99, KEY_MENU, "menu"),
150 GPIO_BUTTON_LOW(176, KEY_COFFEE, "hold"),
151 GPIO_BUTTON(100, EV_KEY, KEY_LEFTALT, 0, "alt"),
152 GPIO_BUTTON(108, EV_SW, SW_LID, 1, "lid"),
153};
154
155static struct gpio_keys_platform_data pandora_gpio_key_info = {
156 .buttons = pandora_gpio_keys,
157 .nbuttons = ARRAY_SIZE(pandora_gpio_keys),
158};
159
160static struct platform_device pandora_keys_gpio = {
161 .name = "gpio-keys",
162 .id = -1,
163 .dev = {
164 .platform_data = &pandora_gpio_key_info,
165 },
166};
167
Grazvydas Ignotasad74db62010-08-02 13:18:01 +0300168static const uint32_t board_keymap[] = {
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800169 /* row, col, code */
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700170 KEY(0, 0, KEY_9),
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800171 KEY(0, 1, KEY_8),
172 KEY(0, 2, KEY_I),
173 KEY(0, 3, KEY_J),
174 KEY(0, 4, KEY_N),
175 KEY(0, 5, KEY_M),
176 KEY(1, 0, KEY_0),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700177 KEY(1, 1, KEY_7),
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800178 KEY(1, 2, KEY_U),
179 KEY(1, 3, KEY_H),
180 KEY(1, 4, KEY_B),
181 KEY(1, 5, KEY_SPACE),
182 KEY(2, 0, KEY_BACKSPACE),
183 KEY(2, 1, KEY_6),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700184 KEY(2, 2, KEY_Y),
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800185 KEY(2, 3, KEY_G),
186 KEY(2, 4, KEY_V),
187 KEY(2, 5, KEY_FN),
188 KEY(3, 0, KEY_O),
189 KEY(3, 1, KEY_5),
190 KEY(3, 2, KEY_T),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700191 KEY(3, 3, KEY_F),
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800192 KEY(3, 4, KEY_C),
193 KEY(4, 0, KEY_P),
194 KEY(4, 1, KEY_4),
195 KEY(4, 2, KEY_R),
196 KEY(4, 3, KEY_D),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700197 KEY(4, 4, KEY_X),
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800198 KEY(5, 0, KEY_K),
199 KEY(5, 1, KEY_3),
200 KEY(5, 2, KEY_E),
201 KEY(5, 3, KEY_S),
202 KEY(5, 4, KEY_Z),
203 KEY(6, 0, KEY_L),
204 KEY(6, 1, KEY_2),
205 KEY(6, 2, KEY_W),
206 KEY(6, 3, KEY_A),
207 KEY(6, 4, KEY_DOT),
208 KEY(7, 0, KEY_ENTER),
209 KEY(7, 1, KEY_1),
210 KEY(7, 2, KEY_Q),
211 KEY(7, 3, KEY_LEFTSHIFT),
212 KEY(7, 4, KEY_COMMA),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700213};
214
Tony Lindgren4f543332009-09-24 16:23:16 -0700215static struct matrix_keymap_data board_map_data = {
216 .keymap = board_keymap,
217 .keymap_size = ARRAY_SIZE(board_keymap),
218};
219
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700220static struct twl4030_keypad_data pandora_kp_data = {
Tony Lindgren4f543332009-09-24 16:23:16 -0700221 .keymap_data = &board_map_data,
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700222 .rows = 8,
223 .cols = 6,
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700224 .rep = 1,
225};
226
Grazvydas Ignotas7b097892010-02-17 14:09:24 -0800227static struct omap_dss_device pandora_lcd_device = {
228 .name = "lcd",
229 .driver_name = "tpo_td043mtea1_panel",
230 .type = OMAP_DISPLAY_TYPE_DPI,
231 .phy.dpi.data_lines = 24,
232 .reset_gpio = 157,
233};
234
235static struct omap_dss_device pandora_tv_device = {
236 .name = "tv",
237 .driver_name = "venc",
238 .type = OMAP_DISPLAY_TYPE_VENC,
239 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
240};
241
242static struct omap_dss_device *pandora_dss_devices[] = {
243 &pandora_lcd_device,
244 &pandora_tv_device,
245};
246
247static struct omap_dss_board_info pandora_dss_data = {
248 .num_devices = ARRAY_SIZE(pandora_dss_devices),
249 .devices = pandora_dss_devices,
250 .default_device = &pandora_lcd_device,
251};
252
253static struct platform_device pandora_dss_device = {
254 .name = "omapdss",
255 .id = -1,
256 .dev = {
257 .platform_data = &pandora_dss_data,
258 },
259};
260
Adrian Hunter68ff0422010-02-15 10:03:34 -0800261static struct omap2_hsmmc_info omap3pandora_mmc[] = {
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800262 {
263 .mmc = 1,
264 .wires = 4,
265 .gpio_cd = -EINVAL,
266 .gpio_wp = 126,
267 .ext_clock = 0,
268 },
269 {
270 .mmc = 2,
271 .wires = 4,
272 .gpio_cd = -EINVAL,
273 .gpio_wp = 127,
274 .ext_clock = 1,
David Brownell0329c372009-03-23 18:23:47 -0700275 .transceiver = true,
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800276 },
Grazvydas Ignotas07d83cc2009-03-23 18:23:47 -0700277 {
278 .mmc = 3,
279 .wires = 4,
280 .gpio_cd = -EINVAL,
281 .gpio_wp = -EINVAL,
282 },
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800283 {} /* Terminator */
284};
285
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800286static int omap3pandora_twl_gpio_setup(struct device *dev,
287 unsigned gpio, unsigned ngpio)
288{
Grazvydas Ignotas79ccf542010-08-02 13:18:01 +0300289 int ret, gpio_32khz;
290
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800291 /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */
292 omap3pandora_mmc[0].gpio_cd = gpio + 0;
293 omap3pandora_mmc[1].gpio_cd = gpio + 1;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800294 omap2_hsmmc_init(omap3pandora_mmc);
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800295
Grazvydas Ignotas79ccf542010-08-02 13:18:01 +0300296 /* gpio + 13 drives 32kHz buffer for wifi module */
297 gpio_32khz = gpio + 13;
298 ret = gpio_request(gpio_32khz, "wifi 32kHz");
299 if (ret < 0) {
300 pr_err("Cannot get GPIO line %d, ret=%d\n", gpio_32khz, ret);
301 goto fail;
302 }
303
304 ret = gpio_direction_output(gpio_32khz, 1);
305 if (ret < 0) {
306 pr_err("Cannot set GPIO line %d, ret=%d\n", gpio_32khz, ret);
307 goto fail_direction;
308 }
309
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800310 return 0;
Grazvydas Ignotas79ccf542010-08-02 13:18:01 +0300311
312fail_direction:
313 gpio_free(gpio_32khz);
314fail:
315 return -ENODEV;
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800316}
317
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800318static struct twl4030_gpio_platform_data omap3pandora_gpio_data = {
319 .gpio_base = OMAP_MAX_GPIO_LINES,
320 .irq_base = TWL4030_GPIO_IRQ_BASE,
321 .irq_end = TWL4030_GPIO_IRQ_END,
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800322 .setup = omap3pandora_twl_gpio_setup,
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800323};
324
Grazvydas Ignotasf6873ee2010-02-17 14:09:25 -0800325static struct regulator_consumer_supply pandora_vmmc1_supply =
326 REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0");
327
328static struct regulator_consumer_supply pandora_vmmc2_supply =
329 REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1");
330
331static struct regulator_consumer_supply pandora_vdda_dac_supply =
332 REGULATOR_SUPPLY("vdda_dac", "omapdss");
333
334static struct regulator_consumer_supply pandora_vdds_supplies[] = {
335 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
336 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
337};
338
339static struct regulator_consumer_supply pandora_vcc_lcd_supply =
340 REGULATOR_SUPPLY("vcc", "display0");
341
342static struct regulator_consumer_supply pandora_usb_phy_supply =
343 REGULATOR_SUPPLY("hsusb0", "ehci-omap.0");
344
345/* ads7846 on SPI and 2 nub controllers on I2C */
346static struct regulator_consumer_supply pandora_vaux4_supplies[] = {
347 REGULATOR_SUPPLY("vcc", "spi1.0"),
348 REGULATOR_SUPPLY("vcc", "3-0066"),
349 REGULATOR_SUPPLY("vcc", "3-0067"),
350};
351
352static struct regulator_consumer_supply pandora_adac_supply =
353 REGULATOR_SUPPLY("vcc", "soc-audio");
354
Grazvydas Ignotas64f535a2009-05-28 14:04:04 -0700355/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
356static struct regulator_init_data pandora_vmmc1 = {
357 .constraints = {
358 .min_uV = 1850000,
359 .max_uV = 3150000,
360 .valid_modes_mask = REGULATOR_MODE_NORMAL
361 | REGULATOR_MODE_STANDBY,
362 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
363 | REGULATOR_CHANGE_MODE
364 | REGULATOR_CHANGE_STATUS,
365 },
366 .num_consumer_supplies = 1,
367 .consumer_supplies = &pandora_vmmc1_supply,
368};
369
370/* VMMC2 for MMC2 pins CMD, CLK, DAT0..DAT3 (max 100 mA) */
371static struct regulator_init_data pandora_vmmc2 = {
372 .constraints = {
373 .min_uV = 1850000,
374 .max_uV = 3150000,
375 .valid_modes_mask = REGULATOR_MODE_NORMAL
376 | REGULATOR_MODE_STANDBY,
377 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
378 | REGULATOR_CHANGE_MODE
379 | REGULATOR_CHANGE_STATUS,
380 },
381 .num_consumer_supplies = 1,
382 .consumer_supplies = &pandora_vmmc2_supply,
383};
384
Grazvydas Ignotas7b097892010-02-17 14:09:24 -0800385/* VDAC for DSS driving S-Video */
386static struct regulator_init_data pandora_vdac = {
387 .constraints = {
388 .min_uV = 1800000,
389 .max_uV = 1800000,
390 .apply_uV = true,
391 .valid_modes_mask = REGULATOR_MODE_NORMAL
392 | REGULATOR_MODE_STANDBY,
393 .valid_ops_mask = REGULATOR_CHANGE_MODE
394 | REGULATOR_CHANGE_STATUS,
395 },
396 .num_consumer_supplies = 1,
397 .consumer_supplies = &pandora_vdda_dac_supply,
398};
399
400/* VPLL2 for digital video outputs */
401static struct regulator_init_data pandora_vpll2 = {
402 .constraints = {
403 .min_uV = 1800000,
404 .max_uV = 1800000,
405 .apply_uV = true,
406 .valid_modes_mask = REGULATOR_MODE_NORMAL
407 | REGULATOR_MODE_STANDBY,
408 .valid_ops_mask = REGULATOR_CHANGE_MODE
409 | REGULATOR_CHANGE_STATUS,
410 },
411 .num_consumer_supplies = ARRAY_SIZE(pandora_vdds_supplies),
412 .consumer_supplies = pandora_vdds_supplies,
413};
414
415/* VAUX1 for LCD */
416static struct regulator_init_data pandora_vaux1 = {
417 .constraints = {
418 .min_uV = 3000000,
419 .max_uV = 3000000,
420 .apply_uV = true,
421 .valid_modes_mask = REGULATOR_MODE_NORMAL
422 | REGULATOR_MODE_STANDBY,
423 .valid_ops_mask = REGULATOR_CHANGE_MODE
424 | REGULATOR_CHANGE_STATUS,
425 },
426 .num_consumer_supplies = 1,
427 .consumer_supplies = &pandora_vcc_lcd_supply,
428};
429
Grazvydas Ignotasf6873ee2010-02-17 14:09:25 -0800430/* VAUX2 for USB host PHY */
431static struct regulator_init_data pandora_vaux2 = {
432 .constraints = {
433 .min_uV = 1800000,
434 .max_uV = 1800000,
435 .apply_uV = true,
436 .valid_modes_mask = REGULATOR_MODE_NORMAL
437 | REGULATOR_MODE_STANDBY,
438 .valid_ops_mask = REGULATOR_CHANGE_MODE
439 | REGULATOR_CHANGE_STATUS,
440 },
441 .num_consumer_supplies = 1,
442 .consumer_supplies = &pandora_usb_phy_supply,
443};
444
445/* VAUX4 for ads7846 and nubs */
446static struct regulator_init_data pandora_vaux4 = {
447 .constraints = {
448 .min_uV = 2800000,
449 .max_uV = 2800000,
450 .apply_uV = true,
451 .valid_modes_mask = REGULATOR_MODE_NORMAL
452 | REGULATOR_MODE_STANDBY,
453 .valid_ops_mask = REGULATOR_CHANGE_MODE
454 | REGULATOR_CHANGE_STATUS,
455 },
456 .num_consumer_supplies = ARRAY_SIZE(pandora_vaux4_supplies),
457 .consumer_supplies = pandora_vaux4_supplies,
458};
459
460/* VSIM for audio DAC */
461static struct regulator_init_data pandora_vsim = {
462 .constraints = {
463 .min_uV = 2800000,
464 .max_uV = 2800000,
465 .apply_uV = true,
466 .valid_modes_mask = REGULATOR_MODE_NORMAL
467 | REGULATOR_MODE_STANDBY,
468 .valid_ops_mask = REGULATOR_CHANGE_MODE
469 | REGULATOR_CHANGE_STATUS,
470 },
471 .num_consumer_supplies = 1,
472 .consumer_supplies = &pandora_adac_supply,
473};
474
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800475static struct twl4030_usb_data omap3pandora_usb_data = {
476 .usb_mode = T2_USB_MODE_ULPI,
477};
478
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300479static struct twl4030_codec_audio_data omap3pandora_audio_data = {
480 .audio_mclk = 26000000,
481};
482
483static struct twl4030_codec_data omap3pandora_codec_data = {
Peter Ujfalusi6df74ef2009-11-04 09:58:18 +0200484 .audio_mclk = 26000000,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300485 .audio = &omap3pandora_audio_data,
486};
487
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800488static struct twl4030_platform_data omap3pandora_twldata = {
489 .irq_base = TWL4030_IRQ_BASE,
490 .irq_end = TWL4030_IRQ_END,
491 .gpio = &omap3pandora_gpio_data,
492 .usb = &omap3pandora_usb_data,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300493 .codec = &omap3pandora_codec_data,
Grazvydas Ignotas64f535a2009-05-28 14:04:04 -0700494 .vmmc1 = &pandora_vmmc1,
495 .vmmc2 = &pandora_vmmc2,
Grazvydas Ignotas7b097892010-02-17 14:09:24 -0800496 .vdac = &pandora_vdac,
497 .vpll2 = &pandora_vpll2,
498 .vaux1 = &pandora_vaux1,
Grazvydas Ignotasf6873ee2010-02-17 14:09:25 -0800499 .vaux2 = &pandora_vaux2,
500 .vaux4 = &pandora_vaux4,
501 .vsim = &pandora_vsim,
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700502 .keypad = &pandora_kp_data,
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800503};
504
505static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = {
506 {
507 I2C_BOARD_INFO("tps65950", 0x48),
508 .flags = I2C_CLIENT_WAKE,
509 .irq = INT_34XX_SYS_NIRQ,
510 .platform_data = &omap3pandora_twldata,
511 },
512};
513
Grazvydas Ignotas03d56712010-03-10 11:13:53 +0000514static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = {
515 {
516 I2C_BOARD_INFO("bq27500", 0x55),
517 .flags = I2C_CLIENT_WAKE,
518 },
519};
520
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800521static int __init omap3pandora_i2c_init(void)
522{
523 omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo,
524 ARRAY_SIZE(omap3pandora_i2c_boardinfo));
525 /* i2c2 pins are not connected */
Grazvydas Ignotas03d56712010-03-10 11:13:53 +0000526 omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo,
527 ARRAY_SIZE(omap3pandora_i2c3_boardinfo));
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800528 return 0;
529}
530
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800531static void __init omap3pandora_ads7846_init(void)
532{
533 int gpio = OMAP3_PANDORA_TS_GPIO;
534 int ret;
535
536 ret = gpio_request(gpio, "ads7846_pen_down");
537 if (ret < 0) {
538 printk(KERN_ERR "Failed to request GPIO %d for "
539 "ads7846 pen down IRQ\n", gpio);
540 return;
541 }
542
543 gpio_direction_input(gpio);
544}
545
546static int ads7846_get_pendown_state(void)
547{
548 return !gpio_get_value(OMAP3_PANDORA_TS_GPIO);
549}
550
551static struct ads7846_platform_data ads7846_config = {
552 .x_max = 0x0fff,
553 .y_max = 0x0fff,
554 .x_plate_ohms = 180,
555 .pressure_max = 255,
556 .debounce_max = 10,
557 .debounce_tol = 3,
558 .debounce_rep = 1,
559 .get_pendown_state = ads7846_get_pendown_state,
560 .keep_vref_on = 1,
561};
562
563static struct omap2_mcspi_device_config ads7846_mcspi_config = {
564 .turbo_mode = 0,
565 .single_channel = 1, /* 0: slave, 1: master */
566};
567
568static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
569 {
570 .modalias = "ads7846",
571 .bus_num = 1,
572 .chip_select = 0,
573 .max_speed_hz = 1500000,
574 .controller_data = &ads7846_mcspi_config,
575 .irq = OMAP_GPIO_IRQ(OMAP3_PANDORA_TS_GPIO),
576 .platform_data = &ads7846_config,
Grazvydas Ignotas7b097892010-02-17 14:09:24 -0800577 }, {
578 .modalias = "tpo_td043mtea1_panel_spi",
579 .bus_num = 1,
580 .chip_select = 1,
581 .max_speed_hz = 375000,
582 .platform_data = &pandora_lcd_device,
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800583 }
584};
585
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300586static void __init omap3pandora_init_irq(void)
587{
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300588 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
589 mt46h32m32lf6_sdrc_params);
590 omap_init_irq();
591 omap_gpio_init();
592}
593
Grazvydas Ignotas79ccf542010-08-02 13:18:01 +0300594static void pandora_wl1251_set_power(bool enable)
595{
596 /*
597 * Keep power always on until wl1251_sdio driver learns to re-init
598 * the chip after powering it down and back up.
599 */
600}
601
602static struct wl12xx_platform_data pandora_wl1251_pdata = {
603 .set_power = pandora_wl1251_set_power,
604 .use_eeprom = true,
605};
606
607static struct platform_device pandora_wl1251_data = {
608 .name = "wl1251_data",
609 .id = -1,
610 .dev = {
611 .platform_data = &pandora_wl1251_pdata,
612 },
613};
614
615static void pandora_wl1251_init(void)
616{
617 int ret;
618
619 ret = gpio_request(PANDORA_WIFI_IRQ_GPIO, "wl1251 irq");
620 if (ret < 0)
621 goto fail;
622
623 ret = gpio_direction_input(PANDORA_WIFI_IRQ_GPIO);
624 if (ret < 0)
625 goto fail_irq;
626
627 pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO);
628 if (pandora_wl1251_pdata.irq < 0)
629 goto fail_irq;
630
631 ret = gpio_request(PANDORA_WIFI_NRESET_GPIO, "wl1251 nreset");
632 if (ret < 0)
633 goto fail_irq;
634
635 /* start powered so that it probes with MMC subsystem */
636 ret = gpio_direction_output(PANDORA_WIFI_NRESET_GPIO, 1);
637 if (ret < 0)
638 goto fail_nreset;
639
640 return;
641
642fail_nreset:
643 gpio_free(PANDORA_WIFI_NRESET_GPIO);
644fail_irq:
645 gpio_free(PANDORA_WIFI_IRQ_GPIO);
646fail:
647 printk(KERN_ERR "wl1251 board initialisation failed\n");
648}
649
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800650static struct platform_device *omap3pandora_devices[] __initdata = {
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700651 &pandora_leds_gpio,
652 &pandora_keys_gpio,
Grazvydas Ignotas7b097892010-02-17 14:09:24 -0800653 &pandora_dss_device,
Grazvydas Ignotas79ccf542010-08-02 13:18:01 +0300654 &pandora_wl1251_data,
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800655};
656
Felipe Balbi6f69a182010-03-04 09:45:53 +0200657static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
Felipe Balbi58a54912009-11-22 10:11:01 -0800658
659 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
660 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
661 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
662
663 .phy_reset = true,
664 .reset_gpio_port[0] = 16,
665 .reset_gpio_port[1] = -EINVAL,
666 .reset_gpio_port[2] = -EINVAL
667};
668
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800669#ifdef CONFIG_OMAP_MUX
670static struct omap_board_mux board_mux[] __initdata = {
671 { .reg_offset = OMAP_MUX_TERMINATOR },
672};
673#else
674#define board_mux NULL
675#endif
676
Maulik Mankad884b8362010-02-17 14:09:30 -0800677static struct omap_musb_board_data musb_board_data = {
678 .interface_type = MUSB_INTERFACE_ULPI,
679 .mode = MUSB_OTG,
680 .power = 100,
681};
682
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800683static void __init omap3pandora_init(void)
684{
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800685 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800686 omap3pandora_i2c_init();
Grazvydas Ignotas79ccf542010-08-02 13:18:01 +0300687 pandora_wl1251_init();
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800688 platform_add_devices(omap3pandora_devices,
689 ARRAY_SIZE(omap3pandora_devices));
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800690 omap_serial_init();
691 spi_register_board_info(omap3pandora_spi_board_info,
692 ARRAY_SIZE(omap3pandora_spi_board_info));
693 omap3pandora_ads7846_init();
Felipe Balbi58a54912009-11-22 10:11:01 -0800694 usb_ehci_init(&ehci_pdata);
Maulik Mankad884b8362010-02-17 14:09:30 -0800695 usb_musb_init(&musb_board_data);
Grazvydas Ignotas79ccf542010-08-02 13:18:01 +0300696 gpmc_nand_init(&pandora_nand_data);
Jean Pihet9fb97412009-07-24 19:43:25 -0600697
698 /* Ensure SDRC pins are mux'd for self-refresh */
Tony Lindgren4896e392009-12-11 16:16:32 -0800699 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
700 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800701}
702
703static void __init omap3pandora_map_io(void)
704{
705 omap2_set_globals_343x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800706 omap34xx_map_common_io();
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800707}
708
709MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
710 .phys_io = 0x48000000,
Santosh Shilimkarb4224b22009-10-19 17:25:55 -0700711 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800712 .boot_params = 0x80000100,
713 .map_io = omap3pandora_map_io,
714 .init_irq = omap3pandora_init_irq,
715 .init_machine = omap3pandora_init,
716 .timer = &omap_timer,
717MACHINE_END