blob: 7d7b5bc8dc31a4ea7e1c858943fe6046ae58de0a [file] [log] [blame]
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -07001/*
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>
Janusz Krzysztofik61354342009-10-22 14:43:17 -070023#include <linux/input/matrix_keypad.h>
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070024#include <linux/leds.h>
Sriram562138a2009-11-22 10:11:30 -080025#include <linux/interrupt.h>
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070026
27#include <linux/spi/spi.h>
28#include <linux/spi/ads7846.h>
Balaji T Kebeb53e2009-12-15 20:09:02 +053029#include <linux/i2c/twl.h>
Gupta, Ajay Kumare8e2ff42009-07-29 11:58:57 +053030#include <linux/usb/otg.h>
Sriram562138a2009-11-22 10:11:30 -080031#include <linux/smsc911x.h>
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070032
Mike Rapoport1a7ec132009-11-22 10:11:29 -080033#include <linux/regulator/machine.h>
34
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070035#include <mach/hardware.h>
36#include <asm/mach-types.h>
37#include <asm/mach/arch.h>
38#include <asm/mach/map.h>
39
Tony Lindgrence491cf2009-10-20 09:40:47 -070040#include <plat/board.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070041#include <plat/usb.h>
42#include <plat/common.h>
43#include <plat/mcspi.h>
Vaibhav Hiremath703e3062010-01-04 15:34:16 +010044#include <plat/display.h>
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070045
Tony Lindgrenca5742b2009-12-11 16:16:32 -080046#include "mux.h"
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070047#include "sdram-micron-mt46h32m32lf-6.h"
Adrian Hunterd02a900b2010-02-15 10:03:34 -080048#include "hsmmc.h"
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070049
50#define OMAP3_EVM_TS_GPIO 175
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -080051#define OMAP3_EVM_EHCI_VBUS 22
52#define OMAP3_EVM_EHCI_SELECT 61
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070053
54#define OMAP3EVM_ETHR_START 0x2c000000
55#define OMAP3EVM_ETHR_SIZE 1024
Ajay Kumar Guptadb408022009-11-22 10:11:27 -080056#define OMAP3EVM_ETHR_ID_REV 0x50
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070057#define OMAP3EVM_ETHR_GPIO_IRQ 176
Sriram562138a2009-11-22 10:11:30 -080058#define OMAP3EVM_SMSC911X_CS 5
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070059
Ajay Kumar Guptadb408022009-11-22 10:11:27 -080060static 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
Sriram562138a2009-11-22 10:11:30 -080092#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
93static struct resource omap3evm_smsc911x_resources[] = {
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070094 [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),
Sriram562138a2009-11-22 10:11:30 -0800102 .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700103 },
104};
105
Sriram562138a2009-11-22 10:11:30 -0800106static 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),
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700111};
112
Sriram562138a2009-11-22 10:11:30 -0800113static struct platform_device omap3evm_smsc911x_device = {
114 .name = "smsc911x",
115 .id = -1,
116 .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources),
117 .resource = &omap3evm_smsc911x_resources[0],
118 .dev = {
119 .platform_data = &smsc911x_config,
120 },
121};
122
123static inline void __init omap3evm_init_smsc911x(void)
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700124{
125 int eth_cs;
126 struct clk *l3ck;
127 unsigned int rate;
128
Sriram562138a2009-11-22 10:11:30 -0800129 eth_cs = OMAP3EVM_SMSC911X_CS;
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700130
131 l3ck = clk_get(NULL, "l3_ck");
132 if (IS_ERR(l3ck))
133 rate = 100000000;
134 else
135 rate = clk_get_rate(l3ck);
136
Sriram562138a2009-11-22 10:11:30 -0800137 if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
138 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700139 OMAP3EVM_ETHR_GPIO_IRQ);
140 return;
141 }
142
143 gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
Sriram562138a2009-11-22 10:11:30 -0800144 platform_device_register(&omap3evm_smsc911x_device);
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700145}
146
Sriram562138a2009-11-22 10:11:30 -0800147#else
148static inline void __init omap3evm_init_smsc911x(void) { return; }
149#endif
150
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100151/*
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
Mike Rapoport1a7ec132009-11-22 10:11:29 -0800332static 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
Adrian Hunter68ff0422010-02-15 10:03:34 -0800370static struct omap2_hsmmc_info mmc[] = {
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700371 {
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) */
Tony Lindgren4896e392009-12-11 16:16:32 -0800408 omap_mux_init_gpio(63, OMAP_PIN_INPUT);
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700409 mmc[0].gpio_cd = gpio + 0;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800410 omap2_hsmmc_init(mmc);
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700411
Mike Rapoport1a7ec132009-11-22 10:11:29 -0800412 /* link regulators to MMC adapters */
413 omap3evm_vmmc1_supply.dev = mmc[0].dev;
414 omap3evm_vsim_supply.dev = mmc[0].dev;
415
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700416 /*
417 * Most GPIOs are for USB OTG. Some are mostly sent to
418 * the P2 connector; notably LEDA for the LCD backlight.
419 */
420
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100421 /* 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
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700429 /* 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
Tony Lindgren4f543332009-09-24 16:23:16 -0700449static int board_keymap[] = {
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700450 KEY(0, 0, KEY_LEFT),
Sanjeev Premi0621d752010-02-17 14:09:24 -0800451 KEY(0, 1, KEY_DOWN),
452 KEY(0, 2, KEY_ENTER),
453 KEY(0, 3, KEY_M),
454
455 KEY(1, 0, KEY_RIGHT),
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700456 KEY(1, 1, KEY_UP),
Sanjeev Premi0621d752010-02-17 14:09:24 -0800457 KEY(1, 2, KEY_I),
458 KEY(1, 3, KEY_N),
459
460 KEY(2, 0, KEY_A),
461 KEY(2, 1, KEY_E),
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700462 KEY(2, 2, KEY_J),
Sanjeev Premi0621d752010-02-17 14:09:24 -0800463 KEY(2, 3, KEY_O),
464
465 KEY(3, 0, KEY_B),
466 KEY(3, 1, KEY_F),
467 KEY(3, 2, KEY_K),
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700468 KEY(3, 3, KEY_P)
469};
470
Tony Lindgren4f543332009-09-24 16:23:16 -0700471static struct matrix_keymap_data board_map_data = {
472 .keymap = board_keymap,
473 .keymap_size = ARRAY_SIZE(board_keymap),
474};
475
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700476static struct twl4030_keypad_data omap3evm_kp_data = {
Tony Lindgren4f543332009-09-24 16:23:16 -0700477 .keymap_data = &board_map_data,
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700478 .rows = 4,
479 .cols = 4,
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700480 .rep = 1,
481};
482
483static struct twl4030_madc_platform_data omap3evm_madc_data = {
484 .irq_line = 1,
485};
486
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300487static struct twl4030_codec_audio_data omap3evm_audio_data = {
488 .audio_mclk = 26000000,
489};
490
491static struct twl4030_codec_data omap3evm_codec_data = {
Peter Ujfalusi6df74ef2009-11-04 09:58:18 +0200492 .audio_mclk = 26000000,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300493 .audio = &omap3evm_audio_data,
494};
495
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100496static 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
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700537static 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,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300546 .codec = &omap3evm_codec_data,
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100547 .vdac = &omap3_evm_vdac,
548 .vpll2 = &omap3_evm_vpll2,
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700549};
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{
Mike Rapoport1a7ec132009-11-22 10:11:29 -0800562 /*
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
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700569 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
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700576static 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
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300622static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300623};
624
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700625static void __init omap3_evm_init_irq(void)
626{
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300627 omap_board_config = omap3_evm_config;
628 omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
Jean Pihet58cda882009-07-24 19:43:25 -0600629 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700630 omap_init_irq();
631 omap_gpio_init();
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700632}
633
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700634static struct platform_device *omap3_evm_devices[] __initdata = {
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100635 &omap3_evm_dss_device,
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700636};
637
Felipe Balbi6f69a182010-03-04 09:45:53 +0200638static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
Felipe Balbi58a54912009-11-22 10:11:01 -0800639
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,
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800645 /* PHY reset GPIO will be runtime programmed based on EVM version */
Felipe Balbi58a54912009-11-22 10:11:01 -0800646 .reset_gpio_port[0] = -EINVAL,
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800647 .reset_gpio_port[1] = -EINVAL,
Felipe Balbi58a54912009-11-22 10:11:01 -0800648 .reset_gpio_port[2] = -EINVAL
649};
650
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800651#ifdef CONFIG_OMAP_MUX
652static struct omap_board_mux board_mux[] __initdata = {
Sanjeev Premiaa6912d82010-02-17 14:09:23 -0800653 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
654 OMAP_PIN_OFF_INPUT_PULLUP |
655 OMAP_PIN_OFF_WAKEUPENABLE),
Sanjeev Premi87520aa2010-02-17 14:09:24 -0800656 OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
657 OMAP_PIN_OFF_INPUT_PULLUP |
658 OMAP_PIN_OFF_WAKEUPENABLE),
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800659 { .reg_offset = OMAP_MUX_TERMINATOR },
660};
661#else
662#define board_mux NULL
663#endif
664
Maulik Mankad884b8362010-02-17 14:09:30 -0800665static struct omap_musb_board_data musb_board_data = {
666 .interface_type = MUSB_INTERFACE_ULPI,
667 .mode = MUSB_OTG,
668 .power = 100,
669};
670
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700671static void __init omap3_evm_init(void)
672{
Ajay Kumar Guptadb408022009-11-22 10:11:27 -0800673 omap3_evm_get_revision();
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800674 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Ajay Kumar Guptadb408022009-11-22 10:11:27 -0800675
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700676 omap3_evm_i2c_init();
677
678 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700679
680 spi_register_board_info(omap3evm_spi_board_info,
681 ARRAY_SIZE(omap3evm_spi_board_info));
682
683 omap_serial_init();
Maulik Mankad1a4f4632010-02-17 14:09:29 -0800684
Gupta, Ajay Kumare8e2ff42009-07-29 11:58:57 +0530685 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
686 usb_nop_xceiv_register();
Maulik Mankad1a4f4632010-02-17 14:09:29 -0800687
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800688 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
689 /* enable EHCI VBUS using GPIO22 */
Tony Lindgren4896e392009-12-11 16:16:32 -0800690 omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800691 gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
692 gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
693 gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
694
695 /* Select EHCI port on main board */
Tony Lindgren4896e392009-12-11 16:16:32 -0800696 omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800697 gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
698 gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
699 gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
700
701 /* setup EHCI phy reset config */
Tony Lindgren4896e392009-12-11 16:16:32 -0800702 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800703 ehci_pdata.reset_gpio_port[1] = 21;
704
Ajay Kumar Gupta58815fa2010-03-25 13:25:27 +0200705 /* EVM REV >= E can supply 500mA with EXTVBUS programming */
706 musb_board_data.power = 500;
707 musb_board_data.extvbus = 1;
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800708 } else {
709 /* setup EHCI phy reset on MDC */
Tony Lindgren4896e392009-12-11 16:16:32 -0800710 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800711 ehci_pdata.reset_gpio_port[1] = 135;
712 }
Maulik Mankad884b8362010-02-17 14:09:30 -0800713 usb_musb_init(&musb_board_data);
Felipe Balbi58a54912009-11-22 10:11:01 -0800714 usb_ehci_init(&ehci_pdata);
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700715 ads7846_dev_init();
Sriram562138a2009-11-22 10:11:30 -0800716 omap3evm_init_smsc911x();
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100717 omap3_evm_display_init();
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700718}
719
720static void __init omap3_evm_map_io(void)
721{
722 omap2_set_globals_343x();
Tony Lindgren6fbd55d2010-02-12 12:26:47 -0800723 omap34xx_map_common_io();
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700724}
725
726MACHINE_START(OMAP3EVM, "OMAP3 EVM")
727 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
728 .phys_io = 0x48000000,
Santosh Shilimkarb4224b22009-10-19 17:25:55 -0700729 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700730 .boot_params = 0x80000100,
731 .map_io = omap3_evm_map_io,
732 .init_irq = omap3_evm_init_irq,
733 .init_machine = omap3_evm_init,
734 .timer = &omap_timer,
735MACHINE_END