4278ecb799a2653368d77bd071cac05941268f5e
[linux-3.10.git] / arch / arm / mach-omap2 / board-overo.c
1 /*
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>
29 #include <linux/i2c/twl.h>
30 #include <linux/regulator/machine.h>
31 #include <linux/regulator/fixed.h>
32 #include <linux/spi/spi.h>
33
34 #include <linux/mtd/mtd.h>
35 #include <linux/mtd/nand.h>
36 #include <linux/mtd/partitions.h>
37 #include <linux/mmc/host.h>
38
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
44 #include <plat/board.h>
45 #include <plat/common.h>
46 #include <plat/display.h>
47 #include <plat/panel-generic-dpi.h>
48 #include <mach/gpio.h>
49 #include <plat/gpmc.h>
50 #include <mach/hardware.h>
51 #include <plat/nand.h>
52 #include <plat/mcspi.h>
53 #include <plat/mux.h>
54 #include <plat/usb.h>
55
56 #include "mux.h"
57 #include "sdram-micron-mt46h32m32lf-6.h"
58 #include "hsmmc.h"
59
60 #define OVERO_GPIO_BT_XGATE     15
61 #define OVERO_GPIO_W2W_NRESET   16
62 #define OVERO_GPIO_PENDOWN      114
63 #define OVERO_GPIO_BT_NRESET    164
64 #define OVERO_GPIO_USBH_CPEN    168
65 #define OVERO_GPIO_USBH_NRESET  183
66
67 #define NAND_BLOCK_SIZE SZ_128K
68
69 #define OVERO_SMSC911X_CS      5
70 #define OVERO_SMSC911X_GPIO    176
71 #define OVERO_SMSC911X2_CS     4
72 #define OVERO_SMSC911X2_GPIO   65
73
74 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
75         defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
76
77 #include <linux/spi/ads7846.h>
78
79 static struct omap2_mcspi_device_config ads7846_mcspi_config = {
80         .turbo_mode     = 0,
81         .single_channel = 1,    /* 0: slave, 1: master */
82 };
83
84 static int ads7846_get_pendown_state(void)
85 {
86         return !gpio_get_value(OVERO_GPIO_PENDOWN);
87 }
88
89 static 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
101 /* fixed regulator for ads7846 */
102 static struct regulator_consumer_supply ads7846_supply =
103         REGULATOR_SUPPLY("vcc", "spi1.0");
104
105 static 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
113 static 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
121 static struct platform_device vads7846_device = {
122         .name           = "reg-fixed-voltage",
123         .id             = 1,
124         .dev = {
125                 .platform_data = &vads7846,
126         },
127 };
128
129 static 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         }
138
139         platform_device_register(&vads7846_device);
140 }
141
142 #else
143 static inline void __init overo_ads7846_init(void) { return; }
144 #endif
145
146 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
147
148 #include <linux/smsc911x.h>
149
150 static 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
160 static 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
170 static 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
177 static struct platform_device overo_smsc911x_device = {
178         .name           = "smsc911x",
179         .id             = 0,
180         .num_resources  = ARRAY_SIZE(overo_smsc911x_resources),
181         .resource       = overo_smsc911x_resources,
182         .dev            = {
183                 .platform_data = &overo_smsc911x_config,
184         },
185 };
186
187 static 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
197 static struct platform_device *smsc911x_devices[] = {
198         &overo_smsc911x_device,
199         &overo_smsc911x2_device,
200 };
201
202 static inline void __init overo_init_smsc911x(void)
203 {
204         unsigned long cs_mem_base, cs_mem_base2;
205
206         /* set up first smsc911x chip */
207
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
227         /* 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));
249 }
250
251 #else
252 static inline void __init overo_init_smsc911x(void) { return; }
253 #endif
254
255 /* DSS */
256 static int lcd_enabled;
257 static int dvi_enabled;
258
259 #define OVERO_GPIO_LCD_EN 144
260 #define OVERO_GPIO_LCD_BL 145
261
262 static 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
279 static 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
290 static void overo_panel_disable_dvi(struct omap_dss_device *dssdev)
291 {
292         dvi_enabled = 0;
293 }
294
295 static 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
301 static 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
309 static 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
316 static 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
329 static 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
336 static 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
342 static 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)
352 static 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
362 static 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
372 static 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
378 static struct regulator_consumer_supply overo_vdda_dac_supply =
379         REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
380
381 static struct regulator_consumer_supply overo_vdds_dsi_supply[] = {
382         REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
383         REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
384 };
385
386 static 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
415 static 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
421 static void __init overo_flash_init(void)
422 {
423         u8 cs = 0;
424         u8 nandcs = GPMC_CS_NUM + 1;
425
426         /* 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;
447
448                 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
449                 if (gpmc_nand_init(&overo_nand_data) < 0)
450                         printk(KERN_ERR "Unable to register NAND device\n");
451         }
452 }
453
454 static struct omap2_hsmmc_info mmc[] = {
455         {
456                 .mmc            = 1,
457                 .caps           = MMC_CAP_4_BIT_DATA,
458                 .gpio_cd        = -EINVAL,
459                 .gpio_wp        = -EINVAL,
460         },
461         {
462                 .mmc            = 2,
463                 .caps           = MMC_CAP_4_BIT_DATA,
464                 .gpio_cd        = -EINVAL,
465                 .gpio_wp        = -EINVAL,
466                 .transceiver    = true,
467                 .ocr_mask       = 0x00100000,   /* 3.3V */
468         },
469         {}      /* Terminator */
470 };
471
472 static struct regulator_consumer_supply overo_vmmc1_supply = {
473         .supply                 = "vmmc",
474 };
475
476 static int overo_twl_gpio_setup(struct device *dev,
477                 unsigned gpio, unsigned ngpio)
478 {
479         omap2_hsmmc_init(mmc);
480
481         overo_vmmc1_supply.dev = mmc[0].dev;
482
483         return 0;
484 }
485
486 static struct twl4030_gpio_platform_data overo_gpio_data = {
487         .gpio_base      = OMAP_MAX_GPIO_LINES,
488         .irq_base       = TWL4030_GPIO_IRQ_BASE,
489         .irq_end        = TWL4030_GPIO_IRQ_END,
490         .setup          = overo_twl_gpio_setup,
491 };
492
493 static struct twl4030_usb_data overo_usb_data = {
494         .usb_mode       = T2_USB_MODE_ULPI,
495 };
496
497 static struct regulator_init_data overo_vmmc1 = {
498         .constraints = {
499                 .min_uV                 = 1850000,
500                 .max_uV                 = 3150000,
501                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
502                                         | REGULATOR_MODE_STANDBY,
503                 .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
504                                         | REGULATOR_CHANGE_MODE
505                                         | REGULATOR_CHANGE_STATUS,
506         },
507         .num_consumer_supplies  = 1,
508         .consumer_supplies      = &overo_vmmc1_supply,
509 };
510
511 /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
512 static struct regulator_init_data overo_vdac = {
513         .constraints = {
514                 .min_uV                 = 1800000,
515                 .max_uV                 = 1800000,
516                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
517                                         | REGULATOR_MODE_STANDBY,
518                 .valid_ops_mask         = REGULATOR_CHANGE_MODE
519                                         | REGULATOR_CHANGE_STATUS,
520         },
521         .num_consumer_supplies  = 1,
522         .consumer_supplies      = &overo_vdda_dac_supply,
523 };
524
525 /* VPLL2 for digital video outputs */
526 static struct regulator_init_data overo_vpll2 = {
527         .constraints = {
528                 .name                   = "VDVI",
529                 .min_uV                 = 1800000,
530                 .max_uV                 = 1800000,
531                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
532                                         | REGULATOR_MODE_STANDBY,
533                 .valid_ops_mask         = REGULATOR_CHANGE_MODE
534                                         | REGULATOR_CHANGE_STATUS,
535         },
536         .num_consumer_supplies  = ARRAY_SIZE(overo_vdds_dsi_supply),
537         .consumer_supplies      = overo_vdds_dsi_supply,
538 };
539
540 static struct twl4030_codec_audio_data overo_audio_data;
541
542 static struct twl4030_codec_data overo_codec_data = {
543         .audio_mclk = 26000000,
544         .audio = &overo_audio_data,
545 };
546
547 static struct twl4030_platform_data overo_twldata = {
548         .irq_base       = TWL4030_IRQ_BASE,
549         .irq_end        = TWL4030_IRQ_END,
550         .gpio           = &overo_gpio_data,
551         .usb            = &overo_usb_data,
552         .codec          = &overo_codec_data,
553         .vmmc1          = &overo_vmmc1,
554         .vdac           = &overo_vdac,
555         .vpll2          = &overo_vpll2,
556 };
557
558 static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
559         {
560                 I2C_BOARD_INFO("tps65950", 0x48),
561                 .flags = I2C_CLIENT_WAKE,
562                 .irq = INT_34XX_SYS_NIRQ,
563                 .platform_data = &overo_twldata,
564         },
565 };
566
567 static int __init overo_i2c_init(void)
568 {
569         omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo,
570                         ARRAY_SIZE(overo_i2c_boardinfo));
571         /* i2c2 pins are used for gpio */
572         omap_register_i2c_bus(3, 400, NULL, 0);
573         return 0;
574 }
575
576 static struct spi_board_info overo_spi_board_info[] __initdata = {
577 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
578         defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
579         {
580                 .modalias               = "ads7846",
581                 .bus_num                = 1,
582                 .chip_select            = 0,
583                 .max_speed_hz           = 1500000,
584                 .controller_data        = &ads7846_mcspi_config,
585                 .irq                    = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
586                 .platform_data          = &ads7846_config,
587         },
588 #endif
589 #if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
590         defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
591         {
592                 .modalias               = "lgphilips_lb035q02_panel-spi",
593                 .bus_num                = 1,
594                 .chip_select            = 1,
595                 .max_speed_hz           = 500000,
596                 .mode                   = SPI_MODE_3,
597         },
598 #endif
599 };
600
601 static int __init overo_spi_init(void)
602 {
603         overo_ads7846_init();
604         spi_register_board_info(overo_spi_board_info,
605                         ARRAY_SIZE(overo_spi_board_info));
606         return 0;
607 }
608
609 static void __init overo_init_early(void)
610 {
611         omap2_init_common_infrastructure();
612         omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
613                                   mt46h32m32lf6_sdrc_params);
614 }
615
616 static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
617         .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
618         .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
619         .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
620
621         .phy_reset  = true,
622         .reset_gpio_port[0]  = -EINVAL,
623         .reset_gpio_port[1]  = OVERO_GPIO_USBH_NRESET,
624         .reset_gpio_port[2]  = -EINVAL
625 };
626
627 #ifdef CONFIG_OMAP_MUX
628 static struct omap_board_mux board_mux[] __initdata = {
629         { .reg_offset = OMAP_MUX_TERMINATOR },
630 };
631 #endif
632
633 static struct omap_musb_board_data musb_board_data = {
634         .interface_type         = MUSB_INTERFACE_ULPI,
635         .mode                   = MUSB_OTG,
636         .power                  = 100,
637 };
638
639 static void __init overo_init(void)
640 {
641         omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
642         overo_i2c_init();
643         omap_display_init(&overo_dss_data);
644         omap_serial_init();
645         overo_flash_init();
646         usb_musb_init(&musb_board_data);
647         usb_ehci_init(&ehci_pdata);
648         overo_spi_init();
649         overo_init_smsc911x();
650         overo_display_init();
651
652         /* Ensure SDRC pins are mux'd for self-refresh */
653         omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
654         omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
655
656         if ((gpio_request(OVERO_GPIO_W2W_NRESET,
657                           "OVERO_GPIO_W2W_NRESET") == 0) &&
658             (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) {
659                 gpio_export(OVERO_GPIO_W2W_NRESET, 0);
660                 gpio_set_value(OVERO_GPIO_W2W_NRESET, 0);
661                 udelay(10);
662                 gpio_set_value(OVERO_GPIO_W2W_NRESET, 1);
663         } else {
664                 printk(KERN_ERR "could not obtain gpio for "
665                                         "OVERO_GPIO_W2W_NRESET\n");
666         }
667
668         if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) &&
669             (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0))
670                 gpio_export(OVERO_GPIO_BT_XGATE, 0);
671         else
672                 printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n");
673
674         if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) &&
675             (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) {
676                 gpio_export(OVERO_GPIO_BT_NRESET, 0);
677                 gpio_set_value(OVERO_GPIO_BT_NRESET, 0);
678                 mdelay(6);
679                 gpio_set_value(OVERO_GPIO_BT_NRESET, 1);
680         } else {
681                 printk(KERN_ERR "could not obtain gpio for "
682                                         "OVERO_GPIO_BT_NRESET\n");
683         }
684
685         if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) &&
686             (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0))
687                 gpio_export(OVERO_GPIO_USBH_CPEN, 0);
688         else
689                 printk(KERN_ERR "could not obtain gpio for "
690                                         "OVERO_GPIO_USBH_CPEN\n");
691 }
692
693 MACHINE_START(OVERO, "Gumstix Overo")
694         .boot_params    = 0x80000100,
695         .reserve        = omap_reserve,
696         .map_io         = omap3_map_io,
697         .init_early     = overo_init_early,
698         .init_irq       = omap_init_irq,
699         .init_machine   = overo_init,
700         .timer          = &omap_timer,
701 MACHINE_END