blob: 3a6cce5d3ff4bc8bdfd311011bea49fca59ec0af [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>
Enric Balletbo i Serra18cbc7d2011-01-10 13:26:14 +000020#include <linux/input.h>
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080021
22#include <linux/regulator/machine.h>
Marc Zyngierda07c0c2010-12-20 18:48:16 -080023#include <linux/regulator/fixed.h>
Balaji T Kebeb53e2009-12-15 20:09:02 +053024#include <linux/i2c/twl.h>
Sukumar Ghorai3a638332010-09-15 14:49:23 +000025#include <linux/mmc/host.h>
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080026
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29
30#include <plat/board.h>
31#include <plat/common.h>
32#include <plat/gpmc.h>
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080033#include <plat/usb.h>
Enric Balletbo i Serra691de272010-02-17 14:09:26 -080034#include <plat/display.h>
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -080035#include <plat/onenand.h>
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080036
Tony Lindgrenca5742b2009-12-11 16:16:32 -080037#include "mux.h"
Adrian Hunterd02a900b2010-02-15 10:03:34 -080038#include "hsmmc.h"
Enric Balletbo i Serra22f1baa2010-02-17 14:09:27 -080039#include "sdram-numonyx-m65kxxxxam.h"
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080040
41#define IGEP2_SMSC911X_CS 5
42#define IGEP2_SMSC911X_GPIO 176
43#define IGEP2_GPIO_USBH_NRESET 24
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -070044#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
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080055
Enric Balletbo i Serra3f8c48d2010-10-08 10:22:35 -070056/*
57 * IGEP2 Hardware Revision Table
58 *
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -070059 * --------------------------------------------------------------------------
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 * --------------------------------------------------------------------------
Enric Balletbo i Serra3f8c48d2010-10-08 10:22:35 -070066 */
67
68#define IGEP2_BOARD_HWREV_B 0
69#define IGEP2_BOARD_HWREV_C 1
70
71static u8 hwrev;
72
73static 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}
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080099
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800100#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
113static 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
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800141static struct omap_onenand_platform_data igep2_onenand_data = {
142 .parts = igep2_onenand_partitions,
143 .nr_parts = ARRAY_SIZE(igep2_onenand_partitions),
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800144 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
145};
146
147static struct platform_device igep2_onenand_device = {
148 .name = "omap2-onenand",
149 .id = -1,
150 .dev = {
151 .platform_data = &igep2_onenand_data,
152 },
153};
154
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -0700155static void __init igep2_flash_init(void)
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800156{
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000157 u8 cs = 0;
158 u8 onenandcs = GPMC_CS_NUM + 1;
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800159
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000160 for (cs = 0; cs < GPMC_CS_NUM; cs++) {
161 u32 ret;
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800162 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 */
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000167 pr_err("IGEP2: Unsupported NAND found\n");
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800168 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 }
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800174 }
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000175
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800176 if (onenandcs > GPMC_CS_NUM) {
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000177 pr_err("IGEP2: Unable to find configuration in GPMC\n");
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800178 return;
179 }
180
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000181 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");
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800185}
186
187#else
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -0700188static void __init igep2_flash_init(void) {}
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800189#endif
190
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800191#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
192
193#include <linux/smsc911x.h>
194
195static 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
202static 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
213static 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
223static 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
248static inline void __init igep2_init_smsc911x(void) { }
249#endif
250
Marc Zyngierda07c0c2010-12-20 18:48:16 -0800251static struct regulator_consumer_supply igep2_vmmc1_supply =
252 REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0");
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800253
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
Marc Zyngierda07c0c2010-12-20 18:48:16 -0800269static struct regulator_consumer_supply igep2_vio_supply =
270 REGULATOR_SUPPLY("vmmc_aux", "mmci-omap-hs.1");
271
272static 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
287static struct regulator_consumer_supply igep2_vmmc2_supply =
288 REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1");
289
290static 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
299static 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
307static struct platform_device igep2_vwlan_device = {
308 .name = "reg-fixed-voltage",
309 .id = 0,
310 .dev = {
311 .platform_data = &igep2_vwlan,
312 },
313};
314
Adrian Hunter68ff0422010-02-15 10:03:34 -0800315static struct omap2_hsmmc_info mmc[] = {
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800316 {
317 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000318 .caps = MMC_CAP_4_BIT_DATA,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800319 .gpio_cd = -EINVAL,
320 .gpio_wp = -EINVAL,
321 },
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700322#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800323 {
324 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000325 .caps = MMC_CAP_4_BIT_DATA,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800326 .gpio_cd = -EINVAL,
327 .gpio_wp = -EINVAL,
328 },
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700329#endif
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800330 {} /* Terminator */
331};
332
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700333#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
334#include <linux/leds.h>
335
336static 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 */
Laurent Pinchart70e77762010-12-17 18:15:08 -0800356 .active_low = 1,
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700357 },
358};
359
360static struct gpio_led_platform_data igep2_led_pdata = {
361 .leds = igep2_gpio_leds,
362 .num_leds = ARRAY_SIZE(igep2_gpio_leds),
363};
364
365static struct platform_device igep2_led_device = {
366 .name = "leds-gpio",
367 .id = -1,
368 .dev = {
369 .platform_data = &igep2_led_pdata,
370 },
371};
372
373static void __init igep2_leds_init(void)
374{
375 platform_device_register(&igep2_led_device);
376}
377
378#else
379static inline void igep2_leds_init(void)
380{
381 if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) &&
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800382 (gpio_direction_output(IGEP2_GPIO_LED0_RED, 0) == 0))
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700383 gpio_export(IGEP2_GPIO_LED0_RED, 0);
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800384 else
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700385 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) &&
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800388 (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 0) == 0))
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700389 gpio_export(IGEP2_GPIO_LED0_GREEN, 0);
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800390 else
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700391 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) &&
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800394 (gpio_direction_output(IGEP2_GPIO_LED1_RED, 0) == 0))
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700395 gpio_export(IGEP2_GPIO_LED1_RED, 0);
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800396 else
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700397 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
398
399}
400#endif
401
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800402static 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;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800407 omap2_hsmmc_init(mmc);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800408
Enric Balletbo i Serra72f381b2010-10-08 10:22:57 -0700409 /*
Enric Balletbo i Serra61e118d2010-10-08 10:22:19 -0700410 * 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
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700425 /* 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)
Laurent Pinchart70e77762010-12-17 18:15:08 -0800428 && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0))
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700429 gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800430 else
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700431 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
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800435
436 return 0;
437};
438
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700439static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = {
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800440 .gpio_base = OMAP_MAX_GPIO_LINES,
441 .irq_base = TWL4030_GPIO_IRQ_BASE,
442 .irq_end = TWL4030_GPIO_IRQ_END,
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700443 .use_leds = true,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800444 .setup = igep2_twl_gpio_setup,
445};
446
447static struct twl4030_usb_data igep2_usb_data = {
448 .usb_mode = T2_USB_MODE_ULPI,
449};
450
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800451static 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
458static void igep2_disable_dvi(struct omap_dss_device *dssdev)
459{
460 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
461}
462
463static struct omap_dss_device igep2_dvi_device = {
464 .type = OMAP_DISPLAY_TYPE_DPI,
465 .name = "dvi",
466 .driver_name = "generic_panel",
467 .phy.dpi.data_lines = 24,
468 .platform_enable = igep2_enable_dvi,
469 .platform_disable = igep2_disable_dvi,
470};
471
472static struct omap_dss_device *igep2_dss_devices[] = {
473 &igep2_dvi_device
474};
475
476static struct omap_dss_board_info igep2_dss_data = {
477 .num_devices = ARRAY_SIZE(igep2_dss_devices),
478 .devices = igep2_dss_devices,
479 .default_device = &igep2_dvi_device,
480};
481
482static struct platform_device igep2_dss_device = {
483 .name = "omapdss",
484 .id = -1,
485 .dev = {
486 .platform_data = &igep2_dss_data,
487 },
488};
489
490static struct regulator_consumer_supply igep2_vpll2_supply = {
491 .supply = "vdds_dsi",
492 .dev = &igep2_dss_device.dev,
493};
494
495static struct regulator_init_data igep2_vpll2 = {
496 .constraints = {
497 .name = "VDVI",
498 .min_uV = 1800000,
499 .max_uV = 1800000,
500 .apply_uV = true,
501 .valid_modes_mask = REGULATOR_MODE_NORMAL
502 | REGULATOR_MODE_STANDBY,
503 .valid_ops_mask = REGULATOR_CHANGE_MODE
504 | REGULATOR_CHANGE_STATUS,
505 },
506 .num_consumer_supplies = 1,
507 .consumer_supplies = &igep2_vpll2_supply,
508};
509
510static void __init igep2_display_init(void)
511{
512 if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") &&
513 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1))
514 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
515}
Enric Balletbo i Serra228893f2010-03-01 11:18:08 +0000516
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800517static struct platform_device *igep2_devices[] __initdata = {
518 &igep2_dss_device,
Marc Zyngierda07c0c2010-12-20 18:48:16 -0800519 &igep2_vwlan_device,
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800520};
521
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800522static void __init igep2_init_irq(void)
523{
Paul Walmsley48057342010-12-21 15:25:10 -0700524 omap2_init_common_infrastructure();
525 omap2_init_common_devices(m65kxxxxam_sdrc_params,
526 m65kxxxxam_sdrc_params);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800527 omap_init_irq();
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800528}
529
Enric Balletbo i Serra7f5f23d2010-02-17 14:09:25 -0800530static struct twl4030_codec_audio_data igep2_audio_data = {
531 .audio_mclk = 26000000,
532};
533
534static struct twl4030_codec_data igep2_codec_data = {
535 .audio_mclk = 26000000,
536 .audio = &igep2_audio_data,
537};
538
Enric Balletbo i Serra18cbc7d2011-01-10 13:26:14 +0000539static int igep2_keymap[] = {
540 KEY(0, 0, KEY_LEFT),
541 KEY(0, 1, KEY_RIGHT),
542 KEY(0, 2, KEY_A),
543 KEY(0, 3, KEY_B),
544 KEY(1, 0, KEY_DOWN),
545 KEY(1, 1, KEY_UP),
546 KEY(1, 2, KEY_E),
547 KEY(1, 3, KEY_F),
548 KEY(2, 0, KEY_ENTER),
549 KEY(2, 1, KEY_I),
550 KEY(2, 2, KEY_J),
551 KEY(2, 3, KEY_K),
552 KEY(3, 0, KEY_M),
553 KEY(3, 1, KEY_N),
554 KEY(3, 2, KEY_O),
555 KEY(3, 3, KEY_P)
556};
557
558static struct matrix_keymap_data igep2_keymap_data = {
559 .keymap = igep2_keymap,
560 .keymap_size = ARRAY_SIZE(igep2_keymap),
561};
562
563static struct twl4030_keypad_data igep2_keypad_pdata = {
564 .keymap_data = &igep2_keymap_data,
565 .rows = 4,
566 .cols = 4,
567 .rep = 1,
568};
569
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800570static struct twl4030_platform_data igep2_twldata = {
571 .irq_base = TWL4030_IRQ_BASE,
572 .irq_end = TWL4030_IRQ_END,
573
574 /* platform_data for children goes here */
575 .usb = &igep2_usb_data,
Enric Balletbo i Serra7f5f23d2010-02-17 14:09:25 -0800576 .codec = &igep2_codec_data,
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700577 .gpio = &igep2_twl4030_gpio_pdata,
Enric Balletbo i Serra18cbc7d2011-01-10 13:26:14 +0000578 .keypad = &igep2_keypad_pdata,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800579 .vmmc1 = &igep2_vmmc1,
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800580 .vpll2 = &igep2_vpll2,
Marc Zyngierda07c0c2010-12-20 18:48:16 -0800581 .vio = &igep2_vio,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800582};
583
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700584static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = {
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800585 {
586 I2C_BOARD_INFO("twl4030", 0x48),
587 .flags = I2C_CLIENT_WAKE,
588 .irq = INT_34XX_SYS_NIRQ,
589 .platform_data = &igep2_twldata,
590 },
591};
592
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700593static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
594 {
595 I2C_BOARD_INFO("eeprom", 0x50),
596 },
597};
598
599static void __init igep2_i2c_init(void)
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800600{
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700601 int ret;
602
603 ret = omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo,
604 ARRAY_SIZE(igep2_i2c1_boardinfo));
605 if (ret)
606 pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret);
607
608 /*
609 * Bus 3 is attached to the DVI port where devices like the pico DLP
610 * projector don't work reliably with 400kHz
611 */
612 ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
613 ARRAY_SIZE(igep2_i2c3_boardinfo));
614 if (ret)
615 pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800616}
617
Maulik Mankad884b8362010-02-17 14:09:30 -0800618static struct omap_musb_board_data musb_board_data = {
619 .interface_type = MUSB_INTERFACE_ULPI,
620 .mode = MUSB_OTG,
621 .power = 100,
622};
623
Felipe Balbi6f69a182010-03-04 09:45:53 +0200624static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
Enric Balletbo i Serraf6b74532010-03-01 15:02:36 +0000625 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
626 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
Enric Balletbo i Serrad08854862010-02-17 14:09:26 -0800627 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
628
629 .phy_reset = true,
Enric Balletbo i Serraf6b74532010-03-01 15:02:36 +0000630 .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
631 .reset_gpio_port[1] = -EINVAL,
Enric Balletbo i Serrad08854862010-02-17 14:09:26 -0800632 .reset_gpio_port[2] = -EINVAL,
633};
634
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800635#ifdef CONFIG_OMAP_MUX
636static struct omap_board_mux board_mux[] __initdata = {
637 { .reg_offset = OMAP_MUX_TERMINATOR },
638};
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800639#endif
640
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700641#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
642
643static void __init igep2_wlan_bt_init(void)
644{
645 unsigned npd, wreset, btreset;
646
647 /* GPIO's for WLAN-BT combo depends on hardware revision */
648 if (hwrev == IGEP2_BOARD_HWREV_B) {
649 npd = IGEP2_RB_GPIO_WIFI_NPD;
650 wreset = IGEP2_RB_GPIO_WIFI_NRESET;
651 btreset = IGEP2_RB_GPIO_BT_NRESET;
652 } else if (hwrev == IGEP2_BOARD_HWREV_C) {
653 npd = IGEP2_RC_GPIO_WIFI_NPD;
654 wreset = IGEP2_RC_GPIO_WIFI_NRESET;
655 btreset = IGEP2_RC_GPIO_BT_NRESET;
656 } else
657 return;
658
659 /* Set GPIO's for WLAN-BT combo module */
660 if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) &&
661 (gpio_direction_output(npd, 1) == 0)) {
662 gpio_export(npd, 0);
663 } else
664 pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n");
665
666 if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) &&
667 (gpio_direction_output(wreset, 1) == 0)) {
668 gpio_export(wreset, 0);
669 gpio_set_value(wreset, 0);
670 udelay(10);
671 gpio_set_value(wreset, 1);
672 } else
673 pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n");
674
675 if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) &&
676 (gpio_direction_output(btreset, 1) == 0)) {
677 gpio_export(btreset, 0);
678 } else
679 pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n");
680}
681#else
682static inline void __init igep2_wlan_bt_init(void) { }
683#endif
684
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800685static void __init igep2_init(void)
686{
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800687 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Enric Balletbo i Serra3f8c48d2010-10-08 10:22:35 -0700688
689 /* Get IGEP2 hardware revision */
690 igep2_get_revision();
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700691 /* Register I2C busses and drivers */
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800692 igep2_i2c_init();
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800693 platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800694 omap_serial_init();
Maulik Mankad884b8362010-02-17 14:09:30 -0800695 usb_musb_init(&musb_board_data);
Enric Balletbo i Serrad08854862010-02-17 14:09:26 -0800696 usb_ehci_init(&ehci_pdata);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800697
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800698 igep2_flash_init();
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700699 igep2_leds_init();
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800700 igep2_display_init();
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800701 igep2_init_smsc911x();
702
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700703 /*
704 * WLAN-BT combo module from MuRata wich has a Marvell WLAN
705 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
706 */
707 igep2_wlan_bt_init();
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800708
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800709}
710
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800711MACHINE_START(IGEP0020, "IGEP v2 board")
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800712 .boot_params = 0x80000100,
Mike Rapoport869fef42010-08-04 14:43:18 +0300713 .map_io = omap3_map_io,
Russell King71ee7da2010-05-23 10:18:16 +0100714 .reserve = omap_reserve,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800715 .init_irq = igep2_init_irq,
716 .init_machine = igep2_init,
717 .timer = &omap_timer,
718MACHINE_END