blob: a0acf8d1e806e01c0e45304f2da7c677302baaa0 [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 Ignotas74190452009-05-28 14:15:44 -070028#include <linux/leds.h>
29#include <linux/input.h>
Janusz Krzysztofik61354342009-10-22 14:43:17 -070030#include <linux/input/matrix_keypad.h>
Grazvydas Ignotas74190452009-05-28 14:15:44 -070031#include <linux/gpio_keys.h>
Grazvydas Ignotasda177242008-12-10 17:36:54 -080032
33#include <asm/mach-types.h>
34#include <asm/mach/arch.h>
35#include <asm/mach/map.h>
36
Tony Lindgrence491cf2009-10-20 09:40:47 -070037#include <plat/board.h>
38#include <plat/common.h>
Grazvydas Ignotasda177242008-12-10 17:36:54 -080039#include <mach/gpio.h>
40#include <mach/hardware.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070041#include <plat/mcspi.h>
42#include <plat/usb.h>
Grazvydas Ignotas7b097892010-02-17 14:09:24 -080043#include <plat/display.h>
Grazvydas Ignotasda177242008-12-10 17:36:54 -080044
Tony Lindgrenca5742b2009-12-11 16:16:32 -080045#include "mux.h"
Paul Walmsley2e12bd72009-05-28 14:03:59 -070046#include "sdram-micron-mt46h32m32lf-6.h"
Adrian Hunterd02a900b2010-02-15 10:03:34 -080047#include "hsmmc.h"
Tony Lindgren90c62bf2008-12-10 17:37:17 -080048
Grazvydas Ignotasda177242008-12-10 17:36:54 -080049#define OMAP3_PANDORA_TS_GPIO 94
50
Grazvydas Ignotas74190452009-05-28 14:15:44 -070051/* hardware debounce: (value + 1) * 31us */
52#define GPIO_DEBOUNCE_TIME 127
53
54static struct gpio_led pandora_gpio_leds[] = {
55 {
56 .name = "pandora::sd1",
57 .default_trigger = "mmc0",
58 .gpio = 128,
59 }, {
60 .name = "pandora::sd2",
61 .default_trigger = "mmc1",
62 .gpio = 129,
63 }, {
64 .name = "pandora::bluetooth",
65 .gpio = 158,
66 }, {
67 .name = "pandora::wifi",
68 .gpio = 159,
69 },
70};
71
72static struct gpio_led_platform_data pandora_gpio_led_data = {
73 .leds = pandora_gpio_leds,
74 .num_leds = ARRAY_SIZE(pandora_gpio_leds),
75};
76
77static struct platform_device pandora_leds_gpio = {
78 .name = "leds-gpio",
79 .id = -1,
80 .dev = {
81 .platform_data = &pandora_gpio_led_data,
82 },
83};
84
85#define GPIO_BUTTON(gpio_num, ev_type, ev_code, act_low, descr) \
86{ \
87 .gpio = gpio_num, \
88 .type = ev_type, \
89 .code = ev_code, \
90 .active_low = act_low, \
91 .desc = "btn " descr, \
92}
93
94#define GPIO_BUTTON_LOW(gpio_num, event_code, description) \
95 GPIO_BUTTON(gpio_num, EV_KEY, event_code, 1, description)
96
97static struct gpio_keys_button pandora_gpio_keys[] = {
98 GPIO_BUTTON_LOW(110, KEY_UP, "up"),
99 GPIO_BUTTON_LOW(103, KEY_DOWN, "down"),
100 GPIO_BUTTON_LOW(96, KEY_LEFT, "left"),
101 GPIO_BUTTON_LOW(98, KEY_RIGHT, "right"),
Grazvydas Ignotas8d88f7f2009-12-11 16:16:34 -0800102 GPIO_BUTTON_LOW(109, KEY_KP1, "game 1"),
103 GPIO_BUTTON_LOW(111, KEY_KP2, "game 2"),
104 GPIO_BUTTON_LOW(106, KEY_KP3, "game 3"),
105 GPIO_BUTTON_LOW(101, KEY_KP4, "game 4"),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700106 GPIO_BUTTON_LOW(102, BTN_TL, "l"),
107 GPIO_BUTTON_LOW(97, BTN_TL2, "l2"),
108 GPIO_BUTTON_LOW(105, BTN_TR, "r"),
109 GPIO_BUTTON_LOW(107, BTN_TR2, "r2"),
110 GPIO_BUTTON_LOW(104, KEY_LEFTCTRL, "ctrl"),
111 GPIO_BUTTON_LOW(99, KEY_MENU, "menu"),
112 GPIO_BUTTON_LOW(176, KEY_COFFEE, "hold"),
113 GPIO_BUTTON(100, EV_KEY, KEY_LEFTALT, 0, "alt"),
114 GPIO_BUTTON(108, EV_SW, SW_LID, 1, "lid"),
115};
116
117static struct gpio_keys_platform_data pandora_gpio_key_info = {
118 .buttons = pandora_gpio_keys,
119 .nbuttons = ARRAY_SIZE(pandora_gpio_keys),
120};
121
122static struct platform_device pandora_keys_gpio = {
123 .name = "gpio-keys",
124 .id = -1,
125 .dev = {
126 .platform_data = &pandora_gpio_key_info,
127 },
128};
129
130static void __init pandora_keys_gpio_init(void)
131{
132 /* set debounce time for GPIO banks 4 and 6 */
133 omap_set_gpio_debounce_time(32 * 3, GPIO_DEBOUNCE_TIME);
134 omap_set_gpio_debounce_time(32 * 5, GPIO_DEBOUNCE_TIME);
135}
136
Tony Lindgren4f543332009-09-24 16:23:16 -0700137static int board_keymap[] = {
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800138 /* row, col, code */
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700139 KEY(0, 0, KEY_9),
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800140 KEY(0, 1, KEY_8),
141 KEY(0, 2, KEY_I),
142 KEY(0, 3, KEY_J),
143 KEY(0, 4, KEY_N),
144 KEY(0, 5, KEY_M),
145 KEY(1, 0, KEY_0),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700146 KEY(1, 1, KEY_7),
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800147 KEY(1, 2, KEY_U),
148 KEY(1, 3, KEY_H),
149 KEY(1, 4, KEY_B),
150 KEY(1, 5, KEY_SPACE),
151 KEY(2, 0, KEY_BACKSPACE),
152 KEY(2, 1, KEY_6),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700153 KEY(2, 2, KEY_Y),
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800154 KEY(2, 3, KEY_G),
155 KEY(2, 4, KEY_V),
156 KEY(2, 5, KEY_FN),
157 KEY(3, 0, KEY_O),
158 KEY(3, 1, KEY_5),
159 KEY(3, 2, KEY_T),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700160 KEY(3, 3, KEY_F),
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800161 KEY(3, 4, KEY_C),
162 KEY(4, 0, KEY_P),
163 KEY(4, 1, KEY_4),
164 KEY(4, 2, KEY_R),
165 KEY(4, 3, KEY_D),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700166 KEY(4, 4, KEY_X),
Grazvydas Ignotas24de0422009-11-11 11:00:35 -0800167 KEY(5, 0, KEY_K),
168 KEY(5, 1, KEY_3),
169 KEY(5, 2, KEY_E),
170 KEY(5, 3, KEY_S),
171 KEY(5, 4, KEY_Z),
172 KEY(6, 0, KEY_L),
173 KEY(6, 1, KEY_2),
174 KEY(6, 2, KEY_W),
175 KEY(6, 3, KEY_A),
176 KEY(6, 4, KEY_DOT),
177 KEY(7, 0, KEY_ENTER),
178 KEY(7, 1, KEY_1),
179 KEY(7, 2, KEY_Q),
180 KEY(7, 3, KEY_LEFTSHIFT),
181 KEY(7, 4, KEY_COMMA),
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700182};
183
Tony Lindgren4f543332009-09-24 16:23:16 -0700184static struct matrix_keymap_data board_map_data = {
185 .keymap = board_keymap,
186 .keymap_size = ARRAY_SIZE(board_keymap),
187};
188
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700189static struct twl4030_keypad_data pandora_kp_data = {
Tony Lindgren4f543332009-09-24 16:23:16 -0700190 .keymap_data = &board_map_data,
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700191 .rows = 8,
192 .cols = 6,
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700193 .rep = 1,
194};
195
Grazvydas Ignotas7b097892010-02-17 14:09:24 -0800196static struct omap_dss_device pandora_lcd_device = {
197 .name = "lcd",
198 .driver_name = "tpo_td043mtea1_panel",
199 .type = OMAP_DISPLAY_TYPE_DPI,
200 .phy.dpi.data_lines = 24,
201 .reset_gpio = 157,
202};
203
204static struct omap_dss_device pandora_tv_device = {
205 .name = "tv",
206 .driver_name = "venc",
207 .type = OMAP_DISPLAY_TYPE_VENC,
208 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
209};
210
211static struct omap_dss_device *pandora_dss_devices[] = {
212 &pandora_lcd_device,
213 &pandora_tv_device,
214};
215
216static struct omap_dss_board_info pandora_dss_data = {
217 .num_devices = ARRAY_SIZE(pandora_dss_devices),
218 .devices = pandora_dss_devices,
219 .default_device = &pandora_lcd_device,
220};
221
222static struct platform_device pandora_dss_device = {
223 .name = "omapdss",
224 .id = -1,
225 .dev = {
226 .platform_data = &pandora_dss_data,
227 },
228};
229
Adrian Hunter68ff0422010-02-15 10:03:34 -0800230static struct omap2_hsmmc_info omap3pandora_mmc[] = {
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800231 {
232 .mmc = 1,
233 .wires = 4,
234 .gpio_cd = -EINVAL,
235 .gpio_wp = 126,
236 .ext_clock = 0,
237 },
238 {
239 .mmc = 2,
240 .wires = 4,
241 .gpio_cd = -EINVAL,
242 .gpio_wp = 127,
243 .ext_clock = 1,
David Brownell0329c372009-03-23 18:23:47 -0700244 .transceiver = true,
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800245 },
Grazvydas Ignotas07d83cc2009-03-23 18:23:47 -0700246 {
247 .mmc = 3,
248 .wires = 4,
249 .gpio_cd = -EINVAL,
250 .gpio_wp = -EINVAL,
251 },
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800252 {} /* Terminator */
253};
254
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800255static int omap3pandora_twl_gpio_setup(struct device *dev,
256 unsigned gpio, unsigned ngpio)
257{
258 /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */
259 omap3pandora_mmc[0].gpio_cd = gpio + 0;
260 omap3pandora_mmc[1].gpio_cd = gpio + 1;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800261 omap2_hsmmc_init(omap3pandora_mmc);
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800262
263 return 0;
264}
265
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800266static struct twl4030_gpio_platform_data omap3pandora_gpio_data = {
267 .gpio_base = OMAP_MAX_GPIO_LINES,
268 .irq_base = TWL4030_GPIO_IRQ_BASE,
269 .irq_end = TWL4030_GPIO_IRQ_END,
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800270 .setup = omap3pandora_twl_gpio_setup,
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800271};
272
Grazvydas Ignotasf6873ee2010-02-17 14:09:25 -0800273static struct regulator_consumer_supply pandora_vmmc1_supply =
274 REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0");
275
276static struct regulator_consumer_supply pandora_vmmc2_supply =
277 REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1");
278
279static struct regulator_consumer_supply pandora_vdda_dac_supply =
280 REGULATOR_SUPPLY("vdda_dac", "omapdss");
281
282static struct regulator_consumer_supply pandora_vdds_supplies[] = {
283 REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
284 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
285};
286
287static struct regulator_consumer_supply pandora_vcc_lcd_supply =
288 REGULATOR_SUPPLY("vcc", "display0");
289
290static struct regulator_consumer_supply pandora_usb_phy_supply =
291 REGULATOR_SUPPLY("hsusb0", "ehci-omap.0");
292
293/* ads7846 on SPI and 2 nub controllers on I2C */
294static struct regulator_consumer_supply pandora_vaux4_supplies[] = {
295 REGULATOR_SUPPLY("vcc", "spi1.0"),
296 REGULATOR_SUPPLY("vcc", "3-0066"),
297 REGULATOR_SUPPLY("vcc", "3-0067"),
298};
299
300static struct regulator_consumer_supply pandora_adac_supply =
301 REGULATOR_SUPPLY("vcc", "soc-audio");
302
Grazvydas Ignotas64f535a2009-05-28 14:04:04 -0700303/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
304static struct regulator_init_data pandora_vmmc1 = {
305 .constraints = {
306 .min_uV = 1850000,
307 .max_uV = 3150000,
308 .valid_modes_mask = REGULATOR_MODE_NORMAL
309 | REGULATOR_MODE_STANDBY,
310 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
311 | REGULATOR_CHANGE_MODE
312 | REGULATOR_CHANGE_STATUS,
313 },
314 .num_consumer_supplies = 1,
315 .consumer_supplies = &pandora_vmmc1_supply,
316};
317
318/* VMMC2 for MMC2 pins CMD, CLK, DAT0..DAT3 (max 100 mA) */
319static struct regulator_init_data pandora_vmmc2 = {
320 .constraints = {
321 .min_uV = 1850000,
322 .max_uV = 3150000,
323 .valid_modes_mask = REGULATOR_MODE_NORMAL
324 | REGULATOR_MODE_STANDBY,
325 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
326 | REGULATOR_CHANGE_MODE
327 | REGULATOR_CHANGE_STATUS,
328 },
329 .num_consumer_supplies = 1,
330 .consumer_supplies = &pandora_vmmc2_supply,
331};
332
Grazvydas Ignotas7b097892010-02-17 14:09:24 -0800333/* VDAC for DSS driving S-Video */
334static struct regulator_init_data pandora_vdac = {
335 .constraints = {
336 .min_uV = 1800000,
337 .max_uV = 1800000,
338 .apply_uV = true,
339 .valid_modes_mask = REGULATOR_MODE_NORMAL
340 | REGULATOR_MODE_STANDBY,
341 .valid_ops_mask = REGULATOR_CHANGE_MODE
342 | REGULATOR_CHANGE_STATUS,
343 },
344 .num_consumer_supplies = 1,
345 .consumer_supplies = &pandora_vdda_dac_supply,
346};
347
348/* VPLL2 for digital video outputs */
349static struct regulator_init_data pandora_vpll2 = {
350 .constraints = {
351 .min_uV = 1800000,
352 .max_uV = 1800000,
353 .apply_uV = true,
354 .valid_modes_mask = REGULATOR_MODE_NORMAL
355 | REGULATOR_MODE_STANDBY,
356 .valid_ops_mask = REGULATOR_CHANGE_MODE
357 | REGULATOR_CHANGE_STATUS,
358 },
359 .num_consumer_supplies = ARRAY_SIZE(pandora_vdds_supplies),
360 .consumer_supplies = pandora_vdds_supplies,
361};
362
363/* VAUX1 for LCD */
364static struct regulator_init_data pandora_vaux1 = {
365 .constraints = {
366 .min_uV = 3000000,
367 .max_uV = 3000000,
368 .apply_uV = true,
369 .valid_modes_mask = REGULATOR_MODE_NORMAL
370 | REGULATOR_MODE_STANDBY,
371 .valid_ops_mask = REGULATOR_CHANGE_MODE
372 | REGULATOR_CHANGE_STATUS,
373 },
374 .num_consumer_supplies = 1,
375 .consumer_supplies = &pandora_vcc_lcd_supply,
376};
377
Grazvydas Ignotasf6873ee2010-02-17 14:09:25 -0800378/* VAUX2 for USB host PHY */
379static struct regulator_init_data pandora_vaux2 = {
380 .constraints = {
381 .min_uV = 1800000,
382 .max_uV = 1800000,
383 .apply_uV = true,
384 .valid_modes_mask = REGULATOR_MODE_NORMAL
385 | REGULATOR_MODE_STANDBY,
386 .valid_ops_mask = REGULATOR_CHANGE_MODE
387 | REGULATOR_CHANGE_STATUS,
388 },
389 .num_consumer_supplies = 1,
390 .consumer_supplies = &pandora_usb_phy_supply,
391};
392
393/* VAUX4 for ads7846 and nubs */
394static struct regulator_init_data pandora_vaux4 = {
395 .constraints = {
396 .min_uV = 2800000,
397 .max_uV = 2800000,
398 .apply_uV = true,
399 .valid_modes_mask = REGULATOR_MODE_NORMAL
400 | REGULATOR_MODE_STANDBY,
401 .valid_ops_mask = REGULATOR_CHANGE_MODE
402 | REGULATOR_CHANGE_STATUS,
403 },
404 .num_consumer_supplies = ARRAY_SIZE(pandora_vaux4_supplies),
405 .consumer_supplies = pandora_vaux4_supplies,
406};
407
408/* VSIM for audio DAC */
409static struct regulator_init_data pandora_vsim = {
410 .constraints = {
411 .min_uV = 2800000,
412 .max_uV = 2800000,
413 .apply_uV = true,
414 .valid_modes_mask = REGULATOR_MODE_NORMAL
415 | REGULATOR_MODE_STANDBY,
416 .valid_ops_mask = REGULATOR_CHANGE_MODE
417 | REGULATOR_CHANGE_STATUS,
418 },
419 .num_consumer_supplies = 1,
420 .consumer_supplies = &pandora_adac_supply,
421};
422
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800423static struct twl4030_usb_data omap3pandora_usb_data = {
424 .usb_mode = T2_USB_MODE_ULPI,
425};
426
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300427static struct twl4030_codec_audio_data omap3pandora_audio_data = {
428 .audio_mclk = 26000000,
429};
430
431static struct twl4030_codec_data omap3pandora_codec_data = {
Peter Ujfalusi6df74ef2009-11-04 09:58:18 +0200432 .audio_mclk = 26000000,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300433 .audio = &omap3pandora_audio_data,
434};
435
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800436static struct twl4030_platform_data omap3pandora_twldata = {
437 .irq_base = TWL4030_IRQ_BASE,
438 .irq_end = TWL4030_IRQ_END,
439 .gpio = &omap3pandora_gpio_data,
440 .usb = &omap3pandora_usb_data,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300441 .codec = &omap3pandora_codec_data,
Grazvydas Ignotas64f535a2009-05-28 14:04:04 -0700442 .vmmc1 = &pandora_vmmc1,
443 .vmmc2 = &pandora_vmmc2,
Grazvydas Ignotas7b097892010-02-17 14:09:24 -0800444 .vdac = &pandora_vdac,
445 .vpll2 = &pandora_vpll2,
446 .vaux1 = &pandora_vaux1,
Grazvydas Ignotasf6873ee2010-02-17 14:09:25 -0800447 .vaux2 = &pandora_vaux2,
448 .vaux4 = &pandora_vaux4,
449 .vsim = &pandora_vsim,
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700450 .keypad = &pandora_kp_data,
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800451};
452
453static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = {
454 {
455 I2C_BOARD_INFO("tps65950", 0x48),
456 .flags = I2C_CLIENT_WAKE,
457 .irq = INT_34XX_SYS_NIRQ,
458 .platform_data = &omap3pandora_twldata,
459 },
460};
461
462static int __init omap3pandora_i2c_init(void)
463{
464 omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo,
465 ARRAY_SIZE(omap3pandora_i2c_boardinfo));
466 /* i2c2 pins are not connected */
Grazvydas Ignotas8d88f7f2009-12-11 16:16:34 -0800467 omap_register_i2c_bus(3, 100, NULL, 0);
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800468 return 0;
469}
470
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800471static void __init omap3pandora_ads7846_init(void)
472{
473 int gpio = OMAP3_PANDORA_TS_GPIO;
474 int ret;
475
476 ret = gpio_request(gpio, "ads7846_pen_down");
477 if (ret < 0) {
478 printk(KERN_ERR "Failed to request GPIO %d for "
479 "ads7846 pen down IRQ\n", gpio);
480 return;
481 }
482
483 gpio_direction_input(gpio);
484}
485
486static int ads7846_get_pendown_state(void)
487{
488 return !gpio_get_value(OMAP3_PANDORA_TS_GPIO);
489}
490
491static struct ads7846_platform_data ads7846_config = {
492 .x_max = 0x0fff,
493 .y_max = 0x0fff,
494 .x_plate_ohms = 180,
495 .pressure_max = 255,
496 .debounce_max = 10,
497 .debounce_tol = 3,
498 .debounce_rep = 1,
499 .get_pendown_state = ads7846_get_pendown_state,
500 .keep_vref_on = 1,
501};
502
503static struct omap2_mcspi_device_config ads7846_mcspi_config = {
504 .turbo_mode = 0,
505 .single_channel = 1, /* 0: slave, 1: master */
506};
507
508static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
509 {
510 .modalias = "ads7846",
511 .bus_num = 1,
512 .chip_select = 0,
513 .max_speed_hz = 1500000,
514 .controller_data = &ads7846_mcspi_config,
515 .irq = OMAP_GPIO_IRQ(OMAP3_PANDORA_TS_GPIO),
516 .platform_data = &ads7846_config,
Grazvydas Ignotas7b097892010-02-17 14:09:24 -0800517 }, {
518 .modalias = "tpo_td043mtea1_panel_spi",
519 .bus_num = 1,
520 .chip_select = 1,
521 .max_speed_hz = 375000,
522 .platform_data = &pandora_lcd_device,
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800523 }
524};
525
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300526static void __init omap3pandora_init_irq(void)
527{
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300528 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
529 mt46h32m32lf6_sdrc_params);
530 omap_init_irq();
531 omap_gpio_init();
532}
533
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800534static struct platform_device *omap3pandora_devices[] __initdata = {
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700535 &pandora_leds_gpio,
536 &pandora_keys_gpio,
Grazvydas Ignotas7b097892010-02-17 14:09:24 -0800537 &pandora_dss_device,
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800538};
539
Felipe Balbi58a54912009-11-22 10:11:01 -0800540static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
541
542 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
543 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
544 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
545
546 .phy_reset = true,
547 .reset_gpio_port[0] = 16,
548 .reset_gpio_port[1] = -EINVAL,
549 .reset_gpio_port[2] = -EINVAL
550};
551
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800552#ifdef CONFIG_OMAP_MUX
553static struct omap_board_mux board_mux[] __initdata = {
554 { .reg_offset = OMAP_MUX_TERMINATOR },
555};
556#else
557#define board_mux NULL
558#endif
559
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800560static void __init omap3pandora_init(void)
561{
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800562 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800563 omap3pandora_i2c_init();
564 platform_add_devices(omap3pandora_devices,
565 ARRAY_SIZE(omap3pandora_devices));
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800566 omap_serial_init();
567 spi_register_board_info(omap3pandora_spi_board_info,
568 ARRAY_SIZE(omap3pandora_spi_board_info));
569 omap3pandora_ads7846_init();
Felipe Balbi58a54912009-11-22 10:11:01 -0800570 usb_ehci_init(&ehci_pdata);
Grazvydas Ignotas74190452009-05-28 14:15:44 -0700571 pandora_keys_gpio_init();
Felipe Balbi18cb7ac2009-03-23 18:34:06 -0700572 usb_musb_init();
Jean Pihet9fb97412009-07-24 19:43:25 -0600573
574 /* Ensure SDRC pins are mux'd for self-refresh */
Tony Lindgren4896e392009-12-11 16:16:32 -0800575 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
576 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800577}
578
579static void __init omap3pandora_map_io(void)
580{
581 omap2_set_globals_343x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800582 omap34xx_map_common_io();
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800583}
584
585MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
586 .phys_io = 0x48000000,
Santosh Shilimkarb4224b22009-10-19 17:25:55 -0700587 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
Grazvydas Ignotasda177242008-12-10 17:36:54 -0800588 .boot_params = 0x80000100,
589 .map_io = omap3pandora_map_io,
590 .init_irq = omap3pandora_init_irq,
591 .init_machine = omap3pandora_init,
592 .timer = &omap_timer,
593MACHINE_END