]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/arm/mach-omap2/board-omap3evm.c
omap: Rename mmc-twl4030 files to hsmmc
[net-next-2.6.git] / arch / arm / mach-omap2 / board-omap3evm.c
CommitLineData
53c5ec31
SMK
1/*
2 * linux/arch/arm/mach-omap2/board-omap3evm.c
3 *
4 * Copyright (C) 2008 Texas Instruments
5 *
6 * Modified from mach-omap2/board-3430sdp.c
7 *
8 * Initial code: Syed Mohammed Khasim
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/delay.h>
19#include <linux/err.h>
20#include <linux/clk.h>
21#include <linux/gpio.h>
22#include <linux/input.h>
6135434a 23#include <linux/input/matrix_keypad.h>
53c5ec31 24#include <linux/leds.h>
562138a4 25#include <linux/interrupt.h>
53c5ec31
SMK
26
27#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h>
ebeb53e1 29#include <linux/i2c/twl.h>
e8e2ff46 30#include <linux/usb/otg.h>
562138a4 31#include <linux/smsc911x.h>
53c5ec31 32
1a7ec135
MR
33#include <linux/regulator/machine.h>
34
53c5ec31
SMK
35#include <mach/hardware.h>
36#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
38#include <asm/mach/map.h>
39
ce491cf8 40#include <plat/board.h>
ce491cf8
TL
41#include <plat/usb.h>
42#include <plat/common.h>
43#include <plat/mcspi.h>
703e3061 44#include <plat/display.h>
53c5ec31 45
ca5742bd 46#include "mux.h"
53c5ec31 47#include "sdram-micron-mt46h32m32lf-6.h"
d02a900b 48#include "hsmmc.h"
53c5ec31
SMK
49
50#define OMAP3_EVM_TS_GPIO 175
e8e51d29
AKG
51#define OMAP3_EVM_EHCI_VBUS 22
52#define OMAP3_EVM_EHCI_SELECT 61
53c5ec31
SMK
53
54#define OMAP3EVM_ETHR_START 0x2c000000
55#define OMAP3EVM_ETHR_SIZE 1024
db408023 56#define OMAP3EVM_ETHR_ID_REV 0x50
53c5ec31 57#define OMAP3EVM_ETHR_GPIO_IRQ 176
562138a4 58#define OMAP3EVM_SMSC911X_CS 5
53c5ec31 59
db408023
AKG
60static u8 omap3_evm_version;
61
62u8 get_omap3_evm_rev(void)
63{
64 return omap3_evm_version;
65}
66EXPORT_SYMBOL(get_omap3_evm_rev);
67
68static void __init omap3_evm_get_revision(void)
69{
70 void __iomem *ioaddr;
71 unsigned int smsc_id;
72
73 /* Ethernet PHY ID is stored at ID_REV register */
74 ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K);
75 if (!ioaddr)
76 return;
77 smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000;
78 iounmap(ioaddr);
79
80 switch (smsc_id) {
81 /*SMSC9115 chipset*/
82 case 0x01150000:
83 omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
84 break;
85 /*SMSC 9220 chipset*/
86 case 0x92200000:
87 default:
88 omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
89 }
90}
91
562138a4
S
92#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
93static struct resource omap3evm_smsc911x_resources[] = {
53c5ec31
SMK
94 [0] = {
95 .start = OMAP3EVM_ETHR_START,
96 .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
97 .flags = IORESOURCE_MEM,
98 },
99 [1] = {
100 .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
101 .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
562138a4 102 .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
53c5ec31
SMK
103 },
104};
105
562138a4
S
106static struct smsc911x_platform_config smsc911x_config = {
107 .phy_interface = PHY_INTERFACE_MODE_MII,
108 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
109 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
110 .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS),
111};
112
113static struct platform_device omap3evm_smsc911x_device = {
114 .name = "smsc911x",
53c5ec31 115 .id = -1,
562138a4
S
116 .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources),
117 .resource = &omap3evm_smsc911x_resources[0],
118 .dev = {
119 .platform_data = &smsc911x_config,
120 },
53c5ec31
SMK
121};
122
562138a4 123static inline void __init omap3evm_init_smsc911x(void)
53c5ec31
SMK
124{
125 int eth_cs;
126 struct clk *l3ck;
127 unsigned int rate;
128
562138a4 129 eth_cs = OMAP3EVM_SMSC911X_CS;
53c5ec31
SMK
130
131 l3ck = clk_get(NULL, "l3_ck");
132 if (IS_ERR(l3ck))
133 rate = 100000000;
134 else
135 rate = clk_get_rate(l3ck);
136
562138a4
S
137 if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
138 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
53c5ec31
SMK
139 OMAP3EVM_ETHR_GPIO_IRQ);
140 return;
141 }
142
143 gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
562138a4 144 platform_device_register(&omap3evm_smsc911x_device);
53c5ec31
SMK
145}
146
562138a4
S
147#else
148static inline void __init omap3evm_init_smsc911x(void) { return; }
149#endif
150
703e3061
VH
151/*
152 * OMAP3EVM LCD Panel control signals
153 */
154#define OMAP3EVM_LCD_PANEL_LR 2
155#define OMAP3EVM_LCD_PANEL_UD 3
156#define OMAP3EVM_LCD_PANEL_INI 152
157#define OMAP3EVM_LCD_PANEL_ENVDD 153
158#define OMAP3EVM_LCD_PANEL_QVGA 154
159#define OMAP3EVM_LCD_PANEL_RESB 155
160#define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210
161#define OMAP3EVM_DVI_PANEL_EN_GPIO 199
162
163static int lcd_enabled;
164static int dvi_enabled;
165
166static void __init omap3_evm_display_init(void)
167{
168 int r;
169
170 r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb");
171 if (r) {
172 printk(KERN_ERR "failed to get lcd_panel_resb\n");
173 return;
174 }
175 gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1);
176
177 r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini");
178 if (r) {
179 printk(KERN_ERR "failed to get lcd_panel_ini\n");
180 goto err_1;
181 }
182 gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1);
183
184 r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga");
185 if (r) {
186 printk(KERN_ERR "failed to get lcd_panel_qvga\n");
187 goto err_2;
188 }
189 gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0);
190
191 r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr");
192 if (r) {
193 printk(KERN_ERR "failed to get lcd_panel_lr\n");
194 goto err_3;
195 }
196 gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1);
197
198 r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud");
199 if (r) {
200 printk(KERN_ERR "failed to get lcd_panel_ud\n");
201 goto err_4;
202 }
203 gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1);
204
205 r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd");
206 if (r) {
207 printk(KERN_ERR "failed to get lcd_panel_envdd\n");
208 goto err_5;
209 }
210 gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0);
211
212 return;
213
214err_5:
215 gpio_free(OMAP3EVM_LCD_PANEL_UD);
216err_4:
217 gpio_free(OMAP3EVM_LCD_PANEL_LR);
218err_3:
219 gpio_free(OMAP3EVM_LCD_PANEL_QVGA);
220err_2:
221 gpio_free(OMAP3EVM_LCD_PANEL_INI);
222err_1:
223 gpio_free(OMAP3EVM_LCD_PANEL_RESB);
224
225}
226
227static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev)
228{
229 if (dvi_enabled) {
230 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
231 return -EINVAL;
232 }
233 gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 0);
234
235 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
236 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
237 else
238 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
239
240 lcd_enabled = 1;
241 return 0;
242}
243
244static void omap3_evm_disable_lcd(struct omap_dss_device *dssdev)
245{
246 gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 1);
247
248 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
249 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
250 else
251 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
252
253 lcd_enabled = 0;
254}
255
256static struct omap_dss_device omap3_evm_lcd_device = {
257 .name = "lcd",
258 .driver_name = "sharp_ls_panel",
259 .type = OMAP_DISPLAY_TYPE_DPI,
260 .phy.dpi.data_lines = 18,
261 .platform_enable = omap3_evm_enable_lcd,
262 .platform_disable = omap3_evm_disable_lcd,
263};
264
265static int omap3_evm_enable_tv(struct omap_dss_device *dssdev)
266{
267 return 0;
268}
269
270static void omap3_evm_disable_tv(struct omap_dss_device *dssdev)
271{
272}
273
274static struct omap_dss_device omap3_evm_tv_device = {
275 .name = "tv",
276 .driver_name = "venc",
277 .type = OMAP_DISPLAY_TYPE_VENC,
278 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
279 .platform_enable = omap3_evm_enable_tv,
280 .platform_disable = omap3_evm_disable_tv,
281};
282
283static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev)
284{
285 if (lcd_enabled) {
286 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
287 return -EINVAL;
288 }
289
290 gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 1);
291
292 dvi_enabled = 1;
293 return 0;
294}
295
296static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev)
297{
298 gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 0);
299
300 dvi_enabled = 0;
301}
302
303static struct omap_dss_device omap3_evm_dvi_device = {
304 .name = "dvi",
305 .driver_name = "generic_panel",
306 .type = OMAP_DISPLAY_TYPE_DPI,
307 .phy.dpi.data_lines = 24,
308 .platform_enable = omap3_evm_enable_dvi,
309 .platform_disable = omap3_evm_disable_dvi,
310};
311
312static struct omap_dss_device *omap3_evm_dss_devices[] = {
313 &omap3_evm_lcd_device,
314 &omap3_evm_tv_device,
315 &omap3_evm_dvi_device,
316};
317
318static struct omap_dss_board_info omap3_evm_dss_data = {
319 .num_devices = ARRAY_SIZE(omap3_evm_dss_devices),
320 .devices = omap3_evm_dss_devices,
321 .default_device = &omap3_evm_lcd_device,
322};
323
324static struct platform_device omap3_evm_dss_device = {
325 .name = "omapdss",
326 .id = -1,
327 .dev = {
328 .platform_data = &omap3_evm_dss_data,
329 },
330};
331
1a7ec135
MR
332static struct regulator_consumer_supply omap3evm_vmmc1_supply = {
333 .supply = "vmmc",
334};
335
336static struct regulator_consumer_supply omap3evm_vsim_supply = {
337 .supply = "vmmc_aux",
338};
339
340/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
341static struct regulator_init_data omap3evm_vmmc1 = {
342 .constraints = {
343 .min_uV = 1850000,
344 .max_uV = 3150000,
345 .valid_modes_mask = REGULATOR_MODE_NORMAL
346 | REGULATOR_MODE_STANDBY,
347 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
348 | REGULATOR_CHANGE_MODE
349 | REGULATOR_CHANGE_STATUS,
350 },
351 .num_consumer_supplies = 1,
352 .consumer_supplies = &omap3evm_vmmc1_supply,
353};
354
355/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
356static struct regulator_init_data omap3evm_vsim = {
357 .constraints = {
358 .min_uV = 1800000,
359 .max_uV = 3000000,
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 = &omap3evm_vsim_supply,
368};
369
53c5ec31
SMK
370static struct twl4030_hsmmc_info mmc[] = {
371 {
372 .mmc = 1,
373 .wires = 4,
374 .gpio_cd = -EINVAL,
375 .gpio_wp = 63,
376 },
377 {} /* Terminator */
378};
379
380static struct gpio_led gpio_leds[] = {
381 {
382 .name = "omap3evm::ledb",
383 /* normally not visible (board underside) */
384 .default_trigger = "default-on",
385 .gpio = -EINVAL, /* gets replaced */
386 .active_low = true,
387 },
388};
389
390static struct gpio_led_platform_data gpio_led_info = {
391 .leds = gpio_leds,
392 .num_leds = ARRAY_SIZE(gpio_leds),
393};
394
395static struct platform_device leds_gpio = {
396 .name = "leds-gpio",
397 .id = -1,
398 .dev = {
399 .platform_data = &gpio_led_info,
400 },
401};
402
403
404static int omap3evm_twl_gpio_setup(struct device *dev,
405 unsigned gpio, unsigned ngpio)
406{
407 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
4896e394 408 omap_mux_init_gpio(63, OMAP_PIN_INPUT);
53c5ec31
SMK
409 mmc[0].gpio_cd = gpio + 0;
410 twl4030_mmc_init(mmc);
411
1a7ec135
MR
412 /* link regulators to MMC adapters */
413 omap3evm_vmmc1_supply.dev = mmc[0].dev;
414 omap3evm_vsim_supply.dev = mmc[0].dev;
415
53c5ec31
SMK
416 /*
417 * Most GPIOs are for USB OTG. Some are mostly sent to
418 * the P2 connector; notably LEDA for the LCD backlight.
419 */
420
703e3061
VH
421 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
422 gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL");
423 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
424
425 /* gpio + 7 == DVI Enable */
426 gpio_request(gpio + 7, "EN_DVI");
427 gpio_direction_output(gpio + 7, 0);
428
53c5ec31
SMK
429 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
430 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
431
432 platform_device_register(&leds_gpio);
433
434 return 0;
435}
436
437static struct twl4030_gpio_platform_data omap3evm_gpio_data = {
438 .gpio_base = OMAP_MAX_GPIO_LINES,
439 .irq_base = TWL4030_GPIO_IRQ_BASE,
440 .irq_end = TWL4030_GPIO_IRQ_END,
441 .use_leds = true,
442 .setup = omap3evm_twl_gpio_setup,
443};
444
445static struct twl4030_usb_data omap3evm_usb_data = {
446 .usb_mode = T2_USB_MODE_ULPI,
447};
448
4f543332 449static int board_keymap[] = {
53c5ec31
SMK
450 KEY(0, 0, KEY_LEFT),
451 KEY(0, 1, KEY_RIGHT),
452 KEY(0, 2, KEY_A),
453 KEY(0, 3, KEY_B),
454 KEY(1, 0, KEY_DOWN),
455 KEY(1, 1, KEY_UP),
456 KEY(1, 2, KEY_E),
457 KEY(1, 3, KEY_F),
458 KEY(2, 0, KEY_ENTER),
459 KEY(2, 1, KEY_I),
460 KEY(2, 2, KEY_J),
461 KEY(2, 3, KEY_K),
462 KEY(3, 0, KEY_M),
463 KEY(3, 1, KEY_N),
464 KEY(3, 2, KEY_O),
465 KEY(3, 3, KEY_P)
466};
467
4f543332
TL
468static struct matrix_keymap_data board_map_data = {
469 .keymap = board_keymap,
470 .keymap_size = ARRAY_SIZE(board_keymap),
471};
472
53c5ec31 473static struct twl4030_keypad_data omap3evm_kp_data = {
4f543332 474 .keymap_data = &board_map_data,
53c5ec31
SMK
475 .rows = 4,
476 .cols = 4,
53c5ec31
SMK
477 .rep = 1,
478};
479
480static struct twl4030_madc_platform_data omap3evm_madc_data = {
481 .irq_line = 1,
482};
483
e86fa0b4
PU
484static struct twl4030_codec_audio_data omap3evm_audio_data = {
485 .audio_mclk = 26000000,
486};
487
488static struct twl4030_codec_data omap3evm_codec_data = {
6df74efb 489 .audio_mclk = 26000000,
e86fa0b4
PU
490 .audio = &omap3evm_audio_data,
491};
492
703e3061
VH
493static struct regulator_consumer_supply omap3_evm_vdda_dac_supply = {
494 .supply = "vdda_dac",
495 .dev = &omap3_evm_dss_device.dev,
496};
497
498/* VDAC for DSS driving S-Video */
499static struct regulator_init_data omap3_evm_vdac = {
500 .constraints = {
501 .min_uV = 1800000,
502 .max_uV = 1800000,
503 .apply_uV = true,
504 .valid_modes_mask = REGULATOR_MODE_NORMAL
505 | REGULATOR_MODE_STANDBY,
506 .valid_ops_mask = REGULATOR_CHANGE_MODE
507 | REGULATOR_CHANGE_STATUS,
508 },
509 .num_consumer_supplies = 1,
510 .consumer_supplies = &omap3_evm_vdda_dac_supply,
511};
512
513/* VPLL2 for digital video outputs */
514static struct regulator_consumer_supply omap3_evm_vpll2_supply = {
515 .supply = "vdvi",
516 .dev = &omap3_evm_lcd_device.dev,
517};
518
519static struct regulator_init_data omap3_evm_vpll2 = {
520 .constraints = {
521 .name = "VDVI",
522 .min_uV = 1800000,
523 .max_uV = 1800000,
524 .apply_uV = true,
525 .valid_modes_mask = REGULATOR_MODE_NORMAL
526 | REGULATOR_MODE_STANDBY,
527 .valid_ops_mask = REGULATOR_CHANGE_MODE
528 | REGULATOR_CHANGE_STATUS,
529 },
530 .num_consumer_supplies = 1,
531 .consumer_supplies = &omap3_evm_vpll2_supply,
532};
533
53c5ec31
SMK
534static struct twl4030_platform_data omap3evm_twldata = {
535 .irq_base = TWL4030_IRQ_BASE,
536 .irq_end = TWL4030_IRQ_END,
537
538 /* platform_data for children goes here */
539 .keypad = &omap3evm_kp_data,
540 .madc = &omap3evm_madc_data,
541 .usb = &omap3evm_usb_data,
542 .gpio = &omap3evm_gpio_data,
e86fa0b4 543 .codec = &omap3evm_codec_data,
703e3061
VH
544 .vdac = &omap3_evm_vdac,
545 .vpll2 = &omap3_evm_vpll2,
53c5ec31
SMK
546};
547
548static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
549 {
550 I2C_BOARD_INFO("twl4030", 0x48),
551 .flags = I2C_CLIENT_WAKE,
552 .irq = INT_34XX_SYS_NIRQ,
553 .platform_data = &omap3evm_twldata,
554 },
555};
556
557static int __init omap3_evm_i2c_init(void)
558{
1a7ec135
MR
559 /*
560 * REVISIT: These entries can be set in omap3evm_twl_data
561 * after a merge with MFD tree
562 */
563 omap3evm_twldata.vmmc1 = &omap3evm_vmmc1;
564 omap3evm_twldata.vsim = &omap3evm_vsim;
565
53c5ec31
SMK
566 omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
567 ARRAY_SIZE(omap3evm_i2c_boardinfo));
568 omap_register_i2c_bus(2, 400, NULL, 0);
569 omap_register_i2c_bus(3, 400, NULL, 0);
570 return 0;
571}
572
53c5ec31
SMK
573static void ads7846_dev_init(void)
574{
575 if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
576 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
577
578 gpio_direction_input(OMAP3_EVM_TS_GPIO);
579
580 omap_set_gpio_debounce(OMAP3_EVM_TS_GPIO, 1);
581 omap_set_gpio_debounce_time(OMAP3_EVM_TS_GPIO, 0xa);
582}
583
584static int ads7846_get_pendown_state(void)
585{
586 return !gpio_get_value(OMAP3_EVM_TS_GPIO);
587}
588
589struct ads7846_platform_data ads7846_config = {
590 .x_max = 0x0fff,
591 .y_max = 0x0fff,
592 .x_plate_ohms = 180,
593 .pressure_max = 255,
594 .debounce_max = 10,
595 .debounce_tol = 3,
596 .debounce_rep = 1,
597 .get_pendown_state = ads7846_get_pendown_state,
598 .keep_vref_on = 1,
599 .settle_delay_usecs = 150,
600};
601
602static struct omap2_mcspi_device_config ads7846_mcspi_config = {
603 .turbo_mode = 0,
604 .single_channel = 1, /* 0: slave, 1: master */
605};
606
607struct spi_board_info omap3evm_spi_board_info[] = {
608 [0] = {
609 .modalias = "ads7846",
610 .bus_num = 1,
611 .chip_select = 0,
612 .max_speed_hz = 1500000,
613 .controller_data = &ads7846_mcspi_config,
614 .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO),
615 .platform_data = &ads7846_config,
616 },
617};
618
b3c6df3a 619static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
b3c6df3a
PW
620};
621
53c5ec31
SMK
622static void __init omap3_evm_init_irq(void)
623{
b3c6df3a
PW
624 omap_board_config = omap3_evm_config;
625 omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
58cda884 626 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
53c5ec31
SMK
627 omap_init_irq();
628 omap_gpio_init();
53c5ec31
SMK
629}
630
53c5ec31 631static struct platform_device *omap3_evm_devices[] __initdata = {
703e3061 632 &omap3_evm_dss_device,
53c5ec31
SMK
633};
634
58a5491c
FB
635static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
636
637 .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
638 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
639 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
640
641 .phy_reset = true,
e8e51d29 642 /* PHY reset GPIO will be runtime programmed based on EVM version */
58a5491c 643 .reset_gpio_port[0] = -EINVAL,
e8e51d29 644 .reset_gpio_port[1] = -EINVAL,
58a5491c
FB
645 .reset_gpio_port[2] = -EINVAL
646};
647
ca5742bd
TL
648#ifdef CONFIG_OMAP_MUX
649static struct omap_board_mux board_mux[] __initdata = {
650 { .reg_offset = OMAP_MUX_TERMINATOR },
651};
652#else
653#define board_mux NULL
654#endif
655
53c5ec31
SMK
656static void __init omap3_evm_init(void)
657{
db408023 658 omap3_evm_get_revision();
ca5742bd 659 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
db408023 660
53c5ec31
SMK
661 omap3_evm_i2c_init();
662
663 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
53c5ec31
SMK
664
665 spi_register_board_info(omap3evm_spi_board_info,
666 ARRAY_SIZE(omap3evm_spi_board_info));
667
668 omap_serial_init();
e8e2ff46
GAK
669#ifdef CONFIG_NOP_USB_XCEIV
670 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
671 usb_nop_xceiv_register();
672#endif
e8e51d29
AKG
673 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
674 /* enable EHCI VBUS using GPIO22 */
4896e394 675 omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
e8e51d29
AKG
676 gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
677 gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
678 gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
679
680 /* Select EHCI port on main board */
4896e394 681 omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
e8e51d29
AKG
682 gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
683 gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
684 gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
685
686 /* setup EHCI phy reset config */
4896e394 687 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
e8e51d29
AKG
688 ehci_pdata.reset_gpio_port[1] = 21;
689
690 } else {
691 /* setup EHCI phy reset on MDC */
4896e394 692 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
e8e51d29
AKG
693 ehci_pdata.reset_gpio_port[1] = 135;
694 }
53c5ec31 695 usb_musb_init();
58a5491c 696 usb_ehci_init(&ehci_pdata);
53c5ec31 697 ads7846_dev_init();
562138a4 698 omap3evm_init_smsc911x();
703e3061 699 omap3_evm_display_init();
53c5ec31
SMK
700}
701
702static void __init omap3_evm_map_io(void)
703{
704 omap2_set_globals_343x();
6fbd55d0 705 omap34xx_map_common_io();
53c5ec31
SMK
706}
707
708MACHINE_START(OMAP3EVM, "OMAP3 EVM")
709 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
710 .phys_io = 0x48000000,
b4224b23 711 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
53c5ec31
SMK
712 .boot_params = 0x80000100,
713 .map_io = omap3_evm_map_io,
714 .init_irq = omap3_evm_init_irq,
715 .init_machine = omap3_evm_init,
716 .timer = &omap_timer,
717MACHINE_END