aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-igep0020.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /arch/arm/mach-omap2/board-igep0020.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'arch/arm/mach-omap2/board-igep0020.c')
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c695
1 files changed, 435 insertions, 260 deletions
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 175f04339761..0c1bfca3f731 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -17,9 +17,12 @@
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/gpio.h> 18#include <linux/gpio.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/input.h>
20 21
21#include <linux/regulator/machine.h> 22#include <linux/regulator/machine.h>
23#include <linux/regulator/fixed.h>
22#include <linux/i2c/twl.h> 24#include <linux/i2c/twl.h>
25#include <linux/mmc/host.h>
23 26
24#include <asm/mach-types.h> 27#include <asm/mach-types.h>
25#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
@@ -28,22 +31,84 @@
28#include <plat/common.h> 31#include <plat/common.h>
29#include <plat/gpmc.h> 32#include <plat/gpmc.h>
30#include <plat/usb.h> 33#include <plat/usb.h>
31#include <plat/display.h> 34#include <video/omapdss.h>
35#include <video/omap-panel-generic-dpi.h>
32#include <plat/onenand.h> 36#include <plat/onenand.h>
33 37
34#include "mux.h" 38#include "mux.h"
35#include "hsmmc.h" 39#include "hsmmc.h"
36#include "sdram-numonyx-m65kxxxxam.h" 40#include "sdram-numonyx-m65kxxxxam.h"
41#include "common-board-devices.h"
37 42
38#define IGEP2_SMSC911X_CS 5 43#define IGEP2_SMSC911X_CS 5
39#define IGEP2_SMSC911X_GPIO 176 44#define IGEP2_SMSC911X_GPIO 176
40#define IGEP2_GPIO_USBH_NRESET 24 45#define IGEP2_GPIO_USBH_NRESET 24
41#define IGEP2_GPIO_LED0_GREEN 26 46#define IGEP2_GPIO_LED0_GREEN 26
42#define IGEP2_GPIO_LED0_RED 27 47#define IGEP2_GPIO_LED0_RED 27
43#define IGEP2_GPIO_LED1_RED 28 48#define IGEP2_GPIO_LED1_RED 28
44#define IGEP2_GPIO_DVI_PUP 170 49#define IGEP2_GPIO_DVI_PUP 170
45#define IGEP2_GPIO_WIFI_NPD 94 50
46#define IGEP2_GPIO_WIFI_NRESET 95 51#define IGEP2_RB_GPIO_WIFI_NPD 94
52#define IGEP2_RB_GPIO_WIFI_NRESET 95
53#define IGEP2_RB_GPIO_BT_NRESET 137
54#define IGEP2_RC_GPIO_WIFI_NPD 138
55#define IGEP2_RC_GPIO_WIFI_NRESET 139
56#define IGEP2_RC_GPIO_BT_NRESET 137
57
58#define IGEP3_GPIO_LED0_GREEN 54
59#define IGEP3_GPIO_LED0_RED 53
60#define IGEP3_GPIO_LED1_RED 16
61#define IGEP3_GPIO_USBH_NRESET 183
62
63/*
64 * IGEP2 Hardware Revision Table
65 *
66 * --------------------------------------------------------------------------
67 * | Id. | Hw Rev. | HW0 (28) | WIFI_NPD | WIFI_NRESET | BT_NRESET |
68 * --------------------------------------------------------------------------
69 * | 0 | B | high | gpio94 | gpio95 | - |
70 * | 0 | B/C (B-compatible) | high | gpio94 | gpio95 | gpio137 |
71 * | 1 | C | low | gpio138 | gpio139 | gpio137 |
72 * --------------------------------------------------------------------------
73 */
74
75#define IGEP2_BOARD_HWREV_B 0
76#define IGEP2_BOARD_HWREV_C 1
77#define IGEP3_BOARD_HWREV 2
78
79static u8 hwrev;
80
81static void __init igep2_get_revision(void)
82{
83 u8 ret;
84
85 if (machine_is_igep0030()) {
86 hwrev = IGEP3_BOARD_HWREV;
87 return;
88 }
89
90 omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT);
91
92 if (gpio_request_one(IGEP2_GPIO_LED1_RED, GPIOF_IN, "GPIO_HW0_REV")) {
93 pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n");
94 pr_err("IGEP2: Unknown Hardware Revision\n");
95 return;
96 }
97
98 ret = gpio_get_value(IGEP2_GPIO_LED1_RED);
99 if (ret == 0) {
100 pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n");
101 hwrev = IGEP2_BOARD_HWREV_C;
102 } else if (ret == 1) {
103 pr_info("IGEP2: Hardware Revision B/C (B compatible)\n");
104 hwrev = IGEP2_BOARD_HWREV_B;
105 } else {
106 pr_err("IGEP2: Unknown Hardware Revision\n");
107 hwrev = -1;
108 }
109
110 gpio_free(IGEP2_GPIO_LED1_RED);
111}
47 112
48#if defined(CONFIG_MTD_ONENAND_OMAP2) || \ 113#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
49 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) 114 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
@@ -58,7 +123,7 @@
58 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048) 123 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
59 */ 124 */
60 125
61static struct mtd_partition igep2_onenand_partitions[] = { 126static struct mtd_partition igep_onenand_partitions[] = {
62 { 127 {
63 .name = "X-Loader", 128 .name = "X-Loader",
64 .offset = 0, 129 .offset = 0,
@@ -86,137 +151,82 @@ static struct mtd_partition igep2_onenand_partitions[] = {
86 }, 151 },
87}; 152};
88 153
89static int igep2_onenand_setup(void __iomem *onenand_base, int freq) 154static struct omap_onenand_platform_data igep_onenand_data = {
90{ 155 .parts = igep_onenand_partitions,
91 /* nothing is required to be setup for onenand as of now */ 156 .nr_parts = ARRAY_SIZE(igep_onenand_partitions),
92 return 0;
93}
94
95static struct omap_onenand_platform_data igep2_onenand_data = {
96 .parts = igep2_onenand_partitions,
97 .nr_parts = ARRAY_SIZE(igep2_onenand_partitions),
98 .onenand_setup = igep2_onenand_setup,
99 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ 157 .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */
100}; 158};
101 159
102static struct platform_device igep2_onenand_device = { 160static struct platform_device igep_onenand_device = {
103 .name = "omap2-onenand", 161 .name = "omap2-onenand",
104 .id = -1, 162 .id = -1,
105 .dev = { 163 .dev = {
106 .platform_data = &igep2_onenand_data, 164 .platform_data = &igep_onenand_data,
107 }, 165 },
108}; 166};
109 167
110void __init igep2_flash_init(void) 168static void __init igep_flash_init(void)
111{ 169{
112 u8 cs = 0; 170 u8 cs = 0;
113 u8 onenandcs = GPMC_CS_NUM + 1; 171 u8 onenandcs = GPMC_CS_NUM + 1;
114 172
115 while (cs < GPMC_CS_NUM) { 173 for (cs = 0; cs < GPMC_CS_NUM; cs++) {
116 u32 ret = 0; 174 u32 ret;
117 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); 175 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
118 176
119 /* Check if NAND/oneNAND is configured */ 177 /* Check if NAND/oneNAND is configured */
120 if ((ret & 0xC00) == 0x800) 178 if ((ret & 0xC00) == 0x800)
121 /* NAND found */ 179 /* NAND found */
122 pr_err("IGEP v2: Unsupported NAND found\n"); 180 pr_err("IGEP: Unsupported NAND found\n");
123 else { 181 else {
124 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); 182 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
125 if ((ret & 0x3F) == (ONENAND_MAP >> 24)) 183 if ((ret & 0x3F) == (ONENAND_MAP >> 24))
126 /* ONENAND found */ 184 /* ONENAND found */
127 onenandcs = cs; 185 onenandcs = cs;
128 } 186 }
129 cs++;
130 } 187 }
188
131 if (onenandcs > GPMC_CS_NUM) { 189 if (onenandcs > GPMC_CS_NUM) {
132 pr_err("IGEP v2: Unable to find configuration in GPMC\n"); 190 pr_err("IGEP: Unable to find configuration in GPMC\n");
133 return; 191 return;
134 } 192 }
135 193
136 if (onenandcs < GPMC_CS_NUM) { 194 igep_onenand_data.cs = onenandcs;
137 igep2_onenand_data.cs = onenandcs; 195
138 if (platform_device_register(&igep2_onenand_device) < 0) 196 if (platform_device_register(&igep_onenand_device) < 0)
139 pr_err("IGEP v2: Unable to register OneNAND device\n"); 197 pr_err("IGEP: Unable to register OneNAND device\n");
140 }
141} 198}
142 199
143#else 200#else
144void __init igep2_flash_init(void) {} 201static void __init igep_flash_init(void) {}
145#endif 202#endif
146 203
147#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 204#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
148 205
149#include <linux/smsc911x.h> 206#include <linux/smsc911x.h>
207#include <plat/gpmc-smsc911x.h>
150 208
151static struct smsc911x_platform_config igep2_smsc911x_config = { 209static struct omap_smsc911x_platform_data smsc911x_cfg = {
152 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 210 .cs = IGEP2_SMSC911X_CS,
153 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, 211 .gpio_irq = IGEP2_SMSC911X_GPIO,
154 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS , 212 .gpio_reset = -EINVAL,
155 .phy_interface = PHY_INTERFACE_MODE_MII, 213 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
156};
157
158static struct resource igep2_smsc911x_resources[] = {
159 {
160 .flags = IORESOURCE_MEM,
161 },
162 {
163 .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
164 .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
165 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
166 },
167};
168
169static struct platform_device igep2_smsc911x_device = {
170 .name = "smsc911x",
171 .id = 0,
172 .num_resources = ARRAY_SIZE(igep2_smsc911x_resources),
173 .resource = igep2_smsc911x_resources,
174 .dev = {
175 .platform_data = &igep2_smsc911x_config,
176 },
177}; 214};
178 215
179static inline void __init igep2_init_smsc911x(void) 216static inline void __init igep2_init_smsc911x(void)
180{ 217{
181 unsigned long cs_mem_base; 218 gpmc_smsc911x_init(&smsc911x_cfg);
182
183 if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) {
184 pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n");
185 gpmc_cs_free(IGEP2_SMSC911X_CS);
186 return;
187 }
188
189 igep2_smsc911x_resources[0].start = cs_mem_base + 0x0;
190 igep2_smsc911x_resources[0].end = cs_mem_base + 0xff;
191
192 if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) &&
193 (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) {
194 gpio_export(IGEP2_SMSC911X_GPIO, 0);
195 } else {
196 pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n");
197 return;
198 }
199
200 platform_device_register(&igep2_smsc911x_device);
201} 219}
202 220
203#else 221#else
204static inline void __init igep2_init_smsc911x(void) { } 222static inline void __init igep2_init_smsc911x(void) { }
205#endif 223#endif
206 224
207static struct omap_board_config_kernel igep2_config[] __initdata = { 225static struct regulator_consumer_supply igep_vmmc1_supply =
208}; 226 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0");
209
210static struct regulator_consumer_supply igep2_vmmc1_supply = {
211 .supply = "vmmc",
212};
213
214static struct regulator_consumer_supply igep2_vmmc2_supply = {
215 .supply = "vmmc",
216};
217 227
218/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ 228/* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
219static struct regulator_init_data igep2_vmmc1 = { 229static struct regulator_init_data igep_vmmc1 = {
220 .constraints = { 230 .constraints = {
221 .min_uV = 1850000, 231 .min_uV = 1850000,
222 .max_uV = 3150000, 232 .max_uV = 3150000,
@@ -227,14 +237,17 @@ static struct regulator_init_data igep2_vmmc1 = {
227 | REGULATOR_CHANGE_STATUS, 237 | REGULATOR_CHANGE_STATUS,
228 }, 238 },
229 .num_consumer_supplies = 1, 239 .num_consumer_supplies = 1,
230 .consumer_supplies = &igep2_vmmc1_supply, 240 .consumer_supplies = &igep_vmmc1_supply,
231}; 241};
232 242
233/* VMMC2 for OMAP VDD_MMC2 (i/o) and MMC2 WIFI */ 243static struct regulator_consumer_supply igep_vio_supply =
234static struct regulator_init_data igep2_vmmc2 = { 244 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.1");
245
246static struct regulator_init_data igep_vio = {
235 .constraints = { 247 .constraints = {
236 .min_uV = 1850000, 248 .min_uV = 1800000,
237 .max_uV = 3150000, 249 .max_uV = 1800000,
250 .apply_uV = 1,
238 .valid_modes_mask = REGULATOR_MODE_NORMAL 251 .valid_modes_mask = REGULATOR_MODE_NORMAL
239 | REGULATOR_MODE_STANDBY, 252 | REGULATOR_MODE_STANDBY,
240 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE 253 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
@@ -242,50 +255,192 @@ static struct regulator_init_data igep2_vmmc2 = {
242 | REGULATOR_CHANGE_STATUS, 255 | REGULATOR_CHANGE_STATUS,
243 }, 256 },
244 .num_consumer_supplies = 1, 257 .num_consumer_supplies = 1,
245 .consumer_supplies = &igep2_vmmc2_supply, 258 .consumer_supplies = &igep_vio_supply,
259};
260
261static struct regulator_consumer_supply igep_vmmc2_supply =
262 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
263
264static struct regulator_init_data igep_vmmc2 = {
265 .constraints = {
266 .valid_modes_mask = REGULATOR_MODE_NORMAL,
267 .always_on = 1,
268 },
269 .num_consumer_supplies = 1,
270 .consumer_supplies = &igep_vmmc2_supply,
271};
272
273static struct fixed_voltage_config igep_vwlan = {
274 .supply_name = "vwlan",
275 .microvolts = 3300000,
276 .gpio = -EINVAL,
277 .enabled_at_boot = 1,
278 .init_data = &igep_vmmc2,
279};
280
281static struct platform_device igep_vwlan_device = {
282 .name = "reg-fixed-voltage",
283 .id = 0,
284 .dev = {
285 .platform_data = &igep_vwlan,
286 },
246}; 287};
247 288
248static struct omap2_hsmmc_info mmc[] = { 289static struct omap2_hsmmc_info mmc[] = {
249 { 290 {
250 .mmc = 1, 291 .mmc = 1,
251 .wires = 4, 292 .caps = MMC_CAP_4_BIT_DATA,
252 .gpio_cd = -EINVAL, 293 .gpio_cd = -EINVAL,
253 .gpio_wp = -EINVAL, 294 .gpio_wp = -EINVAL,
254 }, 295 },
296#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
255 { 297 {
256 .mmc = 2, 298 .mmc = 2,
257 .wires = 4, 299 .caps = MMC_CAP_4_BIT_DATA,
258 .gpio_cd = -EINVAL, 300 .gpio_cd = -EINVAL,
259 .gpio_wp = -EINVAL, 301 .gpio_wp = -EINVAL,
260 }, 302 },
303#endif
261 {} /* Terminator */ 304 {} /* Terminator */
262}; 305};
263 306
264static int igep2_twl_gpio_setup(struct device *dev, 307#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
308#include <linux/leds.h>
309
310static struct gpio_led igep_gpio_leds[] = {
311 [0] = {
312 .name = "gpio-led:red:d0",
313 .default_trigger = "default-off"
314 },
315 [1] = {
316 .name = "gpio-led:green:d0",
317 .default_trigger = "default-off",
318 },
319 [2] = {
320 .name = "gpio-led:red:d1",
321 .default_trigger = "default-off",
322 },
323 [3] = {
324 .name = "gpio-led:green:d1",
325 .default_trigger = "heartbeat",
326 .gpio = -EINVAL, /* gets replaced */
327 .active_low = 1,
328 },
329};
330
331static struct gpio_led_platform_data igep_led_pdata = {
332 .leds = igep_gpio_leds,
333 .num_leds = ARRAY_SIZE(igep_gpio_leds),
334};
335
336static struct platform_device igep_led_device = {
337 .name = "leds-gpio",
338 .id = -1,
339 .dev = {
340 .platform_data = &igep_led_pdata,
341 },
342};
343
344static void __init igep_leds_init(void)
345{
346 if (machine_is_igep0020()) {
347 igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
348 igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
349 igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
350 } else {
351 igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
352 igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
353 igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
354 }
355
356 platform_device_register(&igep_led_device);
357}
358
359#else
360static struct gpio igep_gpio_leds[] __initdata = {
361 { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d0" },
362 { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:green:d0" },
363 { -EINVAL, GPIOF_OUT_INIT_LOW, "gpio-led:red:d1" },
364};
365
366static inline void igep_leds_init(void)
367{
368 int i;
369
370 if (machine_is_igep0020()) {
371 igep_gpio_leds[0].gpio = IGEP2_GPIO_LED0_RED;
372 igep_gpio_leds[1].gpio = IGEP2_GPIO_LED0_GREEN;
373 igep_gpio_leds[2].gpio = IGEP2_GPIO_LED1_RED;
374 } else {
375 igep_gpio_leds[0].gpio = IGEP3_GPIO_LED0_RED;
376 igep_gpio_leds[1].gpio = IGEP3_GPIO_LED0_GREEN;
377 igep_gpio_leds[2].gpio = IGEP3_GPIO_LED1_RED;
378 }
379
380 if (gpio_request_array(igep_gpio_leds, ARRAY_SIZE(igep_gpio_leds))) {
381 pr_warning("IGEP v2: Could not obtain leds gpios\n");
382 return;
383 }
384
385 for (i = 0; i < ARRAY_SIZE(igep_gpio_leds); i++)
386 gpio_export(igep_gpio_leds[i].gpio, 0);
387}
388#endif
389
390static struct gpio igep2_twl_gpios[] = {
391 { -EINVAL, GPIOF_IN, "GPIO_EHCI_NOC" },
392 { -EINVAL, GPIOF_OUT_INIT_LOW, "GPIO_USBH_CPEN" },
393};
394
395static int igep_twl_gpio_setup(struct device *dev,
265 unsigned gpio, unsigned ngpio) 396 unsigned gpio, unsigned ngpio)
266{ 397{
398 int ret;
399
267 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 400 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
268 mmc[0].gpio_cd = gpio + 0; 401 mmc[0].gpio_cd = gpio + 0;
269 omap2_hsmmc_init(mmc); 402 omap2_hsmmc_init(mmc);
270 403
271 /* link regulators to MMC adapters ... we "know" the 404 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
272 * regulators will be set up only *after* we return. 405#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
273 */ 406 ret = gpio_request_one(gpio + TWL4030_GPIO_MAX + 1, GPIOF_OUT_INIT_HIGH,
274 igep2_vmmc1_supply.dev = mmc[0].dev; 407 "gpio-led:green:d1");
275 igep2_vmmc2_supply.dev = mmc[1].dev; 408 if (ret == 0)
409 gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0);
410 else
411 pr_warning("IGEP: Could not obtain gpio GPIO_LED1_GREEN\n");
412#else
413 igep_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1;
414#endif
415
416 if (machine_is_igep0030())
417 return 0;
418
419 /*
420 * REVISIT: need ehci-omap hooks for external VBUS
421 * power switch and overcurrent detect
422 */
423 igep2_twl_gpios[0].gpio = gpio + 1;
424
425 /* TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN (out, active low) */
426 igep2_twl_gpios[1].gpio = gpio + TWL4030_GPIO_MAX;
427
428 ret = gpio_request_array(igep2_twl_gpios, ARRAY_SIZE(igep2_twl_gpios));
429 if (ret < 0)
430 pr_err("IGEP2: Could not obtain gpio for USBH_CPEN");
276 431
277 return 0; 432 return 0;
278}; 433};
279 434
280static struct twl4030_gpio_platform_data igep2_gpio_data = { 435static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {
281 .gpio_base = OMAP_MAX_GPIO_LINES, 436 .gpio_base = OMAP_MAX_GPIO_LINES,
282 .irq_base = TWL4030_GPIO_IRQ_BASE, 437 .irq_base = TWL4030_GPIO_IRQ_BASE,
283 .irq_end = TWL4030_GPIO_IRQ_END, 438 .irq_end = TWL4030_GPIO_IRQ_END,
284 .use_leds = false, 439 .use_leds = true,
285 .setup = igep2_twl_gpio_setup, 440 .setup = igep_twl_gpio_setup,
286}; 441};
287 442
288static struct twl4030_usb_data igep2_usb_data = { 443static struct twl4030_usb_data igep_usb_data = {
289 .usb_mode = T2_USB_MODE_ULPI, 444 .usb_mode = T2_USB_MODE_ULPI,
290}; 445};
291 446
@@ -301,13 +456,18 @@ static void igep2_disable_dvi(struct omap_dss_device *dssdev)
301 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0); 456 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
302} 457}
303 458
459static struct panel_generic_dpi_data dvi_panel = {
460 .name = "generic",
461 .platform_enable = igep2_enable_dvi,
462 .platform_disable = igep2_disable_dvi,
463};
464
304static struct omap_dss_device igep2_dvi_device = { 465static struct omap_dss_device igep2_dvi_device = {
305 .type = OMAP_DISPLAY_TYPE_DPI, 466 .type = OMAP_DISPLAY_TYPE_DPI,
306 .name = "dvi", 467 .name = "dvi",
307 .driver_name = "generic_panel", 468 .driver_name = "generic_dpi_panel",
469 .data = &dvi_panel,
308 .phy.dpi.data_lines = 24, 470 .phy.dpi.data_lines = 24,
309 .platform_enable = igep2_enable_dvi,
310 .platform_disable = igep2_disable_dvi,
311}; 471};
312 472
313static struct omap_dss_device *igep2_dss_devices[] = { 473static struct omap_dss_device *igep2_dss_devices[] = {
@@ -320,17 +480,9 @@ static struct omap_dss_board_info igep2_dss_data = {
320 .default_device = &igep2_dvi_device, 480 .default_device = &igep2_dvi_device,
321}; 481};
322 482
323static struct platform_device igep2_dss_device = { 483static struct regulator_consumer_supply igep2_vpll2_supplies[] = {
324 .name = "omapdss", 484 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
325 .id = -1, 485 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
326 .dev = {
327 .platform_data = &igep2_dss_data,
328 },
329};
330
331static struct regulator_consumer_supply igep2_vpll2_supply = {
332 .supply = "vdds_dsi",
333 .dev = &igep2_dss_device.dev,
334}; 486};
335 487
336static struct regulator_init_data igep2_vpll2 = { 488static struct regulator_init_data igep2_vpll2 = {
@@ -344,123 +496,110 @@ static struct regulator_init_data igep2_vpll2 = {
344 .valid_ops_mask = REGULATOR_CHANGE_MODE 496 .valid_ops_mask = REGULATOR_CHANGE_MODE
345 | REGULATOR_CHANGE_STATUS, 497 | REGULATOR_CHANGE_STATUS,
346 }, 498 },
347 .num_consumer_supplies = 1, 499 .num_consumer_supplies = ARRAY_SIZE(igep2_vpll2_supplies),
348 .consumer_supplies = &igep2_vpll2_supply, 500 .consumer_supplies = igep2_vpll2_supplies,
349}; 501};
350 502
351static void __init igep2_display_init(void) 503static void __init igep2_display_init(void)
352{ 504{
353 if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") && 505 int err = gpio_request_one(IGEP2_GPIO_DVI_PUP, GPIOF_OUT_INIT_HIGH,
354 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1)) 506 "GPIO_DVI_PUP");
507 if (err)
355 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); 508 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
356} 509}
357 510
358#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 511static struct platform_device *igep_devices[] __initdata = {
359#include <linux/leds.h> 512 &igep_vwlan_device,
360
361static struct gpio_led igep2_gpio_leds[] = {
362 {
363 .name = "led0:red",
364 .gpio = IGEP2_GPIO_LED0_RED,
365 },
366 {
367 .name = "led0:green",
368 .default_trigger = "heartbeat",
369 .gpio = IGEP2_GPIO_LED0_GREEN,
370 },
371 {
372 .name = "led1:red",
373 .gpio = IGEP2_GPIO_LED1_RED,
374 },
375};
376
377static struct gpio_led_platform_data igep2_led_pdata = {
378 .leds = igep2_gpio_leds,
379 .num_leds = ARRAY_SIZE(igep2_gpio_leds),
380};
381
382static struct platform_device igep2_led_device = {
383 .name = "leds-gpio",
384 .id = -1,
385 .dev = {
386 .platform_data = &igep2_led_pdata,
387 },
388}; 513};
389 514
390static void __init igep2_init_led(void) 515static void __init igep_init_early(void)
391{ 516{
392 platform_device_register(&igep2_led_device); 517 omap2_init_common_infrastructure();
518 omap2_init_common_devices(m65kxxxxam_sdrc_params,
519 m65kxxxxam_sdrc_params);
393} 520}
394 521
395#else 522static struct twl4030_codec_audio_data igep2_audio_data;
396static inline void igep2_init_led(void) {}
397#endif
398 523
399static struct platform_device *igep2_devices[] __initdata = { 524static struct twl4030_codec_data igep2_codec_data = {
400 &igep2_dss_device, 525 .audio_mclk = 26000000,
526 .audio = &igep2_audio_data,
401}; 527};
402 528
403static void __init igep2_init_irq(void) 529static int igep2_keymap[] = {
404{ 530 KEY(0, 0, KEY_LEFT),
405 omap_board_config = igep2_config; 531 KEY(0, 1, KEY_RIGHT),
406 omap_board_config_size = ARRAY_SIZE(igep2_config); 532 KEY(0, 2, KEY_A),
407 omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params); 533 KEY(0, 3, KEY_B),
408 omap_init_irq(); 534 KEY(1, 0, KEY_DOWN),
409 omap_gpio_init(); 535 KEY(1, 1, KEY_UP),
410} 536 KEY(1, 2, KEY_E),
537 KEY(1, 3, KEY_F),
538 KEY(2, 0, KEY_ENTER),
539 KEY(2, 1, KEY_I),
540 KEY(2, 2, KEY_J),
541 KEY(2, 3, KEY_K),
542 KEY(3, 0, KEY_M),
543 KEY(3, 1, KEY_N),
544 KEY(3, 2, KEY_O),
545 KEY(3, 3, KEY_P)
546};
411 547
412static struct twl4030_codec_audio_data igep2_audio_data = { 548static struct matrix_keymap_data igep2_keymap_data = {
413 .audio_mclk = 26000000, 549 .keymap = igep2_keymap,
550 .keymap_size = ARRAY_SIZE(igep2_keymap),
414}; 551};
415 552
416static struct twl4030_codec_data igep2_codec_data = { 553static struct twl4030_keypad_data igep2_keypad_pdata = {
417 .audio_mclk = 26000000, 554 .keymap_data = &igep2_keymap_data,
418 .audio = &igep2_audio_data, 555 .rows = 4,
556 .cols = 4,
557 .rep = 1,
419}; 558};
420 559
421static struct twl4030_platform_data igep2_twldata = { 560static struct twl4030_platform_data igep_twldata = {
422 .irq_base = TWL4030_IRQ_BASE, 561 .irq_base = TWL4030_IRQ_BASE,
423 .irq_end = TWL4030_IRQ_END, 562 .irq_end = TWL4030_IRQ_END,
424 563
425 /* platform_data for children goes here */ 564 /* platform_data for children goes here */
426 .usb = &igep2_usb_data, 565 .usb = &igep_usb_data,
427 .codec = &igep2_codec_data, 566 .gpio = &igep_twl4030_gpio_pdata,
428 .gpio = &igep2_gpio_data, 567 .vmmc1 = &igep_vmmc1,
429 .vmmc1 = &igep2_vmmc1, 568 .vio = &igep_vio,
430 .vmmc2 = &igep2_vmmc2,
431 .vpll2 = &igep2_vpll2,
432
433}; 569};
434 570
435static struct i2c_board_info __initdata igep2_i2c_boardinfo[] = { 571static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = {
436 { 572 {
437 I2C_BOARD_INFO("twl4030", 0x48), 573 I2C_BOARD_INFO("eeprom", 0x50),
438 .flags = I2C_CLIENT_WAKE,
439 .irq = INT_34XX_SYS_NIRQ,
440 .platform_data = &igep2_twldata,
441 }, 574 },
442}; 575};
443 576
444static int __init igep2_i2c_init(void) 577static void __init igep_i2c_init(void)
445{ 578{
446 omap_register_i2c_bus(1, 2600, igep2_i2c_boardinfo, 579 int ret;
447 ARRAY_SIZE(igep2_i2c_boardinfo)); 580
448 /* Bus 3 is attached to the DVI port where devices like the pico DLP 581 if (machine_is_igep0020()) {
449 * projector don't work reliably with 400kHz */ 582 /*
450 omap_register_i2c_bus(3, 100, NULL, 0); 583 * Bus 3 is attached to the DVI port where devices like the
451 return 0; 584 * pico DLP projector don't work reliably with 400kHz
452} 585 */
586 ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo,
587 ARRAY_SIZE(igep2_i2c3_boardinfo));
588 if (ret)
589 pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);
590
591 igep_twldata.codec = &igep2_codec_data;
592 igep_twldata.keypad = &igep2_keypad_pdata;
593 igep_twldata.vpll2 = &igep2_vpll2;
594 }
453 595
454static struct omap_musb_board_data musb_board_data = { 596 omap3_pmic_init("twl4030", &igep_twldata);
455 .interface_type = MUSB_INTERFACE_ULPI, 597}
456 .mode = MUSB_OTG,
457 .power = 100,
458};
459 598
460static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { 599static const struct usbhs_omap_board_data igep2_usbhs_bdata __initconst = {
461 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, 600 .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
462 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, 601 .port_mode[1] = OMAP_USBHS_PORT_MODE_UNUSED,
463 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, 602 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
464 603
465 .phy_reset = true, 604 .phy_reset = true,
466 .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET, 605 .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
@@ -468,77 +607,113 @@ static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
468 .reset_gpio_port[2] = -EINVAL, 607 .reset_gpio_port[2] = -EINVAL,
469}; 608};
470 609
610static const struct usbhs_omap_board_data igep3_usbhs_bdata __initconst = {
611 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
612 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
613 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
614
615 .phy_reset = true,
616 .reset_gpio_port[0] = -EINVAL,
617 .reset_gpio_port[1] = IGEP3_GPIO_USBH_NRESET,
618 .reset_gpio_port[2] = -EINVAL,
619};
620
471#ifdef CONFIG_OMAP_MUX 621#ifdef CONFIG_OMAP_MUX
472static struct omap_board_mux board_mux[] __initdata = { 622static struct omap_board_mux board_mux[] __initdata = {
473 { .reg_offset = OMAP_MUX_TERMINATOR }, 623 { .reg_offset = OMAP_MUX_TERMINATOR },
474}; 624};
475#else
476#define board_mux NULL
477#endif 625#endif
478 626
479static void __init igep2_init(void) 627#if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE)
628static struct gpio igep_wlan_bt_gpios[] __initdata = {
629 { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NPD" },
630 { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_WIFI_NRESET" },
631 { -EINVAL, GPIOF_OUT_INIT_HIGH, "GPIO_BT_NRESET" },
632};
633
634static void __init igep_wlan_bt_init(void)
480{ 635{
481 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); 636 int err;
482 igep2_i2c_init(); 637
483 platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices)); 638 /* GPIO's for WLAN-BT combo depends on hardware revision */
484 omap_serial_init(); 639 if (hwrev == IGEP2_BOARD_HWREV_B) {
485 usb_musb_init(&musb_board_data); 640 igep_wlan_bt_gpios[0].gpio = IGEP2_RB_GPIO_WIFI_NPD;
486 usb_ehci_init(&ehci_pdata); 641 igep_wlan_bt_gpios[1].gpio = IGEP2_RB_GPIO_WIFI_NRESET;
642 igep_wlan_bt_gpios[2].gpio = IGEP2_RB_GPIO_BT_NRESET;
643 } else if (hwrev == IGEP2_BOARD_HWREV_C || machine_is_igep0030()) {
644 igep_wlan_bt_gpios[0].gpio = IGEP2_RC_GPIO_WIFI_NPD;
645 igep_wlan_bt_gpios[1].gpio = IGEP2_RC_GPIO_WIFI_NRESET;
646 igep_wlan_bt_gpios[2].gpio = IGEP2_RC_GPIO_BT_NRESET;
647 } else
648 return;
487 649
488 igep2_flash_init(); 650 err = gpio_request_array(igep_wlan_bt_gpios,
489 igep2_init_led(); 651 ARRAY_SIZE(igep_wlan_bt_gpios));
490 igep2_display_init(); 652 if (err) {
491 igep2_init_smsc911x(); 653 pr_warning("IGEP2: Could not obtain WIFI/BT gpios\n");
654 return;
655 }
492 656
493 /* GPIO userspace leds */ 657 gpio_export(igep_wlan_bt_gpios[0].gpio, 0);
494#if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) 658 gpio_export(igep_wlan_bt_gpios[1].gpio, 0);
495 if ((gpio_request(IGEP2_GPIO_LED0_RED, "led0:red") == 0) && 659 gpio_export(igep_wlan_bt_gpios[2].gpio, 0);
496 (gpio_direction_output(IGEP2_GPIO_LED0_RED, 1) == 0)) {
497 gpio_export(IGEP2_GPIO_LED0_RED, 0);
498 gpio_set_value(IGEP2_GPIO_LED0_RED, 0);
499 } else
500 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n");
501 660
502 if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "led0:green") == 0) && 661 gpio_set_value(igep_wlan_bt_gpios[1].gpio, 0);
503 (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 1) == 0)) { 662 udelay(10);
504 gpio_export(IGEP2_GPIO_LED0_GREEN, 0); 663 gpio_set_value(igep_wlan_bt_gpios[1].gpio, 1);
505 gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0);
506 } else
507 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n");
508 664
509 if ((gpio_request(IGEP2_GPIO_LED1_RED, "led1:red") == 0) && 665}
510 (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) { 666#else
511 gpio_export(IGEP2_GPIO_LED1_RED, 0); 667static inline void __init igep_wlan_bt_init(void) { }
512 gpio_set_value(IGEP2_GPIO_LED1_RED, 0);
513 } else
514 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n");
515#endif 668#endif
516 669
517 /* GPIO W-LAN + Bluetooth combo module */ 670static void __init igep_init(void)
518 if ((gpio_request(IGEP2_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) && 671{
519 (gpio_direction_output(IGEP2_GPIO_WIFI_NPD, 1) == 0)) { 672 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
520 gpio_export(IGEP2_GPIO_WIFI_NPD, 0); 673
521/* gpio_set_value(IGEP2_GPIO_WIFI_NPD, 0); */ 674 /* Get IGEP2 hardware revision */
522 } else 675 igep2_get_revision();
523 pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NPD\n"); 676 /* Register I2C busses and drivers */
524 677 igep_i2c_init();
525 if ((gpio_request(IGEP2_GPIO_WIFI_NRESET, "GPIO_WIFI_NRESET") == 0) && 678 platform_add_devices(igep_devices, ARRAY_SIZE(igep_devices));
526 (gpio_direction_output(IGEP2_GPIO_WIFI_NRESET, 1) == 0)) { 679 omap_serial_init();
527 gpio_export(IGEP2_GPIO_WIFI_NRESET, 0); 680 usb_musb_init(NULL);
528 gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 0); 681
529 udelay(10); 682 igep_flash_init();
530 gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 1); 683 igep_leds_init();
531 } else 684
532 pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NRESET\n"); 685 /*
686 * WLAN-BT combo module from MuRata which has a Marvell WLAN
687 * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface.
688 */
689 igep_wlan_bt_init();
690
691 if (machine_is_igep0020()) {
692 omap_display_init(&igep2_dss_data);
693 igep2_display_init();
694 igep2_init_smsc911x();
695 usbhs_init(&igep2_usbhs_bdata);
696 } else {
697 usbhs_init(&igep3_usbhs_bdata);
698 }
533} 699}
534 700
535MACHINE_START(IGEP0020, "IGEP v2 board") 701MACHINE_START(IGEP0020, "IGEP v2 board")
536 .phys_io = 0x48000000,
537 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
538 .boot_params = 0x80000100, 702 .boot_params = 0x80000100,
703 .reserve = omap_reserve,
539 .map_io = omap3_map_io, 704 .map_io = omap3_map_io,
705 .init_early = igep_init_early,
706 .init_irq = omap_init_irq,
707 .init_machine = igep_init,
708 .timer = &omap_timer,
709MACHINE_END
710
711MACHINE_START(IGEP0030, "IGEP OMAP3 module")
712 .boot_params = 0x80000100,
540 .reserve = omap_reserve, 713 .reserve = omap_reserve,
541 .init_irq = igep2_init_irq, 714 .map_io = omap3_map_io,
542 .init_machine = igep2_init, 715 .init_early = igep_init_early,
716 .init_irq = omap_init_irq,
717 .init_machine = igep_init,
543 .timer = &omap_timer, 718 .timer = &omap_timer,
544MACHINE_END 719MACHINE_END