Merge branch 'master' of /pub/scm/linux/kernel/git/jejb/scsi-post-merge-2.6 into...
[pandora-kernel.git] / arch / arm / mach-omap2 / board-igep0020.c
1 /*
2  * Copyright (C) 2009 Integration Software and Electronic Engineering.
3  *
4  * Modified from mach-omap2/board-generic.c
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  */
10
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/platform_device.h>
14 #include <linux/delay.h>
15 #include <linux/err.h>
16 #include <linux/clk.h>
17 #include <linux/io.h>
18 #include <linux/gpio.h>
19 #include <linux/interrupt.h>
20
21 #include <linux/regulator/machine.h>
22 #include <linux/regulator/fixed.h>
23 #include <linux/i2c/twl.h>
24 #include <linux/mmc/host.h>
25
26 #include <asm/mach-types.h>
27 #include <asm/mach/arch.h>
28
29 #include <plat/board.h>
30 #include <plat/common.h>
31 #include <plat/gpmc.h>
32 #include <plat/usb.h>
33 #include <plat/display.h>
34 #include <plat/panel-generic-dpi.h>
35 #include <plat/onenand.h>
36
37 #include "mux.h"
38 #include "hsmmc.h"
39 #include "sdram-numonyx-m65kxxxxam.h"
40
41 #define IGEP2_SMSC911X_CS       5
42 #define IGEP2_SMSC911X_GPIO     176
43 #define IGEP2_GPIO_USBH_NRESET  24
44 #define IGEP2_GPIO_LED0_GREEN   26
45 #define IGEP2_GPIO_LED0_RED     27
46 #define IGEP2_GPIO_LED1_RED     28
47 #define IGEP2_GPIO_DVI_PUP      170
48
49 #define IGEP2_RB_GPIO_WIFI_NPD     94
50 #define IGEP2_RB_GPIO_WIFI_NRESET  95
51 #define IGEP2_RB_GPIO_BT_NRESET    137
52 #define IGEP2_RC_GPIO_WIFI_NPD     138
53 #define IGEP2_RC_GPIO_WIFI_NRESET  139
54 #define IGEP2_RC_GPIO_BT_NRESET    137
55
56 /*
57  * IGEP2 Hardware Revision Table
58  *
59  *  --------------------------------------------------------------------------
60  * | Id. | Hw Rev.            | HW0 (28) | WIFI_NPD | WIFI_NRESET | BT_NRESET |
61  *  --------------------------------------------------------------------------
62  * |  0  | B                  |   high   |  gpio94  |   gpio95    |     -     |
63  * |  0  | B/C (B-compatible) |   high   |  gpio94  |   gpio95    |  gpio137  |
64  * |  1  | C                  |   low    |  gpio138 |   gpio139   |  gpio137  |
65  *  --------------------------------------------------------------------------
66  */
67
68 #define IGEP2_BOARD_HWREV_B     0
69 #define IGEP2_BOARD_HWREV_C     1
70
71 static u8 hwrev;
72
73 static void __init igep2_get_revision(void)
74 {
75         u8 ret;
76
77         omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT);
78
79         if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) &&
80             (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) {
81                 ret = gpio_get_value(IGEP2_GPIO_LED1_RED);
82                 if (ret == 0) {
83                         pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
84                         hwrev = IGEP2_BOARD_HWREV_C;
85                 } else if (ret ==  1) {
86                         pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
87                         hwrev = IGEP2_BOARD_HWREV_B;
88                 } else {
89                         pr_err("IGEP2: Unknown Hardware Revision\n");
90                         hwrev = -1;
91                 }
92         } else {
93                 pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n");
94                 pr_err("IGEP2: Unknown Hardware Revision\n");
95         }
96
97         gpio_free(IGEP2_GPIO_LED1_RED);
98 }
99
100 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
101         defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
102
103 #define ONENAND_MAP             0x20000000
104
105 /* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY )
106  * Since the device is equipped with two DataRAMs, and two-plane NAND
107  * Flash memory array, these two component enables simultaneous program
108  * of 4KiB. Plane1 has only even blocks such as block0, block2, block4
109  * while Plane2 has only odd blocks such as block1, block3, block5.
110  * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
111  */
112
113 static struct mtd_partition igep2_onenand_partitions[] = {
114         {
115                 .name           = "X-Loader",
116                 .offset         = 0,
117                 .size           = 2 * (64*(2*2048))
118         },
119         {
120                 .name           = "U-Boot",
121                 .offset         = MTDPART_OFS_APPEND,
122                 .size           = 6 * (64*(2*2048)),
123         },
124         {
125                 .name           = "Environment",
126                 .offset         = MTDPART_OFS_APPEND,
127                 .size           = 2 * (64*(2*2048)),
128         },
129         {
130                 .name           = "Kernel",
131                 .offset         = MTDPART_OFS_APPEND,
132                 .size           = 12 * (64*(2*2048)),
133         },
134         {
135                 .name           = "File System",
136                 .offset         = MTDPART_OFS_APPEND,
137                 .size           = MTDPART_SIZ_FULL,
138         },
139 };
140
141 static struct omap_onenand_platform_data igep2_onenand_data = {
142         .parts = igep2_onenand_partitions,
143         .nr_parts = ARRAY_SIZE(igep2_onenand_partitions),
144         .dma_channel    = -1,   /* disable DMA in OMAP OneNAND driver */
145 };
146
147 static struct platform_device igep2_onenand_device = {
148         .name           = "omap2-onenand",
149         .id             = -1,
150         .dev = {
151                 .platform_data = &igep2_onenand_data,
152         },
153 };
154
155 static void __init igep2_flash_init(void)
156 {
157         u8 cs = 0;
158         u8 onenandcs = GPMC_CS_NUM + 1;
159
160         for (cs = 0; cs < GPMC_CS_NUM; cs++) {
161                 u32 ret;
162                 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
163
164                 /* Check if NAND/oneNAND is configured */
165                 if ((ret & 0xC00) == 0x800)
166                         /* NAND found */
167                         pr_err("IGEP2: Unsupported NAND found\n");
168                 else {
169                         ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
170                         if ((ret & 0x3F) == (ONENAND_MAP >> 24))
171                                 /* ONENAND found */
172                                 onenandcs = cs;
173                 }
174         }
175
176         if (onenandcs > GPMC_CS_NUM) {
177                 pr_err("IGEP2: Unable to find configuration in GPMC\n");
178                 return;
179         }
180
181         igep2_onenand_data.cs = onenandcs;
182
183         if (platform_device_register(&igep2_onenand_device) < 0)
184                 pr_err("IGEP2: Unable to register OneNAND device\n");
185 }
186
187 #else
188 static void __init igep2_flash_init(void) {}
189 #endif
190
191 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
192
193 #include <linux/smsc911x.h>
194
195 static struct smsc911x_platform_config igep2_smsc911x_config = {
196         .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
197         .irq_type       = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
198         .flags          = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS  ,
199         .phy_interface  = PHY_INTERFACE_MODE_MII,
200 };
201
202 static struct resource igep2_smsc911x_resources[] = {
203         {
204                 .flags  = IORESOURCE_MEM,
205         },
206         {
207                 .start  = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
208                 .end    = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
209                 .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
210         },
211 };
212
213 static struct platform_device igep2_smsc911x_device = {
214         .name           = "smsc911x",
215         .id             = 0,
216         .num_resources  = ARRAY_SIZE(igep2_smsc911x_resources),
217         .resource       = igep2_smsc911x_resources,
218         .dev            = {
219                 .platform_data = &igep2_smsc911x_config,
220         },
221 };
222
223 static inline void __init igep2_init_smsc911x(void)
224 {
225         unsigned long cs_mem_base;
226
227         if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
228                 pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n");
229                 gpmc_cs_free(IGEP2_SMSC911X_CS);
230                 return;
231         }
232
233         igep2_smsc911x_resources[0].start = cs_mem_base + 0x0;
234         igep2_smsc911x_resources[0].end   = cs_mem_base + 0xff;
235
236         if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
237             (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) {
238                 gpio_export(IGEP2_SMSC911X_GPIO, 0);
239         } else {
240                 pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n");
241                 return;
242         }
243
244         platform_device_register(&igep2_smsc911x_device);
245 }
246
247 #else
248 static inline void __init igep2_init_smsc911x(void) { }
249 #endif
250
251 static struct regulator_consumer_supply igep2_vmmc1_supply =
252         REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0");
253
254 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
255 static struct regulator_init_data igep2_vmmc1 = {
256         .constraints = {
257                 .min_uV                 = 1850000,
258                 .max_uV                 = 3150000,
259                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
260                                         | REGULATOR_MODE_STANDBY,
261                 .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
262                                         | REGULATOR_CHANGE_MODE
263                                         | REGULATOR_CHANGE_STATUS,
264         },
265         .num_consumer_supplies  = 1,
266         .consumer_supplies      = &igep2_vmmc1_supply,
267 };
268
269 static struct regulator_consumer_supply igep2_vio_supply =
270         REGULATOR_SUPPLY("vmmc_aux", "mmci-omap-hs.1");
271
272 static struct regulator_init_data igep2_vio = {
273         .constraints = {
274                 .min_uV                 = 1800000,
275                 .max_uV                 = 1800000,
276                 .apply_uV               = 1,
277                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
278                                         | REGULATOR_MODE_STANDBY,
279                 .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
280                                         | REGULATOR_CHANGE_MODE
281                                         | REGULATOR_CHANGE_STATUS,
282         },
283         .num_consumer_supplies  = 1,
284         .consumer_supplies      = &igep2_vio_supply,
285 };
286
287 static struct regulator_consumer_supply igep2_vmmc2_supply =
288         REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1");
289
290 static struct regulator_init_data igep2_vmmc2 = {
291         .constraints            = {
292                 .valid_modes_mask       = REGULATOR_MODE_NORMAL,
293                 .always_on              = 1,
294         },
295         .num_consumer_supplies  = 1,
296         .consumer_supplies      = &igep2_vmmc2_supply,
297 };
298
299 static struct fixed_voltage_config igep2_vwlan = {
300         .supply_name            = "vwlan",
301         .microvolts             = 3300000,
302         .gpio                   = -EINVAL,
303         .enabled_at_boot        = 1,
304         .init_data              = &igep2_vmmc2,
305 };
306
307 static struct platform_device igep2_vwlan_device = {
308         .name           = "reg-fixed-voltage",
309         .id             = 0,
310         .dev = {
311                 .platform_data  = &igep2_vwlan,
312         },
313 };
314
315 static struct omap2_hsmmc_info mmc[] = {
316         {
317                 .mmc            = 1,
318                 .caps           = MMC_CAP_4_BIT_DATA,
319                 .gpio_cd        = -EINVAL,
320                 .gpio_wp        = -EINVAL,
321         },
322 #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
323         {
324                 .mmc            = 2,
325                 .caps           = MMC_CAP_4_BIT_DATA,
326                 .gpio_cd        = -EINVAL,
327                 .gpio_wp        = -EINVAL,
328         },
329 #endif
330         {}      /* Terminator */
331 };
332
333 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
334 #include <linux/leds.h>
335
336 static struct gpio_led igep2_gpio_leds[] = {
337         [0] = {
338                 .name                   = "gpio-led:red:d0",
339                 .gpio                   = IGEP2_GPIO_LED0_RED,
340                 .default_trigger        = "default-off"
341         },
342         [1] = {
343                 .name                   = "gpio-led:green:d0",
344                 .gpio                   = IGEP2_GPIO_LED0_GREEN,
345                 .default_trigger        = "default-off",
346         },
347         [2] = {
348                 .name                   = "gpio-led:red:d1",
349                 .gpio                   = IGEP2_GPIO_LED1_RED,
350                 .default_trigger        = "default-off",
351         },
352         [3] = {
353                 .name                   = "gpio-led:green:d1",
354                 .default_trigger        = "heartbeat",
355                 .gpio                   = -EINVAL, /* gets replaced */
356                 .active_low             = 1,
357         },
358 };
359
360 static struct gpio_led_platform_data igep2_led_pdata = {
361         .leds           = igep2_gpio_leds,
362         .num_leds       = ARRAY_SIZE(igep2_gpio_leds),
363 };
364
365 static struct platform_device igep2_led_device = {
366          .name   = "leds-gpio",
367          .id     = -1,
368          .dev    = {
369                  .platform_data  =  &igep2_led_pdata,
370         },
371 };
372
373 static void __init igep2_leds_init(void)
374 {
375         platform_device_register(&igep2_led_device);
376 }
377
378 #else
379 static inline void igep2_leds_init(void)
380 {
381         if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) &&
382             (gpio_direction_output(IGEP2_GPIO_LED0_RED, 0) == 0))
383                 gpio_export(IGEP2_GPIO_LED0_RED, 0);
384         else
385                 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n");
386
387         if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) &&
388             (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 0) == 0))
389                 gpio_export(IGEP2_GPIO_LED0_GREEN, 0);
390         else
391                 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n");
392
393         if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) &&
394             (gpio_direction_output(IGEP2_GPIO_LED1_RED, 0) == 0))
395                 gpio_export(IGEP2_GPIO_LED1_RED, 0);
396         else
397                 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
398
399 }
400 #endif
401
402 static int igep2_twl_gpio_setup(struct device *dev,
403                 unsigned gpio, unsigned ngpio)
404 {
405         /* gpio + 0 is "mmc0_cd" (input/IRQ) */
406         mmc[0].gpio_cd = gpio + 0;
407         omap2_hsmmc_init(mmc);
408
409         /*
410          * REVISIT: need ehci-omap hooks for external VBUS
411          * power switch and overcurrent detect
412          */
413         if ((gpio_request(gpio + 1, "GPIO_EHCI_NOC") < 0) ||
414             (gpio_direction_input(gpio + 1) < 0))
415                 pr_err("IGEP2: Could not obtain gpio for EHCI NOC");
416
417         /*
418          * TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN
419          * (out, active low)
420          */
421         if ((gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USBH_CPEN") < 0) ||
422             (gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0) < 0))
423                 pr_err("IGEP2: Could not obtain gpio for USBH_CPEN");
424
425         /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
426 #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
427         if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0)
428             && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0))
429                 gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
430         else
431                 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n");
432 #else
433         igep2_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
434 #endif
435
436         return 0;
437 };
438
439 static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = {
440         .gpio_base      = OMAP_MAX_GPIO_LINES,
441         .irq_base       = TWL4030_GPIO_IRQ_BASE,
442         .irq_end        = TWL4030_GPIO_IRQ_END,
443         .use_leds       = true,
444         .setup          = igep2_twl_gpio_setup,
445 };
446
447 static struct twl4030_usb_data igep2_usb_data = {
448         .usb_mode       = T2_USB_MODE_ULPI,
449 };
450
451 static int igep2_enable_dvi(struct omap_dss_device *dssdev)
452 {
453         gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1);
454
455         return 0;
456 }
457
458 static void igep2_disable_dvi(struct omap_dss_device *dssdev)
459 {
460         gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
461 }
462
463 static struct panel_generic_dpi_data dvi_panel = {
464         .name                   = "generic",
465         .platform_enable        = igep2_enable_dvi,
466         .platform_disable       = igep2_disable_dvi,
467 };
468
469 static struct omap_dss_device igep2_dvi_device = {
470         .type                   = OMAP_DISPLAY_TYPE_DPI,
471         .name                   = "dvi",
472         .driver_name            = "generic_dpi_panel",
473         .data                   = &dvi_panel,
474         .phy.dpi.data_lines     = 24,
475 };
476
477 static struct omap_dss_device *igep2_dss_devices[] = {
478         &igep2_dvi_device
479 };
480
481 static struct omap_dss_board_info igep2_dss_data = {
482         .num_devices    = ARRAY_SIZE(igep2_dss_devices),
483         .devices        = igep2_dss_devices,
484         .default_device = &igep2_dvi_device,
485 };
486
487 static struct platform_device igep2_dss_device = {
488         .name   = "omapdss",
489         .id     = -1,
490         .dev    = {
491                 .platform_data = &igep2_dss_data,
492         },
493 };
494
495 static struct regulator_consumer_supply igep2_vpll2_supply = {
496         .supply = "vdds_dsi",
497         .dev    = &igep2_dss_device.dev,
498 };
499
500 static struct regulator_init_data igep2_vpll2 = {
501         .constraints = {
502                 .name                   = "VDVI",
503                 .min_uV                 = 1800000,
504                 .max_uV                 = 1800000,
505                 .apply_uV               = true,
506                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
507                                         | REGULATOR_MODE_STANDBY,
508                 .valid_ops_mask         = REGULATOR_CHANGE_MODE
509                                         | REGULATOR_CHANGE_STATUS,
510         },
511         .num_consumer_supplies  = 1,
512         .consumer_supplies      = &igep2_vpll2_supply,
513 };
514
515 static void __init igep2_display_init(void)
516 {
517         if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") &&
518             gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1))
519                 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
520 }
521
522 static struct platform_device *igep2_devices[] __initdata = {
523         &igep2_dss_device,
524         &igep2_vwlan_device,
525 };
526
527 static void __init igep2_init_irq(void)
528 {
529         omap2_init_common_infrastructure();
530         omap2_init_common_devices(m65kxxxxam_sdrc_params,
531                                   m65kxxxxam_sdrc_params);
532         omap_init_irq();
533 }
534
535 static struct twl4030_codec_audio_data igep2_audio_data = {
536         .audio_mclk = 26000000,
537 };
538
539 static struct twl4030_codec_data igep2_codec_data = {
540         .audio_mclk = 26000000,
541         .audio = &igep2_audio_data,
542 };
543
544 static struct twl4030_platform_data igep2_twldata = {
545         .irq_base       = TWL4030_IRQ_BASE,
546         .irq_end        = TWL4030_IRQ_END,
547
548         /* platform_data for children goes here */
549         .usb            = &igep2_usb_data,
550         .codec          = &igep2_codec_data,
551         .gpio           = &igep2_twl4030_gpio_pdata,
552         .vmmc1          = &igep2_vmmc1,
553         .vpll2          = &igep2_vpll2,
554         .vio            = &igep2_vio,
555 };
556
557 static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = {
558         {
559                 I2C_BOARD_INFO("twl4030", 0x48),
560                 .flags          = I2C_CLIENT_WAKE,
561                 .irq            = INT_34XX_SYS_NIRQ,
562                 .platform_data  = &igep2_twldata,
563         },
564 };
565
566 static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
567         {
568                 I2C_BOARD_INFO("eeprom", 0x50),
569         },
570 };
571
572 static void __init igep2_i2c_init(void)
573 {
574         int ret;
575
576         ret = omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo,
577                 ARRAY_SIZE(igep2_i2c1_boardinfo));
578         if (ret)
579                 pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret);
580
581         /*
582          * Bus 3 is attached to the DVI port where devices like the pico DLP
583          * projector don't work reliably with 400kHz
584          */
585         ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
586                 ARRAY_SIZE(igep2_i2c3_boardinfo));
587         if (ret)
588                 pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
589 }
590
591 static struct omap_musb_board_data musb_board_data = {
592         .interface_type         = MUSB_INTERFACE_ULPI,
593         .mode                   = MUSB_OTG,
594         .power                  = 100,
595 };
596
597 static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
598         .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
599         .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
600         .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
601
602         .phy_reset = true,
603         .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
604         .reset_gpio_port[1] = -EINVAL,
605         .reset_gpio_port[2] = -EINVAL,
606 };
607
608 #ifdef CONFIG_OMAP_MUX
609 static struct omap_board_mux board_mux[] __initdata = {
610         { .reg_offset = OMAP_MUX_TERMINATOR },
611 };
612 #endif
613
614 #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
615
616 static void __init igep2_wlan_bt_init(void)
617 {
618         unsigned npd, wreset, btreset;
619
620         /* GPIO's for WLAN-BT combo depends on hardware revision */
621         if (hwrev == IGEP2_BOARD_HWREV_B) {
622                 npd = IGEP2_RB_GPIO_WIFI_NPD;
623                 wreset = IGEP2_RB_GPIO_WIFI_NRESET;
624                 btreset = IGEP2_RB_GPIO_BT_NRESET;
625         } else if (hwrev == IGEP2_BOARD_HWREV_C) {
626                 npd = IGEP2_RC_GPIO_WIFI_NPD;
627                 wreset = IGEP2_RC_GPIO_WIFI_NRESET;
628                 btreset = IGEP2_RC_GPIO_BT_NRESET;
629         } else
630                 return;
631
632         /* Set GPIO's for  WLAN-BT combo module */
633         if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) &&
634             (gpio_direction_output(npd, 1) == 0)) {
635                 gpio_export(npd, 0);
636         } else
637                 pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n");
638
639         if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) &&
640             (gpio_direction_output(wreset, 1) == 0)) {
641                 gpio_export(wreset, 0);
642                 gpio_set_value(wreset, 0);
643                 udelay(10);
644                 gpio_set_value(wreset, 1);
645         } else
646                 pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n");
647
648         if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) &&
649             (gpio_direction_output(btreset, 1) == 0)) {
650                 gpio_export(btreset, 0);
651         } else
652                 pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n");
653 }
654 #else
655 static inline void __init igep2_wlan_bt_init(void) { }
656 #endif
657
658 static void __init igep2_init(void)
659 {
660         omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
661
662         /* Get IGEP2 hardware revision */
663         igep2_get_revision();
664         /* Register I2C busses and drivers */
665         igep2_i2c_init();
666         platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
667         omap_serial_init();
668         usb_musb_init(&musb_board_data);
669         usb_ehci_init(&ehci_pdata);
670
671         igep2_flash_init();
672         igep2_leds_init();
673         igep2_display_init();
674         igep2_init_smsc911x();
675
676         /*
677          * WLAN-BT combo module from MuRata wich has a Marvell WLAN
678          * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
679          */
680         igep2_wlan_bt_init();
681
682 }
683
684 MACHINE_START(IGEP0020, "IGEP v2 board")
685         .boot_params    = 0x80000100,
686         .map_io         = omap3_map_io,
687         .reserve        = omap_reserve,
688         .init_irq       = igep2_init_irq,
689         .init_machine   = igep2_init,
690         .timer          = &omap_timer,
691 MACHINE_END