diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-igep0020.c')
-rw-r--r-- | arch/arm/mach-omap2/board-igep0020.c | 285 |
1 files changed, 278 insertions, 7 deletions
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c index 117b8fd7e3a6..9958987a3d0a 100644 --- a/arch/arm/mach-omap2/board-igep0020.c +++ b/arch/arm/mach-omap2/board-igep0020.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/clk.h> | 16 | #include <linux/clk.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/gpio.h> | 18 | #include <linux/gpio.h> |
19 | #include <linux/leds.h> | ||
19 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
20 | 21 | ||
21 | #include <linux/regulator/machine.h> | 22 | #include <linux/regulator/machine.h> |
@@ -28,9 +29,12 @@ | |||
28 | #include <plat/common.h> | 29 | #include <plat/common.h> |
29 | #include <plat/gpmc.h> | 30 | #include <plat/gpmc.h> |
30 | #include <plat/usb.h> | 31 | #include <plat/usb.h> |
32 | #include <plat/display.h> | ||
33 | #include <plat/onenand.h> | ||
31 | 34 | ||
32 | #include "mux.h" | 35 | #include "mux.h" |
33 | #include "mmc-twl4030.h" | 36 | #include "hsmmc.h" |
37 | #include "sdram-numonyx-m65kxxxxam.h" | ||
34 | 38 | ||
35 | #define IGEP2_SMSC911X_CS 5 | 39 | #define IGEP2_SMSC911X_CS 5 |
36 | #define IGEP2_SMSC911X_GPIO 176 | 40 | #define IGEP2_SMSC911X_GPIO 176 |
@@ -38,6 +42,108 @@ | |||
38 | #define IGEP2_GPIO_LED0_RED 26 | 42 | #define IGEP2_GPIO_LED0_RED 26 |
39 | #define IGEP2_GPIO_LED0_GREEN 27 | 43 | #define IGEP2_GPIO_LED0_GREEN 27 |
40 | #define IGEP2_GPIO_LED1_RED 28 | 44 | #define IGEP2_GPIO_LED1_RED 28 |
45 | #define IGEP2_GPIO_DVI_PUP 170 | ||
46 | #define IGEP2_GPIO_WIFI_NPD 94 | ||
47 | #define IGEP2_GPIO_WIFI_NRESET 95 | ||
48 | |||
49 | #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ | ||
50 | defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) | ||
51 | |||
52 | #define ONENAND_MAP 0x20000000 | ||
53 | |||
54 | /* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY ) | ||
55 | * Since the device is equipped with two DataRAMs, and two-plane NAND | ||
56 | * Flash memory array, these two component enables simultaneous program | ||
57 | * of 4KiB. Plane1 has only even blocks such as block0, block2, block4 | ||
58 | * while Plane2 has only odd blocks such as block1, block3, block5. | ||
59 | * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048) | ||
60 | */ | ||
61 | |||
62 | static struct mtd_partition igep2_onenand_partitions[] = { | ||
63 | { | ||
64 | .name = "X-Loader", | ||
65 | .offset = 0, | ||
66 | .size = 2 * (64*(2*2048)) | ||
67 | }, | ||
68 | { | ||
69 | .name = "U-Boot", | ||
70 | .offset = MTDPART_OFS_APPEND, | ||
71 | .size = 6 * (64*(2*2048)), | ||
72 | }, | ||
73 | { | ||
74 | .name = "Environment", | ||
75 | .offset = MTDPART_OFS_APPEND, | ||
76 | .size = 2 * (64*(2*2048)), | ||
77 | }, | ||
78 | { | ||
79 | .name = "Kernel", | ||
80 | .offset = MTDPART_OFS_APPEND, | ||
81 | .size = 12 * (64*(2*2048)), | ||
82 | }, | ||
83 | { | ||
84 | .name = "File System", | ||
85 | .offset = MTDPART_OFS_APPEND, | ||
86 | .size = MTDPART_SIZ_FULL, | ||
87 | }, | ||
88 | }; | ||
89 | |||
90 | static int igep2_onenand_setup(void __iomem *onenand_base, int freq) | ||
91 | { | ||
92 | /* nothing is required to be setup for onenand as of now */ | ||
93 | return 0; | ||
94 | } | ||
95 | |||
96 | static struct omap_onenand_platform_data igep2_onenand_data = { | ||
97 | .parts = igep2_onenand_partitions, | ||
98 | .nr_parts = ARRAY_SIZE(igep2_onenand_partitions), | ||
99 | .onenand_setup = igep2_onenand_setup, | ||
100 | .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ | ||
101 | }; | ||
102 | |||
103 | static struct platform_device igep2_onenand_device = { | ||
104 | .name = "omap2-onenand", | ||
105 | .id = -1, | ||
106 | .dev = { | ||
107 | .platform_data = &igep2_onenand_data, | ||
108 | }, | ||
109 | }; | ||
110 | |||
111 | void __init igep2_flash_init(void) | ||
112 | { | ||
113 | u8 cs = 0; | ||
114 | u8 onenandcs = GPMC_CS_NUM + 1; | ||
115 | |||
116 | while (cs < GPMC_CS_NUM) { | ||
117 | u32 ret = 0; | ||
118 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
119 | |||
120 | /* Check if NAND/oneNAND is configured */ | ||
121 | if ((ret & 0xC00) == 0x800) | ||
122 | /* NAND found */ | ||
123 | pr_err("IGEP v2: Unsupported NAND found\n"); | ||
124 | else { | ||
125 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); | ||
126 | if ((ret & 0x3F) == (ONENAND_MAP >> 24)) | ||
127 | /* ONENAND found */ | ||
128 | onenandcs = cs; | ||
129 | } | ||
130 | cs++; | ||
131 | } | ||
132 | if (onenandcs > GPMC_CS_NUM) { | ||
133 | pr_err("IGEP v2: Unable to find configuration in GPMC\n"); | ||
134 | return; | ||
135 | } | ||
136 | |||
137 | if (onenandcs < GPMC_CS_NUM) { | ||
138 | igep2_onenand_data.cs = onenandcs; | ||
139 | if (platform_device_register(&igep2_onenand_device) < 0) | ||
140 | pr_err("IGEP v2: Unable to register OneNAND device\n"); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | #else | ||
145 | void __init igep2_flash_init(void) {} | ||
146 | #endif | ||
41 | 147 | ||
42 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) | 148 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
43 | 149 | ||
@@ -106,6 +212,10 @@ static struct regulator_consumer_supply igep2_vmmc1_supply = { | |||
106 | .supply = "vmmc", | 212 | .supply = "vmmc", |
107 | }; | 213 | }; |
108 | 214 | ||
215 | static struct regulator_consumer_supply igep2_vmmc2_supply = { | ||
216 | .supply = "vmmc", | ||
217 | }; | ||
218 | |||
109 | /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ | 219 | /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ |
110 | static struct regulator_init_data igep2_vmmc1 = { | 220 | static struct regulator_init_data igep2_vmmc1 = { |
111 | .constraints = { | 221 | .constraints = { |
@@ -121,7 +231,22 @@ static struct regulator_init_data igep2_vmmc1 = { | |||
121 | .consumer_supplies = &igep2_vmmc1_supply, | 231 | .consumer_supplies = &igep2_vmmc1_supply, |
122 | }; | 232 | }; |
123 | 233 | ||
124 | static struct twl4030_hsmmc_info mmc[] = { | 234 | /* VMMC2 for OMAP VDD_MMC2 (i/o) and MMC2 WIFI */ |
235 | static struct regulator_init_data igep2_vmmc2 = { | ||
236 | .constraints = { | ||
237 | .min_uV = 1850000, | ||
238 | .max_uV = 3150000, | ||
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_vmmc2_supply, | ||
247 | }; | ||
248 | |||
249 | static struct omap2_hsmmc_info mmc[] = { | ||
125 | { | 250 | { |
126 | .mmc = 1, | 251 | .mmc = 1, |
127 | .wires = 4, | 252 | .wires = 4, |
@@ -142,12 +267,13 @@ static int igep2_twl_gpio_setup(struct device *dev, | |||
142 | { | 267 | { |
143 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 268 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
144 | mmc[0].gpio_cd = gpio + 0; | 269 | mmc[0].gpio_cd = gpio + 0; |
145 | twl4030_mmc_init(mmc); | 270 | omap2_hsmmc_init(mmc); |
146 | 271 | ||
147 | /* link regulators to MMC adapters ... we "know" the | 272 | /* link regulators to MMC adapters ... we "know" the |
148 | * regulators will be set up only *after* we return. | 273 | * regulators will be set up only *after* we return. |
149 | */ | 274 | */ |
150 | igep2_vmmc1_supply.dev = mmc[0].dev; | 275 | igep2_vmmc1_supply.dev = mmc[0].dev; |
276 | igep2_vmmc2_supply.dev = mmc[1].dev; | ||
151 | 277 | ||
152 | return 0; | 278 | return 0; |
153 | }; | 279 | }; |
@@ -164,23 +290,130 @@ static struct twl4030_usb_data igep2_usb_data = { | |||
164 | .usb_mode = T2_USB_MODE_ULPI, | 290 | .usb_mode = T2_USB_MODE_ULPI, |
165 | }; | 291 | }; |
166 | 292 | ||
293 | static int igep2_enable_dvi(struct omap_dss_device *dssdev) | ||
294 | { | ||
295 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1); | ||
296 | |||
297 | return 0; | ||
298 | } | ||
299 | |||
300 | static void igep2_disable_dvi(struct omap_dss_device *dssdev) | ||
301 | { | ||
302 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0); | ||
303 | } | ||
304 | |||
305 | static struct omap_dss_device igep2_dvi_device = { | ||
306 | .type = OMAP_DISPLAY_TYPE_DPI, | ||
307 | .name = "dvi", | ||
308 | .driver_name = "generic_panel", | ||
309 | .phy.dpi.data_lines = 24, | ||
310 | .platform_enable = igep2_enable_dvi, | ||
311 | .platform_disable = igep2_disable_dvi, | ||
312 | }; | ||
313 | |||
314 | static struct omap_dss_device *igep2_dss_devices[] = { | ||
315 | &igep2_dvi_device | ||
316 | }; | ||
317 | |||
318 | static struct omap_dss_board_info igep2_dss_data = { | ||
319 | .num_devices = ARRAY_SIZE(igep2_dss_devices), | ||
320 | .devices = igep2_dss_devices, | ||
321 | .default_device = &igep2_dvi_device, | ||
322 | }; | ||
323 | |||
324 | static struct platform_device igep2_dss_device = { | ||
325 | .name = "omapdss", | ||
326 | .id = -1, | ||
327 | .dev = { | ||
328 | .platform_data = &igep2_dss_data, | ||
329 | }, | ||
330 | }; | ||
331 | |||
332 | static struct regulator_consumer_supply igep2_vpll2_supply = { | ||
333 | .supply = "vdds_dsi", | ||
334 | .dev = &igep2_dss_device.dev, | ||
335 | }; | ||
336 | |||
337 | static struct regulator_init_data igep2_vpll2 = { | ||
338 | .constraints = { | ||
339 | .name = "VDVI", | ||
340 | .min_uV = 1800000, | ||
341 | .max_uV = 1800000, | ||
342 | .apply_uV = true, | ||
343 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
344 | | REGULATOR_MODE_STANDBY, | ||
345 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
346 | | REGULATOR_CHANGE_STATUS, | ||
347 | }, | ||
348 | .num_consumer_supplies = 1, | ||
349 | .consumer_supplies = &igep2_vpll2_supply, | ||
350 | }; | ||
351 | |||
352 | static void __init igep2_display_init(void) | ||
353 | { | ||
354 | if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") && | ||
355 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1)) | ||
356 | pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); | ||
357 | } | ||
358 | #ifdef CONFIG_LEDS_TRIGGERS | ||
359 | static struct gpio_led gpio_leds[] = { | ||
360 | { | ||
361 | .name = "GPIO_LED1_RED", | ||
362 | .default_trigger = "heartbeat", | ||
363 | .gpio = IGEP2_GPIO_LED1_RED, | ||
364 | }, | ||
365 | }; | ||
366 | |||
367 | static struct gpio_led_platform_data gpio_leds_info = { | ||
368 | .leds = gpio_leds, | ||
369 | .num_leds = ARRAY_SIZE(gpio_leds), | ||
370 | }; | ||
371 | |||
372 | static struct platform_device leds_gpio = { | ||
373 | .name = "leds-gpio", | ||
374 | .id = -1, | ||
375 | .dev = { | ||
376 | .platform_data = &gpio_leds_info, | ||
377 | }, | ||
378 | }; | ||
379 | #endif | ||
380 | |||
381 | static struct platform_device *igep2_devices[] __initdata = { | ||
382 | &igep2_dss_device, | ||
383 | #ifdef CONFIG_LEDS_TRIGGERS | ||
384 | &leds_gpio, | ||
385 | #endif | ||
386 | }; | ||
387 | |||
167 | static void __init igep2_init_irq(void) | 388 | static void __init igep2_init_irq(void) |
168 | { | 389 | { |
169 | omap_board_config = igep2_config; | 390 | omap_board_config = igep2_config; |
170 | omap_board_config_size = ARRAY_SIZE(igep2_config); | 391 | omap_board_config_size = ARRAY_SIZE(igep2_config); |
171 | omap2_init_common_hw(NULL, NULL); | 392 | omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params); |
172 | omap_init_irq(); | 393 | omap_init_irq(); |
173 | omap_gpio_init(); | 394 | omap_gpio_init(); |
174 | } | 395 | } |
175 | 396 | ||
397 | static struct twl4030_codec_audio_data igep2_audio_data = { | ||
398 | .audio_mclk = 26000000, | ||
399 | }; | ||
400 | |||
401 | static struct twl4030_codec_data igep2_codec_data = { | ||
402 | .audio_mclk = 26000000, | ||
403 | .audio = &igep2_audio_data, | ||
404 | }; | ||
405 | |||
176 | static struct twl4030_platform_data igep2_twldata = { | 406 | static struct twl4030_platform_data igep2_twldata = { |
177 | .irq_base = TWL4030_IRQ_BASE, | 407 | .irq_base = TWL4030_IRQ_BASE, |
178 | .irq_end = TWL4030_IRQ_END, | 408 | .irq_end = TWL4030_IRQ_END, |
179 | 409 | ||
180 | /* platform_data for children goes here */ | 410 | /* platform_data for children goes here */ |
181 | .usb = &igep2_usb_data, | 411 | .usb = &igep2_usb_data, |
412 | .codec = &igep2_codec_data, | ||
182 | .gpio = &igep2_gpio_data, | 413 | .gpio = &igep2_gpio_data, |
183 | .vmmc1 = &igep2_vmmc1, | 414 | .vmmc1 = &igep2_vmmc1, |
415 | .vmmc2 = &igep2_vmmc2, | ||
416 | .vpll2 = &igep2_vpll2, | ||
184 | 417 | ||
185 | }; | 418 | }; |
186 | 419 | ||
@@ -203,6 +436,23 @@ static int __init igep2_i2c_init(void) | |||
203 | return 0; | 436 | return 0; |
204 | } | 437 | } |
205 | 438 | ||
439 | static struct omap_musb_board_data musb_board_data = { | ||
440 | .interface_type = MUSB_INTERFACE_ULPI, | ||
441 | .mode = MUSB_OTG, | ||
442 | .power = 100, | ||
443 | }; | ||
444 | |||
445 | static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | ||
446 | .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, | ||
447 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | ||
448 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | ||
449 | |||
450 | .phy_reset = true, | ||
451 | .reset_gpio_port[0] = -EINVAL, | ||
452 | .reset_gpio_port[1] = IGEP2_GPIO_USBH_NRESET, | ||
453 | .reset_gpio_port[2] = -EINVAL, | ||
454 | }; | ||
455 | |||
206 | #ifdef CONFIG_OMAP_MUX | 456 | #ifdef CONFIG_OMAP_MUX |
207 | static struct omap_board_mux board_mux[] __initdata = { | 457 | static struct omap_board_mux board_mux[] __initdata = { |
208 | { .reg_offset = OMAP_MUX_TERMINATOR }, | 458 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
@@ -215,9 +465,13 @@ static void __init igep2_init(void) | |||
215 | { | 465 | { |
216 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 466 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
217 | igep2_i2c_init(); | 467 | igep2_i2c_init(); |
468 | platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices)); | ||
218 | omap_serial_init(); | 469 | omap_serial_init(); |
219 | usb_musb_init(); | 470 | usb_musb_init(&musb_board_data); |
471 | usb_ehci_init(&ehci_pdata); | ||
220 | 472 | ||
473 | igep2_flash_init(); | ||
474 | igep2_display_init(); | ||
221 | igep2_init_smsc911x(); | 475 | igep2_init_smsc911x(); |
222 | 476 | ||
223 | /* GPIO userspace leds */ | 477 | /* GPIO userspace leds */ |
@@ -234,19 +488,36 @@ static void __init igep2_init(void) | |||
234 | gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0); | 488 | gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0); |
235 | } else | 489 | } else |
236 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n"); | 490 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n"); |
237 | 491 | #ifndef CONFIG_LEDS_TRIGGERS | |
238 | if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_LED1_RED") == 0) && | 492 | if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_LED1_RED") == 0) && |
239 | (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) { | 493 | (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) { |
240 | gpio_export(IGEP2_GPIO_LED1_RED, 0); | 494 | gpio_export(IGEP2_GPIO_LED1_RED, 0); |
241 | gpio_set_value(IGEP2_GPIO_LED1_RED, 0); | 495 | gpio_set_value(IGEP2_GPIO_LED1_RED, 0); |
242 | } else | 496 | } else |
243 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n"); | 497 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n"); |
498 | #endif | ||
499 | /* GPIO W-LAN + Bluetooth combo module */ | ||
500 | if ((gpio_request(IGEP2_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) && | ||
501 | (gpio_direction_output(IGEP2_GPIO_WIFI_NPD, 1) == 0)) { | ||
502 | gpio_export(IGEP2_GPIO_WIFI_NPD, 0); | ||
503 | /* gpio_set_value(IGEP2_GPIO_WIFI_NPD, 0); */ | ||
504 | } else | ||
505 | pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NPD\n"); | ||
506 | |||
507 | if ((gpio_request(IGEP2_GPIO_WIFI_NRESET, "GPIO_WIFI_NRESET") == 0) && | ||
508 | (gpio_direction_output(IGEP2_GPIO_WIFI_NRESET, 1) == 0)) { | ||
509 | gpio_export(IGEP2_GPIO_WIFI_NRESET, 0); | ||
510 | gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 0); | ||
511 | udelay(10); | ||
512 | gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 1); | ||
513 | } else | ||
514 | pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NRESET\n"); | ||
244 | } | 515 | } |
245 | 516 | ||
246 | static void __init igep2_map_io(void) | 517 | static void __init igep2_map_io(void) |
247 | { | 518 | { |
248 | omap2_set_globals_343x(); | 519 | omap2_set_globals_343x(); |
249 | omap2_map_common_io(); | 520 | omap34xx_map_common_io(); |
250 | } | 521 | } |
251 | 522 | ||
252 | MACHINE_START(IGEP0020, "IGEP v2 board") | 523 | MACHINE_START(IGEP0020, "IGEP v2 board") |