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> |
79ccf549 GI |
28 | #include <linux/spi/wl12xx.h> |
29 | #include <linux/mtd/partitions.h> | |
30 | #include <linux/mtd/nand.h> | |
74190450 GI |
31 | #include <linux/leds.h> |
32 | #include <linux/input.h> | |
6135434a | 33 | #include <linux/input/matrix_keypad.h> |
74190450 | 34 | #include <linux/gpio_keys.h> |
da177247 GI |
35 | |
36 | #include <asm/mach-types.h> | |
37 | #include <asm/mach/arch.h> | |
38 | #include <asm/mach/map.h> | |
39 | ||
ce491cf8 TL |
40 | #include <plat/board.h> |
41 | #include <plat/common.h> | |
da177247 GI |
42 | #include <mach/gpio.h> |
43 | #include <mach/hardware.h> | |
ce491cf8 TL |
44 | #include <plat/mcspi.h> |
45 | #include <plat/usb.h> | |
7b097896 | 46 | #include <plat/display.h> |
79ccf549 | 47 | #include <plat/nand.h> |
da177247 | 48 | |
ca5742bd | 49 | #include "mux.h" |
2e12bd7e | 50 | #include "sdram-micron-mt46h32m32lf-6.h" |
d02a900b | 51 | #include "hsmmc.h" |
90c62bf0 | 52 | |
79ccf549 GI |
53 | #define PANDORA_WIFI_IRQ_GPIO 21 |
54 | #define PANDORA_WIFI_NRESET_GPIO 23 | |
da177247 GI |
55 | #define OMAP3_PANDORA_TS_GPIO 94 |
56 | ||
79ccf549 GI |
57 | #define NAND_BLOCK_SIZE SZ_128K |
58 | ||
59 | static 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 | ||
84 | static 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 | ||
74190450 GI |
91 | static 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 | ||
109 | static struct gpio_led_platform_data pandora_gpio_led_data = { | |
110 | .leds = pandora_gpio_leds, | |
111 | .num_leds = ARRAY_SIZE(pandora_gpio_leds), | |
112 | }; | |
113 | ||
114 | static 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, \ | |
ad74db60 | 128 | .debounce_interval = 4, \ |
74190450 GI |
129 | .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 | ||
135 | static 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"), | |
ad74db60 GI |
140 | 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"), | |
74190450 GI |
148 | 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 | ||
155 | static struct gpio_keys_platform_data pandora_gpio_key_info = { | |
156 | .buttons = pandora_gpio_keys, | |
157 | .nbuttons = ARRAY_SIZE(pandora_gpio_keys), | |
158 | }; | |
159 | ||
160 | static 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 | ||
ad74db60 | 168 | static const uint32_t board_keymap[] = { |
24de042c | 169 | /* row, col, code */ |
74190450 | 170 | KEY(0, 0, KEY_9), |
24de042c GI |
171 | 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), | |
74190450 | 177 | KEY(1, 1, KEY_7), |
24de042c GI |
178 | 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), | |
74190450 | 184 | KEY(2, 2, KEY_Y), |
24de042c GI |
185 | 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), | |
74190450 | 191 | KEY(3, 3, KEY_F), |
24de042c GI |
192 | 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), | |
74190450 | 197 | KEY(4, 4, KEY_X), |
24de042c GI |
198 | 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), | |
74190450 GI |
213 | }; |
214 | ||
4f543332 TL |
215 | static struct matrix_keymap_data board_map_data = { |
216 | .keymap = board_keymap, | |
217 | .keymap_size = ARRAY_SIZE(board_keymap), | |
218 | }; | |
219 | ||
74190450 | 220 | static struct twl4030_keypad_data pandora_kp_data = { |
4f543332 | 221 | .keymap_data = &board_map_data, |
74190450 GI |
222 | .rows = 8, |
223 | .cols = 6, | |
74190450 GI |
224 | .rep = 1, |
225 | }; | |
226 | ||
7b097896 GI |
227 | static 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 | ||
235 | static 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 | ||
242 | static struct omap_dss_device *pandora_dss_devices[] = { | |
243 | &pandora_lcd_device, | |
244 | &pandora_tv_device, | |
245 | }; | |
246 | ||
247 | static 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 | ||
253 | static struct platform_device pandora_dss_device = { | |
254 | .name = "omapdss", | |
255 | .id = -1, | |
256 | .dev = { | |
257 | .platform_data = &pandora_dss_data, | |
258 | }, | |
259 | }; | |
260 | ||
68ff0423 | 261 | static struct omap2_hsmmc_info omap3pandora_mmc[] = { |
90c62bf0 TL |
262 | { |
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, | |
0329c377 | 275 | .transceiver = true, |
90c62bf0 | 276 | }, |
07d83cc9 GI |
277 | { |
278 | .mmc = 3, | |
279 | .wires = 4, | |
280 | .gpio_cd = -EINVAL, | |
281 | .gpio_wp = -EINVAL, | |
282 | }, | |
90c62bf0 TL |
283 | {} /* Terminator */ |
284 | }; | |
285 | ||
90c62bf0 TL |
286 | static int omap3pandora_twl_gpio_setup(struct device *dev, |
287 | unsigned gpio, unsigned ngpio) | |
288 | { | |
79ccf549 GI |
289 | int ret, gpio_32khz; |
290 | ||
90c62bf0 TL |
291 | /* 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; | |
68ff0423 | 294 | omap2_hsmmc_init(omap3pandora_mmc); |
90c62bf0 | 295 | |
79ccf549 GI |
296 | /* 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 | ||
90c62bf0 | 310 | return 0; |
79ccf549 GI |
311 | |
312 | fail_direction: | |
313 | gpio_free(gpio_32khz); | |
314 | fail: | |
315 | return -ENODEV; | |
90c62bf0 TL |
316 | } |
317 | ||
da177247 GI |
318 | static 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, | |
90c62bf0 | 322 | .setup = omap3pandora_twl_gpio_setup, |
da177247 GI |
323 | }; |
324 | ||
f6873eed GI |
325 | static struct regulator_consumer_supply pandora_vmmc1_supply = |
326 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0"); | |
327 | ||
328 | static struct regulator_consumer_supply pandora_vmmc2_supply = | |
329 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1"); | |
330 | ||
331 | static struct regulator_consumer_supply pandora_vdda_dac_supply = | |
332 | REGULATOR_SUPPLY("vdda_dac", "omapdss"); | |
333 | ||
334 | static struct regulator_consumer_supply pandora_vdds_supplies[] = { | |
335 | REGULATOR_SUPPLY("vdds_sdi", "omapdss"), | |
336 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"), | |
337 | }; | |
338 | ||
339 | static struct regulator_consumer_supply pandora_vcc_lcd_supply = | |
340 | REGULATOR_SUPPLY("vcc", "display0"); | |
341 | ||
342 | static 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 */ | |
346 | static 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 | ||
352 | static struct regulator_consumer_supply pandora_adac_supply = | |
353 | REGULATOR_SUPPLY("vcc", "soc-audio"); | |
354 | ||
64f535a8 GI |
355 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
356 | static 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) */ | |
371 | static 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 | ||
7b097896 GI |
385 | /* VDAC for DSS driving S-Video */ |
386 | static 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 */ | |
401 | static 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 */ | |
416 | static 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 | ||
f6873eed GI |
430 | /* VAUX2 for USB host PHY */ |
431 | static 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 */ | |
446 | static 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 */ | |
461 | static 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 | ||
da177247 GI |
475 | static struct twl4030_usb_data omap3pandora_usb_data = { |
476 | .usb_mode = T2_USB_MODE_ULPI, | |
477 | }; | |
478 | ||
e86fa0b4 PU |
479 | static struct twl4030_codec_audio_data omap3pandora_audio_data = { |
480 | .audio_mclk = 26000000, | |
481 | }; | |
482 | ||
483 | static struct twl4030_codec_data omap3pandora_codec_data = { | |
6df74efb | 484 | .audio_mclk = 26000000, |
e86fa0b4 PU |
485 | .audio = &omap3pandora_audio_data, |
486 | }; | |
487 | ||
da177247 GI |
488 | static 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, | |
e86fa0b4 | 493 | .codec = &omap3pandora_codec_data, |
64f535a8 GI |
494 | .vmmc1 = &pandora_vmmc1, |
495 | .vmmc2 = &pandora_vmmc2, | |
7b097896 GI |
496 | .vdac = &pandora_vdac, |
497 | .vpll2 = &pandora_vpll2, | |
498 | .vaux1 = &pandora_vaux1, | |
f6873eed GI |
499 | .vaux2 = &pandora_vaux2, |
500 | .vaux4 = &pandora_vaux4, | |
501 | .vsim = &pandora_vsim, | |
74190450 | 502 | .keypad = &pandora_kp_data, |
da177247 GI |
503 | }; |
504 | ||
505 | static 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 | ||
03d5671d GI |
514 | static struct i2c_board_info __initdata omap3pandora_i2c3_boardinfo[] = { |
515 | { | |
516 | I2C_BOARD_INFO("bq27500", 0x55), | |
517 | .flags = I2C_CLIENT_WAKE, | |
518 | }, | |
519 | }; | |
520 | ||
da177247 GI |
521 | static 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 */ | |
03d5671d GI |
526 | omap_register_i2c_bus(3, 100, omap3pandora_i2c3_boardinfo, |
527 | ARRAY_SIZE(omap3pandora_i2c3_boardinfo)); | |
da177247 GI |
528 | return 0; |
529 | } | |
530 | ||
da177247 GI |
531 | static 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 | ||
546 | static int ads7846_get_pendown_state(void) | |
547 | { | |
548 | return !gpio_get_value(OMAP3_PANDORA_TS_GPIO); | |
549 | } | |
550 | ||
551 | static 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 | ||
563 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { | |
564 | .turbo_mode = 0, | |
565 | .single_channel = 1, /* 0: slave, 1: master */ | |
566 | }; | |
567 | ||
568 | static 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, | |
7b097896 GI |
577 | }, { |
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, | |
da177247 GI |
583 | } |
584 | }; | |
585 | ||
b3c6df3a PW |
586 | static void __init omap3pandora_init_irq(void) |
587 | { | |
b3c6df3a PW |
588 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, |
589 | mt46h32m32lf6_sdrc_params); | |
590 | omap_init_irq(); | |
591 | omap_gpio_init(); | |
592 | } | |
593 | ||
79ccf549 GI |
594 | static 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 | ||
602 | static struct wl12xx_platform_data pandora_wl1251_pdata = { | |
603 | .set_power = pandora_wl1251_set_power, | |
604 | .use_eeprom = true, | |
605 | }; | |
606 | ||
607 | static struct platform_device pandora_wl1251_data = { | |
608 | .name = "wl1251_data", | |
609 | .id = -1, | |
610 | .dev = { | |
611 | .platform_data = &pandora_wl1251_pdata, | |
612 | }, | |
613 | }; | |
614 | ||
615 | static 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 | ||
642 | fail_nreset: | |
643 | gpio_free(PANDORA_WIFI_NRESET_GPIO); | |
644 | fail_irq: | |
645 | gpio_free(PANDORA_WIFI_IRQ_GPIO); | |
646 | fail: | |
647 | printk(KERN_ERR "wl1251 board initialisation failed\n"); | |
648 | } | |
649 | ||
da177247 | 650 | static struct platform_device *omap3pandora_devices[] __initdata = { |
74190450 GI |
651 | &pandora_leds_gpio, |
652 | &pandora_keys_gpio, | |
7b097896 | 653 | &pandora_dss_device, |
79ccf549 | 654 | &pandora_wl1251_data, |
da177247 GI |
655 | }; |
656 | ||
6f69a181 | 657 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
58a5491c FB |
658 | |
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 | ||
ca5742bd TL |
669 | #ifdef CONFIG_OMAP_MUX |
670 | static struct omap_board_mux board_mux[] __initdata = { | |
671 | { .reg_offset = OMAP_MUX_TERMINATOR }, | |
672 | }; | |
673 | #else | |
674 | #define board_mux NULL | |
675 | #endif | |
676 | ||
884b8369 MM |
677 | static struct omap_musb_board_data musb_board_data = { |
678 | .interface_type = MUSB_INTERFACE_ULPI, | |
679 | .mode = MUSB_OTG, | |
680 | .power = 100, | |
681 | }; | |
682 | ||
da177247 GI |
683 | static void __init omap3pandora_init(void) |
684 | { | |
ca5742bd | 685 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
da177247 | 686 | omap3pandora_i2c_init(); |
79ccf549 | 687 | pandora_wl1251_init(); |
da177247 GI |
688 | platform_add_devices(omap3pandora_devices, |
689 | ARRAY_SIZE(omap3pandora_devices)); | |
da177247 GI |
690 | omap_serial_init(); |
691 | spi_register_board_info(omap3pandora_spi_board_info, | |
692 | ARRAY_SIZE(omap3pandora_spi_board_info)); | |
693 | omap3pandora_ads7846_init(); | |
58a5491c | 694 | usb_ehci_init(&ehci_pdata); |
884b8369 | 695 | usb_musb_init(&musb_board_data); |
79ccf549 | 696 | gpmc_nand_init(&pandora_nand_data); |
9fb97412 JP |
697 | |
698 | /* Ensure SDRC pins are mux'd for self-refresh */ | |
4896e394 TL |
699 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
700 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | |
da177247 GI |
701 | } |
702 | ||
703 | static void __init omap3pandora_map_io(void) | |
704 | { | |
705 | omap2_set_globals_343x(); | |
6fbd55d0 | 706 | omap34xx_map_common_io(); |
da177247 GI |
707 | } |
708 | ||
709 | MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console") | |
710 | .phys_io = 0x48000000, | |
b4224b23 | 711 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
da177247 GI |
712 | .boot_params = 0x80000100, |
713 | .map_io = omap3pandora_map_io, | |
714 | .init_irq = omap3pandora_init_irq, | |
715 | .init_machine = omap3pandora_init, | |
716 | .timer = &omap_timer, | |
717 | MACHINE_END |