blob: 5e38da97decc36959622b4345ebfdf63a3cf151c [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>
Sukumar Ghorai3a638332010-09-15 14:49:23 +000034#include <linux/mmc/host.h>
Mike Rapoport1a7ec132009-11-22 10:11:29 -080035
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070036#include <mach/hardware.h>
37#include <asm/mach-types.h>
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40
Tony Lindgrence491cf2009-10-20 09:40:47 -070041#include <plat/board.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070042#include <plat/usb.h>
43#include <plat/common.h>
44#include <plat/mcspi.h>
Vaibhav Hiremath703e3062010-01-04 15:34:16 +010045#include <plat/display.h>
Bryan Wu89747c92010-11-17 13:34:34 +000046#include <plat/panel-generic-dpi.h>
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070047
Tony Lindgrenca5742b2009-12-11 16:16:32 -080048#include "mux.h"
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070049#include "sdram-micron-mt46h32m32lf-6.h"
Adrian Hunterd02a9002010-02-15 10:03:34 -080050#include "hsmmc.h"
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070051
52#define OMAP3_EVM_TS_GPIO 175
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -080053#define OMAP3_EVM_EHCI_VBUS 22
54#define OMAP3_EVM_EHCI_SELECT 61
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070055
56#define OMAP3EVM_ETHR_START 0x2c000000
57#define OMAP3EVM_ETHR_SIZE 1024
Ajay Kumar Guptadb408022009-11-22 10:11:27 -080058#define OMAP3EVM_ETHR_ID_REV 0x50
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070059#define OMAP3EVM_ETHR_GPIO_IRQ 176
Sriram562138a2009-11-22 10:11:30 -080060#define OMAP3EVM_SMSC911X_CS 5
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070061
Ajay Kumar Guptadb408022009-11-22 10:11:27 -080062static u8 omap3_evm_version;
63
64u8 get_omap3_evm_rev(void)
65{
66 return omap3_evm_version;
67}
68EXPORT_SYMBOL(get_omap3_evm_rev);
69
70static void __init omap3_evm_get_revision(void)
71{
72 void __iomem *ioaddr;
73 unsigned int smsc_id;
74
75 /* Ethernet PHY ID is stored at ID_REV register */
76 ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K);
77 if (!ioaddr)
78 return;
79 smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000;
80 iounmap(ioaddr);
81
82 switch (smsc_id) {
83 /*SMSC9115 chipset*/
84 case 0x01150000:
85 omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
86 break;
87 /*SMSC 9220 chipset*/
88 case 0x92200000:
89 default:
90 omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
91 }
92}
93
Sriram562138a2009-11-22 10:11:30 -080094#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
95static struct resource omap3evm_smsc911x_resources[] = {
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -070096 [0] = {
97 .start = OMAP3EVM_ETHR_START,
98 .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
99 .flags = IORESOURCE_MEM,
100 },
101 [1] = {
102 .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
103 .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
Sriram562138a2009-11-22 10:11:30 -0800104 .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700105 },
106};
107
Sriram562138a2009-11-22 10:11:30 -0800108static struct smsc911x_platform_config smsc911x_config = {
109 .phy_interface = PHY_INTERFACE_MODE_MII,
110 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
111 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
112 .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS),
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700113};
114
Sriram562138a2009-11-22 10:11:30 -0800115static struct platform_device omap3evm_smsc911x_device = {
116 .name = "smsc911x",
117 .id = -1,
118 .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources),
119 .resource = &omap3evm_smsc911x_resources[0],
120 .dev = {
121 .platform_data = &smsc911x_config,
122 },
123};
124
125static inline void __init omap3evm_init_smsc911x(void)
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700126{
127 int eth_cs;
128 struct clk *l3ck;
129 unsigned int rate;
130
Sriram562138a2009-11-22 10:11:30 -0800131 eth_cs = OMAP3EVM_SMSC911X_CS;
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700132
133 l3ck = clk_get(NULL, "l3_ck");
134 if (IS_ERR(l3ck))
135 rate = 100000000;
136 else
137 rate = clk_get_rate(l3ck);
138
Sriram562138a2009-11-22 10:11:30 -0800139 if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
140 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700141 OMAP3EVM_ETHR_GPIO_IRQ);
142 return;
143 }
144
145 gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
Sriram562138a2009-11-22 10:11:30 -0800146 platform_device_register(&omap3evm_smsc911x_device);
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700147}
148
Sriram562138a2009-11-22 10:11:30 -0800149#else
150static inline void __init omap3evm_init_smsc911x(void) { return; }
151#endif
152
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100153/*
154 * OMAP3EVM LCD Panel control signals
155 */
156#define OMAP3EVM_LCD_PANEL_LR 2
157#define OMAP3EVM_LCD_PANEL_UD 3
158#define OMAP3EVM_LCD_PANEL_INI 152
159#define OMAP3EVM_LCD_PANEL_ENVDD 153
160#define OMAP3EVM_LCD_PANEL_QVGA 154
161#define OMAP3EVM_LCD_PANEL_RESB 155
162#define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210
163#define OMAP3EVM_DVI_PANEL_EN_GPIO 199
164
165static int lcd_enabled;
166static int dvi_enabled;
167
168static void __init omap3_evm_display_init(void)
169{
170 int r;
171
172 r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb");
173 if (r) {
174 printk(KERN_ERR "failed to get lcd_panel_resb\n");
175 return;
176 }
177 gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1);
178
179 r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini");
180 if (r) {
181 printk(KERN_ERR "failed to get lcd_panel_ini\n");
182 goto err_1;
183 }
184 gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1);
185
186 r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga");
187 if (r) {
188 printk(KERN_ERR "failed to get lcd_panel_qvga\n");
189 goto err_2;
190 }
191 gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0);
192
193 r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr");
194 if (r) {
195 printk(KERN_ERR "failed to get lcd_panel_lr\n");
196 goto err_3;
197 }
198 gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1);
199
200 r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud");
201 if (r) {
202 printk(KERN_ERR "failed to get lcd_panel_ud\n");
203 goto err_4;
204 }
205 gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1);
206
207 r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd");
208 if (r) {
209 printk(KERN_ERR "failed to get lcd_panel_envdd\n");
210 goto err_5;
211 }
212 gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0);
213
214 return;
215
216err_5:
217 gpio_free(OMAP3EVM_LCD_PANEL_UD);
218err_4:
219 gpio_free(OMAP3EVM_LCD_PANEL_LR);
220err_3:
221 gpio_free(OMAP3EVM_LCD_PANEL_QVGA);
222err_2:
223 gpio_free(OMAP3EVM_LCD_PANEL_INI);
224err_1:
225 gpio_free(OMAP3EVM_LCD_PANEL_RESB);
226
227}
228
229static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev)
230{
231 if (dvi_enabled) {
232 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
233 return -EINVAL;
234 }
235 gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 0);
236
237 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
238 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
239 else
240 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
241
242 lcd_enabled = 1;
243 return 0;
244}
245
246static void omap3_evm_disable_lcd(struct omap_dss_device *dssdev)
247{
248 gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 1);
249
250 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
251 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
252 else
253 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
254
255 lcd_enabled = 0;
256}
257
258static struct omap_dss_device omap3_evm_lcd_device = {
259 .name = "lcd",
260 .driver_name = "sharp_ls_panel",
261 .type = OMAP_DISPLAY_TYPE_DPI,
262 .phy.dpi.data_lines = 18,
263 .platform_enable = omap3_evm_enable_lcd,
264 .platform_disable = omap3_evm_disable_lcd,
265};
266
267static int omap3_evm_enable_tv(struct omap_dss_device *dssdev)
268{
269 return 0;
270}
271
272static void omap3_evm_disable_tv(struct omap_dss_device *dssdev)
273{
274}
275
276static struct omap_dss_device omap3_evm_tv_device = {
277 .name = "tv",
278 .driver_name = "venc",
279 .type = OMAP_DISPLAY_TYPE_VENC,
280 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
281 .platform_enable = omap3_evm_enable_tv,
282 .platform_disable = omap3_evm_disable_tv,
283};
284
285static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev)
286{
287 if (lcd_enabled) {
288 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
289 return -EINVAL;
290 }
291
292 gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 1);
293
294 dvi_enabled = 1;
295 return 0;
296}
297
298static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev)
299{
300 gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 0);
301
302 dvi_enabled = 0;
303}
304
Bryan Wu89747c92010-11-17 13:34:34 +0000305static struct panel_generic_dpi_data dvi_panel = {
306 .name = "generic",
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100307 .platform_enable = omap3_evm_enable_dvi,
308 .platform_disable = omap3_evm_disable_dvi,
309};
310
Bryan Wu89747c92010-11-17 13:34:34 +0000311static struct omap_dss_device omap3_evm_dvi_device = {
312 .name = "dvi",
313 .type = OMAP_DISPLAY_TYPE_DPI,
314 .driver_name = "generic_dpi_panel",
315 .data = &dvi_panel,
316 .phy.dpi.data_lines = 24,
317};
318
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100319static struct omap_dss_device *omap3_evm_dss_devices[] = {
320 &omap3_evm_lcd_device,
321 &omap3_evm_tv_device,
322 &omap3_evm_dvi_device,
323};
324
325static struct omap_dss_board_info omap3_evm_dss_data = {
326 .num_devices = ARRAY_SIZE(omap3_evm_dss_devices),
327 .devices = omap3_evm_dss_devices,
328 .default_device = &omap3_evm_lcd_device,
329};
330
331static struct platform_device omap3_evm_dss_device = {
332 .name = "omapdss",
333 .id = -1,
334 .dev = {
335 .platform_data = &omap3_evm_dss_data,
336 },
337};
338
Mike Rapoport1a7ec132009-11-22 10:11:29 -0800339static struct regulator_consumer_supply omap3evm_vmmc1_supply = {
340 .supply = "vmmc",
341};
342
343static struct regulator_consumer_supply omap3evm_vsim_supply = {
344 .supply = "vmmc_aux",
345};
346
347/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
348static struct regulator_init_data omap3evm_vmmc1 = {
349 .constraints = {
350 .min_uV = 1850000,
351 .max_uV = 3150000,
352 .valid_modes_mask = REGULATOR_MODE_NORMAL
353 | REGULATOR_MODE_STANDBY,
354 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
355 | REGULATOR_CHANGE_MODE
356 | REGULATOR_CHANGE_STATUS,
357 },
358 .num_consumer_supplies = 1,
359 .consumer_supplies = &omap3evm_vmmc1_supply,
360};
361
362/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
363static struct regulator_init_data omap3evm_vsim = {
364 .constraints = {
365 .min_uV = 1800000,
366 .max_uV = 3000000,
367 .valid_modes_mask = REGULATOR_MODE_NORMAL
368 | REGULATOR_MODE_STANDBY,
369 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
370 | REGULATOR_CHANGE_MODE
371 | REGULATOR_CHANGE_STATUS,
372 },
373 .num_consumer_supplies = 1,
374 .consumer_supplies = &omap3evm_vsim_supply,
375};
376
Adrian Hunter68ff0422010-02-15 10:03:34 -0800377static struct omap2_hsmmc_info mmc[] = {
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700378 {
379 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000380 .caps = MMC_CAP_4_BIT_DATA,
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700381 .gpio_cd = -EINVAL,
382 .gpio_wp = 63,
383 },
384 {} /* Terminator */
385};
386
387static struct gpio_led gpio_leds[] = {
388 {
389 .name = "omap3evm::ledb",
390 /* normally not visible (board underside) */
391 .default_trigger = "default-on",
392 .gpio = -EINVAL, /* gets replaced */
393 .active_low = true,
394 },
395};
396
397static struct gpio_led_platform_data gpio_led_info = {
398 .leds = gpio_leds,
399 .num_leds = ARRAY_SIZE(gpio_leds),
400};
401
402static struct platform_device leds_gpio = {
403 .name = "leds-gpio",
404 .id = -1,
405 .dev = {
406 .platform_data = &gpio_led_info,
407 },
408};
409
410
411static int omap3evm_twl_gpio_setup(struct device *dev,
412 unsigned gpio, unsigned ngpio)
413{
414 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
Tony Lindgren4896e392009-12-11 16:16:32 -0800415 omap_mux_init_gpio(63, OMAP_PIN_INPUT);
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700416 mmc[0].gpio_cd = gpio + 0;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800417 omap2_hsmmc_init(mmc);
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700418
Mike Rapoport1a7ec132009-11-22 10:11:29 -0800419 /* link regulators to MMC adapters */
420 omap3evm_vmmc1_supply.dev = mmc[0].dev;
421 omap3evm_vsim_supply.dev = mmc[0].dev;
422
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700423 /*
424 * Most GPIOs are for USB OTG. Some are mostly sent to
425 * the P2 connector; notably LEDA for the LCD backlight.
426 */
427
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100428 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
429 gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL");
430 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
431
432 /* gpio + 7 == DVI Enable */
433 gpio_request(gpio + 7, "EN_DVI");
434 gpio_direction_output(gpio + 7, 0);
435
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700436 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
437 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
438
439 platform_device_register(&leds_gpio);
440
441 return 0;
442}
443
444static struct twl4030_gpio_platform_data omap3evm_gpio_data = {
445 .gpio_base = OMAP_MAX_GPIO_LINES,
446 .irq_base = TWL4030_GPIO_IRQ_BASE,
447 .irq_end = TWL4030_GPIO_IRQ_END,
448 .use_leds = true,
449 .setup = omap3evm_twl_gpio_setup,
450};
451
452static struct twl4030_usb_data omap3evm_usb_data = {
453 .usb_mode = T2_USB_MODE_ULPI,
454};
455
Manjunath Kondaiah Gbead4372010-10-08 10:01:13 -0700456static uint32_t board_keymap[] = {
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700457 KEY(0, 0, KEY_LEFT),
Sanjeev Premi0621d752010-02-17 14:09:24 -0800458 KEY(0, 1, KEY_DOWN),
459 KEY(0, 2, KEY_ENTER),
460 KEY(0, 3, KEY_M),
461
462 KEY(1, 0, KEY_RIGHT),
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700463 KEY(1, 1, KEY_UP),
Sanjeev Premi0621d752010-02-17 14:09:24 -0800464 KEY(1, 2, KEY_I),
465 KEY(1, 3, KEY_N),
466
467 KEY(2, 0, KEY_A),
468 KEY(2, 1, KEY_E),
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700469 KEY(2, 2, KEY_J),
Sanjeev Premi0621d752010-02-17 14:09:24 -0800470 KEY(2, 3, KEY_O),
471
472 KEY(3, 0, KEY_B),
473 KEY(3, 1, KEY_F),
474 KEY(3, 2, KEY_K),
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700475 KEY(3, 3, KEY_P)
476};
477
Tony Lindgren4f543332009-09-24 16:23:16 -0700478static struct matrix_keymap_data board_map_data = {
479 .keymap = board_keymap,
480 .keymap_size = ARRAY_SIZE(board_keymap),
481};
482
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700483static struct twl4030_keypad_data omap3evm_kp_data = {
Tony Lindgren4f543332009-09-24 16:23:16 -0700484 .keymap_data = &board_map_data,
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700485 .rows = 4,
486 .cols = 4,
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700487 .rep = 1,
488};
489
490static struct twl4030_madc_platform_data omap3evm_madc_data = {
491 .irq_line = 1,
492};
493
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300494static struct twl4030_codec_audio_data omap3evm_audio_data = {
495 .audio_mclk = 26000000,
496};
497
498static struct twl4030_codec_data omap3evm_codec_data = {
Peter Ujfalusi6df74ef2009-11-04 09:58:18 +0200499 .audio_mclk = 26000000,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300500 .audio = &omap3evm_audio_data,
501};
502
Senthilvadivu Guruswamy1dde9732011-01-24 06:21:53 +0000503static struct regulator_consumer_supply omap3_evm_vdda_dac_supply =
504 REGULATOR_SUPPLY("vdda_dac", "omapdss");
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100505
506/* VDAC for DSS driving S-Video */
507static struct regulator_init_data omap3_evm_vdac = {
508 .constraints = {
509 .min_uV = 1800000,
510 .max_uV = 1800000,
511 .apply_uV = true,
512 .valid_modes_mask = REGULATOR_MODE_NORMAL
513 | REGULATOR_MODE_STANDBY,
514 .valid_ops_mask = REGULATOR_CHANGE_MODE
515 | REGULATOR_CHANGE_STATUS,
516 },
517 .num_consumer_supplies = 1,
518 .consumer_supplies = &omap3_evm_vdda_dac_supply,
519};
520
521/* VPLL2 for digital video outputs */
Vaibhav Hiremathf3fe53c2010-03-19 11:21:19 +0000522static struct regulator_consumer_supply omap3_evm_vpll2_supply =
523 REGULATOR_SUPPLY("vdds_dsi", "omapdss");
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100524
525static struct regulator_init_data omap3_evm_vpll2 = {
526 .constraints = {
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100527 .min_uV = 1800000,
528 .max_uV = 1800000,
529 .apply_uV = true,
530 .valid_modes_mask = REGULATOR_MODE_NORMAL
531 | REGULATOR_MODE_STANDBY,
532 .valid_ops_mask = REGULATOR_CHANGE_MODE
533 | REGULATOR_CHANGE_STATUS,
534 },
535 .num_consumer_supplies = 1,
536 .consumer_supplies = &omap3_evm_vpll2_supply,
537};
538
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700539static struct twl4030_platform_data omap3evm_twldata = {
540 .irq_base = TWL4030_IRQ_BASE,
541 .irq_end = TWL4030_IRQ_END,
542
543 /* platform_data for children goes here */
544 .keypad = &omap3evm_kp_data,
545 .madc = &omap3evm_madc_data,
546 .usb = &omap3evm_usb_data,
547 .gpio = &omap3evm_gpio_data,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300548 .codec = &omap3evm_codec_data,
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100549 .vdac = &omap3_evm_vdac,
550 .vpll2 = &omap3_evm_vpll2,
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700551};
552
553static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
554 {
555 I2C_BOARD_INFO("twl4030", 0x48),
556 .flags = I2C_CLIENT_WAKE,
557 .irq = INT_34XX_SYS_NIRQ,
558 .platform_data = &omap3evm_twldata,
559 },
560};
561
562static int __init omap3_evm_i2c_init(void)
563{
Mike Rapoport1a7ec132009-11-22 10:11:29 -0800564 /*
565 * REVISIT: These entries can be set in omap3evm_twl_data
566 * after a merge with MFD tree
567 */
568 omap3evm_twldata.vmmc1 = &omap3evm_vmmc1;
569 omap3evm_twldata.vsim = &omap3evm_vsim;
570
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700571 omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
572 ARRAY_SIZE(omap3evm_i2c_boardinfo));
573 omap_register_i2c_bus(2, 400, NULL, 0);
574 omap_register_i2c_bus(3, 400, NULL, 0);
575 return 0;
576}
577
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700578static void ads7846_dev_init(void)
579{
580 if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
581 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
582
583 gpio_direction_input(OMAP3_EVM_TS_GPIO);
Felipe Balbi48feb332010-05-26 14:42:24 -0700584 gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310);
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700585}
586
587static int ads7846_get_pendown_state(void)
588{
589 return !gpio_get_value(OMAP3_EVM_TS_GPIO);
590}
591
Manjunath Kondaiah G38815732010-10-08 09:56:37 -0700592static struct ads7846_platform_data ads7846_config = {
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700593 .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,
Ranjith Lohithakshan7a44ad22010-05-08 12:39:21 +0530603 .wakeup = true,
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700604};
605
606static struct omap2_mcspi_device_config ads7846_mcspi_config = {
607 .turbo_mode = 0,
608 .single_channel = 1, /* 0: slave, 1: master */
609};
610
Manjunath Kondaiah G38815732010-10-08 09:56:37 -0700611static struct spi_board_info omap3evm_spi_board_info[] = {
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700612 [0] = {
613 .modalias = "ads7846",
614 .bus_num = 1,
615 .chip_select = 0,
616 .max_speed_hz = 1500000,
617 .controller_data = &ads7846_mcspi_config,
618 .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO),
619 .platform_data = &ads7846_config,
620 },
621};
622
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300623static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300624};
625
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800626static void __init omap3_evm_init_early(void)
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700627{
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300628 omap_board_config = omap3_evm_config;
629 omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
Paul Walmsley48057342010-12-21 15:25:10 -0700630 omap2_init_common_infrastructure();
631 omap2_init_common_devices(mt46h32m32lf6_sdrc_params, NULL);
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 |
Ranjith Lohithakshanf3a8cde2010-05-03 17:07:51 +0530654 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
Sanjeev Premiaa6912d82010-02-17 14:09:23 -0800655 OMAP_PIN_OFF_WAKEUPENABLE),
Sanjeev Premi87520aa2010-02-17 14:09:24 -0800656 OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
Ranjith Lohithakshan7a44ad22010-05-08 12:39:21 +0530657 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW),
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800658 { .reg_offset = OMAP_MUX_TERMINATOR },
659};
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800660#endif
661
Maulik Mankad884b8362010-02-17 14:09:30 -0800662static struct omap_musb_board_data musb_board_data = {
663 .interface_type = MUSB_INTERFACE_ULPI,
664 .mode = MUSB_OTG,
665 .power = 100,
666};
667
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700668static void __init omap3_evm_init(void)
669{
Ajay Kumar Guptadb408022009-11-22 10:11:27 -0800670 omap3_evm_get_revision();
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800671 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Ajay Kumar Guptadb408022009-11-22 10:11:27 -0800672
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700673 omap3_evm_i2c_init();
674
675 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700676
677 spi_register_board_info(omap3evm_spi_board_info,
678 ARRAY_SIZE(omap3evm_spi_board_info));
679
680 omap_serial_init();
Maulik Mankad1a4f4632010-02-17 14:09:29 -0800681
Gupta, Ajay Kumare8e2ff42009-07-29 11:58:57 +0530682 /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
683 usb_nop_xceiv_register();
Maulik Mankad1a4f4632010-02-17 14:09:29 -0800684
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800685 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
686 /* enable EHCI VBUS using GPIO22 */
Tony Lindgren4896e392009-12-11 16:16:32 -0800687 omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800688 gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
689 gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
690 gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
691
692 /* Select EHCI port on main board */
Tony Lindgren4896e392009-12-11 16:16:32 -0800693 omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800694 gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
695 gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
696 gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
697
698 /* setup EHCI phy reset config */
Tony Lindgren4896e392009-12-11 16:16:32 -0800699 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800700 ehci_pdata.reset_gpio_port[1] = 21;
701
Ajay Kumar Gupta58815fa2010-03-25 13:25:27 +0200702 /* EVM REV >= E can supply 500mA with EXTVBUS programming */
703 musb_board_data.power = 500;
704 musb_board_data.extvbus = 1;
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800705 } else {
706 /* setup EHCI phy reset on MDC */
Tony Lindgren4896e392009-12-11 16:16:32 -0800707 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
Ajay Kumar Guptae8e51d22009-11-22 10:11:28 -0800708 ehci_pdata.reset_gpio_port[1] = 135;
709 }
Maulik Mankad884b8362010-02-17 14:09:30 -0800710 usb_musb_init(&musb_board_data);
Felipe Balbi58a54912009-11-22 10:11:01 -0800711 usb_ehci_init(&ehci_pdata);
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700712 ads7846_dev_init();
Sriram562138a2009-11-22 10:11:30 -0800713 omap3evm_init_smsc911x();
Vaibhav Hiremath703e3062010-01-04 15:34:16 +0100714 omap3_evm_display_init();
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700715}
716
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700717MACHINE_START(OMAP3EVM, "OMAP3 EVM")
718 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700719 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100720 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800721 .map_io = omap3_map_io,
722 .init_early = omap3_evm_init_early,
723 .init_irq = omap_init_irq,
Syed Mohammed Khasim53c5ec32009-05-28 14:13:28 -0700724 .init_machine = omap3_evm_init,
725 .timer = &omap_timer,
726MACHINE_END