Commit | Line | Data |
---|---|---|
da177247 GI |
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/spi/ads7846.h> | |
64f535a8 | 26 | #include <linux/regulator/machine.h> |
b07682b6 | 27 | #include <linux/i2c/twl.h> |
74190450 GI |
28 | #include <linux/leds.h> |
29 | #include <linux/input.h> | |
6135434a | 30 | #include <linux/input/matrix_keypad.h> |
74190450 | 31 | #include <linux/gpio_keys.h> |
da177247 GI |
32 | |
33 | #include <asm/mach-types.h> | |
34 | #include <asm/mach/arch.h> | |
35 | #include <asm/mach/map.h> | |
36 | ||
ce491cf8 TL |
37 | #include <plat/board.h> |
38 | #include <plat/common.h> | |
da177247 GI |
39 | #include <mach/gpio.h> |
40 | #include <mach/hardware.h> | |
ce491cf8 TL |
41 | #include <plat/mcspi.h> |
42 | #include <plat/usb.h> | |
7b097896 | 43 | #include <plat/display.h> |
da177247 | 44 | |
ca5742bd | 45 | #include "mux.h" |
2e12bd7e | 46 | #include "sdram-micron-mt46h32m32lf-6.h" |
d02a900b | 47 | #include "hsmmc.h" |
90c62bf0 | 48 | |
da177247 GI |
49 | #define OMAP3_PANDORA_TS_GPIO 94 |
50 | ||
74190450 GI |
51 | /* hardware debounce: (value + 1) * 31us */ |
52 | #define GPIO_DEBOUNCE_TIME 127 | |
53 | ||
54 | static 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 | ||
72 | static struct gpio_led_platform_data pandora_gpio_led_data = { | |
73 | .leds = pandora_gpio_leds, | |
74 | .num_leds = ARRAY_SIZE(pandora_gpio_leds), | |
75 | }; | |
76 | ||
77 | static 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 | ||
97 | static 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"), | |
8d88f7f7 GI |
102 | 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"), | |
74190450 GI |
106 | 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 | ||
117 | static struct gpio_keys_platform_data pandora_gpio_key_info = { | |
118 | .buttons = pandora_gpio_keys, | |
119 | .nbuttons = ARRAY_SIZE(pandora_gpio_keys), | |
120 | }; | |
121 | ||
122 | static 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 | ||
130 | static 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 | ||
4f543332 | 137 | static int board_keymap[] = { |
24de042c | 138 | /* row, col, code */ |
74190450 | 139 | KEY(0, 0, KEY_9), |
24de042c GI |
140 | 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), | |
74190450 | 146 | KEY(1, 1, KEY_7), |
24de042c GI |
147 | 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), | |
74190450 | 153 | KEY(2, 2, KEY_Y), |
24de042c GI |
154 | 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), | |
74190450 | 160 | KEY(3, 3, KEY_F), |
24de042c GI |
161 | 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), | |
74190450 | 166 | KEY(4, 4, KEY_X), |
24de042c GI |
167 | 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), | |
74190450 GI |
182 | }; |
183 | ||
4f543332 TL |
184 | static struct matrix_keymap_data board_map_data = { |
185 | .keymap = board_keymap, | |
186 | .keymap_size = ARRAY_SIZE(board_keymap), | |
187 | }; | |
188 | ||
74190450 | 189 | static struct twl4030_keypad_data pandora_kp_data = { |
4f543332 | 190 | .keymap_data = &board_map_data, |
74190450 GI |
191 | .rows = 8, |
192 | .cols = 6, | |
74190450 GI |
193 | .rep = 1, |
194 | }; | |
195 | ||
7b097896 GI |
196 | static 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 | ||
204 | static 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 | ||
211 | static struct omap_dss_device *pandora_dss_devices[] = { | |
212 | &pandora_lcd_device, | |
213 | &pandora_tv_device, | |
214 | }; | |
215 | ||
216 | static 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 | ||
222 | static struct platform_device pandora_dss_device = { | |
223 | .name = "omapdss", | |
224 | .id = -1, | |
225 | .dev = { | |
226 | .platform_data = &pandora_dss_data, | |
227 | }, | |
228 | }; | |
229 | ||
68ff0423 | 230 | static struct omap2_hsmmc_info omap3pandora_mmc[] = { |
90c62bf0 TL |
231 | { |
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, | |
0329c377 | 244 | .transceiver = true, |
90c62bf0 | 245 | }, |
07d83cc9 GI |
246 | { |
247 | .mmc = 3, | |
248 | .wires = 4, | |
249 | .gpio_cd = -EINVAL, | |
250 | .gpio_wp = -EINVAL, | |
251 | }, | |
90c62bf0 TL |
252 | {} /* Terminator */ |
253 | }; | |
254 | ||
90c62bf0 TL |
255 | static 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; | |
68ff0423 | 261 | omap2_hsmmc_init(omap3pandora_mmc); |
90c62bf0 TL |
262 | |
263 | return 0; | |
264 | } | |
265 | ||
da177247 GI |
266 | static 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, | |
90c62bf0 | 270 | .setup = omap3pandora_twl_gpio_setup, |
da177247 GI |
271 | }; |
272 | ||
f6873eed GI |
273 | static struct regulator_consumer_supply pandora_vmmc1_supply = |
274 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0"); | |
275 | ||
276 | static struct regulator_consumer_supply pandora_vmmc2_supply = | |
277 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1"); | |
278 | ||
279 | static struct regulator_consumer_supply pandora_vdda_dac_supply = | |
280 | REGULATOR_SUPPLY("vdda_dac", "omapdss"); | |
281 | ||
282 | static struct regulator_consumer_supply pandora_vdds_supplies[] = { | |
283 | REGULATOR_SUPPLY("vdds_sdi", "omapdss"), | |
284 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"), | |
285 | }; | |
286 | ||
287 | static struct regulator_consumer_supply pandora_vcc_lcd_supply = | |
288 | REGULATOR_SUPPLY("vcc", "display0"); | |
289 | ||
290 | static 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 */ | |
294 | static 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 | ||
300 | static struct regulator_consumer_supply pandora_adac_supply = | |
301 | REGULATOR_SUPPLY("vcc", "soc-audio"); | |
302 | ||
64f535a8 GI |
303 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
304 | static 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) */ | |
319 | static 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 | ||
7b097896 GI |
333 | /* VDAC for DSS driving S-Video */ |
334 | static 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 */ | |
349 | static 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 */ | |
364 | static 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 | ||
f6873eed GI |
378 | /* VAUX2 for USB host PHY */ |
379 | static 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 */ | |
394 | static 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 */ | |
409 | static 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 | ||
da177247 GI |
423 | static struct twl4030_usb_data omap3pandora_usb_data = { |
424 | .usb_mode = T2_USB_MODE_ULPI, | |
425 | }; | |
426 | ||
e86fa0b4 PU |
427 | static struct twl4030_codec_audio_data omap3pandora_audio_data = { |
428 | .audio_mclk = 26000000, | |
429 | }; | |
430 | ||
431 | static struct twl4030_codec_data omap3pandora_codec_data = { | |
6df74efb | 432 | .audio_mclk = 26000000, |
e86fa0b4 PU |
433 | .audio = &omap3pandora_audio_data, |
434 | }; | |
435 | ||
da177247 GI |
436 | static 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, | |
e86fa0b4 | 441 | .codec = &omap3pandora_codec_data, |
64f535a8 GI |
442 | .vmmc1 = &pandora_vmmc1, |
443 | .vmmc2 = &pandora_vmmc2, | |
7b097896 GI |
444 | .vdac = &pandora_vdac, |
445 | .vpll2 = &pandora_vpll2, | |
446 | .vaux1 = &pandora_vaux1, | |
f6873eed GI |
447 | .vaux2 = &pandora_vaux2, |
448 | .vaux4 = &pandora_vaux4, | |
449 | .vsim = &pandora_vsim, | |
74190450 | 450 | .keypad = &pandora_kp_data, |
da177247 GI |
451 | }; |
452 | ||
453 | static 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 | ||
462 | static 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 */ | |
8d88f7f7 | 467 | omap_register_i2c_bus(3, 100, NULL, 0); |
da177247 GI |
468 | return 0; |
469 | } | |
470 | ||
da177247 GI |
471 | static 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 | ||
486 | static int ads7846_get_pendown_state(void) | |
487 | { | |
488 | return !gpio_get_value(OMAP3_PANDORA_TS_GPIO); | |
489 | } | |
490 | ||
491 | static 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 | ||
503 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | |
504 | .turbo_mode = 0, | |
505 | .single_channel = 1, /* 0: slave, 1: master */ | |
506 | }; | |
507 | ||
508 | static 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, | |
7b097896 GI |
517 | }, { |
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, | |
da177247 GI |
523 | } |
524 | }; | |
525 | ||
b3c6df3a PW |
526 | static void __init omap3pandora_init_irq(void) |
527 | { | |
b3c6df3a PW |
528 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, |
529 | mt46h32m32lf6_sdrc_params); | |
530 | omap_init_irq(); | |
531 | omap_gpio_init(); | |
532 | } | |
533 | ||
da177247 | 534 | static struct platform_device *omap3pandora_devices[] __initdata = { |
74190450 GI |
535 | &pandora_leds_gpio, |
536 | &pandora_keys_gpio, | |
7b097896 | 537 | &pandora_dss_device, |
da177247 GI |
538 | }; |
539 | ||
6f69a181 | 540 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
58a5491c FB |
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 | ||
ca5742bd TL |
552 | #ifdef CONFIG_OMAP_MUX |
553 | static struct omap_board_mux board_mux[] __initdata = { | |
554 | { .reg_offset = OMAP_MUX_TERMINATOR }, | |
555 | }; | |
556 | #else | |
557 | #define board_mux NULL | |
558 | #endif | |
559 | ||
884b8369 MM |
560 | static struct omap_musb_board_data musb_board_data = { |
561 | .interface_type = MUSB_INTERFACE_ULPI, | |
562 | .mode = MUSB_OTG, | |
563 | .power = 100, | |
564 | }; | |
565 | ||
da177247 GI |
566 | static void __init omap3pandora_init(void) |
567 | { | |
ca5742bd | 568 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
da177247 GI |
569 | omap3pandora_i2c_init(); |
570 | platform_add_devices(omap3pandora_devices, | |
571 | ARRAY_SIZE(omap3pandora_devices)); | |
da177247 GI |
572 | omap_serial_init(); |
573 | spi_register_board_info(omap3pandora_spi_board_info, | |
574 | ARRAY_SIZE(omap3pandora_spi_board_info)); | |
575 | omap3pandora_ads7846_init(); | |
58a5491c | 576 | usb_ehci_init(&ehci_pdata); |
74190450 | 577 | pandora_keys_gpio_init(); |
884b8369 | 578 | usb_musb_init(&musb_board_data); |
9fb97412 JP |
579 | |
580 | /* Ensure SDRC pins are mux'd for self-refresh */ | |
4896e394 TL |
581 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
582 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | |
da177247 GI |
583 | } |
584 | ||
585 | static void __init omap3pandora_map_io(void) | |
586 | { | |
587 | omap2_set_globals_343x(); | |
6fbd55d0 | 588 | omap34xx_map_common_io(); |
da177247 GI |
589 | } |
590 | ||
591 | MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console") | |
592 | .phys_io = 0x48000000, | |
b4224b23 | 593 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
da177247 GI |
594 | .boot_params = 0x80000100, |
595 | .map_io = omap3pandora_map_io, | |
596 | .init_irq = omap3pandora_init_irq, | |
597 | .init_machine = omap3pandora_init, | |
598 | .timer = &omap_timer, | |
599 | MACHINE_END |