blob: 42dcbf4f16026e25ef957e4cd3bdb7902d61bf21 [file] [log] [blame]
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -08001/*
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>
Balaji T Kebeb53e2009-12-15 20:09:02 +053022#include <linux/i2c/twl.h>
Sukumar Ghorai3a638332010-09-15 14:49:23 +000023#include <linux/mmc/host.h>
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080024
25#include <asm/mach-types.h>
26#include <asm/mach/arch.h>
27
28#include <plat/board.h>
29#include <plat/common.h>
30#include <plat/gpmc.h>
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080031#include <plat/usb.h>
Enric Balletbo i Serra691de272010-02-17 14:09:26 -080032#include <plat/display.h>
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -080033#include <plat/onenand.h>
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080034
Tony Lindgrenca5742b2009-12-11 16:16:32 -080035#include "mux.h"
Adrian Hunterd02a9002010-02-15 10:03:34 -080036#include "hsmmc.h"
Enric Balletbo i Serra22f1baa2010-02-17 14:09:27 -080037#include "sdram-numonyx-m65kxxxxam.h"
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080038
39#define IGEP2_SMSC911X_CS 5
40#define IGEP2_SMSC911X_GPIO 176
41#define IGEP2_GPIO_USBH_NRESET 24
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -070042#define IGEP2_GPIO_LED0_GREEN 26
43#define IGEP2_GPIO_LED0_RED 27
44#define IGEP2_GPIO_LED1_RED 28
45#define IGEP2_GPIO_DVI_PUP 170
46
47#define IGEP2_RB_GPIO_WIFI_NPD 94
48#define IGEP2_RB_GPIO_WIFI_NRESET 95
49#define IGEP2_RB_GPIO_BT_NRESET 137
50#define IGEP2_RC_GPIO_WIFI_NPD 138
51#define IGEP2_RC_GPIO_WIFI_NRESET 139
52#define IGEP2_RC_GPIO_BT_NRESET 137
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080053
Enric Balletbo i Serra3f8c48d2010-10-08 10:22:35 -070054/*
55 * IGEP2 Hardware Revision Table
56 *
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -070057 * --------------------------------------------------------------------------
58 * | Id. | Hw Rev. | HW0 (28) | WIFI_NPD | WIFI_NRESET | BT_NRESET |
59 * --------------------------------------------------------------------------
60 * | 0 | B | high | gpio94 | gpio95 | - |
61 * | 0 | B/C (B-compatible) | high | gpio94 | gpio95 | gpio137 |
62 * | 1 | C | low | gpio138 | gpio139 | gpio137 |
63 * --------------------------------------------------------------------------
Enric Balletbo i Serra3f8c48d2010-10-08 10:22:35 -070064 */
65
66#define IGEP2_BOARD_HWREV_B 0
67#define IGEP2_BOARD_HWREV_C 1
68
69static u8 hwrev;
70
71static void __init igep2_get_revision(void)
72{
73 u8 ret;
74
75 omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT);
76
77 if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) &&
78 (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) {
79 ret = gpio_get_value(IGEP2_GPIO_LED1_RED);
80 if (ret == 0) {
81 pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
82 hwrev = IGEP2_BOARD_HWREV_C;
83 } else if (ret == 1) {
84 pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
85 hwrev = IGEP2_BOARD_HWREV_B;
86 } else {
87 pr_err("IGEP2: Unknown Hardware Revision\n");
88 hwrev = -1;
89 }
90 } else {
91 pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n");
92 pr_err("IGEP2: Unknown Hardware Revision\n");
93 }
94
95 gpio_free(IGEP2_GPIO_LED1_RED);
96}
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080097
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -080098#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
99 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
100
101#define ONENAND_MAP 0x20000000
102
103/* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY )
104 * Since the device is equipped with two DataRAMs, and two-plane NAND
105 * Flash memory array, these two component enables simultaneous program
106 * of 4KiB. Plane1 has only even blocks such as block0, block2, block4
107 * while Plane2 has only odd blocks such as block1, block3, block5.
108 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
109 */
110
111static struct mtd_partition igep2_onenand_partitions[] = {
112 {
113 .name = "X-Loader",
114 .offset = 0,
115 .size = 2 * (64*(2*2048))
116 },
117 {
118 .name = "U-Boot",
119 .offset = MTDPART_OFS_APPEND,
120 .size = 6 * (64*(2*2048)),
121 },
122 {
123 .name = "Environment",
124 .offset = MTDPART_OFS_APPEND,
125 .size = 2 * (64*(2*2048)),
126 },
127 {
128 .name = "Kernel",
129 .offset = MTDPART_OFS_APPEND,
130 .size = 12 * (64*(2*2048)),
131 },
132 {
133 .name = "File System",
134 .offset = MTDPART_OFS_APPEND,
135 .size = MTDPART_SIZ_FULL,
136 },
137};
138
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800139static struct omap_onenand_platform_data igep2_onenand_data = {
140 .parts = igep2_onenand_partitions,
141 .nr_parts = ARRAY_SIZE(igep2_onenand_partitions),
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800142 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
143};
144
145static struct platform_device igep2_onenand_device = {
146 .name = "omap2-onenand",
147 .id = -1,
148 .dev = {
149 .platform_data = &igep2_onenand_data,
150 },
151};
152
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -0700153static void __init igep2_flash_init(void)
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800154{
155 u8 cs = 0;
156 u8 onenandcs = GPMC_CS_NUM + 1;
157
158 while (cs < GPMC_CS_NUM) {
159 u32 ret = 0;
160 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
161
162 /* Check if NAND/oneNAND is configured */
163 if ((ret & 0xC00) == 0x800)
164 /* NAND found */
165 pr_err("IGEP v2: Unsupported NAND found\n");
166 else {
167 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
168 if ((ret & 0x3F) == (ONENAND_MAP >> 24))
169 /* ONENAND found */
170 onenandcs = cs;
171 }
172 cs++;
173 }
174 if (onenandcs > GPMC_CS_NUM) {
175 pr_err("IGEP v2: Unable to find configuration in GPMC\n");
176 return;
177 }
178
179 if (onenandcs < GPMC_CS_NUM) {
180 igep2_onenand_data.cs = onenandcs;
181 if (platform_device_register(&igep2_onenand_device) < 0)
182 pr_err("IGEP v2: Unable to register OneNAND device\n");
183 }
184}
185
186#else
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -0700187static void __init igep2_flash_init(void) {}
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800188#endif
189
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800190#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
191
192#include <linux/smsc911x.h>
193
194static struct smsc911x_platform_config igep2_smsc911x_config = {
195 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
196 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
197 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS ,
198 .phy_interface = PHY_INTERFACE_MODE_MII,
199};
200
201static struct resource igep2_smsc911x_resources[] = {
202 {
203 .flags = IORESOURCE_MEM,
204 },
205 {
206 .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
207 .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
208 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
209 },
210};
211
212static struct platform_device igep2_smsc911x_device = {
213 .name = "smsc911x",
214 .id = 0,
215 .num_resources = ARRAY_SIZE(igep2_smsc911x_resources),
216 .resource = igep2_smsc911x_resources,
217 .dev = {
218 .platform_data = &igep2_smsc911x_config,
219 },
220};
221
222static inline void __init igep2_init_smsc911x(void)
223{
224 unsigned long cs_mem_base;
225
226 if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
227 pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n");
228 gpmc_cs_free(IGEP2_SMSC911X_CS);
229 return;
230 }
231
232 igep2_smsc911x_resources[0].start = cs_mem_base + 0x0;
233 igep2_smsc911x_resources[0].end = cs_mem_base + 0xff;
234
235 if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
236 (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) {
237 gpio_export(IGEP2_SMSC911X_GPIO, 0);
238 } else {
239 pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n");
240 return;
241 }
242
243 platform_device_register(&igep2_smsc911x_device);
244}
245
246#else
247static inline void __init igep2_init_smsc911x(void) { }
248#endif
249
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800250static struct regulator_consumer_supply igep2_vmmc1_supply = {
251 .supply = "vmmc",
252};
253
254/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
255static 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
Adrian Hunter68ff0422010-02-15 10:03:34 -0800269static struct omap2_hsmmc_info mmc[] = {
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800270 {
271 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000272 .caps = MMC_CAP_4_BIT_DATA,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800273 .gpio_cd = -EINVAL,
274 .gpio_wp = -EINVAL,
275 },
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700276#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800277 {
278 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000279 .caps = MMC_CAP_4_BIT_DATA,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800280 .gpio_cd = -EINVAL,
281 .gpio_wp = -EINVAL,
282 },
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700283#endif
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800284 {} /* Terminator */
285};
286
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700287#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
288#include <linux/leds.h>
289
290static struct gpio_led igep2_gpio_leds[] = {
291 [0] = {
292 .name = "gpio-led:red:d0",
293 .gpio = IGEP2_GPIO_LED0_RED,
294 .default_trigger = "default-off"
295 },
296 [1] = {
297 .name = "gpio-led:green:d0",
298 .gpio = IGEP2_GPIO_LED0_GREEN,
299 .default_trigger = "default-off",
300 },
301 [2] = {
302 .name = "gpio-led:red:d1",
303 .gpio = IGEP2_GPIO_LED1_RED,
304 .default_trigger = "default-off",
305 },
306 [3] = {
307 .name = "gpio-led:green:d1",
308 .default_trigger = "heartbeat",
309 .gpio = -EINVAL, /* gets replaced */
310 },
311};
312
313static struct gpio_led_platform_data igep2_led_pdata = {
314 .leds = igep2_gpio_leds,
315 .num_leds = ARRAY_SIZE(igep2_gpio_leds),
316};
317
318static struct platform_device igep2_led_device = {
319 .name = "leds-gpio",
320 .id = -1,
321 .dev = {
322 .platform_data = &igep2_led_pdata,
323 },
324};
325
326static void __init igep2_leds_init(void)
327{
328 platform_device_register(&igep2_led_device);
329}
330
331#else
332static inline void igep2_leds_init(void)
333{
334 if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) &&
335 (gpio_direction_output(IGEP2_GPIO_LED0_RED, 1) == 0)) {
336 gpio_export(IGEP2_GPIO_LED0_RED, 0);
337 gpio_set_value(IGEP2_GPIO_LED0_RED, 0);
338 } else
339 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n");
340
341 if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) &&
342 (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 1) == 0)) {
343 gpio_export(IGEP2_GPIO_LED0_GREEN, 0);
344 gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0);
345 } else
346 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n");
347
348 if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) &&
349 (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) {
350 gpio_export(IGEP2_GPIO_LED1_RED, 0);
351 gpio_set_value(IGEP2_GPIO_LED1_RED, 0);
352 } else
353 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
354
355}
356#endif
357
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800358static int igep2_twl_gpio_setup(struct device *dev,
359 unsigned gpio, unsigned ngpio)
360{
361 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
362 mmc[0].gpio_cd = gpio + 0;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800363 omap2_hsmmc_init(mmc);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800364
Enric Balletbo i Serra72f381b2010-10-08 10:22:57 -0700365 /*
366 * link regulators to MMC adapters ... we "know" the
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800367 * regulators will be set up only *after* we return.
Enric Balletbo i Serra72f381b2010-10-08 10:22:57 -0700368 */
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800369 igep2_vmmc1_supply.dev = mmc[0].dev;
370
Enric Balletbo i Serra61e118d2010-10-08 10:22:19 -0700371 /*
372 * REVISIT: need ehci-omap hooks for external VBUS
373 * power switch and overcurrent detect
374 */
375 if ((gpio_request(gpio + 1, "GPIO_EHCI_NOC") < 0) ||
376 (gpio_direction_input(gpio + 1) < 0))
377 pr_err("IGEP2: Could not obtain gpio for EHCI NOC");
378
379 /*
380 * TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN
381 * (out, active low)
382 */
383 if ((gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USBH_CPEN") < 0) ||
384 (gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0) < 0))
385 pr_err("IGEP2: Could not obtain gpio for USBH_CPEN");
386
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700387 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
388#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
389 if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0)
390 && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) {
391 gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
392 gpio_set_value(gpio + TWL4030_GPIO_MAX + 1, 0);
393 } else
394 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n");
395#else
396 igep2_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
397#endif
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800398
399 return 0;
400};
401
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700402static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = {
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800403 .gpio_base = OMAP_MAX_GPIO_LINES,
404 .irq_base = TWL4030_GPIO_IRQ_BASE,
405 .irq_end = TWL4030_GPIO_IRQ_END,
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700406 .use_leds = true,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800407 .setup = igep2_twl_gpio_setup,
408};
409
410static struct twl4030_usb_data igep2_usb_data = {
411 .usb_mode = T2_USB_MODE_ULPI,
412};
413
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800414static int igep2_enable_dvi(struct omap_dss_device *dssdev)
415{
416 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1);
417
418 return 0;
419}
420
421static void igep2_disable_dvi(struct omap_dss_device *dssdev)
422{
423 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
424}
425
426static struct omap_dss_device igep2_dvi_device = {
427 .type = OMAP_DISPLAY_TYPE_DPI,
428 .name = "dvi",
429 .driver_name = "generic_panel",
430 .phy.dpi.data_lines = 24,
431 .platform_enable = igep2_enable_dvi,
432 .platform_disable = igep2_disable_dvi,
433};
434
435static struct omap_dss_device *igep2_dss_devices[] = {
436 &igep2_dvi_device
437};
438
439static struct omap_dss_board_info igep2_dss_data = {
440 .num_devices = ARRAY_SIZE(igep2_dss_devices),
441 .devices = igep2_dss_devices,
442 .default_device = &igep2_dvi_device,
443};
444
445static struct platform_device igep2_dss_device = {
446 .name = "omapdss",
447 .id = -1,
448 .dev = {
449 .platform_data = &igep2_dss_data,
450 },
451};
452
453static struct regulator_consumer_supply igep2_vpll2_supply = {
454 .supply = "vdds_dsi",
455 .dev = &igep2_dss_device.dev,
456};
457
458static struct regulator_init_data igep2_vpll2 = {
459 .constraints = {
460 .name = "VDVI",
461 .min_uV = 1800000,
462 .max_uV = 1800000,
463 .apply_uV = true,
464 .valid_modes_mask = REGULATOR_MODE_NORMAL
465 | REGULATOR_MODE_STANDBY,
466 .valid_ops_mask = REGULATOR_CHANGE_MODE
467 | REGULATOR_CHANGE_STATUS,
468 },
469 .num_consumer_supplies = 1,
470 .consumer_supplies = &igep2_vpll2_supply,
471};
472
473static void __init igep2_display_init(void)
474{
475 if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") &&
476 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1))
477 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
478}
Enric Balletbo i Serra228893f2010-03-01 11:18:08 +0000479
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800480static struct platform_device *igep2_devices[] __initdata = {
481 &igep2_dss_device,
482};
483
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800484static void __init igep2_init_irq(void)
485{
Enric Balletbo i Serra22f1baa2010-02-17 14:09:27 -0800486 omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800487 omap_init_irq();
488 omap_gpio_init();
489}
490
Enric Balletbo i Serra7f5f23d2010-02-17 14:09:25 -0800491static struct twl4030_codec_audio_data igep2_audio_data = {
492 .audio_mclk = 26000000,
493};
494
495static struct twl4030_codec_data igep2_codec_data = {
496 .audio_mclk = 26000000,
497 .audio = &igep2_audio_data,
498};
499
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800500static struct twl4030_platform_data igep2_twldata = {
501 .irq_base = TWL4030_IRQ_BASE,
502 .irq_end = TWL4030_IRQ_END,
503
504 /* platform_data for children goes here */
505 .usb = &igep2_usb_data,
Enric Balletbo i Serra7f5f23d2010-02-17 14:09:25 -0800506 .codec = &igep2_codec_data,
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700507 .gpio = &igep2_twl4030_gpio_pdata,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800508 .vmmc1 = &igep2_vmmc1,
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800509 .vpll2 = &igep2_vpll2,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800510
511};
512
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700513static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = {
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800514 {
515 I2C_BOARD_INFO("twl4030", 0x48),
516 .flags = I2C_CLIENT_WAKE,
517 .irq = INT_34XX_SYS_NIRQ,
518 .platform_data = &igep2_twldata,
519 },
520};
521
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700522static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
523 {
524 I2C_BOARD_INFO("eeprom", 0x50),
525 },
526};
527
528static void __init igep2_i2c_init(void)
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800529{
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700530 int ret;
531
532 ret = omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo,
533 ARRAY_SIZE(igep2_i2c1_boardinfo));
534 if (ret)
535 pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret);
536
537 /*
538 * Bus 3 is attached to the DVI port where devices like the pico DLP
539 * projector don't work reliably with 400kHz
540 */
541 ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
542 ARRAY_SIZE(igep2_i2c3_boardinfo));
543 if (ret)
544 pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800545}
546
Maulik Mankad884b8362010-02-17 14:09:30 -0800547static struct omap_musb_board_data musb_board_data = {
548 .interface_type = MUSB_INTERFACE_ULPI,
549 .mode = MUSB_OTG,
550 .power = 100,
551};
552
Felipe Balbi6f69a182010-03-04 09:45:53 +0200553static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
Enric Balletbo i Serraf6b74532010-03-01 15:02:36 +0000554 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
555 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
Enric Balletbo i Serrad0885482010-02-17 14:09:26 -0800556 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
557
558 .phy_reset = true,
Enric Balletbo i Serraf6b74532010-03-01 15:02:36 +0000559 .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
560 .reset_gpio_port[1] = -EINVAL,
Enric Balletbo i Serrad0885482010-02-17 14:09:26 -0800561 .reset_gpio_port[2] = -EINVAL,
562};
563
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800564#ifdef CONFIG_OMAP_MUX
565static struct omap_board_mux board_mux[] __initdata = {
566 { .reg_offset = OMAP_MUX_TERMINATOR },
567};
568#else
569#define board_mux NULL
570#endif
571
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700572#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
573
574static void __init igep2_wlan_bt_init(void)
575{
576 unsigned npd, wreset, btreset;
577
578 /* GPIO's for WLAN-BT combo depends on hardware revision */
579 if (hwrev == IGEP2_BOARD_HWREV_B) {
580 npd = IGEP2_RB_GPIO_WIFI_NPD;
581 wreset = IGEP2_RB_GPIO_WIFI_NRESET;
582 btreset = IGEP2_RB_GPIO_BT_NRESET;
583 } else if (hwrev == IGEP2_BOARD_HWREV_C) {
584 npd = IGEP2_RC_GPIO_WIFI_NPD;
585 wreset = IGEP2_RC_GPIO_WIFI_NRESET;
586 btreset = IGEP2_RC_GPIO_BT_NRESET;
587 } else
588 return;
589
590 /* Set GPIO's for WLAN-BT combo module */
591 if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) &&
592 (gpio_direction_output(npd, 1) == 0)) {
593 gpio_export(npd, 0);
594 } else
595 pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n");
596
597 if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) &&
598 (gpio_direction_output(wreset, 1) == 0)) {
599 gpio_export(wreset, 0);
600 gpio_set_value(wreset, 0);
601 udelay(10);
602 gpio_set_value(wreset, 1);
603 } else
604 pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n");
605
606 if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) &&
607 (gpio_direction_output(btreset, 1) == 0)) {
608 gpio_export(btreset, 0);
609 } else
610 pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n");
611}
612#else
613static inline void __init igep2_wlan_bt_init(void) { }
614#endif
615
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800616static void __init igep2_init(void)
617{
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800618 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Enric Balletbo i Serra3f8c48d2010-10-08 10:22:35 -0700619
620 /* Get IGEP2 hardware revision */
621 igep2_get_revision();
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700622 /* Register I2C busses and drivers */
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800623 igep2_i2c_init();
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800624 platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800625 omap_serial_init();
Maulik Mankad884b8362010-02-17 14:09:30 -0800626 usb_musb_init(&musb_board_data);
Enric Balletbo i Serrad0885482010-02-17 14:09:26 -0800627 usb_ehci_init(&ehci_pdata);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800628
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800629 igep2_flash_init();
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700630 igep2_leds_init();
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800631 igep2_display_init();
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800632 igep2_init_smsc911x();
633
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700634 /*
635 * WLAN-BT combo module from MuRata wich has a Marvell WLAN
636 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
637 */
638 igep2_wlan_bt_init();
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800639
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800640}
641
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800642MACHINE_START(IGEP0020, "IGEP v2 board")
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800643 .boot_params = 0x80000100,
Mike Rapoport869fef42010-08-04 14:43:18 +0300644 .map_io = omap3_map_io,
Russell King71ee7da2010-05-23 10:18:16 +0100645 .reserve = omap_reserve,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800646 .init_irq = igep2_init_irq,
647 .init_machine = igep2_init,
648 .timer = &omap_timer,
649MACHINE_END