block: kill ISA_DMA_THRESHOLD usage
[linux-2.6/next.git] / arch / arm / mach-omap2 / board-igep0020.c
blobd55c57b761a988e3bb62cc2adeb999709861db2c
1 /*
2 * Copyright (C) 2009 Integration Software and Electronic Engineering.
4 * Modified from mach-omap2/board-generic.c
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 */
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>
21 #include <linux/regulator/machine.h>
22 #include <linux/i2c/twl.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
27 #include <plat/board.h>
28 #include <plat/common.h>
29 #include <plat/gpmc.h>
30 #include <plat/usb.h>
31 #include <plat/display.h>
32 #include <plat/onenand.h>
34 #include "mux.h"
35 #include "hsmmc.h"
36 #include "sdram-numonyx-m65kxxxxam.h"
38 #define IGEP2_SMSC911X_CS 5
39 #define IGEP2_SMSC911X_GPIO 176
40 #define IGEP2_GPIO_USBH_NRESET 24
41 #define IGEP2_GPIO_LED0_GREEN 26
42 #define IGEP2_GPIO_LED0_RED 27
43 #define IGEP2_GPIO_LED1_RED 28
44 #define IGEP2_GPIO_DVI_PUP 170
45 #define IGEP2_GPIO_WIFI_NPD 94
46 #define IGEP2_GPIO_WIFI_NRESET 95
48 #if defined(CONFIG_MTD_ONENAND_OMAP2) || \
49 defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
51 #define ONENAND_MAP 0x20000000
53 /* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY )
54 * Since the device is equipped with two DataRAMs, and two-plane NAND
55 * Flash memory array, these two component enables simultaneous program
56 * of 4KiB. Plane1 has only even blocks such as block0, block2, block4
57 * while Plane2 has only odd blocks such as block1, block3, block5.
58 * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048)
61 static struct mtd_partition igep2_onenand_partitions[] = {
63 .name = "X-Loader",
64 .offset = 0,
65 .size = 2 * (64*(2*2048))
68 .name = "U-Boot",
69 .offset = MTDPART_OFS_APPEND,
70 .size = 6 * (64*(2*2048)),
73 .name = "Environment",
74 .offset = MTDPART_OFS_APPEND,
75 .size = 2 * (64*(2*2048)),
78 .name = "Kernel",
79 .offset = MTDPART_OFS_APPEND,
80 .size = 12 * (64*(2*2048)),
83 .name = "File System",
84 .offset = MTDPART_OFS_APPEND,
85 .size = MTDPART_SIZ_FULL,
89 static int igep2_onenand_setup(void __iomem *onenand_base, int freq)
91 /* nothing is required to be setup for onenand as of now */
92 return 0;
95 static 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 */
102 static struct platform_device igep2_onenand_device = {
103 .name = "omap2-onenand",
104 .id = -1,
105 .dev = {
106 .platform_data = &igep2_onenand_data,
110 void __init igep2_flash_init(void)
112 u8 cs = 0;
113 u8 onenandcs = GPMC_CS_NUM + 1;
115 while (cs < GPMC_CS_NUM) {
116 u32 ret = 0;
117 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
119 /* Check if NAND/oneNAND is configured */
120 if ((ret & 0xC00) == 0x800)
121 /* NAND found */
122 pr_err("IGEP v2: Unsupported NAND found\n");
123 else {
124 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7);
125 if ((ret & 0x3F) == (ONENAND_MAP >> 24))
126 /* ONENAND found */
127 onenandcs = cs;
129 cs++;
131 if (onenandcs > GPMC_CS_NUM) {
132 pr_err("IGEP v2: Unable to find configuration in GPMC\n");
133 return;
136 if (onenandcs < GPMC_CS_NUM) {
137 igep2_onenand_data.cs = onenandcs;
138 if (platform_device_register(&igep2_onenand_device) < 0)
139 pr_err("IGEP v2: Unable to register OneNAND device\n");
143 #else
144 void __init igep2_flash_init(void) {}
145 #endif
147 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
149 #include <linux/smsc911x.h>
151 static struct smsc911x_platform_config igep2_smsc911x_config = {
152 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
153 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
154 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS ,
155 .phy_interface = PHY_INTERFACE_MODE_MII,
158 static struct resource igep2_smsc911x_resources[] = {
160 .flags = IORESOURCE_MEM,
163 .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
164 .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO),
165 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
169 static 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,
179 static inline void __init igep2_init_smsc911x(void)
181 unsigned long cs_mem_base;
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;
189 igep2_smsc911x_resources[0].start = cs_mem_base + 0x0;
190 igep2_smsc911x_resources[0].end = cs_mem_base + 0xff;
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;
200 platform_device_register(&igep2_smsc911x_device);
203 #else
204 static inline void __init igep2_init_smsc911x(void) { }
205 #endif
207 static struct omap_board_config_kernel igep2_config[] __initdata = {
210 static struct regulator_consumer_supply igep2_vmmc1_supply = {
211 .supply = "vmmc",
214 static struct regulator_consumer_supply igep2_vmmc2_supply = {
215 .supply = "vmmc",
218 /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */
219 static struct regulator_init_data igep2_vmmc1 = {
220 .constraints = {
221 .min_uV = 1850000,
222 .max_uV = 3150000,
223 .valid_modes_mask = REGULATOR_MODE_NORMAL
224 | REGULATOR_MODE_STANDBY,
225 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
226 | REGULATOR_CHANGE_MODE
227 | REGULATOR_CHANGE_STATUS,
229 .num_consumer_supplies = 1,
230 .consumer_supplies = &igep2_vmmc1_supply,
233 /* VMMC2 for OMAP VDD_MMC2 (i/o) and MMC2 WIFI */
234 static struct regulator_init_data igep2_vmmc2 = {
235 .constraints = {
236 .min_uV = 1850000,
237 .max_uV = 3150000,
238 .valid_modes_mask = REGULATOR_MODE_NORMAL
239 | REGULATOR_MODE_STANDBY,
240 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
241 | REGULATOR_CHANGE_MODE
242 | REGULATOR_CHANGE_STATUS,
244 .num_consumer_supplies = 1,
245 .consumer_supplies = &igep2_vmmc2_supply,
248 static struct omap2_hsmmc_info mmc[] = {
250 .mmc = 1,
251 .wires = 4,
252 .gpio_cd = -EINVAL,
253 .gpio_wp = -EINVAL,
256 .mmc = 2,
257 .wires = 4,
258 .gpio_cd = -EINVAL,
259 .gpio_wp = -EINVAL,
261 {} /* Terminator */
264 static int igep2_twl_gpio_setup(struct device *dev,
265 unsigned gpio, unsigned ngpio)
267 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
268 mmc[0].gpio_cd = gpio + 0;
269 omap2_hsmmc_init(mmc);
271 /* link regulators to MMC adapters ... we "know" the
272 * regulators will be set up only *after* we return.
274 igep2_vmmc1_supply.dev = mmc[0].dev;
275 igep2_vmmc2_supply.dev = mmc[1].dev;
277 return 0;
280 static struct twl4030_gpio_platform_data igep2_gpio_data = {
281 .gpio_base = OMAP_MAX_GPIO_LINES,
282 .irq_base = TWL4030_GPIO_IRQ_BASE,
283 .irq_end = TWL4030_GPIO_IRQ_END,
284 .use_leds = false,
285 .setup = igep2_twl_gpio_setup,
288 static struct twl4030_usb_data igep2_usb_data = {
289 .usb_mode = T2_USB_MODE_ULPI,
292 static int igep2_enable_dvi(struct omap_dss_device *dssdev)
294 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1);
296 return 0;
299 static void igep2_disable_dvi(struct omap_dss_device *dssdev)
301 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0);
304 static struct omap_dss_device igep2_dvi_device = {
305 .type = OMAP_DISPLAY_TYPE_DPI,
306 .name = "dvi",
307 .driver_name = "generic_panel",
308 .phy.dpi.data_lines = 24,
309 .platform_enable = igep2_enable_dvi,
310 .platform_disable = igep2_disable_dvi,
313 static struct omap_dss_device *igep2_dss_devices[] = {
314 &igep2_dvi_device
317 static struct omap_dss_board_info igep2_dss_data = {
318 .num_devices = ARRAY_SIZE(igep2_dss_devices),
319 .devices = igep2_dss_devices,
320 .default_device = &igep2_dvi_device,
323 static struct platform_device igep2_dss_device = {
324 .name = "omapdss",
325 .id = -1,
326 .dev = {
327 .platform_data = &igep2_dss_data,
331 static struct regulator_consumer_supply igep2_vpll2_supply = {
332 .supply = "vdds_dsi",
333 .dev = &igep2_dss_device.dev,
336 static struct regulator_init_data igep2_vpll2 = {
337 .constraints = {
338 .name = "VDVI",
339 .min_uV = 1800000,
340 .max_uV = 1800000,
341 .apply_uV = true,
342 .valid_modes_mask = REGULATOR_MODE_NORMAL
343 | REGULATOR_MODE_STANDBY,
344 .valid_ops_mask = REGULATOR_CHANGE_MODE
345 | REGULATOR_CHANGE_STATUS,
347 .num_consumer_supplies = 1,
348 .consumer_supplies = &igep2_vpll2_supply,
351 static void __init igep2_display_init(void)
353 if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") &&
354 gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1))
355 pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n");
358 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
359 #include <linux/leds.h>
361 static struct gpio_led igep2_gpio_leds[] = {
363 .name = "led0:red",
364 .gpio = IGEP2_GPIO_LED0_RED,
367 .name = "led0:green",
368 .default_trigger = "heartbeat",
369 .gpio = IGEP2_GPIO_LED0_GREEN,
372 .name = "led1:red",
373 .gpio = IGEP2_GPIO_LED1_RED,
377 static struct gpio_led_platform_data igep2_led_pdata = {
378 .leds = igep2_gpio_leds,
379 .num_leds = ARRAY_SIZE(igep2_gpio_leds),
382 static struct platform_device igep2_led_device = {
383 .name = "leds-gpio",
384 .id = -1,
385 .dev = {
386 .platform_data = &igep2_led_pdata,
390 static void __init igep2_init_led(void)
392 platform_device_register(&igep2_led_device);
395 #else
396 static inline void igep2_init_led(void) {}
397 #endif
399 static struct platform_device *igep2_devices[] __initdata = {
400 &igep2_dss_device,
403 static void __init igep2_init_irq(void)
405 omap_board_config = igep2_config;
406 omap_board_config_size = ARRAY_SIZE(igep2_config);
407 omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params);
408 omap_init_irq();
409 omap_gpio_init();
412 static struct twl4030_codec_audio_data igep2_audio_data = {
413 .audio_mclk = 26000000,
416 static struct twl4030_codec_data igep2_codec_data = {
417 .audio_mclk = 26000000,
418 .audio = &igep2_audio_data,
421 static struct twl4030_platform_data igep2_twldata = {
422 .irq_base = TWL4030_IRQ_BASE,
423 .irq_end = TWL4030_IRQ_END,
425 /* platform_data for children goes here */
426 .usb = &igep2_usb_data,
427 .codec = &igep2_codec_data,
428 .gpio = &igep2_gpio_data,
429 .vmmc1 = &igep2_vmmc1,
430 .vmmc2 = &igep2_vmmc2,
431 .vpll2 = &igep2_vpll2,
435 static struct i2c_board_info __initdata igep2_i2c_boardinfo[] = {
437 I2C_BOARD_INFO("twl4030", 0x48),
438 .flags = I2C_CLIENT_WAKE,
439 .irq = INT_34XX_SYS_NIRQ,
440 .platform_data = &igep2_twldata,
444 static int __init igep2_i2c_init(void)
446 omap_register_i2c_bus(1, 2600, igep2_i2c_boardinfo,
447 ARRAY_SIZE(igep2_i2c_boardinfo));
448 /* Bus 3 is attached to the DVI port where devices like the pico DLP
449 * projector don't work reliably with 400kHz */
450 omap_register_i2c_bus(3, 100, NULL, 0);
451 return 0;
454 static struct omap_musb_board_data musb_board_data = {
455 .interface_type = MUSB_INTERFACE_ULPI,
456 .mode = MUSB_OTG,
457 .power = 100,
460 static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
461 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
462 .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN,
463 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
465 .phy_reset = true,
466 .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET,
467 .reset_gpio_port[1] = -EINVAL,
468 .reset_gpio_port[2] = -EINVAL,
471 #ifdef CONFIG_OMAP_MUX
472 static struct omap_board_mux board_mux[] __initdata = {
473 { .reg_offset = OMAP_MUX_TERMINATOR },
475 #else
476 #define board_mux NULL
477 #endif
479 static void __init igep2_init(void)
481 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
482 igep2_i2c_init();
483 platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices));
484 omap_serial_init();
485 usb_musb_init(&musb_board_data);
486 usb_ehci_init(&ehci_pdata);
488 igep2_flash_init();
489 igep2_init_led();
490 igep2_display_init();
491 igep2_init_smsc911x();
493 /* GPIO userspace leds */
494 #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE)
495 if ((gpio_request(IGEP2_GPIO_LED0_RED, "led0:red") == 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");
502 if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "led0:green") == 0) &&
503 (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 1) == 0)) {
504 gpio_export(IGEP2_GPIO_LED0_GREEN, 0);
505 gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0);
506 } else
507 pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n");
509 if ((gpio_request(IGEP2_GPIO_LED1_RED, "led1:red") == 0) &&
510 (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) {
511 gpio_export(IGEP2_GPIO_LED1_RED, 0);
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
517 /* GPIO W-LAN + Bluetooth combo module */
518 if ((gpio_request(IGEP2_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) &&
519 (gpio_direction_output(IGEP2_GPIO_WIFI_NPD, 1) == 0)) {
520 gpio_export(IGEP2_GPIO_WIFI_NPD, 0);
521 /* gpio_set_value(IGEP2_GPIO_WIFI_NPD, 0); */
522 } else
523 pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NPD\n");
525 if ((gpio_request(IGEP2_GPIO_WIFI_NRESET, "GPIO_WIFI_NRESET") == 0) &&
526 (gpio_direction_output(IGEP2_GPIO_WIFI_NRESET, 1) == 0)) {
527 gpio_export(IGEP2_GPIO_WIFI_NRESET, 0);
528 gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 0);
529 udelay(10);
530 gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 1);
531 } else
532 pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NRESET\n");
535 static void __init igep2_map_io(void)
537 omap2_set_globals_343x();
538 omap34xx_map_common_io();
541 MACHINE_START(IGEP0020, "IGEP v2 board")
542 .phys_io = 0x48000000,
543 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
544 .boot_params = 0x80000100,
545 .map_io = igep2_map_io,
546 .init_irq = igep2_init_irq,
547 .init_machine = igep2_init,
548 .timer = &omap_timer,
549 MACHINE_END