blob: d621ee8fec0c433ee17c39abdb16d780105c1b1d [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 Sakoman7b12d7b2011-03-05 07:58:39 -060031#include <linux/spi/spi.h>
Steve Sakomaneba26452008-10-09 17:51:43 +030032
33#include <linux/mtd/mtd.h>
34#include <linux/mtd/nand.h>
35#include <linux/mtd/partitions.h>
Sukumar Ghorai3a638332010-09-15 14:49:23 +000036#include <linux/mmc/host.h>
Steve Sakomaneba26452008-10-09 17:51:43 +030037
38#include <asm/mach-types.h>
39#include <asm/mach/arch.h>
40#include <asm/mach/flash.h>
41#include <asm/mach/map.h>
42
Tony Lindgrence491cf2009-10-20 09:40:47 -070043#include <plat/board.h>
44#include <plat/common.h>
Steve Sakoman7b12d7b2011-03-05 07:58:39 -060045#include <plat/display.h>
46#include <plat/panel-generic-dpi.h>
Steve Sakomaneba26452008-10-09 17:51:43 +030047#include <mach/gpio.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070048#include <plat/gpmc.h>
Steve Sakomaneba26452008-10-09 17:51:43 +030049#include <mach/hardware.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070050#include <plat/nand.h>
Steve Sakoman7b12d7b2011-03-05 07:58:39 -060051#include <plat/mcspi.h>
52#include <plat/mux.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070053#include <plat/usb.h>
Steve Sakomaneba26452008-10-09 17:51:43 +030054
Tony Lindgrenca5742b2009-12-11 16:16:32 -080055#include "mux.h"
Paul Walmsley2e12bd72009-05-28 14:03:59 -070056#include "sdram-micron-mt46h32m32lf-6.h"
Adrian Hunterd02a900b2010-02-15 10:03:34 -080057#include "hsmmc.h"
Tony Lindgren90c62bf2008-12-10 17:37:17 -080058
Tony Lindgren0d4d9ab2009-03-23 18:07:38 -070059#define OVERO_GPIO_BT_XGATE 15
60#define OVERO_GPIO_W2W_NRESET 16
Kevin Hilman6fd210a2009-07-20 09:09:23 -070061#define OVERO_GPIO_PENDOWN 114
Tony Lindgren0d4d9ab2009-03-23 18:07:38 -070062#define OVERO_GPIO_BT_NRESET 164
63#define OVERO_GPIO_USBH_CPEN 168
64#define OVERO_GPIO_USBH_NRESET 183
65
Steve Sakomaneba26452008-10-09 17:51:43 +030066#define NAND_BLOCK_SIZE SZ_128K
Steve Sakomaneba26452008-10-09 17:51:43 +030067
Steve Sakoman172ef272009-02-02 06:27:49 +000068#define OVERO_SMSC911X_CS 5
69#define OVERO_SMSC911X_GPIO 176
Steve Sakoman5c9a29e2010-05-10 14:29:18 -070070#define OVERO_SMSC911X2_CS 4
71#define OVERO_SMSC911X2_GPIO 65
Steve Sakoman172ef272009-02-02 06:27:49 +000072
Steve Sakomanc6a81312009-03-23 18:38:16 -070073#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
74 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
75
Steve Sakomanc6a81312009-03-23 18:38:16 -070076#include <linux/spi/ads7846.h>
77
78static struct omap2_mcspi_device_config ads7846_mcspi_config = {
79 .turbo_mode = 0,
80 .single_channel = 1, /* 0: slave, 1: master */
81};
82
83static int ads7846_get_pendown_state(void)
84{
85 return !gpio_get_value(OVERO_GPIO_PENDOWN);
86}
87
88static struct ads7846_platform_data ads7846_config = {
89 .x_max = 0x0fff,
90 .y_max = 0x0fff,
91 .x_plate_ohms = 180,
92 .pressure_max = 255,
93 .debounce_max = 10,
94 .debounce_tol = 3,
95 .debounce_rep = 1,
96 .get_pendown_state = ads7846_get_pendown_state,
97 .keep_vref_on = 1,
98};
99
Steve Sakomanc6a81312009-03-23 18:38:16 -0700100static void __init overo_ads7846_init(void)
101{
102 if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) &&
103 (gpio_direction_input(OVERO_GPIO_PENDOWN) == 0)) {
104 gpio_export(OVERO_GPIO_PENDOWN, 0);
105 } else {
106 printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n");
107 return;
108 }
Steve Sakomanc6a81312009-03-23 18:38:16 -0700109}
110
111#else
112static inline void __init overo_ads7846_init(void) { return; }
113#endif
114
Steve Sakoman172ef272009-02-02 06:27:49 +0000115#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
116
117#include <linux/smsc911x.h>
118
119static struct resource overo_smsc911x_resources[] = {
120 {
121 .name = "smsc911x-memory",
122 .flags = IORESOURCE_MEM,
123 },
124 {
125 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
126 },
127};
128
Steve Sakoman5c9a29e2010-05-10 14:29:18 -0700129static struct resource overo_smsc911x2_resources[] = {
130 {
131 .name = "smsc911x2-memory",
132 .flags = IORESOURCE_MEM,
133 },
134 {
135 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
136 },
137};
138
Steve Sakoman172ef272009-02-02 06:27:49 +0000139static struct smsc911x_platform_config overo_smsc911x_config = {
140 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
141 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
142 .flags = SMSC911X_USE_32BIT ,
143 .phy_interface = PHY_INTERFACE_MODE_MII,
144};
145
146static struct platform_device overo_smsc911x_device = {
147 .name = "smsc911x",
Steve Sakoman5c9a29e2010-05-10 14:29:18 -0700148 .id = 0,
Steve Sakoman172ef272009-02-02 06:27:49 +0000149 .num_resources = ARRAY_SIZE(overo_smsc911x_resources),
Sergio Aguirre50329022009-08-10 14:49:50 +0300150 .resource = overo_smsc911x_resources,
Steve Sakoman172ef272009-02-02 06:27:49 +0000151 .dev = {
152 .platform_data = &overo_smsc911x_config,
153 },
154};
155
Steve Sakomana5ba7ae2010-08-02 14:21:39 +0300156static struct platform_device overo_smsc911x2_device = {
157 .name = "smsc911x",
158 .id = 1,
159 .num_resources = ARRAY_SIZE(overo_smsc911x2_resources),
160 .resource = overo_smsc911x2_resources,
161 .dev = {
162 .platform_data = &overo_smsc911x_config,
163 },
164};
165
166static struct platform_device *smsc911x_devices[] = {
167 &overo_smsc911x_device,
168 &overo_smsc911x2_device,
169};
170
Steve Sakoman172ef272009-02-02 06:27:49 +0000171static inline void __init overo_init_smsc911x(void)
172{
Steve Sakomana5ba7ae2010-08-02 14:21:39 +0300173 unsigned long cs_mem_base, cs_mem_base2;
174
175 /* set up first smsc911x chip */
Steve Sakoman172ef272009-02-02 06:27:49 +0000176
177 if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
178 printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n");
179 return;
180 }
181
182 overo_smsc911x_resources[0].start = cs_mem_base + 0x0;
183 overo_smsc911x_resources[0].end = cs_mem_base + 0xff;
184
185 if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
186 (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) {
187 gpio_export(OVERO_SMSC911X_GPIO, 0);
188 } else {
189 printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n");
190 return;
191 }
192
193 overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO);
194 overo_smsc911x_resources[1].end = 0;
195
Steve Sakomana5ba7ae2010-08-02 14:21:39 +0300196 /* set up second smsc911x chip */
197
198 if (gpmc_cs_request(OVERO_SMSC911X2_CS, SZ_16M, &cs_mem_base2) < 0) {
199 printk(KERN_ERR "Failed request for GPMC mem for smsc911x2\n");
200 return;
201 }
202
203 overo_smsc911x2_resources[0].start = cs_mem_base2 + 0x0;
204 overo_smsc911x2_resources[0].end = cs_mem_base2 + 0xff;
205
206 if ((gpio_request(OVERO_SMSC911X2_GPIO, "SMSC911X2 IRQ") == 0) &&
207 (gpio_direction_input(OVERO_SMSC911X2_GPIO) == 0)) {
208 gpio_export(OVERO_SMSC911X2_GPIO, 0);
209 } else {
210 printk(KERN_ERR "could not obtain gpio for SMSC911X2 IRQ\n");
211 return;
212 }
213
214 overo_smsc911x2_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X2_GPIO);
215 overo_smsc911x2_resources[1].end = 0;
216
217 platform_add_devices(smsc911x_devices, ARRAY_SIZE(smsc911x_devices));
Steve Sakoman172ef272009-02-02 06:27:49 +0000218}
219
220#else
221static inline void __init overo_init_smsc911x(void) { return; }
222#endif
223
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600224/* DSS */
225static int lcd_enabled;
226static int dvi_enabled;
227
228#define OVERO_GPIO_LCD_EN 144
229#define OVERO_GPIO_LCD_BL 145
230
231static void __init overo_display_init(void)
232{
233 if ((gpio_request(OVERO_GPIO_LCD_EN, "OVERO_GPIO_LCD_EN") == 0) &&
234 (gpio_direction_output(OVERO_GPIO_LCD_EN, 1) == 0))
235 gpio_export(OVERO_GPIO_LCD_EN, 0);
236 else
237 printk(KERN_ERR "could not obtain gpio for "
238 "OVERO_GPIO_LCD_EN\n");
239
240 if ((gpio_request(OVERO_GPIO_LCD_BL, "OVERO_GPIO_LCD_BL") == 0) &&
241 (gpio_direction_output(OVERO_GPIO_LCD_BL, 1) == 0))
242 gpio_export(OVERO_GPIO_LCD_BL, 0);
243 else
244 printk(KERN_ERR "could not obtain gpio for "
245 "OVERO_GPIO_LCD_BL\n");
246}
247
248static int overo_panel_enable_dvi(struct omap_dss_device *dssdev)
249{
250 if (lcd_enabled) {
251 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
252 return -EINVAL;
253 }
254 dvi_enabled = 1;
255
256 return 0;
257}
258
259static void overo_panel_disable_dvi(struct omap_dss_device *dssdev)
260{
261 dvi_enabled = 0;
262}
263
264static struct panel_generic_dpi_data dvi_panel = {
265 .name = "generic",
266 .platform_enable = overo_panel_enable_dvi,
267 .platform_disable = overo_panel_disable_dvi,
268};
269
270static struct omap_dss_device overo_dvi_device = {
271 .name = "dvi",
272 .type = OMAP_DISPLAY_TYPE_DPI,
273 .driver_name = "generic_dpi_panel",
274 .data = &dvi_panel,
275 .phy.dpi.data_lines = 24,
276};
277
278static struct omap_dss_device overo_tv_device = {
279 .name = "tv",
280 .driver_name = "venc",
281 .type = OMAP_DISPLAY_TYPE_VENC,
282 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
283};
284
285static int overo_panel_enable_lcd(struct omap_dss_device *dssdev)
286{
287 if (dvi_enabled) {
288 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
289 return -EINVAL;
290 }
291
292 gpio_set_value(OVERO_GPIO_LCD_EN, 1);
293 gpio_set_value(OVERO_GPIO_LCD_BL, 1);
294 lcd_enabled = 1;
295 return 0;
296}
297
298static void overo_panel_disable_lcd(struct omap_dss_device *dssdev)
299{
300 gpio_set_value(OVERO_GPIO_LCD_EN, 0);
301 gpio_set_value(OVERO_GPIO_LCD_BL, 0);
302 lcd_enabled = 0;
303}
304
305static struct panel_generic_dpi_data lcd43_panel = {
306 .name = "samsung_lte430wq_f0c",
307 .platform_enable = overo_panel_enable_lcd,
308 .platform_disable = overo_panel_disable_lcd,
309};
310
311static struct omap_dss_device overo_lcd43_device = {
312 .name = "lcd43",
313 .type = OMAP_DISPLAY_TYPE_DPI,
314 .driver_name = "generic_dpi_panel",
315 .data = &lcd43_panel,
316 .phy.dpi.data_lines = 24,
317};
318
319#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
320 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
321static struct omap_dss_device overo_lcd35_device = {
322 .type = OMAP_DISPLAY_TYPE_DPI,
323 .name = "lcd35",
324 .driver_name = "lgphilips_lb035q02_panel",
325 .phy.dpi.data_lines = 24,
326 .platform_enable = overo_panel_enable_lcd,
327 .platform_disable = overo_panel_disable_lcd,
328};
329#endif
330
331static struct omap_dss_device *overo_dss_devices[] = {
332 &overo_dvi_device,
333 &overo_tv_device,
334#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
335 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
336 &overo_lcd35_device,
337#endif
338 &overo_lcd43_device,
339};
340
341static struct omap_dss_board_info overo_dss_data = {
342 .num_devices = ARRAY_SIZE(overo_dss_devices),
343 .devices = overo_dss_devices,
344 .default_device = &overo_dvi_device,
345};
346
347static struct regulator_consumer_supply overo_vdda_dac_supply =
348 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
349
350static struct regulator_consumer_supply overo_vdds_dsi_supply[] = {
351 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
352 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
353};
354
Steve Sakomaneba26452008-10-09 17:51:43 +0300355static struct mtd_partition overo_nand_partitions[] = {
356 {
357 .name = "xloader",
358 .offset = 0, /* Offset = 0x00000 */
359 .size = 4 * NAND_BLOCK_SIZE,
360 .mask_flags = MTD_WRITEABLE
361 },
362 {
363 .name = "uboot",
364 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
365 .size = 14 * NAND_BLOCK_SIZE,
366 },
367 {
368 .name = "uboot environment",
369 .offset = MTDPART_OFS_APPEND, /* Offset = 0x240000 */
370 .size = 2 * NAND_BLOCK_SIZE,
371 },
372 {
373 .name = "linux",
374 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
375 .size = 32 * NAND_BLOCK_SIZE,
376 },
377 {
378 .name = "rootfs",
379 .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
380 .size = MTDPART_SIZ_FULL,
381 },
382};
383
384static struct omap_nand_platform_data overo_nand_data = {
385 .parts = overo_nand_partitions,
386 .nr_parts = ARRAY_SIZE(overo_nand_partitions),
387 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
388};
389
Steve Sakomaneba26452008-10-09 17:51:43 +0300390static void __init overo_flash_init(void)
391{
392 u8 cs = 0;
393 u8 nandcs = GPMC_CS_NUM + 1;
394
Steve Sakomaneba26452008-10-09 17:51:43 +0300395 /* find out the chip-select on which NAND exists */
396 while (cs < GPMC_CS_NUM) {
397 u32 ret = 0;
398 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
399
400 if ((ret & 0xC00) == 0x800) {
401 printk(KERN_INFO "Found NAND on CS%d\n", cs);
402 if (nandcs > GPMC_CS_NUM)
403 nandcs = cs;
404 }
405 cs++;
406 }
407
408 if (nandcs > GPMC_CS_NUM) {
409 printk(KERN_INFO "NAND: Unable to find configuration "
410 "in GPMC\n ");
411 return;
412 }
413
414 if (nandcs < GPMC_CS_NUM) {
415 overo_nand_data.cs = nandcs;
Steve Sakomaneba26452008-10-09 17:51:43 +0300416
417 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
Sukumar Ghoraif450d862010-07-09 09:14:46 +0000418 if (gpmc_nand_init(&overo_nand_data) < 0)
Steve Sakomaneba26452008-10-09 17:51:43 +0300419 printk(KERN_ERR "Unable to register NAND device\n");
420 }
421}
Steve Sakomaneba26452008-10-09 17:51:43 +0300422
Adrian Hunter68ff0422010-02-15 10:03:34 -0800423static struct omap2_hsmmc_info mmc[] = {
David Brownellbb3b9d82009-05-28 14:04:03 -0700424 {
425 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000426 .caps = MMC_CAP_4_BIT_DATA,
David Brownellbb3b9d82009-05-28 14:04:03 -0700427 .gpio_cd = -EINVAL,
428 .gpio_wp = -EINVAL,
429 },
430 {
431 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000432 .caps = MMC_CAP_4_BIT_DATA,
David Brownellbb3b9d82009-05-28 14:04:03 -0700433 .gpio_cd = -EINVAL,
434 .gpio_wp = -EINVAL,
435 .transceiver = true,
436 .ocr_mask = 0x00100000, /* 3.3V */
437 },
438 {} /* Terminator */
439};
440
441static struct regulator_consumer_supply overo_vmmc1_supply = {
442 .supply = "vmmc",
443};
444
445static int overo_twl_gpio_setup(struct device *dev,
446 unsigned gpio, unsigned ngpio)
447{
Adrian Hunter68ff0422010-02-15 10:03:34 -0800448 omap2_hsmmc_init(mmc);
David Brownellbb3b9d82009-05-28 14:04:03 -0700449
450 overo_vmmc1_supply.dev = mmc[0].dev;
451
452 return 0;
453}
454
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800455static struct twl4030_gpio_platform_data overo_gpio_data = {
456 .gpio_base = OMAP_MAX_GPIO_LINES,
457 .irq_base = TWL4030_GPIO_IRQ_BASE,
458 .irq_end = TWL4030_GPIO_IRQ_END,
David Brownellbb3b9d82009-05-28 14:04:03 -0700459 .setup = overo_twl_gpio_setup,
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800460};
461
David Brownellbb3b9d82009-05-28 14:04:03 -0700462static struct twl4030_usb_data overo_usb_data = {
463 .usb_mode = T2_USB_MODE_ULPI,
464};
465
466static struct regulator_init_data overo_vmmc1 = {
467 .constraints = {
468 .min_uV = 1850000,
469 .max_uV = 3150000,
470 .valid_modes_mask = REGULATOR_MODE_NORMAL
471 | REGULATOR_MODE_STANDBY,
472 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
473 | REGULATOR_CHANGE_MODE
474 | REGULATOR_CHANGE_STATUS,
475 },
476 .num_consumer_supplies = 1,
477 .consumer_supplies = &overo_vmmc1_supply,
478};
479
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600480/* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
481static struct regulator_init_data overo_vdac = {
482 .constraints = {
483 .min_uV = 1800000,
484 .max_uV = 1800000,
485 .valid_modes_mask = REGULATOR_MODE_NORMAL
486 | REGULATOR_MODE_STANDBY,
487 .valid_ops_mask = REGULATOR_CHANGE_MODE
488 | REGULATOR_CHANGE_STATUS,
489 },
490 .num_consumer_supplies = 1,
491 .consumer_supplies = &overo_vdda_dac_supply,
492};
493
494/* VPLL2 for digital video outputs */
495static struct regulator_init_data overo_vpll2 = {
496 .constraints = {
497 .name = "VDVI",
498 .min_uV = 1800000,
499 .max_uV = 1800000,
500 .valid_modes_mask = REGULATOR_MODE_NORMAL
501 | REGULATOR_MODE_STANDBY,
502 .valid_ops_mask = REGULATOR_CHANGE_MODE
503 | REGULATOR_CHANGE_STATUS,
504 },
505 .num_consumer_supplies = ARRAY_SIZE(overo_vdds_dsi_supply),
506 .consumer_supplies = overo_vdds_dsi_supply,
507};
508
Ilkka Koskinen6a58baf2011-03-02 13:24:05 +0000509static struct twl4030_codec_audio_data overo_audio_data;
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300510
511static struct twl4030_codec_data overo_codec_data = {
Peter Ujfalusi6df74ef2009-11-04 09:58:18 +0200512 .audio_mclk = 26000000,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300513 .audio = &overo_audio_data,
514};
515
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800516static struct twl4030_platform_data overo_twldata = {
517 .irq_base = TWL4030_IRQ_BASE,
518 .irq_end = TWL4030_IRQ_END,
519 .gpio = &overo_gpio_data,
David Brownellbb3b9d82009-05-28 14:04:03 -0700520 .usb = &overo_usb_data,
Peter Ujfalusie86fa0b2009-10-22 13:26:46 +0300521 .codec = &overo_codec_data,
David Brownellbb3b9d82009-05-28 14:04:03 -0700522 .vmmc1 = &overo_vmmc1,
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600523 .vdac = &overo_vdac,
524 .vpll2 = &overo_vpll2,
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800525};
526
527static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
528 {
David Brownellbb3b9d82009-05-28 14:04:03 -0700529 I2C_BOARD_INFO("tps65950", 0x48),
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800530 .flags = I2C_CLIENT_WAKE,
531 .irq = INT_34XX_SYS_NIRQ,
532 .platform_data = &overo_twldata,
533 },
534};
535
Steve Sakomaneba26452008-10-09 17:51:43 +0300536static int __init overo_i2c_init(void)
537{
Tony Lindgren90c62bf2008-12-10 17:37:17 -0800538 omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo,
539 ARRAY_SIZE(overo_i2c_boardinfo));
Steve Sakomaneba26452008-10-09 17:51:43 +0300540 /* i2c2 pins are used for gpio */
541 omap_register_i2c_bus(3, 400, NULL, 0);
542 return 0;
543}
544
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600545static struct spi_board_info overo_spi_board_info[] __initdata = {
546#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
547 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
548 {
549 .modalias = "ads7846",
550 .bus_num = 1,
551 .chip_select = 0,
552 .max_speed_hz = 1500000,
553 .controller_data = &ads7846_mcspi_config,
554 .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
555 .platform_data = &ads7846_config,
556 },
557#endif
558#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
559 defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
560 {
561 .modalias = "lgphilips_lb035q02_panel-spi",
562 .bus_num = 1,
563 .chip_select = 1,
564 .max_speed_hz = 500000,
565 .mode = SPI_MODE_3,
566 },
567#endif
Steve Sakomaneba26452008-10-09 17:51:43 +0300568};
569
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600570static int __init overo_spi_init(void)
571{
572 overo_ads7846_init();
573 spi_register_board_info(overo_spi_board_info,
574 ARRAY_SIZE(overo_spi_board_info));
575 return 0;
576}
Steve Sakomaneba26452008-10-09 17:51:43 +0300577
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800578static void __init overo_init_early(void)
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300579{
Paul Walmsley48057342010-12-21 15:25:10 -0700580 omap2_init_common_infrastructure();
581 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
582 mt46h32m32lf6_sdrc_params);
Paul Walmsleyb3c6df32009-09-03 20:14:02 +0300583}
584
Felipe Balbi6f69a182010-03-04 09:45:53 +0200585static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
Felipe Balbi58a54912009-11-22 10:11:01 -0800586 .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
587 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
588 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
589
590 .phy_reset = true,
591 .reset_gpio_port[0] = -EINVAL,
592 .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET,
593 .reset_gpio_port[2] = -EINVAL
594};
595
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800596#ifdef CONFIG_OMAP_MUX
597static struct omap_board_mux board_mux[] __initdata = {
598 { .reg_offset = OMAP_MUX_TERMINATOR },
599};
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800600#endif
Felipe Balbi58a54912009-11-22 10:11:01 -0800601
Maulik Mankad884b83692010-02-17 14:09:30 -0800602static struct omap_musb_board_data musb_board_data = {
603 .interface_type = MUSB_INTERFACE_ULPI,
604 .mode = MUSB_OTG,
605 .power = 100,
606};
607
Steve Sakomaneba26452008-10-09 17:51:43 +0300608static void __init overo_init(void)
609{
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800610 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Steve Sakomaneba26452008-10-09 17:51:43 +0300611 overo_i2c_init();
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600612 omap_display_init(&overo_dss_data);
Steve Sakomaneba26452008-10-09 17:51:43 +0300613 omap_serial_init();
Steve Sakomaneba26452008-10-09 17:51:43 +0300614 overo_flash_init();
Maulik Mankad884b83692010-02-17 14:09:30 -0800615 usb_musb_init(&musb_board_data);
Felipe Balbi58a54912009-11-22 10:11:01 -0800616 usb_ehci_init(&ehci_pdata);
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600617 overo_spi_init();
Steve Sakoman172ef272009-02-02 06:27:49 +0000618 overo_init_smsc911x();
Steve Sakoman7b12d7b2011-03-05 07:58:39 -0600619 overo_display_init();
Steve Sakomaneba26452008-10-09 17:51:43 +0300620
Jean Pihet9fb97412009-07-24 19:43:25 -0600621 /* Ensure SDRC pins are mux'd for self-refresh */
Tony Lindgren4896e392009-12-11 16:16:32 -0800622 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
623 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
Jean Pihet9fb97412009-07-24 19:43:25 -0600624
Steve Sakomaneba26452008-10-09 17:51:43 +0300625 if ((gpio_request(OVERO_GPIO_W2W_NRESET,
626 "OVERO_GPIO_W2W_NRESET") == 0) &&
627 (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
628 gpio_export(OVERO_GPIO_W2W_NRESET, 0);
629 gpio_set_value(OVERO_GPIO_W2W_NRESET, 0);
630 udelay(10);
631 gpio_set_value(OVERO_GPIO_W2W_NRESET, 1);
632 } else {
633 printk(KERN_ERR "could not obtain gpio for "
634 "OVERO_GPIO_W2W_NRESET\n");
635 }
636
637 if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) &&
638 (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0))
639 gpio_export(OVERO_GPIO_BT_XGATE, 0);
640 else
641 printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n");
642
643 if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) &&
644 (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) {
645 gpio_export(OVERO_GPIO_BT_NRESET, 0);
646 gpio_set_value(OVERO_GPIO_BT_NRESET, 0);
647 mdelay(6);
648 gpio_set_value(OVERO_GPIO_BT_NRESET, 1);
649 } else {
650 printk(KERN_ERR "could not obtain gpio for "
651 "OVERO_GPIO_BT_NRESET\n");
652 }
653
654 if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) &&
655 (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0))
656 gpio_export(OVERO_GPIO_USBH_CPEN, 0);
657 else
658 printk(KERN_ERR "could not obtain gpio for "
659 "OVERO_GPIO_USBH_CPEN\n");
Steve Sakomaneba26452008-10-09 17:51:43 +0300660}
661
Steve Sakomaneba26452008-10-09 17:51:43 +0300662MACHINE_START(OVERO, "Gumstix Overo")
Steve Sakomaneba26452008-10-09 17:51:43 +0300663 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100664 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800665 .map_io = omap3_map_io,
666 .init_early = overo_init_early,
667 .init_irq = omap_init_irq,
Steve Sakomaneba26452008-10-09 17:51:43 +0300668 .init_machine = overo_init,
669 .timer = &omap_timer,
670MACHINE_END