omap: musb: Remove #ifdef from board-omap3evm.c
[deliverable/linux.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
68ff0423 370static struct omap2_hsmmc_info mmc[] = {
53c5ec31
SMK
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 409 mmc[0].gpio_cd = gpio + 0;
68ff0423 410 omap2_hsmmc_init(mmc);
53c5ec31 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 450 KEY(0, 0, KEY_LEFT),
0621d756
SP
451 KEY(0, 1, KEY_DOWN),
452 KEY(0, 2, KEY_ENTER),
453 KEY(0, 3, KEY_M),
454
455 KEY(1, 0, KEY_RIGHT),
53c5ec31 456 KEY(1, 1, KEY_UP),
0621d756
SP
457 KEY(1, 2, KEY_I),
458 KEY(1, 3, KEY_N),
459
460 KEY(2, 0, KEY_A),
461 KEY(2, 1, KEY_E),
53c5ec31 462 KEY(2, 2, KEY_J),
0621d756
SP
463 KEY(2, 3, KEY_O),
464
465 KEY(3, 0, KEY_B),
466 KEY(3, 1, KEY_F),
467 KEY(3, 2, KEY_K),
53c5ec31
SMK
468 KEY(3, 3, KEY_P)
469};
470
4f543332
TL
471static struct matrix_keymap_data board_map_data = {
472 .keymap = board_keymap,
473 .keymap_size = ARRAY_SIZE(board_keymap),
474};
475
53c5ec31 476static struct twl4030_keypad_data omap3evm_kp_data = {
4f543332 477 .keymap_data = &board_map_data,
53c5ec31
SMK
478 .rows = 4,
479 .cols = 4,
53c5ec31
SMK
480 .rep = 1,
481};
482
483static struct twl4030_madc_platform_data omap3evm_madc_data = {
484 .irq_line = 1,
485};
486
e86fa0b4
PU
487static struct twl4030_codec_audio_data omap3evm_audio_data = {
488 .audio_mclk = 26000000,
489};
490
491static struct twl4030_codec_data omap3evm_codec_data = {
6df74efb 492 .audio_mclk = 26000000,
e86fa0b4
PU
493 .audio = &omap3evm_audio_data,
494};
495
703e3061
VH
496static struct regulator_consumer_supply omap3_evm_vdda_dac_supply = {
497 .supply = "vdda_dac",
498 .dev = &omap3_evm_dss_device.dev,
499};
500
501/* VDAC for DSS driving S-Video */
502static struct regulator_init_data omap3_evm_vdac = {
503 .constraints = {
504 .min_uV = 1800000,
505 .max_uV = 1800000,
506 .apply_uV = true,
507 .valid_modes_mask = REGULATOR_MODE_NORMAL
508 | REGULATOR_MODE_STANDBY,
509 .valid_ops_mask = REGULATOR_CHANGE_MODE
510 | REGULATOR_CHANGE_STATUS,
511 },
512 .num_consumer_supplies = 1,
513 .consumer_supplies = &omap3_evm_vdda_dac_supply,
514};
515
516/* VPLL2 for digital video outputs */
517static struct regulator_consumer_supply omap3_evm_vpll2_supply = {
518 .supply = "vdvi",
519 .dev = &omap3_evm_lcd_device.dev,
520};
521
522static struct regulator_init_data omap3_evm_vpll2 = {
523 .constraints = {
524 .name = "VDVI",
525 .min_uV = 1800000,
526 .max_uV = 1800000,
527 .apply_uV = true,
528 .valid_modes_mask = REGULATOR_MODE_NORMAL
529 | REGULATOR_MODE_STANDBY,
530 .valid_ops_mask = REGULATOR_CHANGE_MODE
531 | REGULATOR_CHANGE_STATUS,
532 },
533 .num_consumer_supplies = 1,
534 .consumer_supplies = &omap3_evm_vpll2_supply,
535};
536
53c5ec31
SMK
537static struct twl4030_platform_data omap3evm_twldata = {
538 .irq_base = TWL4030_IRQ_BASE,
539 .irq_end = TWL4030_IRQ_END,
540
541 /* platform_data for children goes here */
542 .keypad = &omap3evm_kp_data,
543 .madc = &omap3evm_madc_data,
544 .usb = &omap3evm_usb_data,
545 .gpio = &omap3evm_gpio_data,
e86fa0b4 546 .codec = &omap3evm_codec_data,
703e3061
VH
547 .vdac = &omap3_evm_vdac,
548 .vpll2 = &omap3_evm_vpll2,
53c5ec31
SMK
549};
550
551static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
552 {
553 I2C_BOARD_INFO("twl4030", 0x48),
554 .flags = I2C_CLIENT_WAKE,
555 .irq = INT_34XX_SYS_NIRQ,
556 .platform_data = &omap3evm_twldata,
557 },
558};
559
560static int __init omap3_evm_i2c_init(void)
561{
1a7ec135
MR
562 /*
563 * REVISIT: These entries can be set in omap3evm_twl_data
564 * after a merge with MFD tree
565 */
566 omap3evm_twldata.vmmc1 = &omap3evm_vmmc1;
567 omap3evm_twldata.vsim = &omap3evm_vsim;
568
53c5ec31
SMK
569 omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
570 ARRAY_SIZE(omap3evm_i2c_boardinfo));
571 omap_register_i2c_bus(2, 400, NULL, 0);
572 omap_register_i2c_bus(3, 400, NULL, 0);
573 return 0;
574}
575
53c5ec31
SMK
576static void ads7846_dev_init(void)
577{
578 if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
579 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
580
581 gpio_direction_input(OMAP3_EVM_TS_GPIO);
582
583 omap_set_gpio_debounce(OMAP3_EVM_TS_GPIO, 1);
584 omap_set_gpio_debounce_time(OMAP3_EVM_TS_GPIO, 0xa);
585}
586
587static int ads7846_get_pendown_state(void)
588{
589 return !gpio_get_value(OMAP3_EVM_TS_GPIO);
590}
591
592struct ads7846_platform_data ads7846_config = {
593 .x_max = 0x0fff,
594 .y_max = 0x0fff,
595 .x_plate_ohms = 180,
596 .pressure_max = 255,
597 .debounce_max = 10,
598 .debounce_tol = 3,
599 .debounce_rep = 1,
600 .get_pendown_state = ads7846_get_pendown_state,
601 .keep_vref_on = 1,
602 .settle_delay_usecs = 150,
603};
604
605static struct omap2_mcspi_device_config ads7846_mcspi_config = {
606 .turbo_mode = 0,
607 .single_channel = 1, /* 0: slave, 1: master */
608};
609
610struct spi_board_info omap3evm_spi_board_info[] = {
611 [0] = {
612 .modalias = "ads7846",
613 .bus_num = 1,
614 .chip_select = 0,
615 .max_speed_hz = 1500000,
616 .controller_data = &ads7846_mcspi_config,
617 .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO),
618 .platform_data = &ads7846_config,
619 },
620};
621
b3c6df3a 622static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
b3c6df3a
PW
623};
624
53c5ec31
SMK
625static void __init omap3_evm_init_irq(void)
626{
b3c6df3a
PW
627 omap_board_config = omap3_evm_config;
628 omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
58cda884 629 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
53c5ec31
SMK
630 omap_init_irq();
631 omap_gpio_init();
53c5ec31
SMK
632}
633
53c5ec31 634static struct platform_device *omap3_evm_devices[] __initdata = {
703e3061 635 &omap3_evm_dss_device,
53c5ec31
SMK
636};
637
58a5491c
FB
638static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
639
640 .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
641 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
642 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
643
644 .phy_reset = true,
e8e51d29 645 /* PHY reset GPIO will be runtime programmed based on EVM version */
58a5491c 646 .reset_gpio_port[0] = -EINVAL,
e8e51d29 647 .reset_gpio_port[1] = -EINVAL,
58a5491c
FB
648 .reset_gpio_port[2] = -EINVAL
649};
650
ca5742bd
TL
651#ifdef CONFIG_OMAP_MUX
652static struct omap_board_mux board_mux[] __initdata = {
aa6912d8
SP
653 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
654 OMAP_PIN_OFF_INPUT_PULLUP |
655 OMAP_PIN_OFF_WAKEUPENABLE),
87520aae
SP
656 OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
657 OMAP_PIN_OFF_INPUT_PULLUP |
658 OMAP_PIN_OFF_WAKEUPENABLE),
ca5742bd
TL
659 { .reg_offset = OMAP_MUX_TERMINATOR },
660};
661#else
662#define board_mux NULL
663#endif
664
53c5ec31
SMK
665static void __init omap3_evm_init(void)
666{
db408023 667 omap3_evm_get_revision();
ca5742bd 668 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
db408023 669
53c5ec31
SMK
670 omap3_evm_i2c_init();
671
672 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
53c5ec31
SMK
673
674 spi_register_board_info(omap3evm_spi_board_info,
675 ARRAY_SIZE(omap3evm_spi_board_info));
676
677 omap_serial_init();
1a4f4637 678
e8e2ff46
GAK
679 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
680 usb_nop_xceiv_register();
1a4f4637 681
e8e51d29
AKG
682 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
683 /* enable EHCI VBUS using GPIO22 */
4896e394 684 omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
e8e51d29
AKG
685 gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
686 gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
687 gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
688
689 /* Select EHCI port on main board */
4896e394 690 omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
e8e51d29
AKG
691 gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
692 gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
693 gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
694
695 /* setup EHCI phy reset config */
4896e394 696 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
e8e51d29
AKG
697 ehci_pdata.reset_gpio_port[1] = 21;
698
699 } else {
700 /* setup EHCI phy reset on MDC */
4896e394 701 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
e8e51d29
AKG
702 ehci_pdata.reset_gpio_port[1] = 135;
703 }
53c5ec31 704 usb_musb_init();
58a5491c 705 usb_ehci_init(&ehci_pdata);
53c5ec31 706 ads7846_dev_init();
562138a4 707 omap3evm_init_smsc911x();
703e3061 708 omap3_evm_display_init();
53c5ec31
SMK
709}
710
711static void __init omap3_evm_map_io(void)
712{
713 omap2_set_globals_343x();
6fbd55d0 714 omap34xx_map_common_io();
53c5ec31
SMK
715}
716
717MACHINE_START(OMAP3EVM, "OMAP3 EVM")
718 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
719 .phys_io = 0x48000000,
b4224b23 720 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
53c5ec31
SMK
721 .boot_params = 0x80000100,
722 .map_io = omap3_evm_map_io,
723 .init_irq = omap3_evm_init_irq,
724 .init_machine = omap3_evm_init,
725 .timer = &omap_timer,
726MACHINE_END
This page took 0.09812 seconds and 5 git commands to generate.