blob: 5b9bde74b6bf8e14d335478b5126d92282581b07 [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>
Bryan Wu89747c92010-11-17 13:34:34 +000035#include <plat/panel-generic-dpi.h>
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -080036#include <plat/onenand.h>
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080037
Tony Lindgrenca5742b2009-12-11 16:16:32 -080038#include "mux.h"
Adrian Hunterd02a900b2010-02-15 10:03:34 -080039#include "hsmmc.h"
Enric Balletbo i Serra22f1baa2010-02-17 14:09:27 -080040#include "sdram-numonyx-m65kxxxxam.h"
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080041
42#define IGEP2_SMSC911X_CS 5
43#define IGEP2_SMSC911X_GPIO 176
44#define IGEP2_GPIO_USBH_NRESET 24
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -070045#define IGEP2_GPIO_LED0_GREEN 26
46#define IGEP2_GPIO_LED0_RED 27
47#define IGEP2_GPIO_LED1_RED 28
48#define IGEP2_GPIO_DVI_PUP 170
49
50#define IGEP2_RB_GPIO_WIFI_NPD 94
51#define IGEP2_RB_GPIO_WIFI_NRESET 95
52#define IGEP2_RB_GPIO_BT_NRESET 137
53#define IGEP2_RC_GPIO_WIFI_NPD 138
54#define IGEP2_RC_GPIO_WIFI_NRESET 139
55#define IGEP2_RC_GPIO_BT_NRESET 137
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -080056
Enric Balletbo i Serra3f8c48d2010-10-08 10:22:35 -070057/*
58 * IGEP2 Hardware Revision Table
59 *
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -070060 * --------------------------------------------------------------------------
61 * | Id. | Hw Rev. | HW0 (28) | WIFI_NPD | WIFI_NRESET | BT_NRESET |
62 * --------------------------------------------------------------------------
63 * | 0 | B | high | gpio94 | gpio95 | - |
64 * | 0 | B/C (B-compatible) | high | gpio94 | gpio95 | gpio137 |
65 * | 1 | C | low | gpio138 | gpio139 | gpio137 |
66 * --------------------------------------------------------------------------
Enric Balletbo i Serra3f8c48d2010-10-08 10:22:35 -070067 */
68
69#define IGEP2_BOARD_HWREV_B 0
70#define IGEP2_BOARD_HWREV_C 1
71
72static u8 hwrev;
73
74static void __init igep2_get_revision(void)
75{
76 u8 ret;
77
78 omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT);
79
80 if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) &&
81 (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) {
82 ret = gpio_get_value(IGEP2_GPIO_LED1_RED);
83 if (ret == 0) {
84 pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
85 hwrev = IGEP2_BOARD_HWREV_C;
86 } else if (ret == 1) {
87 pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
88 hwrev = IGEP2_BOARD_HWREV_B;
89 } else {
90 pr_err("IGEP2: Unknown Hardware Revision\n");
91 hwrev = -1;
92 }
93 } else {
94 pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n");
95 pr_err("IGEP2: Unknown Hardware Revision\n");
96 }
97
98 gpio_free(IGEP2_GPIO_LED1_RED);
99}
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800100
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800101#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
102 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
103
104#define ONENAND_MAP 0x20000000
105
106/* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY )
107 * Since the device is equipped with two DataRAMs, and two-plane NAND
108 * Flash memory array, these two component enables simultaneous program
109 * of 4KiB. Plane1 has only even blocks such as block0, block2, block4
110 * while Plane2 has only odd blocks such as block1, block3, block5.
111 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
112 */
113
114static struct mtd_partition igep2_onenand_partitions[] = {
115 {
116 .name = "X-Loader",
117 .offset = 0,
118 .size = 2 * (64*(2*2048))
119 },
120 {
121 .name = "U-Boot",
122 .offset = MTDPART_OFS_APPEND,
123 .size = 6 * (64*(2*2048)),
124 },
125 {
126 .name = "Environment",
127 .offset = MTDPART_OFS_APPEND,
128 .size = 2 * (64*(2*2048)),
129 },
130 {
131 .name = "Kernel",
132 .offset = MTDPART_OFS_APPEND,
133 .size = 12 * (64*(2*2048)),
134 },
135 {
136 .name = "File System",
137 .offset = MTDPART_OFS_APPEND,
138 .size = MTDPART_SIZ_FULL,
139 },
140};
141
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800142static struct omap_onenand_platform_data igep2_onenand_data = {
143 .parts = igep2_onenand_partitions,
144 .nr_parts = ARRAY_SIZE(igep2_onenand_partitions),
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800145 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
146};
147
148static struct platform_device igep2_onenand_device = {
149 .name = "omap2-onenand",
150 .id = -1,
151 .dev = {
152 .platform_data = &igep2_onenand_data,
153 },
154};
155
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -0700156static void __init igep2_flash_init(void)
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800157{
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000158 u8 cs = 0;
159 u8 onenandcs = GPMC_CS_NUM + 1;
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800160
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000161 for (cs = 0; cs < GPMC_CS_NUM; cs++) {
162 u32 ret;
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800163 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
164
165 /* Check if NAND/oneNAND is configured */
166 if ((ret & 0xC00) == 0x800)
167 /* NAND found */
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000168 pr_err("IGEP2: Unsupported NAND found\n");
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800169 else {
170 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
171 if ((ret & 0x3F) == (ONENAND_MAP >> 24))
172 /* ONENAND found */
173 onenandcs = cs;
174 }
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800175 }
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000176
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800177 if (onenandcs > GPMC_CS_NUM) {
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000178 pr_err("IGEP2: Unable to find configuration in GPMC\n");
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800179 return;
180 }
181
Enric Balletbo i Serra235228b2010-10-23 16:49:00 +0000182 igep2_onenand_data.cs = onenandcs;
183
184 if (platform_device_register(&igep2_onenand_device) < 0)
185 pr_err("IGEP2: Unable to register OneNAND device\n");
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800186}
187
188#else
Manjunath Kondaiah G04aeae72010-10-08 09:58:35 -0700189static void __init igep2_flash_init(void) {}
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800190#endif
191
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800192#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
193
194#include <linux/smsc911x.h>
Mike Rapoport21b42732011-04-16 22:29:30 +0000195#include <plat/gpmc-smsc911x.h>
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800196
Mike Rapoport21b42732011-04-16 22:29:30 +0000197static struct omap_smsc911x_platform_data smsc911x_cfg = {
198 .cs = IGEP2_SMSC911X_CS,
199 .gpio_irq = IGEP2_SMSC911X_GPIO,
200 .gpio_reset = -EINVAL,
201 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800202};
203
204static inline void __init igep2_init_smsc911x(void)
205{
Mike Rapoport21b42732011-04-16 22:29:30 +0000206 gpmc_smsc911x_init(&smsc911x_cfg);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800207}
208
209#else
210static inline void __init igep2_init_smsc911x(void) { }
211#endif
212
Marc Zyngierda07c0c2010-12-20 18:48:16 -0800213static struct regulator_consumer_supply igep2_vmmc1_supply =
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530214 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0");
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800215
216/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
217static struct regulator_init_data igep2_vmmc1 = {
218 .constraints = {
219 .min_uV = 1850000,
220 .max_uV = 3150000,
221 .valid_modes_mask = REGULATOR_MODE_NORMAL
222 | REGULATOR_MODE_STANDBY,
223 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
224 | REGULATOR_CHANGE_MODE
225 | REGULATOR_CHANGE_STATUS,
226 },
227 .num_consumer_supplies = 1,
228 .consumer_supplies = &igep2_vmmc1_supply,
229};
230
Marc Zyngierda07c0c2010-12-20 18:48:16 -0800231static struct regulator_consumer_supply igep2_vio_supply =
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530232 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1");
Marc Zyngierda07c0c2010-12-20 18:48:16 -0800233
234static struct regulator_init_data igep2_vio = {
235 .constraints = {
236 .min_uV = 1800000,
237 .max_uV = 1800000,
238 .apply_uV = 1,
239 .valid_modes_mask = REGULATOR_MODE_NORMAL
240 | REGULATOR_MODE_STANDBY,
241 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
242 | REGULATOR_CHANGE_MODE
243 | REGULATOR_CHANGE_STATUS,
244 },
245 .num_consumer_supplies = 1,
246 .consumer_supplies = &igep2_vio_supply,
247};
248
249static struct regulator_consumer_supply igep2_vmmc2_supply =
Kishore Kadiyala0005ae72011-02-28 20:48:05 +0530250 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
Marc Zyngierda07c0c2010-12-20 18:48:16 -0800251
252static struct regulator_init_data igep2_vmmc2 = {
253 .constraints = {
254 .valid_modes_mask = REGULATOR_MODE_NORMAL,
255 .always_on = 1,
256 },
257 .num_consumer_supplies = 1,
258 .consumer_supplies = &igep2_vmmc2_supply,
259};
260
261static struct fixed_voltage_config igep2_vwlan = {
262 .supply_name = "vwlan",
263 .microvolts = 3300000,
264 .gpio = -EINVAL,
265 .enabled_at_boot = 1,
266 .init_data = &igep2_vmmc2,
267};
268
269static struct platform_device igep2_vwlan_device = {
270 .name = "reg-fixed-voltage",
271 .id = 0,
272 .dev = {
273 .platform_data = &igep2_vwlan,
274 },
275};
276
Adrian Hunter68ff0422010-02-15 10:03:34 -0800277static struct omap2_hsmmc_info mmc[] = {
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800278 {
279 .mmc = 1,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000280 .caps = MMC_CAP_4_BIT_DATA,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800281 .gpio_cd = -EINVAL,
282 .gpio_wp = -EINVAL,
283 },
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700284#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800285 {
286 .mmc = 2,
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000287 .caps = MMC_CAP_4_BIT_DATA,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800288 .gpio_cd = -EINVAL,
289 .gpio_wp = -EINVAL,
290 },
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700291#endif
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800292 {} /* Terminator */
293};
294
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700295#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
296#include <linux/leds.h>
297
298static struct gpio_led igep2_gpio_leds[] = {
299 [0] = {
300 .name = "gpio-led:red:d0",
301 .gpio = IGEP2_GPIO_LED0_RED,
302 .default_trigger = "default-off"
303 },
304 [1] = {
305 .name = "gpio-led:green:d0",
306 .gpio = IGEP2_GPIO_LED0_GREEN,
307 .default_trigger = "default-off",
308 },
309 [2] = {
310 .name = "gpio-led:red:d1",
311 .gpio = IGEP2_GPIO_LED1_RED,
312 .default_trigger = "default-off",
313 },
314 [3] = {
315 .name = "gpio-led:green:d1",
316 .default_trigger = "heartbeat",
317 .gpio = -EINVAL, /* gets replaced */
Laurent Pinchart70e77762010-12-17 18:15:08 -0800318 .active_low = 1,
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700319 },
320};
321
322static struct gpio_led_platform_data igep2_led_pdata = {
323 .leds = igep2_gpio_leds,
324 .num_leds = ARRAY_SIZE(igep2_gpio_leds),
325};
326
327static struct platform_device igep2_led_device = {
328 .name = "leds-gpio",
329 .id = -1,
330 .dev = {
331 .platform_data = &igep2_led_pdata,
332 },
333};
334
335static void __init igep2_leds_init(void)
336{
337 platform_device_register(&igep2_led_device);
338}
339
340#else
341static inline void igep2_leds_init(void)
342{
343 if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) &&
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800344 (gpio_direction_output(IGEP2_GPIO_LED0_RED, 0) == 0))
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700345 gpio_export(IGEP2_GPIO_LED0_RED, 0);
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800346 else
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700347 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n");
348
349 if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) &&
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800350 (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 0) == 0))
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700351 gpio_export(IGEP2_GPIO_LED0_GREEN, 0);
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800352 else
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700353 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n");
354
355 if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) &&
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800356 (gpio_direction_output(IGEP2_GPIO_LED1_RED, 0) == 0))
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700357 gpio_export(IGEP2_GPIO_LED1_RED, 0);
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800358 else
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700359 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
360
361}
362#endif
363
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800364static int igep2_twl_gpio_setup(struct device *dev,
365 unsigned gpio, unsigned ngpio)
366{
367 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
368 mmc[0].gpio_cd = gpio + 0;
Adrian Hunter68ff0422010-02-15 10:03:34 -0800369 omap2_hsmmc_init(mmc);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800370
Enric Balletbo i Serra72f381b2010-10-08 10:22:57 -0700371 /*
Enric Balletbo i Serra61e118d2010-10-08 10:22:19 -0700372 * 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)
Laurent Pinchart70e77762010-12-17 18:15:08 -0800390 && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0))
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700391 gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
Laurent Pinchart62d8e9e2010-12-17 18:15:07 -0800392 else
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700393 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n");
394#else
395 igep2_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
396#endif
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800397
398 return 0;
399};
400
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700401static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = {
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800402 .gpio_base = OMAP_MAX_GPIO_LINES,
403 .irq_base = TWL4030_GPIO_IRQ_BASE,
404 .irq_end = TWL4030_GPIO_IRQ_END,
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700405 .use_leds = true,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800406 .setup = igep2_twl_gpio_setup,
407};
408
409static struct twl4030_usb_data igep2_usb_data = {
410 .usb_mode = T2_USB_MODE_ULPI,
411};
412
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800413static int igep2_enable_dvi(struct omap_dss_device *dssdev)
414{
415 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1);
416
417 return 0;
418}
419
420static void igep2_disable_dvi(struct omap_dss_device *dssdev)
421{
422 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
423}
424
Bryan Wu89747c92010-11-17 13:34:34 +0000425static struct panel_generic_dpi_data dvi_panel = {
426 .name = "generic",
427 .platform_enable = igep2_enable_dvi,
428 .platform_disable = igep2_disable_dvi,
429};
430
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800431static struct omap_dss_device igep2_dvi_device = {
432 .type = OMAP_DISPLAY_TYPE_DPI,
433 .name = "dvi",
Bryan Wu89747c92010-11-17 13:34:34 +0000434 .driver_name = "generic_dpi_panel",
435 .data = &dvi_panel,
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800436 .phy.dpi.data_lines = 24,
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800437};
438
439static struct omap_dss_device *igep2_dss_devices[] = {
440 &igep2_dvi_device
441};
442
443static struct omap_dss_board_info igep2_dss_data = {
444 .num_devices = ARRAY_SIZE(igep2_dss_devices),
445 .devices = igep2_dss_devices,
446 .default_device = &igep2_dvi_device,
447};
448
Senthilvadivu Guruswamyc8aac012011-01-24 06:22:02 +0000449static struct regulator_consumer_supply igep2_vpll2_supplies[] = {
450 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
451 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
452};
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800453
454static struct regulator_init_data igep2_vpll2 = {
455 .constraints = {
456 .name = "VDVI",
457 .min_uV = 1800000,
458 .max_uV = 1800000,
459 .apply_uV = true,
460 .valid_modes_mask = REGULATOR_MODE_NORMAL
461 | REGULATOR_MODE_STANDBY,
462 .valid_ops_mask = REGULATOR_CHANGE_MODE
463 | REGULATOR_CHANGE_STATUS,
464 },
Senthilvadivu Guruswamyc8aac012011-01-24 06:22:02 +0000465 .num_consumer_supplies = ARRAY_SIZE(igep2_vpll2_supplies),
466 .consumer_supplies = igep2_vpll2_supplies,
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800467};
468
469static void __init igep2_display_init(void)
470{
471 if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") &&
472 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1))
473 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
474}
Enric Balletbo i Serra228893f2010-03-01 11:18:08 +0000475
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800476static struct platform_device *igep2_devices[] __initdata = {
Marc Zyngierda07c0c2010-12-20 18:48:16 -0800477 &igep2_vwlan_device,
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800478};
479
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800480static void __init igep2_init_early(void)
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800481{
Paul Walmsley48057342010-12-21 15:25:10 -0700482 omap2_init_common_infrastructure();
483 omap2_init_common_devices(m65kxxxxam_sdrc_params,
484 m65kxxxxam_sdrc_params);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800485}
486
Ilkka Koskinen6a58baf2011-03-02 13:24:05 +0000487static struct twl4030_codec_audio_data igep2_audio_data;
Enric Balletbo i Serra7f5f23d2010-02-17 14:09:25 -0800488
489static struct twl4030_codec_data igep2_codec_data = {
490 .audio_mclk = 26000000,
491 .audio = &igep2_audio_data,
492};
493
Enric Balletbo i Serra18cbc7d2011-01-10 13:26:14 +0000494static int igep2_keymap[] = {
495 KEY(0, 0, KEY_LEFT),
496 KEY(0, 1, KEY_RIGHT),
497 KEY(0, 2, KEY_A),
498 KEY(0, 3, KEY_B),
499 KEY(1, 0, KEY_DOWN),
500 KEY(1, 1, KEY_UP),
501 KEY(1, 2, KEY_E),
502 KEY(1, 3, KEY_F),
503 KEY(2, 0, KEY_ENTER),
504 KEY(2, 1, KEY_I),
505 KEY(2, 2, KEY_J),
506 KEY(2, 3, KEY_K),
507 KEY(3, 0, KEY_M),
508 KEY(3, 1, KEY_N),
509 KEY(3, 2, KEY_O),
510 KEY(3, 3, KEY_P)
511};
512
513static struct matrix_keymap_data igep2_keymap_data = {
514 .keymap = igep2_keymap,
515 .keymap_size = ARRAY_SIZE(igep2_keymap),
516};
517
518static struct twl4030_keypad_data igep2_keypad_pdata = {
519 .keymap_data = &igep2_keymap_data,
520 .rows = 4,
521 .cols = 4,
522 .rep = 1,
523};
524
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800525static struct twl4030_platform_data igep2_twldata = {
526 .irq_base = TWL4030_IRQ_BASE,
527 .irq_end = TWL4030_IRQ_END,
528
529 /* platform_data for children goes here */
530 .usb = &igep2_usb_data,
Enric Balletbo i Serra7f5f23d2010-02-17 14:09:25 -0800531 .codec = &igep2_codec_data,
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700532 .gpio = &igep2_twl4030_gpio_pdata,
Enric Balletbo i Serra18cbc7d2011-01-10 13:26:14 +0000533 .keypad = &igep2_keypad_pdata,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800534 .vmmc1 = &igep2_vmmc1,
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800535 .vpll2 = &igep2_vpll2,
Marc Zyngierda07c0c2010-12-20 18:48:16 -0800536 .vio = &igep2_vio,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800537};
538
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700539static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = {
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800540 {
541 I2C_BOARD_INFO("twl4030", 0x48),
542 .flags = I2C_CLIENT_WAKE,
543 .irq = INT_34XX_SYS_NIRQ,
544 .platform_data = &igep2_twldata,
545 },
546};
547
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700548static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
549 {
550 I2C_BOARD_INFO("eeprom", 0x50),
551 },
552};
553
554static void __init igep2_i2c_init(void)
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800555{
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700556 int ret;
557
558 ret = omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo,
559 ARRAY_SIZE(igep2_i2c1_boardinfo));
560 if (ret)
561 pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret);
562
563 /*
564 * Bus 3 is attached to the DVI port where devices like the pico DLP
565 * projector don't work reliably with 400kHz
566 */
567 ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
568 ARRAY_SIZE(igep2_i2c3_boardinfo));
569 if (ret)
570 pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800571}
572
Maulik Mankad884b8362010-02-17 14:09:30 -0800573static struct omap_musb_board_data musb_board_data = {
574 .interface_type = MUSB_INTERFACE_ULPI,
575 .mode = MUSB_OTG,
576 .power = 100,
577};
578
Keshava Munegowda181b2502011-03-01 20:08:16 +0530579static const struct usbhs_omap_board_data usbhs_bdata __initconst = {
580 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
581 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
582 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
Enric Balletbo i Serrad08854862010-02-17 14:09:26 -0800583
584 .phy_reset = true,
Enric Balletbo i Serraf6b74532010-03-01 15:02:36 +0000585 .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
586 .reset_gpio_port[1] = -EINVAL,
Enric Balletbo i Serrad08854862010-02-17 14:09:26 -0800587 .reset_gpio_port[2] = -EINVAL,
588};
589
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800590#ifdef CONFIG_OMAP_MUX
591static struct omap_board_mux board_mux[] __initdata = {
592 { .reg_offset = OMAP_MUX_TERMINATOR },
593};
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800594#endif
595
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700596#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
597
598static void __init igep2_wlan_bt_init(void)
599{
600 unsigned npd, wreset, btreset;
601
602 /* GPIO's for WLAN-BT combo depends on hardware revision */
603 if (hwrev == IGEP2_BOARD_HWREV_B) {
604 npd = IGEP2_RB_GPIO_WIFI_NPD;
605 wreset = IGEP2_RB_GPIO_WIFI_NRESET;
606 btreset = IGEP2_RB_GPIO_BT_NRESET;
607 } else if (hwrev == IGEP2_BOARD_HWREV_C) {
608 npd = IGEP2_RC_GPIO_WIFI_NPD;
609 wreset = IGEP2_RC_GPIO_WIFI_NRESET;
610 btreset = IGEP2_RC_GPIO_BT_NRESET;
611 } else
612 return;
613
614 /* Set GPIO's for WLAN-BT combo module */
615 if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) &&
616 (gpio_direction_output(npd, 1) == 0)) {
617 gpio_export(npd, 0);
618 } else
619 pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n");
620
621 if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) &&
622 (gpio_direction_output(wreset, 1) == 0)) {
623 gpio_export(wreset, 0);
624 gpio_set_value(wreset, 0);
625 udelay(10);
626 gpio_set_value(wreset, 1);
627 } else
628 pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n");
629
630 if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) &&
631 (gpio_direction_output(btreset, 1) == 0)) {
632 gpio_export(btreset, 0);
633 } else
634 pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n");
635}
636#else
637static inline void __init igep2_wlan_bt_init(void) { }
638#endif
639
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800640static void __init igep2_init(void)
641{
Tony Lindgrenca5742b2009-12-11 16:16:32 -0800642 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
Enric Balletbo i Serra3f8c48d2010-10-08 10:22:35 -0700643
644 /* Get IGEP2 hardware revision */
645 igep2_get_revision();
Enric Balletbo i Serra91d139c2010-10-08 10:22:51 -0700646 /* Register I2C busses and drivers */
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800647 igep2_i2c_init();
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800648 platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
Senthilvadivu Guruswamyd5e13222011-02-22 11:24:50 +0200649 omap_display_init(&igep2_dss_data);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800650 omap_serial_init();
Maulik Mankad884b8362010-02-17 14:09:30 -0800651 usb_musb_init(&musb_board_data);
Keshava Munegowda9e64bb12011-03-01 20:08:19 +0530652 usbhs_init(&usbhs_bdata);
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800653
Enric Balletbo i Serracddb4832010-02-17 14:09:26 -0800654 igep2_flash_init();
Enric Balletbo i Serrabee15392010-10-08 10:22:28 -0700655 igep2_leds_init();
Enric Balletbo i Serra691de272010-02-17 14:09:26 -0800656 igep2_display_init();
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800657 igep2_init_smsc911x();
658
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700659 /*
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300660 * WLAN-BT combo module from MuRata which has a Marvell WLAN
Enric Balletbo i Serra5a9fcc92010-10-08 10:22:43 -0700661 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
662 */
663 igep2_wlan_bt_init();
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800664
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800665}
666
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800667MACHINE_START(IGEP0020, "IGEP v2 board")
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800668 .boot_params = 0x80000100,
Russell King71ee7da2010-05-23 10:18:16 +0100669 .reserve = omap_reserve,
Russell King - ARM Linux3dc3bad2011-02-14 15:40:20 -0800670 .map_io = omap3_map_io,
671 .init_early = igep2_init_early,
672 .init_irq = omap_init_irq,
Enric Balletbo i Serra58e11162009-11-18 18:41:07 -0800673 .init_machine = igep2_init,
674 .timer = &omap_timer,
675MACHINE_END