]>
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> |
c1f9a095 | 28 | #include <linux/wl12xx.h> |
74190450 GI |
29 | #include <linux/leds.h> |
30 | #include <linux/input.h> | |
6135434a | 31 | #include <linux/input/matrix_keypad.h> |
74190450 | 32 | #include <linux/gpio_keys.h> |
da177247 GI |
33 | |
34 | #include <asm/mach-types.h> | |
35 | #include <asm/mach/arch.h> | |
36 | #include <asm/mach/map.h> | |
37 | ||
ce491cf8 TL |
38 | #include <plat/board.h> |
39 | #include <plat/common.h> | |
da177247 GI |
40 | #include <mach/gpio.h> |
41 | #include <mach/hardware.h> | |
ce491cf8 TL |
42 | #include <plat/mcspi.h> |
43 | #include <plat/usb.h> | |
7b097896 | 44 | #include <plat/display.h> |
da177247 | 45 | |
ca5742bd | 46 | #include "mux.h" |
2e12bd7e | 47 | #include "sdram-micron-mt46h32m32lf-6.h" |
d02a900b | 48 | #include "hsmmc.h" |
90c62bf0 | 49 | |
da177247 GI |
50 | #define OMAP3_PANDORA_TS_GPIO 94 |
51 | ||
74190450 GI |
52 | /* hardware debounce: (value + 1) * 31us */ |
53 | #define GPIO_DEBOUNCE_TIME 127 | |
54 | ||
55 | static struct gpio_led pandora_gpio_leds[] = { | |
56 | { | |
57 | .name = "pandora::sd1", | |
58 | .default_trigger = "mmc0", | |
59 | .gpio = 128, | |
60 | }, { | |
61 | .name = "pandora::sd2", | |
62 | .default_trigger = "mmc1", | |
63 | .gpio = 129, | |
64 | }, { | |
65 | .name = "pandora::bluetooth", | |
66 | .gpio = 158, | |
67 | }, { | |
68 | .name = "pandora::wifi", | |
69 | .gpio = 159, | |
70 | }, | |
71 | }; | |
72 | ||
73 | static struct gpio_led_platform_data pandora_gpio_led_data = { | |
74 | .leds = pandora_gpio_leds, | |
75 | .num_leds = ARRAY_SIZE(pandora_gpio_leds), | |
76 | }; | |
77 | ||
78 | static struct platform_device pandora_leds_gpio = { | |
79 | .name = "leds-gpio", | |
80 | .id = -1, | |
81 | .dev = { | |
82 | .platform_data = &pandora_gpio_led_data, | |
83 | }, | |
84 | }; | |
85 | ||
86 | #define GPIO_BUTTON(gpio_num, ev_type, ev_code, act_low, descr) \ | |
87 | { \ | |
88 | .gpio = gpio_num, \ | |
89 | .type = ev_type, \ | |
90 | .code = ev_code, \ | |
91 | .active_low = act_low, \ | |
92 | .desc = "btn " descr, \ | |
93 | } | |
94 | ||
95 | #define GPIO_BUTTON_LOW(gpio_num, event_code, description) \ | |
96 | GPIO_BUTTON(gpio_num, EV_KEY, event_code, 1, description) | |
97 | ||
98 | static struct gpio_keys_button pandora_gpio_keys[] = { | |
99 | GPIO_BUTTON_LOW(110, KEY_UP, "up"), | |
100 | GPIO_BUTTON_LOW(103, KEY_DOWN, "down"), | |
101 | GPIO_BUTTON_LOW(96, KEY_LEFT, "left"), | |
102 | GPIO_BUTTON_LOW(98, KEY_RIGHT, "right"), | |
8d88f7f7 GI |
103 | GPIO_BUTTON_LOW(109, KEY_KP1, "game 1"), |
104 | GPIO_BUTTON_LOW(111, KEY_KP2, "game 2"), | |
105 | GPIO_BUTTON_LOW(106, KEY_KP3, "game 3"), | |
106 | GPIO_BUTTON_LOW(101, KEY_KP4, "game 4"), | |
74190450 GI |
107 | GPIO_BUTTON_LOW(102, BTN_TL, "l"), |
108 | GPIO_BUTTON_LOW(97, BTN_TL2, "l2"), | |
109 | GPIO_BUTTON_LOW(105, BTN_TR, "r"), | |
110 | GPIO_BUTTON_LOW(107, BTN_TR2, "r2"), | |
111 | GPIO_BUTTON_LOW(104, KEY_LEFTCTRL, "ctrl"), | |
112 | GPIO_BUTTON_LOW(99, KEY_MENU, "menu"), | |
113 | GPIO_BUTTON_LOW(176, KEY_COFFEE, "hold"), | |
114 | GPIO_BUTTON(100, EV_KEY, KEY_LEFTALT, 0, "alt"), | |
115 | GPIO_BUTTON(108, EV_SW, SW_LID, 1, "lid"), | |
116 | }; | |
117 | ||
118 | static struct gpio_keys_platform_data pandora_gpio_key_info = { | |
119 | .buttons = pandora_gpio_keys, | |
120 | .nbuttons = ARRAY_SIZE(pandora_gpio_keys), | |
121 | }; | |
122 | ||
123 | static struct platform_device pandora_keys_gpio = { | |
124 | .name = "gpio-keys", | |
125 | .id = -1, | |
126 | .dev = { | |
127 | .platform_data = &pandora_gpio_key_info, | |
128 | }, | |
129 | }; | |
130 | ||
131 | static void __init pandora_keys_gpio_init(void) | |
132 | { | |
133 | /* set debounce time for GPIO banks 4 and 6 */ | |
48feb337 FB |
134 | gpio_set_debounce(32 * 3, GPIO_DEBOUNCE_TIME); |
135 | gpio_set_debounce(32 * 5, GPIO_DEBOUNCE_TIME); | |
74190450 GI |
136 | } |
137 | ||
4f543332 | 138 | static int board_keymap[] = { |
24de042c | 139 | /* row, col, code */ |
74190450 | 140 | KEY(0, 0, KEY_9), |
24de042c GI |
141 | KEY(0, 1, KEY_8), |
142 | KEY(0, 2, KEY_I), | |
143 | KEY(0, 3, KEY_J), | |
144 | KEY(0, 4, KEY_N), | |
145 | KEY(0, 5, KEY_M), | |
146 | KEY(1, 0, KEY_0), | |
74190450 | 147 | KEY(1, 1, KEY_7), |
24de042c GI |
148 | KEY(1, 2, KEY_U), |
149 | KEY(1, 3, KEY_H), | |
150 | KEY(1, 4, KEY_B), | |
151 | KEY(1, 5, KEY_SPACE), | |
152 | KEY(2, 0, KEY_BACKSPACE), | |
153 | KEY(2, 1, KEY_6), | |
74190450 | 154 | KEY(2, 2, KEY_Y), |
24de042c GI |
155 | KEY(2, 3, KEY_G), |
156 | KEY(2, 4, KEY_V), | |
157 | KEY(2, 5, KEY_FN), | |
158 | KEY(3, 0, KEY_O), | |
159 | KEY(3, 1, KEY_5), | |
160 | KEY(3, 2, KEY_T), | |
74190450 | 161 | KEY(3, 3, KEY_F), |
24de042c GI |
162 | KEY(3, 4, KEY_C), |
163 | KEY(4, 0, KEY_P), | |
164 | KEY(4, 1, KEY_4), | |
165 | KEY(4, 2, KEY_R), | |
166 | KEY(4, 3, KEY_D), | |
74190450 | 167 | KEY(4, 4, KEY_X), |
24de042c GI |
168 | KEY(5, 0, KEY_K), |
169 | KEY(5, 1, KEY_3), | |
170 | KEY(5, 2, KEY_E), | |
171 | KEY(5, 3, KEY_S), | |
172 | KEY(5, 4, KEY_Z), | |
173 | KEY(6, 0, KEY_L), | |
174 | KEY(6, 1, KEY_2), | |
175 | KEY(6, 2, KEY_W), | |
176 | KEY(6, 3, KEY_A), | |
177 | KEY(6, 4, KEY_DOT), | |
178 | KEY(7, 0, KEY_ENTER), | |
179 | KEY(7, 1, KEY_1), | |
180 | KEY(7, 2, KEY_Q), | |
181 | KEY(7, 3, KEY_LEFTSHIFT), | |
182 | KEY(7, 4, KEY_COMMA), | |
74190450 GI |
183 | }; |
184 | ||
4f543332 TL |
185 | static struct matrix_keymap_data board_map_data = { |
186 | .keymap = board_keymap, | |
187 | .keymap_size = ARRAY_SIZE(board_keymap), | |
188 | }; | |
189 | ||
74190450 | 190 | static struct twl4030_keypad_data pandora_kp_data = { |
4f543332 | 191 | .keymap_data = &board_map_data, |
74190450 GI |
192 | .rows = 8, |
193 | .cols = 6, | |
74190450 GI |
194 | .rep = 1, |
195 | }; | |
196 | ||
7b097896 GI |
197 | static struct omap_dss_device pandora_lcd_device = { |
198 | .name = "lcd", | |
199 | .driver_name = "tpo_td043mtea1_panel", | |
200 | .type = OMAP_DISPLAY_TYPE_DPI, | |
201 | .phy.dpi.data_lines = 24, | |
202 | .reset_gpio = 157, | |
203 | }; | |
204 | ||
205 | static struct omap_dss_device pandora_tv_device = { | |
206 | .name = "tv", | |
207 | .driver_name = "venc", | |
208 | .type = OMAP_DISPLAY_TYPE_VENC, | |
209 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | |
210 | }; | |
211 | ||
212 | static struct omap_dss_device *pandora_dss_devices[] = { | |
213 | &pandora_lcd_device, | |
214 | &pandora_tv_device, | |
215 | }; | |
216 | ||
217 | static struct omap_dss_board_info pandora_dss_data = { | |
218 | .num_devices = ARRAY_SIZE(pandora_dss_devices), | |
219 | .devices = pandora_dss_devices, | |
220 | .default_device = &pandora_lcd_device, | |
221 | }; | |
222 | ||
223 | static struct platform_device pandora_dss_device = { | |
224 | .name = "omapdss", | |
225 | .id = -1, | |
226 | .dev = { | |
227 | .platform_data = &pandora_dss_data, | |
228 | }, | |
229 | }; | |
230 | ||
68ff0423 | 231 | static struct omap2_hsmmc_info omap3pandora_mmc[] = { |
90c62bf0 TL |
232 | { |
233 | .mmc = 1, | |
234 | .wires = 4, | |
235 | .gpio_cd = -EINVAL, | |
236 | .gpio_wp = 126, | |
237 | .ext_clock = 0, | |
238 | }, | |
239 | { | |
240 | .mmc = 2, | |
241 | .wires = 4, | |
242 | .gpio_cd = -EINVAL, | |
243 | .gpio_wp = 127, | |
244 | .ext_clock = 1, | |
0329c377 | 245 | .transceiver = true, |
90c62bf0 | 246 | }, |
07d83cc9 GI |
247 | { |
248 | .mmc = 3, | |
249 | .wires = 4, | |
250 | .gpio_cd = -EINVAL, | |
251 | .gpio_wp = -EINVAL, | |
252 | }, | |
90c62bf0 TL |
253 | {} /* Terminator */ |
254 | }; | |
255 | ||
90c62bf0 TL |
256 | static int omap3pandora_twl_gpio_setup(struct device *dev, |
257 | unsigned gpio, unsigned ngpio) | |
258 | { | |
259 | /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */ | |
260 | omap3pandora_mmc[0].gpio_cd = gpio + 0; | |
261 | omap3pandora_mmc[1].gpio_cd = gpio + 1; | |
68ff0423 | 262 | omap2_hsmmc_init(omap3pandora_mmc); |
90c62bf0 TL |
263 | |
264 | return 0; | |
265 | } | |
266 | ||
da177247 GI |
267 | static struct twl4030_gpio_platform_data omap3pandora_gpio_data = { |
268 | .gpio_base = OMAP_MAX_GPIO_LINES, | |
269 | .irq_base = TWL4030_GPIO_IRQ_BASE, | |
270 | .irq_end = TWL4030_GPIO_IRQ_END, | |
90c62bf0 | 271 | .setup = omap3pandora_twl_gpio_setup, |
da177247 GI |
272 | }; |
273 | ||
f6873eed GI |
274 | static struct regulator_consumer_supply pandora_vmmc1_supply = |
275 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0"); | |
276 | ||
277 | static struct regulator_consumer_supply pandora_vmmc2_supply = | |
278 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1"); | |
279 | ||
280 | static struct regulator_consumer_supply pandora_vdda_dac_supply = | |
281 | REGULATOR_SUPPLY("vdda_dac", "omapdss"); | |
282 | ||
283 | static struct regulator_consumer_supply pandora_vdds_supplies[] = { | |
284 | REGULATOR_SUPPLY("vdds_sdi", "omapdss"), | |
285 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"), | |
286 | }; | |
287 | ||
288 | static struct regulator_consumer_supply pandora_vcc_lcd_supply = | |
289 | REGULATOR_SUPPLY("vcc", "display0"); | |
290 | ||
291 | static struct regulator_consumer_supply pandora_usb_phy_supply = | |
292 | REGULATOR_SUPPLY("hsusb0", "ehci-omap.0"); | |
293 | ||
294 | /* ads7846 on SPI and 2 nub controllers on I2C */ | |
295 | static struct regulator_consumer_supply pandora_vaux4_supplies[] = { | |
296 | REGULATOR_SUPPLY("vcc", "spi1.0"), | |
297 | REGULATOR_SUPPLY("vcc", "3-0066"), | |
298 | REGULATOR_SUPPLY("vcc", "3-0067"), | |
299 | }; | |
300 | ||
301 | static struct regulator_consumer_supply pandora_adac_supply = | |
302 | REGULATOR_SUPPLY("vcc", "soc-audio"); | |
303 | ||
64f535a8 GI |
304 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
305 | static struct regulator_init_data pandora_vmmc1 = { | |
306 | .constraints = { | |
307 | .min_uV = 1850000, | |
308 | .max_uV = 3150000, | |
309 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
310 | | REGULATOR_MODE_STANDBY, | |
311 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
312 | | REGULATOR_CHANGE_MODE | |
313 | | REGULATOR_CHANGE_STATUS, | |
314 | }, | |
315 | .num_consumer_supplies = 1, | |
316 | .consumer_supplies = &pandora_vmmc1_supply, | |
317 | }; | |
318 | ||
319 | /* VMMC2 for MMC2 pins CMD, CLK, DAT0..DAT3 (max 100 mA) */ | |
320 | static struct regulator_init_data pandora_vmmc2 = { | |
321 | .constraints = { | |
322 | .min_uV = 1850000, | |
323 | .max_uV = 3150000, | |
324 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
325 | | REGULATOR_MODE_STANDBY, | |
326 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
327 | | REGULATOR_CHANGE_MODE | |
328 | | REGULATOR_CHANGE_STATUS, | |
329 | }, | |
330 | .num_consumer_supplies = 1, | |
331 | .consumer_supplies = &pandora_vmmc2_supply, | |
332 | }; | |
333 | ||
7b097896 GI |
334 | /* VDAC for DSS driving S-Video */ |
335 | static struct regulator_init_data pandora_vdac = { | |
336 | .constraints = { | |
337 | .min_uV = 1800000, | |
338 | .max_uV = 1800000, | |
339 | .apply_uV = true, | |
340 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
341 | | REGULATOR_MODE_STANDBY, | |
342 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
343 | | REGULATOR_CHANGE_STATUS, | |
344 | }, | |
345 | .num_consumer_supplies = 1, | |
346 | .consumer_supplies = &pandora_vdda_dac_supply, | |
347 | }; | |
348 | ||
349 | /* VPLL2 for digital video outputs */ | |
350 | static struct regulator_init_data pandora_vpll2 = { | |
351 | .constraints = { | |
352 | .min_uV = 1800000, | |
353 | .max_uV = 1800000, | |
354 | .apply_uV = true, | |
355 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
356 | | REGULATOR_MODE_STANDBY, | |
357 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
358 | | REGULATOR_CHANGE_STATUS, | |
359 | }, | |
360 | .num_consumer_supplies = ARRAY_SIZE(pandora_vdds_supplies), | |
361 | .consumer_supplies = pandora_vdds_supplies, | |
362 | }; | |
363 | ||
364 | /* VAUX1 for LCD */ | |
365 | static struct regulator_init_data pandora_vaux1 = { | |
366 | .constraints = { | |
367 | .min_uV = 3000000, | |
368 | .max_uV = 3000000, | |
369 | .apply_uV = true, | |
370 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
371 | | REGULATOR_MODE_STANDBY, | |
372 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
373 | | REGULATOR_CHANGE_STATUS, | |
374 | }, | |
375 | .num_consumer_supplies = 1, | |
376 | .consumer_supplies = &pandora_vcc_lcd_supply, | |
377 | }; | |
378 | ||
f6873eed GI |
379 | /* VAUX2 for USB host PHY */ |
380 | static struct regulator_init_data pandora_vaux2 = { | |
381 | .constraints = { | |
382 | .min_uV = 1800000, | |
383 | .max_uV = 1800000, | |
384 | .apply_uV = true, | |
385 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
386 | | REGULATOR_MODE_STANDBY, | |
387 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
388 | | REGULATOR_CHANGE_STATUS, | |
389 | }, | |
390 | .num_consumer_supplies = 1, | |
391 | .consumer_supplies = &pandora_usb_phy_supply, | |
392 | }; | |
393 | ||
394 | /* VAUX4 for ads7846 and nubs */ | |
395 | static struct regulator_init_data pandora_vaux4 = { | |
396 | .constraints = { | |
397 | .min_uV = 2800000, | |
398 | .max_uV = 2800000, | |
399 | .apply_uV = true, | |
400 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
401 | | REGULATOR_MODE_STANDBY, | |
402 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
403 | | REGULATOR_CHANGE_STATUS, | |
404 | }, | |
405 | .num_consumer_supplies = ARRAY_SIZE(pandora_vaux4_supplies), | |
406 | .consumer_supplies = pandora_vaux4_supplies, | |
407 | }; | |
408 | ||
409 | /* VSIM for audio DAC */ | |
410 | static struct regulator_init_data pandora_vsim = { | |
411 | .constraints = { | |
412 | .min_uV = 2800000, | |
413 | .max_uV = 2800000, | |
414 | .apply_uV = true, | |
415 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
416 | | REGULATOR_MODE_STANDBY, | |
417 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
418 | | REGULATOR_CHANGE_STATUS, | |
419 | }, | |
420 | .num_consumer_supplies = 1, | |
421 | .consumer_supplies = &pandora_adac_supply, | |
422 | }; | |
423 | ||
da177247 GI |
424 | static struct twl4030_usb_data omap3pandora_usb_data = { |
425 | .usb_mode = T2_USB_MODE_ULPI, | |
426 | }; | |
427 | ||
e86fa0b4 PU |
428 | static struct twl4030_codec_audio_data omap3pandora_audio_data = { |
429 | .audio_mclk = 26000000, | |
430 | }; | |
431 | ||
432 | static struct twl4030_codec_data omap3pandora_codec_data = { | |
6df74efb | 433 | .audio_mclk = 26000000, |
e86fa0b4 PU |
434 | .audio = &omap3pandora_audio_data, |
435 | }; | |
436 | ||
da177247 GI |
437 | static struct twl4030_platform_data omap3pandora_twldata = { |
438 | .irq_base = TWL4030_IRQ_BASE, | |
439 | .irq_end = TWL4030_IRQ_END, | |
440 | .gpio = &omap3pandora_gpio_data, | |
441 | .usb = &omap3pandora_usb_data, | |
e86fa0b4 | 442 | .codec = &omap3pandora_codec_data, |
64f535a8 GI |
443 | .vmmc1 = &pandora_vmmc1, |
444 | .vmmc2 = &pandora_vmmc2, | |
7b097896 GI |
445 | .vdac = &pandora_vdac, |
446 | .vpll2 = &pandora_vpll2, | |
447 | .vaux1 = &pandora_vaux1, | |
f6873eed GI |
448 | .vaux2 = &pandora_vaux2, |
449 | .vaux4 = &pandora_vaux4, | |
450 | .vsim = &pandora_vsim, | |
74190450 | 451 | .keypad = &pandora_kp_data, |
da177247 GI |
452 | }; |
453 | ||
454 | static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = { | |
455 | { | |
456 | I2C_BOARD_INFO("tps65950", 0x48), | |
457 | .flags = I2C_CLIENT_WAKE, | |
458 | .irq = INT_34XX_SYS_NIRQ, | |
459 | .platform_data = &omap3pandora_twldata, | |
460 | }, | |
461 | }; | |
462 | ||
03d5671d GI |
463 | static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = { |
464 | { | |
465 | I2C_BOARD_INFO("bq27500", 0x55), | |
466 | .flags = I2C_CLIENT_WAKE, | |
467 | }, | |
468 | }; | |
469 | ||
da177247 GI |
470 | static int __init omap3pandora_i2c_init(void) |
471 | { | |
472 | omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo, | |
473 | ARRAY_SIZE(omap3pandora_i2c_boardinfo)); | |
474 | /* i2c2 pins are not connected */ | |
03d5671d GI |
475 | omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo, |
476 | ARRAY_SIZE(omap3pandora_i2c3_boardinfo)); | |
da177247 GI |
477 | return 0; |
478 | } | |
479 | ||
da177247 GI |
480 | static void __init omap3pandora_ads7846_init(void) |
481 | { | |
482 | int gpio = OMAP3_PANDORA_TS_GPIO; | |
483 | int ret; | |
484 | ||
485 | ret = gpio_request(gpio, "ads7846_pen_down"); | |
486 | if (ret < 0) { | |
487 | printk(KERN_ERR "Failed to request GPIO %d for " | |
488 | "ads7846 pen down IRQ\n", gpio); | |
489 | return; | |
490 | } | |
491 | ||
492 | gpio_direction_input(gpio); | |
493 | } | |
494 | ||
495 | static int ads7846_get_pendown_state(void) | |
496 | { | |
497 | return !gpio_get_value(OMAP3_PANDORA_TS_GPIO); | |
498 | } | |
499 | ||
500 | static struct ads7846_platform_data ads7846_config = { | |
501 | .x_max = 0x0fff, | |
502 | .y_max = 0x0fff, | |
503 | .x_plate_ohms = 180, | |
504 | .pressure_max = 255, | |
505 | .debounce_max = 10, | |
506 | .debounce_tol = 3, | |
507 | .debounce_rep = 1, | |
508 | .get_pendown_state = ads7846_get_pendown_state, | |
509 | .keep_vref_on = 1, | |
510 | }; | |
511 | ||
512 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | |
513 | .turbo_mode = 0, | |
514 | .single_channel = 1, /* 0: slave, 1: master */ | |
515 | }; | |
516 | ||
517 | static struct spi_board_info omap3pandora_spi_board_info[] __initdata = { | |
518 | { | |
519 | .modalias = "ads7846", | |
520 | .bus_num = 1, | |
521 | .chip_select = 0, | |
522 | .max_speed_hz = 1500000, | |
523 | .controller_data = &ads7846_mcspi_config, | |
524 | .irq = OMAP_GPIO_IRQ(OMAP3_PANDORA_TS_GPIO), | |
525 | .platform_data = &ads7846_config, | |
7b097896 GI |
526 | }, { |
527 | .modalias = "tpo_td043mtea1_panel_spi", | |
528 | .bus_num = 1, | |
529 | .chip_select = 1, | |
530 | .max_speed_hz = 375000, | |
531 | .platform_data = &pandora_lcd_device, | |
da177247 GI |
532 | } |
533 | }; | |
534 | ||
b3c6df3a PW |
535 | static void __init omap3pandora_init_irq(void) |
536 | { | |
b3c6df3a PW |
537 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, |
538 | mt46h32m32lf6_sdrc_params); | |
539 | omap_init_irq(); | |
540 | omap_gpio_init(); | |
541 | } | |
542 | ||
da177247 | 543 | static struct platform_device *omap3pandora_devices[] __initdata = { |
74190450 GI |
544 | &pandora_leds_gpio, |
545 | &pandora_keys_gpio, | |
7b097896 | 546 | &pandora_dss_device, |
da177247 GI |
547 | }; |
548 | ||
6f69a181 | 549 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
58a5491c FB |
550 | |
551 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, | |
552 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, | |
553 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | |
554 | ||
555 | .phy_reset = true, | |
556 | .reset_gpio_port[0] = 16, | |
557 | .reset_gpio_port[1] = -EINVAL, | |
558 | .reset_gpio_port[2] = -EINVAL | |
559 | }; | |
560 | ||
ca5742bd TL |
561 | #ifdef CONFIG_OMAP_MUX |
562 | static struct omap_board_mux board_mux[] __initdata = { | |
563 | { .reg_offset = OMAP_MUX_TERMINATOR }, | |
564 | }; | |
565 | #else | |
566 | #define board_mux NULL | |
567 | #endif | |
568 | ||
884b8369 MM |
569 | static struct omap_musb_board_data musb_board_data = { |
570 | .interface_type = MUSB_INTERFACE_ULPI, | |
571 | .mode = MUSB_OTG, | |
572 | .power = 100, | |
573 | }; | |
574 | ||
da177247 GI |
575 | static void __init omap3pandora_init(void) |
576 | { | |
ca5742bd | 577 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
da177247 GI |
578 | omap3pandora_i2c_init(); |
579 | platform_add_devices(omap3pandora_devices, | |
580 | ARRAY_SIZE(omap3pandora_devices)); | |
da177247 GI |
581 | omap_serial_init(); |
582 | spi_register_board_info(omap3pandora_spi_board_info, | |
583 | ARRAY_SIZE(omap3pandora_spi_board_info)); | |
584 | omap3pandora_ads7846_init(); | |
58a5491c | 585 | usb_ehci_init(&ehci_pdata); |
74190450 | 586 | pandora_keys_gpio_init(); |
884b8369 | 587 | usb_musb_init(&musb_board_data); |
9fb97412 JP |
588 | |
589 | /* Ensure SDRC pins are mux'd for self-refresh */ | |
4896e394 TL |
590 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
591 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | |
da177247 GI |
592 | } |
593 | ||
594 | static void __init omap3pandora_map_io(void) | |
595 | { | |
596 | omap2_set_globals_343x(); | |
6fbd55d0 | 597 | omap34xx_map_common_io(); |
da177247 GI |
598 | } |
599 | ||
600 | MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console") | |
601 | .phys_io = 0x48000000, | |
b4224b23 | 602 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
da177247 GI |
603 | .boot_params = 0x80000100, |
604 | .map_io = omap3pandora_map_io, | |
71ee7dad | 605 | .reserve = omap_reserve, |
da177247 GI |
606 | .init_irq = omap3pandora_init_irq, |
607 | .init_machine = omap3pandora_init, | |
608 | .timer = &omap_timer, | |
609 | MACHINE_END |