Commit | Line | Data |
---|---|---|
58e11162 EBS |
1 | /* |
2 | * Copyright (C) 2009 Integration Software and Electronic Engineering. | |
3 | * | |
4 | * Modified from mach-omap2/board-generic.c | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License version 2 as | |
8 | * published by the Free Software Foundation. | |
9 | */ | |
10 | ||
11 | #include <linux/kernel.h> | |
12 | #include <linux/init.h> | |
13 | #include <linux/platform_device.h> | |
14 | #include <linux/delay.h> | |
15 | #include <linux/err.h> | |
16 | #include <linux/clk.h> | |
17 | #include <linux/io.h> | |
18 | #include <linux/gpio.h> | |
19 | #include <linux/interrupt.h> | |
20 | ||
21 | #include <linux/regulator/machine.h> | |
ebeb53e1 | 22 | #include <linux/i2c/twl.h> |
3a63833e | 23 | #include <linux/mmc/host.h> |
58e11162 EBS |
24 | |
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> | |
58e11162 | 31 | #include <plat/usb.h> |
691de27f | 32 | #include <plat/display.h> |
cddb483a | 33 | #include <plat/onenand.h> |
58e11162 | 34 | |
ca5742bd | 35 | #include "mux.h" |
d02a900b | 36 | #include "hsmmc.h" |
22f1baac | 37 | #include "sdram-numonyx-m65kxxxxam.h" |
58e11162 EBS |
38 | |
39 | #define IGEP2_SMSC911X_CS 5 | |
40 | #define IGEP2_SMSC911X_GPIO 176 | |
41 | #define IGEP2_GPIO_USBH_NRESET 24 | |
5a9fcc99 EBS |
42 | #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 | |
58e11162 | 53 | |
3f8c48d9 EBS |
54 | /* |
55 | * IGEP2 Hardware Revision Table | |
56 | * | |
5a9fcc99 EBS |
57 | * -------------------------------------------------------------------------- |
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 | * -------------------------------------------------------------------------- | |
3f8c48d9 EBS |
64 | */ |
65 | ||
66 | #define IGEP2_BOARD_HWREV_B 0 | |
67 | #define IGEP2_BOARD_HWREV_C 1 | |
68 | ||
69 | static u8 hwrev; | |
70 | ||
71 | static 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 | } | |
58e11162 | 97 | |
cddb483a EBS |
98 | #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 | ||
111 | static 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 | ||
cddb483a EBS |
139 | static struct omap_onenand_platform_data igep2_onenand_data = { |
140 | .parts = igep2_onenand_partitions, | |
141 | .nr_parts = ARRAY_SIZE(igep2_onenand_partitions), | |
cddb483a EBS |
142 | .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ |
143 | }; | |
144 | ||
145 | static struct platform_device igep2_onenand_device = { | |
146 | .name = "omap2-onenand", | |
147 | .id = -1, | |
148 | .dev = { | |
149 | .platform_data = &igep2_onenand_data, | |
150 | }, | |
151 | }; | |
152 | ||
04aeae77 | 153 | static void __init igep2_flash_init(void) |
cddb483a | 154 | { |
235228ba EBS |
155 | u8 cs = 0; |
156 | u8 onenandcs = GPMC_CS_NUM + 1; | |
cddb483a | 157 | |
235228ba EBS |
158 | for (cs = 0; cs < GPMC_CS_NUM; cs++) { |
159 | u32 ret; | |
cddb483a EBS |
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 */ | |
235228ba | 165 | pr_err("IGEP2: Unsupported NAND found\n"); |
cddb483a EBS |
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 | } | |
cddb483a | 172 | } |
235228ba | 173 | |
cddb483a | 174 | if (onenandcs > GPMC_CS_NUM) { |
235228ba | 175 | pr_err("IGEP2: Unable to find configuration in GPMC\n"); |
cddb483a EBS |
176 | return; |
177 | } | |
178 | ||
235228ba EBS |
179 | igep2_onenand_data.cs = onenandcs; |
180 | ||
181 | if (platform_device_register(&igep2_onenand_device) < 0) | |
182 | pr_err("IGEP2: Unable to register OneNAND device\n"); | |
cddb483a EBS |
183 | } |
184 | ||
185 | #else | |
04aeae77 | 186 | static void __init igep2_flash_init(void) {} |
cddb483a EBS |
187 | #endif |
188 | ||
58e11162 EBS |
189 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
190 | ||
191 | #include <linux/smsc911x.h> | |
192 | ||
193 | static struct smsc911x_platform_config igep2_smsc911x_config = { | |
194 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, | |
195 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, | |
196 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS , | |
197 | .phy_interface = PHY_INTERFACE_MODE_MII, | |
198 | }; | |
199 | ||
200 | static struct resource igep2_smsc911x_resources[] = { | |
201 | { | |
202 | .flags = IORESOURCE_MEM, | |
203 | }, | |
204 | { | |
205 | .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO), | |
206 | .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO), | |
207 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, | |
208 | }, | |
209 | }; | |
210 | ||
211 | static struct platform_device igep2_smsc911x_device = { | |
212 | .name = "smsc911x", | |
213 | .id = 0, | |
214 | .num_resources = ARRAY_SIZE(igep2_smsc911x_resources), | |
215 | .resource = igep2_smsc911x_resources, | |
216 | .dev = { | |
217 | .platform_data = &igep2_smsc911x_config, | |
218 | }, | |
219 | }; | |
220 | ||
221 | static inline void __init igep2_init_smsc911x(void) | |
222 | { | |
223 | unsigned long cs_mem_base; | |
224 | ||
225 | if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { | |
226 | pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n"); | |
227 | gpmc_cs_free(IGEP2_SMSC911X_CS); | |
228 | return; | |
229 | } | |
230 | ||
231 | igep2_smsc911x_resources[0].start = cs_mem_base + 0x0; | |
232 | igep2_smsc911x_resources[0].end = cs_mem_base + 0xff; | |
233 | ||
234 | if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) && | |
235 | (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) { | |
236 | gpio_export(IGEP2_SMSC911X_GPIO, 0); | |
237 | } else { | |
238 | pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n"); | |
239 | return; | |
240 | } | |
241 | ||
242 | platform_device_register(&igep2_smsc911x_device); | |
243 | } | |
244 | ||
245 | #else | |
246 | static inline void __init igep2_init_smsc911x(void) { } | |
247 | #endif | |
248 | ||
58e11162 EBS |
249 | static struct regulator_consumer_supply igep2_vmmc1_supply = { |
250 | .supply = "vmmc", | |
251 | }; | |
252 | ||
253 | /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ | |
254 | static struct regulator_init_data igep2_vmmc1 = { | |
255 | .constraints = { | |
256 | .min_uV = 1850000, | |
257 | .max_uV = 3150000, | |
258 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
259 | | REGULATOR_MODE_STANDBY, | |
260 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
261 | | REGULATOR_CHANGE_MODE | |
262 | | REGULATOR_CHANGE_STATUS, | |
263 | }, | |
264 | .num_consumer_supplies = 1, | |
265 | .consumer_supplies = &igep2_vmmc1_supply, | |
266 | }; | |
267 | ||
68ff0423 | 268 | static struct omap2_hsmmc_info mmc[] = { |
58e11162 EBS |
269 | { |
270 | .mmc = 1, | |
3a63833e | 271 | .caps = MMC_CAP_4_BIT_DATA, |
58e11162 EBS |
272 | .gpio_cd = -EINVAL, |
273 | .gpio_wp = -EINVAL, | |
274 | }, | |
5a9fcc99 | 275 | #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) |
58e11162 EBS |
276 | { |
277 | .mmc = 2, | |
3a63833e | 278 | .caps = MMC_CAP_4_BIT_DATA, |
58e11162 EBS |
279 | .gpio_cd = -EINVAL, |
280 | .gpio_wp = -EINVAL, | |
281 | }, | |
5a9fcc99 | 282 | #endif |
58e11162 EBS |
283 | {} /* Terminator */ |
284 | }; | |
285 | ||
bee15390 EBS |
286 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
287 | #include <linux/leds.h> | |
288 | ||
289 | static struct gpio_led igep2_gpio_leds[] = { | |
290 | [0] = { | |
291 | .name = "gpio-led:red:d0", | |
292 | .gpio = IGEP2_GPIO_LED0_RED, | |
293 | .default_trigger = "default-off" | |
294 | }, | |
295 | [1] = { | |
296 | .name = "gpio-led:green:d0", | |
297 | .gpio = IGEP2_GPIO_LED0_GREEN, | |
298 | .default_trigger = "default-off", | |
299 | }, | |
300 | [2] = { | |
301 | .name = "gpio-led:red:d1", | |
302 | .gpio = IGEP2_GPIO_LED1_RED, | |
303 | .default_trigger = "default-off", | |
304 | }, | |
305 | [3] = { | |
306 | .name = "gpio-led:green:d1", | |
307 | .default_trigger = "heartbeat", | |
308 | .gpio = -EINVAL, /* gets replaced */ | |
309 | }, | |
310 | }; | |
311 | ||
312 | static struct gpio_led_platform_data igep2_led_pdata = { | |
313 | .leds = igep2_gpio_leds, | |
314 | .num_leds = ARRAY_SIZE(igep2_gpio_leds), | |
315 | }; | |
316 | ||
317 | static struct platform_device igep2_led_device = { | |
318 | .name = "leds-gpio", | |
319 | .id = -1, | |
320 | .dev = { | |
321 | .platform_data = &igep2_led_pdata, | |
322 | }, | |
323 | }; | |
324 | ||
325 | static void __init igep2_leds_init(void) | |
326 | { | |
327 | platform_device_register(&igep2_led_device); | |
328 | } | |
329 | ||
330 | #else | |
331 | static inline void igep2_leds_init(void) | |
332 | { | |
333 | if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) && | |
334 | (gpio_direction_output(IGEP2_GPIO_LED0_RED, 1) == 0)) { | |
335 | gpio_export(IGEP2_GPIO_LED0_RED, 0); | |
336 | gpio_set_value(IGEP2_GPIO_LED0_RED, 0); | |
337 | } else | |
338 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n"); | |
339 | ||
340 | if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) && | |
341 | (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 1) == 0)) { | |
342 | gpio_export(IGEP2_GPIO_LED0_GREEN, 0); | |
343 | gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0); | |
344 | } else | |
345 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n"); | |
346 | ||
347 | if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) && | |
348 | (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) { | |
349 | gpio_export(IGEP2_GPIO_LED1_RED, 0); | |
350 | gpio_set_value(IGEP2_GPIO_LED1_RED, 0); | |
351 | } else | |
352 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n"); | |
353 | ||
354 | } | |
355 | #endif | |
356 | ||
58e11162 EBS |
357 | static int igep2_twl_gpio_setup(struct device *dev, |
358 | unsigned gpio, unsigned ngpio) | |
359 | { | |
360 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | |
361 | mmc[0].gpio_cd = gpio + 0; | |
68ff0423 | 362 | omap2_hsmmc_init(mmc); |
58e11162 | 363 | |
72f381ba EBS |
364 | /* |
365 | * link regulators to MMC adapters ... we "know" the | |
58e11162 | 366 | * regulators will be set up only *after* we return. |
72f381ba | 367 | */ |
58e11162 EBS |
368 | igep2_vmmc1_supply.dev = mmc[0].dev; |
369 | ||
61e118dd EBS |
370 | /* |
371 | * REVISIT: need ehci-omap hooks for external VBUS | |
372 | * power switch and overcurrent detect | |
373 | */ | |
374 | if ((gpio_request(gpio + 1, "GPIO_EHCI_NOC") < 0) || | |
375 | (gpio_direction_input(gpio + 1) < 0)) | |
376 | pr_err("IGEP2: Could not obtain gpio for EHCI NOC"); | |
377 | ||
378 | /* | |
379 | * TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN | |
380 | * (out, active low) | |
381 | */ | |
382 | if ((gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USBH_CPEN") < 0) || | |
383 | (gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0) < 0)) | |
384 | pr_err("IGEP2: Could not obtain gpio for USBH_CPEN"); | |
385 | ||
bee15390 EBS |
386 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ |
387 | #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) | |
388 | if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0) | |
389 | && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) { | |
390 | gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); | |
391 | gpio_set_value(gpio + TWL4030_GPIO_MAX + 1, 0); | |
392 | } else | |
393 | 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 | |
58e11162 EBS |
397 | |
398 | return 0; | |
399 | }; | |
400 | ||
bee15390 | 401 | static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = { |
58e11162 EBS |
402 | .gpio_base = OMAP_MAX_GPIO_LINES, |
403 | .irq_base = TWL4030_GPIO_IRQ_BASE, | |
404 | .irq_end = TWL4030_GPIO_IRQ_END, | |
bee15390 | 405 | .use_leds = true, |
58e11162 EBS |
406 | .setup = igep2_twl_gpio_setup, |
407 | }; | |
408 | ||
409 | static struct twl4030_usb_data igep2_usb_data = { | |
410 | .usb_mode = T2_USB_MODE_ULPI, | |
411 | }; | |
412 | ||
691de27f EBS |
413 | static 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 | ||
420 | static void igep2_disable_dvi(struct omap_dss_device *dssdev) | |
421 | { | |
422 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0); | |
423 | } | |
424 | ||
425 | static struct omap_dss_device igep2_dvi_device = { | |
426 | .type = OMAP_DISPLAY_TYPE_DPI, | |
427 | .name = "dvi", | |
428 | .driver_name = "generic_panel", | |
429 | .phy.dpi.data_lines = 24, | |
430 | .platform_enable = igep2_enable_dvi, | |
431 | .platform_disable = igep2_disable_dvi, | |
432 | }; | |
433 | ||
434 | static struct omap_dss_device *igep2_dss_devices[] = { | |
435 | &igep2_dvi_device | |
436 | }; | |
437 | ||
438 | static struct omap_dss_board_info igep2_dss_data = { | |
439 | .num_devices = ARRAY_SIZE(igep2_dss_devices), | |
440 | .devices = igep2_dss_devices, | |
441 | .default_device = &igep2_dvi_device, | |
442 | }; | |
443 | ||
444 | static struct platform_device igep2_dss_device = { | |
445 | .name = "omapdss", | |
446 | .id = -1, | |
447 | .dev = { | |
448 | .platform_data = &igep2_dss_data, | |
449 | }, | |
450 | }; | |
451 | ||
452 | static struct regulator_consumer_supply igep2_vpll2_supply = { | |
453 | .supply = "vdds_dsi", | |
454 | .dev = &igep2_dss_device.dev, | |
455 | }; | |
456 | ||
457 | static struct regulator_init_data igep2_vpll2 = { | |
458 | .constraints = { | |
459 | .name = "VDVI", | |
460 | .min_uV = 1800000, | |
461 | .max_uV = 1800000, | |
462 | .apply_uV = true, | |
463 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
464 | | REGULATOR_MODE_STANDBY, | |
465 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
466 | | REGULATOR_CHANGE_STATUS, | |
467 | }, | |
468 | .num_consumer_supplies = 1, | |
469 | .consumer_supplies = &igep2_vpll2_supply, | |
470 | }; | |
471 | ||
472 | static void __init igep2_display_init(void) | |
473 | { | |
474 | if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") && | |
475 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1)) | |
476 | pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); | |
477 | } | |
228893f9 | 478 | |
691de27f EBS |
479 | static struct platform_device *igep2_devices[] __initdata = { |
480 | &igep2_dss_device, | |
481 | }; | |
482 | ||
58e11162 EBS |
483 | static void __init igep2_init_irq(void) |
484 | { | |
22f1baac | 485 | omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params); |
58e11162 | 486 | omap_init_irq(); |
58e11162 EBS |
487 | } |
488 | ||
7f5f23da EBS |
489 | static struct twl4030_codec_audio_data igep2_audio_data = { |
490 | .audio_mclk = 26000000, | |
491 | }; | |
492 | ||
493 | static struct twl4030_codec_data igep2_codec_data = { | |
494 | .audio_mclk = 26000000, | |
495 | .audio = &igep2_audio_data, | |
496 | }; | |
497 | ||
58e11162 EBS |
498 | static struct twl4030_platform_data igep2_twldata = { |
499 | .irq_base = TWL4030_IRQ_BASE, | |
500 | .irq_end = TWL4030_IRQ_END, | |
501 | ||
502 | /* platform_data for children goes here */ | |
503 | .usb = &igep2_usb_data, | |
7f5f23da | 504 | .codec = &igep2_codec_data, |
bee15390 | 505 | .gpio = &igep2_twl4030_gpio_pdata, |
58e11162 | 506 | .vmmc1 = &igep2_vmmc1, |
691de27f | 507 | .vpll2 = &igep2_vpll2, |
58e11162 EBS |
508 | |
509 | }; | |
510 | ||
91d139cf | 511 | static struct i2c_board_info __initdata igep2_i2c1_boardinfo[] = { |
58e11162 EBS |
512 | { |
513 | I2C_BOARD_INFO("twl4030", 0x48), | |
514 | .flags = I2C_CLIENT_WAKE, | |
515 | .irq = INT_34XX_SYS_NIRQ, | |
516 | .platform_data = &igep2_twldata, | |
517 | }, | |
518 | }; | |
519 | ||
91d139cf EBS |
520 | static struct i2c_board_info __initdata igep2_i2c3_boardinfo[] = { |
521 | { | |
522 | I2C_BOARD_INFO("eeprom", 0x50), | |
523 | }, | |
524 | }; | |
525 | ||
526 | static void __init igep2_i2c_init(void) | |
58e11162 | 527 | { |
91d139cf EBS |
528 | int ret; |
529 | ||
530 | ret = omap_register_i2c_bus(1, 2600, igep2_i2c1_boardinfo, | |
531 | ARRAY_SIZE(igep2_i2c1_boardinfo)); | |
532 | if (ret) | |
533 | pr_warning("IGEP2: Could not register I2C1 bus (%d)\n", ret); | |
534 | ||
535 | /* | |
536 | * Bus 3 is attached to the DVI port where devices like the pico DLP | |
537 | * projector don't work reliably with 400kHz | |
538 | */ | |
539 | ret = omap_register_i2c_bus(3, 100, igep2_i2c3_boardinfo, | |
540 | ARRAY_SIZE(igep2_i2c3_boardinfo)); | |
541 | if (ret) | |
542 | pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret); | |
58e11162 EBS |
543 | } |
544 | ||
884b8369 MM |
545 | static struct omap_musb_board_data musb_board_data = { |
546 | .interface_type = MUSB_INTERFACE_ULPI, | |
547 | .mode = MUSB_OTG, | |
548 | .power = 100, | |
549 | }; | |
550 | ||
6f69a181 | 551 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
f6b74535 EBS |
552 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, |
553 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, | |
d0885486 EBS |
554 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
555 | ||
556 | .phy_reset = true, | |
f6b74535 EBS |
557 | .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET, |
558 | .reset_gpio_port[1] = -EINVAL, | |
d0885486 EBS |
559 | .reset_gpio_port[2] = -EINVAL, |
560 | }; | |
561 | ||
ca5742bd TL |
562 | #ifdef CONFIG_OMAP_MUX |
563 | static struct omap_board_mux board_mux[] __initdata = { | |
564 | { .reg_offset = OMAP_MUX_TERMINATOR }, | |
565 | }; | |
ca5742bd TL |
566 | #endif |
567 | ||
5a9fcc99 EBS |
568 | #if defined(CONFIG_LIBERTAS_SDIO) || defined(CONFIG_LIBERTAS_SDIO_MODULE) |
569 | ||
570 | static void __init igep2_wlan_bt_init(void) | |
571 | { | |
572 | unsigned npd, wreset, btreset; | |
573 | ||
574 | /* GPIO's for WLAN-BT combo depends on hardware revision */ | |
575 | if (hwrev == IGEP2_BOARD_HWREV_B) { | |
576 | npd = IGEP2_RB_GPIO_WIFI_NPD; | |
577 | wreset = IGEP2_RB_GPIO_WIFI_NRESET; | |
578 | btreset = IGEP2_RB_GPIO_BT_NRESET; | |
579 | } else if (hwrev == IGEP2_BOARD_HWREV_C) { | |
580 | npd = IGEP2_RC_GPIO_WIFI_NPD; | |
581 | wreset = IGEP2_RC_GPIO_WIFI_NRESET; | |
582 | btreset = IGEP2_RC_GPIO_BT_NRESET; | |
583 | } else | |
584 | return; | |
585 | ||
586 | /* Set GPIO's for WLAN-BT combo module */ | |
587 | if ((gpio_request(npd, "GPIO_WIFI_NPD") == 0) && | |
588 | (gpio_direction_output(npd, 1) == 0)) { | |
589 | gpio_export(npd, 0); | |
590 | } else | |
591 | pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NPD\n"); | |
592 | ||
593 | if ((gpio_request(wreset, "GPIO_WIFI_NRESET") == 0) && | |
594 | (gpio_direction_output(wreset, 1) == 0)) { | |
595 | gpio_export(wreset, 0); | |
596 | gpio_set_value(wreset, 0); | |
597 | udelay(10); | |
598 | gpio_set_value(wreset, 1); | |
599 | } else | |
600 | pr_warning("IGEP2: Could not obtain gpio GPIO_WIFI_NRESET\n"); | |
601 | ||
602 | if ((gpio_request(btreset, "GPIO_BT_NRESET") == 0) && | |
603 | (gpio_direction_output(btreset, 1) == 0)) { | |
604 | gpio_export(btreset, 0); | |
605 | } else | |
606 | pr_warning("IGEP2: Could not obtain gpio GPIO_BT_NRESET\n"); | |
607 | } | |
608 | #else | |
609 | static inline void __init igep2_wlan_bt_init(void) { } | |
610 | #endif | |
611 | ||
58e11162 EBS |
612 | static void __init igep2_init(void) |
613 | { | |
ca5742bd | 614 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
3f8c48d9 EBS |
615 | |
616 | /* Get IGEP2 hardware revision */ | |
617 | igep2_get_revision(); | |
91d139cf | 618 | /* Register I2C busses and drivers */ |
58e11162 | 619 | igep2_i2c_init(); |
691de27f | 620 | platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices)); |
58e11162 | 621 | omap_serial_init(); |
884b8369 | 622 | usb_musb_init(&musb_board_data); |
d0885486 | 623 | usb_ehci_init(&ehci_pdata); |
58e11162 | 624 | |
cddb483a | 625 | igep2_flash_init(); |
bee15390 | 626 | igep2_leds_init(); |
691de27f | 627 | igep2_display_init(); |
58e11162 EBS |
628 | igep2_init_smsc911x(); |
629 | ||
5a9fcc99 EBS |
630 | /* |
631 | * WLAN-BT combo module from MuRata wich has a Marvell WLAN | |
632 | * (88W8686) + CSR Bluetooth chipset. Uses SDIO interface. | |
633 | */ | |
634 | igep2_wlan_bt_init(); | |
c67b0d98 | 635 | |
58e11162 EBS |
636 | } |
637 | ||
58e11162 | 638 | MACHINE_START(IGEP0020, "IGEP v2 board") |
58e11162 | 639 | .boot_params = 0x80000100, |
869fef41 | 640 | .map_io = omap3_map_io, |
71ee7dad | 641 | .reserve = omap_reserve, |
58e11162 EBS |
642 | .init_irq = igep2_init_irq, |
643 | .init_machine = igep2_init, | |
644 | .timer = &omap_timer, | |
645 | MACHINE_END |