blob: e694ebd2636cc691131a72a6734c3a7d51df24ff [file] [log] [blame]
Steve Sakomaneba26452008-10-09 17:51:43 +03001/*
2 * board-overo.c (Gumstix Overo)
3 *
4 * Initial code: Steve Sakoman <steve@sakoman.com>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include <linux/clk.h>
23#include <linux/delay.h>
24#include <linux/err.h>
25#include <linux/init.h>
26#include <linux/io.h>
27#include <linux/kernel.h>
28#include <linux/platform_device.h>
Santosh Shilimkarb07682b2009-12-13 20:05:51 +010029#include <linux/i2c/twl.h>
David Brownellbb3b9d82009-05-28 14:04:03 -070030#include <linux/regulator/machine.h>
Steve Sakomanca0a6a62011-03-05 10:12:26 -060031#include <linux/regulator/fixed.h>
Steve Sakoman7b12d7b2011-03-05 07:58:39 -060032#include <linux/spi/spi.h>
Steve Sakomaneba26452008-10-09 17:51:43 +030033
34#include <linux/mtd/mtd.h>
35#include <linux/mtd/nand.h>
36#include <linux/mtd/partitions.h>
Sukumar Ghorai3a638332010-09-15 14:49:23 +000037#include <linux/mmc/host.h>
Steve Sakomaneba26452008-10-09 17:51:43 +030038
39#include <asm/mach-types.h>
40#include <asm/mach/arch.h>
41#include <asm/mach/flash.h>
42#include <asm/mach/map.h>
43
Tony Lindgrence491cf2009-10-20 09:40:47 -070044#include <plat/board.h>
45#include <plat/common.h>
Steve Sakoman7b12d7b2011-03-05 07:58:39 -060046#include <plat/display.h>
47#include <plat/panel-generic-dpi.h>
Steve Sakomaneba26452008-10-09 17:51:43 +030048#include <mach/gpio.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070049#include <plat/gpmc.h>
Steve Sakomaneba26452008-10-09 17:51:43 +030050#include <mach/hardware.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070051#include <plat/nand.h>
Steve Sakoman7b12d7b2011-03-05 07:58:39 -060052#include <plat/mcspi.h>
53#include <plat/mux.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070054#include <plat/usb.h>
Steve Sakomaneba26452008-10-09 17:51:43 +030055
Tony Lindgrenca5742b2009-12-11 16:16:32 -080056#include "mux.h"
Paul Walmsley2e12bd72009-05-28 14:03:59 -070057#include "sdram-micron-mt46h32m32lf-6.h"
Adrian Hunterd02a900b2010-02-15 10:03:34 -080058#include "hsmmc.h"
Tony Lindgren90c62bf2008-12-10 17:37:17 -080059
Tony Lindgren0d4d9ab2009-03-23 18:07:38 -070060#define OVERO_GPIO_BT_XGATE 15
61#define OVERO_GPIO_W2W_NRESET 16
Kevin Hilman6fd210a2009-07-20 09:09:23 -070062#define OVERO_GPIO_PENDOWN 114
Tony Lindgren0d4d9ab2009-03-23 18:07:38 -070063#define OVERO_GPIO_BT_NRESET 164
64#define OVERO_GPIO_USBH_CPEN 168
65#define OVERO_GPIO_USBH_NRESET 183
66
Steve Sakomaneba26452008-10-09 17:51:43 +030067#define NAND_BLOCK_SIZE SZ_128K
Steve Sakomaneba26452008-10-09 17:51:43 +030068
Steve Sakoman172ef272009-02-02 06:27:49 +000069#define OVERO_SMSC911X_CS 5
70#define OVERO_SMSC911X_GPIO 176
Steve Sakoman5c9a29e2010-05-10 14:29:18 -070071#define OVERO_SMSC911X2_CS 4
72#define OVERO_SMSC911X2_GPIO 65
Steve Sakoman172ef272009-02-02 06:27:49 +000073
Steve Sakomanc6a81312009-03-23 18:38:16 -070074#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
75 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
76
Steve Sakomanc6a81312009-03-23 18:38:16 -070077#include <linux/spi/ads7846.h>
78
79static struct omap2_mcspi_device_config ads7846_mcspi_config = {
80 .turbo_mode = 0,
81 .single_channel = 1, /* 0: slave, 1: master */
82};
83
84static int ads7846_get_pendown_state(void)
85{
86 return !gpio_get_value(OVERO_GPIO_PENDOWN);
87}
88
89static struct ads7846_platform_data ads7846_config = {
90 .x_max = 0x0fff,
91 .y_max = 0x0fff,
92 .x_plate_ohms = 180,
93 .pressure_max = 255,
94 .debounce_max = 10,
95 .debounce_tol = 3,
96 .debounce_rep = 1,
97 .get_pendown_state = ads7846_get_pendown_state,
98 .keep_vref_on = 1,
99};
100
Steve Sakomanca0a6a62011-03-05 10:12:26 -0600101/* fixed regulator for ads7846 */
102static struct regulator_consumer_supply ads7846_supply =
103 REGULATOR_SUPPLY("vcc", "spi1.0");
104
105static struct regulator_init_data vads7846_regulator = {
106 .constraints = {
107 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
108 },
109 .num_consumer_supplies = 1,
110 .consumer_supplies = &ads7846_supply,
111};
112
113static struct fixed_voltage_config vads7846 = {
114 .supply_name = "vads7846",
115 .microvolts = 3300000, /* 3.3V */
116 .gpio = -EINVAL,
117 .startup_delay = 0,
118 .init_data = &vads7846_regulator,
119};
120
121static struct platform_device vads7846_device = {
122 .name = "reg-fixed-voltage",
123 .id = 1,
124 .dev = {
125 .platform_data = &vads7846,
126 },
127};
128
Steve Sakomanc6a81312009-03-23 18:38:16 -0700129static void __init overo_ads7846_init(void)
130{
131 if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) &&
132 (gpio_direction_input(OVERO_GPIO_PENDOWN) == 0)) {
133 gpio_export(OVERO_GPIO_PENDOWN, 0);
134 } else {
135 printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n");
136 return;
137 }
Steve Sakomanca0a6a62011-03-05 10:12:26 -0600138
139 platform_device_register(&vads7846_device);
Steve Sakomanc6a81312009-03-23 18:38:16 -0700140}
141
142#else
143static inline void __init overo_ads7846_init(void) { return; }
144#endif
145
Steve Sakoman172ef272009-02-02 06:27:49 +0000146#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
147
148#include <linux/smsc911x.h>
149
150static struct resource overo_smsc911x_resources[] = {
151 {
152 .name = "smsc911x-memory",
153 .flags = IORESOURCE_MEM,
154 },
155 {
156 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
157 },
158};
159
Steve Sakoman5c9a29e2010-05-10 14:29:18 -0700160static struct resource overo_smsc911x2_resources[] = {
161 {
162 .name = "smsc911x2-memory",
163 .flags = IORESOURCE_MEM,
164 },
165 {
166 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
167 },
168};
169
Steve Sakoman172ef272009-02-02 06:27:49 +0000170static struct smsc911x_platform_config overo_smsc911x_config = {
171 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
172 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
173 .flags = SMSC911X_USE_32BIT ,
174 .phy_interface = PHY_INTERFACE_MODE_MII,
175};
176
177static struct platform_device overo_smsc911x_device = {
178 .name = "smsc911x",
Steve Sakoman5c9a29e2010-05-10 14:29:18 -0700179 .id = 0,
Steve Sakoman172ef272009-02-02 06:27:49 +0000180 .num_resources = ARRAY_SIZE(overo_smsc911x_resources),
Sergio Aguirre50329022009-08-10 14:49:50 +0300181 .resource = overo_smsc911x_resources,
Steve Sakoman172ef272009-02-02 06:27:49 +0000182 .dev = {
183 .platform_data = &overo_smsc911x_config,
184 },
185};
186
Steve Sakomana5ba7ae2010-08-02 14:21:39 +0300187static struct platform_device overo_smsc911x2_device = {
188 .name = "smsc911x",
189 .id = 1,
190 .num_resources = ARRAY_SIZE(overo_smsc911x2_resources),
191 .resource = overo_smsc911x2_resources,
192 .dev = {
193 .platform_data = &overo_smsc911x_config,
194 },
195};
196
197static struct platform_device *smsc911x_devices[] = {
198 &overo_smsc911x_device,
199 &overo_smsc911x2_device,
200};
201
Steve Sakoman172ef272009-02-02 06:27:49 +0000202static inline void __init overo_init_smsc911x(void)
203{
Steve Sakomana5ba7ae2010-08-02 14:21:39 +0300204 unsigned long cs_mem_base, cs_mem_base2;
205
206 /* set up first smsc911x chip */
Steve Sakoman172ef272009-02-02 06:27:49 +0000207
208 if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
209 printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n");
210 return;
211 }
212
213 overo_smsc911x_resources[0].start = cs_mem_base + 0x0;
214 overo_smsc911x_resources[0].end = cs_mem_base + 0xff;
215
216 if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
217 (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) {
218 gpio_export(OVERO_SMSC911X_GPIO, 0);
219 } else {
220 printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n");
221 return;
222 }
223
224 overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO);
225 overo_smsc911x_resources[1].end = 0;
226
Steve Sakomana5ba7ae2010-08-02 14:21:39 +0300227 /* set up second smsc911x chip */
228
229 if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) {
230 printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n");
231 return;
232 }
233
234 overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0;
235 overo_smsc911x2_resources[0].end = cs_mem_base2 + 0xff;
236
237 if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) &&
238 (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) {
239 gpio_export(OVERO_SMSC911X2_GPIO, 0);
240 } else {
241 printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n");
242 return;
243 }
244
245 overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO);
246 overo_smsc911x2_resources[1].end = 0;
247
248 platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices));
Steve Sakoman172ef272009-02-02 06:27:49 +0000249}
250
251#else
252static inline void __init overo_init_smsc911x(void) { return; }
253#endif
254
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600255/* DSS */
256static int lcd_enabled;
257static int dvi_enabled;
258
259#define OVERO_GPIO_LCD_EN 144
260#define OVERO_GPIO_LCD_BL 145
261
262static void __init overo_display_init(void)
263{
264 if ((gpio_request(OVERO_GPIO_LCD_EN, "OVERO_GPIO_LCD_EN") == 0) &&
265 (gpio_direction_output(OVERO_GPIO_LCD_EN, 1) == 0))
266 gpio_export(OVERO_GPIO_LCD_EN, 0);
267 else
268 printk(KERN_ERR "could not obtain gpio for "
269 "OVERO_GPIO_LCD_EN\n");
270
271 if ((gpio_request(OVERO_GPIO_LCD_BL, "OVERO_GPIO_LCD_BL") == 0) &&
272 (gpio_direction_output(OVERO_GPIO_LCD_BL, 1) == 0))
273 gpio_export(OVERO_GPIO_LCD_BL, 0);
274 else
275 printk(KERN_ERR "could not obtain gpio for "
276 "OVERO_GPIO_LCD_BL\n");
277}
278
279static int overo_panel_enable_dvi(struct omap_dss_device *dssdev)
280{
281 if (lcd_enabled) {
282 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
283 return -EINVAL;
284 }
285 dvi_enabled = 1;
286
287 return 0;
288}
289
290static void overo_panel_disable_dvi(struct omap_dss_device *dssdev)
291{
292 dvi_enabled = 0;
293}
294
295static struct panel_generic_dpi_data dvi_panel = {
296 .name = "generic",
297 .platform_enable = overo_panel_enable_dvi,
298 .platform_disable = overo_panel_disable_dvi,
299};
300
301static struct omap_dss_device overo_dvi_device = {
302 .name = "dvi",
303 .type = OMAP_DISPLAY_TYPE_DPI,
304 .driver_name = "generic_dpi_panel",
305 .data = &dvi_panel,
306 .phy.dpi.data_lines = 24,
307};
308
309static struct omap_dss_device overo_tv_device = {
310 .name = "tv",
311 .driver_name = "venc",
312 .type = OMAP_DISPLAY_TYPE_VENC,
313 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
314};
315
316static int overo_panel_enable_lcd(struct omap_dss_device *dssdev)
317{
318 if (dvi_enabled) {
319 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
320 return -EINVAL;
321 }
322
323 gpio_set_value(OVERO_GPIO_LCD_EN, 1);
324 gpio_set_value(OVERO_GPIO_LCD_BL, 1);
325 lcd_enabled = 1;
326 return 0;
327}
328
329static void overo_panel_disable_lcd(struct omap_dss_device *dssdev)
330{
331 gpio_set_value(OVERO_GPIO_LCD_EN, 0);
332 gpio_set_value(OVERO_GPIO_LCD_BL, 0);
333 lcd_enabled = 0;
334}
335
336static struct panel_generic_dpi_data lcd43_panel = {
337 .name = "samsung_lte430wq_f0c",
338 .platform_enable = overo_panel_enable_lcd,
339 .platform_disable = overo_panel_disable_lcd,
340};
341
342static struct omap_dss_device overo_lcd43_device = {
343 .name = "lcd43",
344 .type = OMAP_DISPLAY_TYPE_DPI,
345 .driver_name = "generic_dpi_panel",
346 .data = &lcd43_panel,
347 .phy.dpi.data_lines = 24,
348};
349
350#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
351 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
352static struct omap_dss_device overo_lcd35_device = {
353 .type = OMAP_DISPLAY_TYPE_DPI,
354 .name = "lcd35",
355 .driver_name = "lgphilips_lb035q02_panel",
356 .phy.dpi.data_lines = 24,
357 .platform_enable = overo_panel_enable_lcd,
358 .platform_disable = overo_panel_disable_lcd,
359};
360#endif
361
362static struct omap_dss_device *overo_dss_devices[] = {
363 &overo_dvi_device,
364 &overo_tv_device,
365#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
366 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
367 &overo_lcd35_device,
368#endif
369 &overo_lcd43_device,
370};
371
372static struct omap_dss_board_info overo_dss_data = {
373 .num_devices = ARRAY_SIZE(overo_dss_devices),
374 .devices = overo_dss_devices,
375 .default_device = &overo_dvi_device,
376};
377
378static struct regulator_consumer_supply overo_vdda_dac_supply =
379 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
380
381static struct regulator_consumer_supply overo_vdds_dsi_supply[] = {
382 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
383 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
384};
385
Steve Sakomaneba26452008-10-09 17:51:43 +0300386static struct mtd_partition overo_nand_partitions[] = {
387 {
388 .name = "xloader",
389 .offset = 0, /* Offset = 0x00000 */
390 .size = 4 * NAND_BLOCK_SIZE,
391 .mask_flags = MTD_WRITEABLE
392 },
393 {
394 .name = "uboot",
395 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
396 .size = 14 * NAND_BLOCK_SIZE,
397 },
398 {
399 .name = "uboot environment",
400 .offset = MTDPART_OFS_APPEND, /* Offset = 0x240000 */
401 .size = 2 * NAND_BLOCK_SIZE,
402 },
403 {
404 .name = "linux",
405 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
406 .size = 32 * NAND_BLOCK_SIZE,
407 },
408 {
409 .name = "rootfs",
410 .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
411 .size = MTDPART_SIZ_FULL,
412 },
413};
414
415static struct omap_nand_platform_data overo_nand_data = {
416 .parts = overo_nand_partitions,
417 .nr_parts = ARRAY_SIZE(overo_nand_partitions),
418 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
419};
420
Steve Sakomaneba26452008-10-09 17:51:43 +0300421static void __init overo_flash_init(void)
422{
423 u8 cs = 0;
424 u8 nandcs = GPMC_CS_NUM + 1;
425
Steve Sakomaneba26452008-10-09 17:51:43 +0300426 /* find out the chip-select on which NAND exists */
427 while (cs < GPMC_CS_NUM) {
428 u32 ret = 0;
429 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
430
431 if ((ret & 0xC00) == 0x800) {
432 printk(KERN_INFO "Found NAND on CS%d\n", cs);
433 if (nandcs > GPMC_CS_NUM)
434 nandcs = cs;
435 }
436 cs++;
437 }
438
439 if (nandcs > GPMC_CS_NUM) {
440 printk(KERN_INFO "NAND: Unable to find configuration "
441 "in GPMC\n ");
442 return;
443 }
444
445 if (nandcs < GPMC_CS_NUM) {
446 overo_nand_data.cs = nandcs;
Steve Sakomaneba26452008-10-09 17:51:43 +0300447
448 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
Sukumar Ghoraif450d862010-07-09 09:14:46 +0000449 if (gpmc_nand_init(&overo_nand_data) < 0)
Steve Sakomaneba26452008-10-09 17:51:43 +0300450 printk(KERN_ERR "Unable to register NAND device\n");
451 }
452}
Steve Sakomaneba26452008-10-09 17:51:43 +0300453
Adrian Hunter68ff0422010-02-15 10:03:34 -0800454static struct omap2_hsmmc_info mmc[] = {
David Brownellbb3b9d82009-05-28 14:04:03 -0700455 {
456 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000457 .caps = MMC_CAP_4_BIT_DATA,
David Brownellbb3b9d82009-05-28 14:04:03 -0700458 .gpio_cd = -EINVAL,
459 .gpio_wp = -EINVAL,
460 },
461 {
462 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000463 .caps = MMC_CAP_4_BIT_DATA,
David Brownellbb3b9d82009-05-28 14:04:03 -0700464 .gpio_cd = -EINVAL,
465 .gpio_wp = -EINVAL,
466 .transceiver = true,
467 .ocr_mask = 0x00100000, /* 3.3V */
468 },
469 {} /* Terminator */
470};
471
472static struct regulator_consumer_supply overo_vmmc1_supply = {
473 .supply = "vmmc",
474};
475
Steve Sakoman7c94f682011-03-09 18:08:05 -0600476#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
477#include <linux/leds.h>
478
479static struct gpio_led gpio_leds[] = {
480 {
481 .name = "overo:red:gpio21",
482 .default_trigger = "heartbeat",
483 .gpio = 21,
484 .active_low = true,
485 },
486 {
487 .name = "overo:blue:gpio22",
488 .default_trigger = "none",
489 .gpio = 22,
490 .active_low = true,
491 },
492 {
493 .name = "overo:blue:COM",
494 .default_trigger = "mmc0",
495 .gpio = -EINVAL, /* gets replaced */
496 .active_low = true,
497 },
498};
499
500static struct gpio_led_platform_data gpio_leds_pdata = {
501 .leds = gpio_leds,
502 .num_leds = ARRAY_SIZE(gpio_leds),
503};
504
505static struct platform_device gpio_leds_device = {
506 .name = "leds-gpio",
507 .id = -1,
508 .dev = {
509 .platform_data = &gpio_leds_pdata,
510 },
511};
512
513static void __init overo_init_led(void)
514{
515 platform_device_register(&gpio_leds_device);
516}
517
518#else
519static inline void __init overo_init_led(void) { return; }
520#endif
521
David Brownellbb3b9d82009-05-28 14:04:03 -0700522static int overo_twl_gpio_setup(struct device *dev,
523 unsigned gpio, unsigned ngpio)
524{
Adrian Hunter68ff0422010-02-15 10:03:34 -0800525 omap2_hsmmc_init(mmc);
David Brownellbb3b9d82009-05-28 14:04:03 -0700526
527 overo_vmmc1_supply.dev = mmc[0].dev;
528
Steve Sakoman7c94f682011-03-09 18:08:05 -0600529#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
530 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
531 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
532#endif
533
David Brownellbb3b9d82009-05-28 14:04:03 -0700534 return 0;
535}
536
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800537static struct twl4030_gpio_platform_data overo_gpio_data = {
538 .gpio_base = OMAP_MAX_GPIO_LINES,
539 .irq_base = TWL4030_GPIO_IRQ_BASE,
540 .irq_end = TWL4030_GPIO_IRQ_END,
Steve Sakoman7c94f682011-03-09 18:08:05 -0600541 .use_leds = true,
David Brownellbb3b9d82009-05-28 14:04:03 -0700542 .setup = overo_twl_gpio_setup,
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800543};
544
David Brownellbb3b9d82009-05-28 14:04:03 -0700545static struct twl4030_usb_data overo_usb_data = {
546 .usb_mode = T2_USB_MODE_ULPI,
547};
548
549static struct regulator_init_data overo_vmmc1 = {
550 .constraints = {
551 .min_uV = 1850000,
552 .max_uV = 3150000,
553 .valid_modes_mask = REGULATOR_MODE_NORMAL
554 | REGULATOR_MODE_STANDBY,
555 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
556 | REGULATOR_CHANGE_MODE
557 | REGULATOR_CHANGE_STATUS,
558 },
559 .num_consumer_supplies = 1,
560 .consumer_supplies = &overo_vmmc1_supply,
561};
562
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600563/* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
564static struct regulator_init_data overo_vdac = {
565 .constraints = {
566 .min_uV = 1800000,
567 .max_uV = 1800000,
568 .valid_modes_mask = REGULATOR_MODE_NORMAL
569 | REGULATOR_MODE_STANDBY,
570 .valid_ops_mask = REGULATOR_CHANGE_MODE
571 | REGULATOR_CHANGE_STATUS,
572 },
573 .num_consumer_supplies = 1,
574 .consumer_supplies = &overo_vdda_dac_supply,
575};
576
577/* VPLL2 for digital video outputs */
578static struct regulator_init_data overo_vpll2 = {
579 .constraints = {
580 .name = "VDVI",
581 .min_uV = 1800000,
582 .max_uV = 1800000,
583 .valid_modes_mask = REGULATOR_MODE_NORMAL
584 | REGULATOR_MODE_STANDBY,
585 .valid_ops_mask = REGULATOR_CHANGE_MODE
586 | REGULATOR_CHANGE_STATUS,
587 },
588 .num_consumer_supplies = ARRAY_SIZE(overo_vdds_dsi_supply),
589 .consumer_supplies = overo_vdds_dsi_supply,
590};
591
Ilkka Koskinen6a58baf2011-03-02 13:24:05 +0000592static struct twl4030_codec_audio_data overo_audio_data;
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300593
594static struct twl4030_codec_data overo_codec_data = {
Peter Ujfalusi6df74ef2009-11-04 09:58:18 +0200595 .audio_mclk = 26000000,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300596 .audio = &overo_audio_data,
597};
598
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800599static struct twl4030_platform_data overo_twldata = {
600 .irq_base = TWL4030_IRQ_BASE,
601 .irq_end = TWL4030_IRQ_END,
602 .gpio = &overo_gpio_data,
David Brownellbb3b9d82009-05-28 14:04:03 -0700603 .usb = &overo_usb_data,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300604 .codec = &overo_codec_data,
David Brownellbb3b9d82009-05-28 14:04:03 -0700605 .vmmc1 = &overo_vmmc1,
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600606 .vdac = &overo_vdac,
607 .vpll2 = &overo_vpll2,
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800608};
609
610static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
611 {
David Brownellbb3b9d82009-05-28 14:04:03 -0700612 I2C_BOARD_INFO("tps65950", 0x48),
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800613 .flags = I2C_CLIENT_WAKE,
614 .irq = INT_34XX_SYS_NIRQ,
615 .platform_data = &overo_twldata,
616 },
617};
618
Steve Sakomaneba26452008-10-09 17:51:43 +0300619static int __init overo_i2c_init(void)
620{
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800621 omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo,
622 ARRAY_SIZE(overo_i2c_boardinfo));
Steve Sakomaneba26452008-10-09 17:51:43 +0300623 /* i2c2 pins are used for gpio */
624 omap_register_i2c_bus(3, 400, NULL, 0);
625 return 0;
626}
627
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600628static struct spi_board_info overo_spi_board_info[] __initdata = {
629#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
630 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
631 {
632 .modalias = "ads7846",
633 .bus_num = 1,
634 .chip_select = 0,
635 .max_speed_hz = 1500000,
636 .controller_data = &ads7846_mcspi_config,
637 .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
638 .platform_data = &ads7846_config,
639 },
640#endif
641#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
642 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
643 {
644 .modalias = "lgphilips_lb035q02_panel-spi",
645 .bus_num = 1,
646 .chip_select = 1,
647 .max_speed_hz = 500000,
648 .mode = SPI_MODE_3,
649 },
650#endif
Steve Sakomaneba26452008-10-09 17:51:43 +0300651};
652
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600653static int __init overo_spi_init(void)
654{
655 overo_ads7846_init();
656 spi_register_board_info(overo_spi_board_info,
657 ARRAY_SIZE(overo_spi_board_info));
658 return 0;
659}
Steve Sakomaneba26452008-10-09 17:51:43 +0300660
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800661static void __init overo_init_early(void)
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300662{
Paul Walmsley48057342010-12-21 15:25:10 -0700663 omap2_init_common_infrastructure();
664 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
665 mt46h32m32lf6_sdrc_params);
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300666}
667
Felipe Balbi6f69a182010-03-04 09:45:53 +0200668static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
Felipe Balbi58a54912009-11-22 10:11:01 -0800669 .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
670 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
671 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
672
673 .phy_reset = true,
674 .reset_gpio_port[0] = -EINVAL,
675 .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET,
676 .reset_gpio_port[2] = -EINVAL
677};
678
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800679#ifdef CONFIG_OMAP_MUX
680static struct omap_board_mux board_mux[] __initdata = {
681 { .reg_offset = OMAP_MUX_TERMINATOR },
682};
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800683#endif
Felipe Balbi58a54912009-11-22 10:11:01 -0800684
Maulik Mankad884b83692010-02-17 14:09:30 -0800685static struct omap_musb_board_data musb_board_data = {
686 .interface_type = MUSB_INTERFACE_ULPI,
687 .mode = MUSB_OTG,
688 .power = 100,
689};
690
Steve Sakomaneba26452008-10-09 17:51:43 +0300691static void __init overo_init(void)
692{
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800693 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Steve Sakomaneba26452008-10-09 17:51:43 +0300694 overo_i2c_init();
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600695 omap_display_init(&overo_dss_data);
Steve Sakomaneba26452008-10-09 17:51:43 +0300696 omap_serial_init();
Steve Sakomaneba26452008-10-09 17:51:43 +0300697 overo_flash_init();
Maulik Mankad884b83692010-02-17 14:09:30 -0800698 usb_musb_init(&musb_board_data);
Felipe Balbi58a54912009-11-22 10:11:01 -0800699 usb_ehci_init(&ehci_pdata);
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600700 overo_spi_init();
Steve Sakoman172ef272009-02-02 06:27:49 +0000701 overo_init_smsc911x();
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600702 overo_display_init();
Steve Sakoman7c94f682011-03-09 18:08:05 -0600703 overo_init_led();
Steve Sakomaneba26452008-10-09 17:51:43 +0300704
Jean Pihet9fb97412009-07-24 19:43:25 -0600705 /* Ensure SDRC pins are mux'd for self-refresh */
Tony Lindgren4896e392009-12-11 16:16:32 -0800706 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
707 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
Jean Pihet9fb97412009-07-24 19:43:25 -0600708
Steve Sakomaneba26452008-10-09 17:51:43 +0300709 if ((gpio_request(OVERO_GPIO_W2W_NRESET,
710 "OVERO_GPIO_W2W_NRESET") == 0) &&
711 (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
712 gpio_export(OVERO_GPIO_W2W_NRESET, 0);
713 gpio_set_value(OVERO_GPIO_W2W_NRESET, 0);
714 udelay(10);
715 gpio_set_value(OVERO_GPIO_W2W_NRESET, 1);
716 } else {
717 printk(KERN_ERR "could not obtain gpio for "
718 "OVERO_GPIO_W2W_NRESET\n");
719 }
720
721 if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) &&
722 (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0))
723 gpio_export(OVERO_GPIO_BT_XGATE, 0);
724 else
725 printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n");
726
727 if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) &&
728 (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) {
729 gpio_export(OVERO_GPIO_BT_NRESET, 0);
730 gpio_set_value(OVERO_GPIO_BT_NRESET, 0);
731 mdelay(6);
732 gpio_set_value(OVERO_GPIO_BT_NRESET, 1);
733 } else {
734 printk(KERN_ERR "could not obtain gpio for "
735 "OVERO_GPIO_BT_NRESET\n");
736 }
737
738 if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) &&
739 (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0))
740 gpio_export(OVERO_GPIO_USBH_CPEN, 0);
741 else
742 printk(KERN_ERR "could not obtain gpio for "
743 "OVERO_GPIO_USBH_CPEN\n");
Steve Sakomaneba26452008-10-09 17:51:43 +0300744}
745
Steve Sakomaneba26452008-10-09 17:51:43 +0300746MACHINE_START(OVERO, "Gumstix Overo")
Steve Sakomaneba26452008-10-09 17:51:43 +0300747 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100748 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800749 .map_io = omap3_map_io,
750 .init_early = overo_init_early,
751 .init_irq = omap_init_irq,
Steve Sakomaneba26452008-10-09 17:51:43 +0300752 .init_machine = overo_init,
753 .timer = &omap_timer,
754MACHINE_END