| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 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> | 
| Balaji T K | ebeb53e | 2009-12-15 20:09:02 +0530 | [diff] [blame] | 22 | #include <linux/i2c/twl.h> | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 23 |  | 
 | 24 | #include <asm/mach-types.h> | 
 | 25 | #include <asm/mach/arch.h> | 
 | 26 |  | 
 | 27 | #include <plat/board.h> | 
 | 28 | #include <plat/common.h> | 
 | 29 | #include <plat/gpmc.h> | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 30 | #include <plat/usb.h> | 
| Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 31 | #include <plat/display.h> | 
| Enric Balletbo i Serra | cddb483 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 32 | #include <plat/onenand.h> | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 33 |  | 
| Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 34 | #include "mux.h" | 
| Adrian Hunter | d02a900 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 35 | #include "hsmmc.h" | 
| Enric Balletbo i Serra | 22f1baa | 2010-02-17 14:09:27 -0800 | [diff] [blame] | 36 | #include "sdram-numonyx-m65kxxxxam.h" | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 37 |  | 
 | 38 | #define IGEP2_SMSC911X_CS       5 | 
 | 39 | #define IGEP2_SMSC911X_GPIO     176 | 
 | 40 | #define IGEP2_GPIO_USBH_NRESET  24 | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 41 | #define IGEP2_GPIO_LED0_GREEN 	26 | 
 | 42 | #define IGEP2_GPIO_LED0_RED 	27 | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 43 | #define IGEP2_GPIO_LED1_RED   	28 | 
| Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 44 | #define IGEP2_GPIO_DVI_PUP	170 | 
| Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 45 | #define IGEP2_GPIO_WIFI_NPD 	94 | 
 | 46 | #define IGEP2_GPIO_WIFI_NRESET 	95 | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 47 |  | 
| Enric Balletbo i Serra | cddb483 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 48 | #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ | 
 | 49 | 	defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) | 
 | 50 |  | 
 | 51 | #define ONENAND_MAP             0x20000000 | 
 | 52 |  | 
 | 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) | 
 | 59 |  */ | 
 | 60 |  | 
 | 61 | static struct mtd_partition igep2_onenand_partitions[] = { | 
 | 62 | 	{ | 
 | 63 | 		.name           = "X-Loader", | 
 | 64 | 		.offset         = 0, | 
 | 65 | 		.size           = 2 * (64*(2*2048)) | 
 | 66 | 	}, | 
 | 67 | 	{ | 
 | 68 | 		.name           = "U-Boot", | 
 | 69 | 		.offset         = MTDPART_OFS_APPEND, | 
 | 70 | 		.size           = 6 * (64*(2*2048)), | 
 | 71 | 	}, | 
 | 72 | 	{ | 
 | 73 | 		.name           = "Environment", | 
 | 74 | 		.offset         = MTDPART_OFS_APPEND, | 
 | 75 | 		.size           = 2 * (64*(2*2048)), | 
 | 76 | 	}, | 
 | 77 | 	{ | 
 | 78 | 		.name           = "Kernel", | 
 | 79 | 		.offset         = MTDPART_OFS_APPEND, | 
 | 80 | 		.size           = 12 * (64*(2*2048)), | 
 | 81 | 	}, | 
 | 82 | 	{ | 
 | 83 | 		.name           = "File System", | 
 | 84 | 		.offset         = MTDPART_OFS_APPEND, | 
 | 85 | 		.size           = MTDPART_SIZ_FULL, | 
 | 86 | 	}, | 
 | 87 | }; | 
 | 88 |  | 
 | 89 | static int igep2_onenand_setup(void __iomem *onenand_base, int freq) | 
 | 90 | { | 
 | 91 |        /* nothing is required to be setup for onenand as of now */ | 
 | 92 |        return 0; | 
 | 93 | } | 
 | 94 |  | 
 | 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 */ | 
 | 100 | }; | 
 | 101 |  | 
 | 102 | static struct platform_device igep2_onenand_device = { | 
 | 103 | 	.name		= "omap2-onenand", | 
 | 104 | 	.id		= -1, | 
 | 105 | 	.dev = { | 
 | 106 | 		.platform_data = &igep2_onenand_data, | 
 | 107 | 	}, | 
 | 108 | }; | 
 | 109 |  | 
 | 110 | void __init igep2_flash_init(void) | 
 | 111 | { | 
 | 112 | 	u8		cs = 0; | 
 | 113 | 	u8		onenandcs = GPMC_CS_NUM + 1; | 
 | 114 |  | 
 | 115 | 	while (cs < GPMC_CS_NUM) { | 
 | 116 | 		u32 ret = 0; | 
 | 117 | 		ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | 
 | 118 |  | 
 | 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; | 
 | 128 | 		} | 
 | 129 | 		cs++; | 
 | 130 | 	} | 
 | 131 | 	if (onenandcs > GPMC_CS_NUM) { | 
 | 132 | 		pr_err("IGEP v2: Unable to find configuration in GPMC\n"); | 
 | 133 | 		return; | 
 | 134 | 	} | 
 | 135 |  | 
 | 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"); | 
 | 140 | 	} | 
 | 141 | } | 
 | 142 |  | 
 | 143 | #else | 
 | 144 | void __init igep2_flash_init(void) {} | 
 | 145 | #endif | 
 | 146 |  | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 147 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) | 
 | 148 |  | 
 | 149 | #include <linux/smsc911x.h> | 
 | 150 |  | 
 | 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, | 
 | 156 | }; | 
 | 157 |  | 
 | 158 | static 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 |  | 
 | 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, | 
 | 176 | 	}, | 
 | 177 | }; | 
 | 178 |  | 
 | 179 | static inline void __init igep2_init_smsc911x(void) | 
 | 180 | { | 
 | 181 | 	unsigned long cs_mem_base; | 
 | 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 | } | 
 | 202 |  | 
 | 203 | #else | 
 | 204 | static inline void __init igep2_init_smsc911x(void) { } | 
 | 205 | #endif | 
 | 206 |  | 
 | 207 | static struct omap_board_config_kernel igep2_config[] __initdata = { | 
 | 208 | }; | 
 | 209 |  | 
 | 210 | static struct regulator_consumer_supply igep2_vmmc1_supply = { | 
 | 211 | 	.supply		= "vmmc", | 
 | 212 | }; | 
 | 213 |  | 
| Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 214 | static struct regulator_consumer_supply igep2_vmmc2_supply = { | 
 | 215 | 	.supply		= "vmmc", | 
 | 216 | }; | 
 | 217 |  | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 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, | 
 | 228 | 	}, | 
 | 229 | 	.num_consumer_supplies  = 1, | 
 | 230 | 	.consumer_supplies      = &igep2_vmmc1_supply, | 
 | 231 | }; | 
 | 232 |  | 
| Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 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, | 
 | 243 | 	}, | 
 | 244 | 	.num_consumer_supplies  = 1, | 
 | 245 | 	.consumer_supplies      = &igep2_vmmc2_supply, | 
 | 246 | }; | 
 | 247 |  | 
| Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 248 | static struct omap2_hsmmc_info mmc[] = { | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 249 | 	{ | 
 | 250 | 		.mmc		= 1, | 
 | 251 | 		.wires		= 4, | 
 | 252 | 		.gpio_cd	= -EINVAL, | 
 | 253 | 		.gpio_wp	= -EINVAL, | 
 | 254 | 	}, | 
 | 255 | 	{ | 
 | 256 | 		.mmc		= 2, | 
 | 257 | 		.wires		= 4, | 
 | 258 | 		.gpio_cd	= -EINVAL, | 
 | 259 | 		.gpio_wp	= -EINVAL, | 
 | 260 | 	}, | 
 | 261 | 	{}      /* Terminator */ | 
 | 262 | }; | 
 | 263 |  | 
 | 264 | static int igep2_twl_gpio_setup(struct device *dev, | 
 | 265 | 		unsigned gpio, unsigned ngpio) | 
 | 266 | { | 
 | 267 | 	/* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 
 | 268 | 	mmc[0].gpio_cd = gpio + 0; | 
| Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 269 | 	omap2_hsmmc_init(mmc); | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 270 |  | 
 | 271 | 	/* link regulators to MMC adapters ... we "know" the | 
 | 272 | 	 * regulators will be set up only *after* we return. | 
 | 273 | 	*/ | 
 | 274 | 	igep2_vmmc1_supply.dev = mmc[0].dev; | 
| Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 275 | 	igep2_vmmc2_supply.dev = mmc[1].dev; | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 276 |  | 
 | 277 | 	return 0; | 
 | 278 | }; | 
 | 279 |  | 
 | 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, | 
 | 286 | }; | 
 | 287 |  | 
 | 288 | static struct twl4030_usb_data igep2_usb_data = { | 
 | 289 | 	.usb_mode	= T2_USB_MODE_ULPI, | 
 | 290 | }; | 
 | 291 |  | 
| Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 292 | static int igep2_enable_dvi(struct omap_dss_device *dssdev) | 
 | 293 | { | 
 | 294 | 	gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1); | 
 | 295 |  | 
 | 296 | 	return 0; | 
 | 297 | } | 
 | 298 |  | 
 | 299 | static void igep2_disable_dvi(struct omap_dss_device *dssdev) | 
 | 300 | { | 
 | 301 | 	gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0); | 
 | 302 | } | 
 | 303 |  | 
 | 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, | 
 | 311 | }; | 
 | 312 |  | 
 | 313 | static struct omap_dss_device *igep2_dss_devices[] = { | 
 | 314 | 	&igep2_dvi_device | 
 | 315 | }; | 
 | 316 |  | 
 | 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, | 
 | 321 | }; | 
 | 322 |  | 
 | 323 | static struct platform_device igep2_dss_device = { | 
 | 324 | 	.name	= "omapdss", | 
 | 325 | 	.id	= -1, | 
 | 326 | 	.dev	= { | 
 | 327 | 		.platform_data = &igep2_dss_data, | 
 | 328 | 	}, | 
 | 329 | }; | 
 | 330 |  | 
 | 331 | static struct regulator_consumer_supply igep2_vpll2_supply = { | 
 | 332 | 	.supply	= "vdds_dsi", | 
 | 333 | 	.dev	= &igep2_dss_device.dev, | 
 | 334 | }; | 
 | 335 |  | 
 | 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, | 
 | 346 | 	}, | 
 | 347 | 	.num_consumer_supplies	= 1, | 
 | 348 | 	.consumer_supplies	= &igep2_vpll2_supply, | 
 | 349 | }; | 
 | 350 |  | 
 | 351 | static void __init igep2_display_init(void) | 
 | 352 | { | 
 | 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"); | 
 | 356 | } | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 357 |  | 
 | 358 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | 
 | 359 | #include <linux/leds.h> | 
 | 360 |  | 
 | 361 | static struct gpio_led igep2_gpio_leds[] = { | 
| Jonas Zetterberg | b344d87 | 2010-02-14 19:33:26 +0000 | [diff] [blame] | 362 | 	{ | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 363 | 		.name = "led0:red", | 
 | 364 | 		.gpio = IGEP2_GPIO_LED0_RED, | 
 | 365 | 	}, | 
 | 366 | 	{ | 
 | 367 | 		.name = "led0:green", | 
| Jonas Zetterberg | b344d87 | 2010-02-14 19:33:26 +0000 | [diff] [blame] | 368 | 		.default_trigger = "heartbeat", | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 369 | 		.gpio = IGEP2_GPIO_LED0_GREEN, | 
 | 370 | 	}, | 
 | 371 | 	{ | 
 | 372 | 		.name = "led1:red", | 
| Jonas Zetterberg | b344d87 | 2010-02-14 19:33:26 +0000 | [diff] [blame] | 373 | 		.gpio = IGEP2_GPIO_LED1_RED, | 
 | 374 | 	}, | 
 | 375 | }; | 
 | 376 |  | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 377 | static struct gpio_led_platform_data igep2_led_pdata = { | 
 | 378 | 	.leds           = igep2_gpio_leds, | 
 | 379 | 	.num_leds       = ARRAY_SIZE(igep2_gpio_leds), | 
| Jonas Zetterberg | b344d87 | 2010-02-14 19:33:26 +0000 | [diff] [blame] | 380 | }; | 
 | 381 |  | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 382 | static struct platform_device igep2_led_device = { | 
| Jonas Zetterberg | b344d87 | 2010-02-14 19:33:26 +0000 | [diff] [blame] | 383 | 	 .name   = "leds-gpio", | 
 | 384 | 	 .id     = -1, | 
 | 385 | 	 .dev    = { | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 386 | 		 .platform_data  =  &igep2_led_pdata, | 
| Jonas Zetterberg | b344d87 | 2010-02-14 19:33:26 +0000 | [diff] [blame] | 387 | 	}, | 
 | 388 | }; | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 389 |  | 
 | 390 | static void __init igep2_init_led(void) | 
 | 391 | { | 
 | 392 | 	platform_device_register(&igep2_led_device); | 
 | 393 | } | 
 | 394 |  | 
 | 395 | #else | 
 | 396 | static inline void igep2_init_led(void) {} | 
| Jonas Zetterberg | b344d87 | 2010-02-14 19:33:26 +0000 | [diff] [blame] | 397 | #endif | 
| Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 398 |  | 
 | 399 | static struct platform_device *igep2_devices[] __initdata = { | 
 | 400 | 	&igep2_dss_device, | 
 | 401 | }; | 
 | 402 |  | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 403 | static void __init igep2_init_irq(void) | 
 | 404 | { | 
 | 405 | 	omap_board_config = igep2_config; | 
 | 406 | 	omap_board_config_size = ARRAY_SIZE(igep2_config); | 
| Enric Balletbo i Serra | 22f1baa | 2010-02-17 14:09:27 -0800 | [diff] [blame] | 407 | 	omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params); | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 408 | 	omap_init_irq(); | 
 | 409 | 	omap_gpio_init(); | 
 | 410 | } | 
 | 411 |  | 
| Enric Balletbo i Serra | 7f5f23d | 2010-02-17 14:09:25 -0800 | [diff] [blame] | 412 | static struct twl4030_codec_audio_data igep2_audio_data = { | 
 | 413 | 	.audio_mclk = 26000000, | 
 | 414 | }; | 
 | 415 |  | 
 | 416 | static struct twl4030_codec_data igep2_codec_data = { | 
 | 417 | 	.audio_mclk = 26000000, | 
 | 418 | 	.audio = &igep2_audio_data, | 
 | 419 | }; | 
 | 420 |  | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 421 | static struct twl4030_platform_data igep2_twldata = { | 
 | 422 | 	.irq_base	= TWL4030_IRQ_BASE, | 
 | 423 | 	.irq_end	= TWL4030_IRQ_END, | 
 | 424 |  | 
 | 425 | 	/* platform_data for children goes here */ | 
 | 426 | 	.usb		= &igep2_usb_data, | 
| Enric Balletbo i Serra | 7f5f23d | 2010-02-17 14:09:25 -0800 | [diff] [blame] | 427 | 	.codec		= &igep2_codec_data, | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 428 | 	.gpio		= &igep2_gpio_data, | 
 | 429 | 	.vmmc1          = &igep2_vmmc1, | 
| Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 430 | 	.vmmc2		= &igep2_vmmc2, | 
| Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 431 | 	.vpll2		= &igep2_vpll2, | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 432 |  | 
 | 433 | }; | 
 | 434 |  | 
 | 435 | static struct i2c_board_info __initdata igep2_i2c_boardinfo[] = { | 
 | 436 | 	{ | 
 | 437 | 		I2C_BOARD_INFO("twl4030", 0x48), | 
 | 438 | 		.flags		= I2C_CLIENT_WAKE, | 
 | 439 | 		.irq		= INT_34XX_SYS_NIRQ, | 
 | 440 | 		.platform_data	= &igep2_twldata, | 
 | 441 | 	}, | 
 | 442 | }; | 
 | 443 |  | 
 | 444 | static int __init igep2_i2c_init(void) | 
 | 445 | { | 
 | 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; | 
 | 452 | } | 
 | 453 |  | 
| Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 454 | static struct omap_musb_board_data musb_board_data = { | 
 | 455 | 	.interface_type		= MUSB_INTERFACE_ULPI, | 
 | 456 | 	.mode			= MUSB_OTG, | 
 | 457 | 	.power			= 100, | 
 | 458 | }; | 
 | 459 |  | 
| Felipe Balbi | 6f69a18 | 2010-03-04 09:45:53 +0200 | [diff] [blame] | 460 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | 
| Enric Balletbo i Serra | f6b7453 | 2010-03-01 15:02:36 +0000 | [diff] [blame] | 461 | 	.port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, | 
 | 462 | 	.port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, | 
| Enric Balletbo i Serra | d088548 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 463 | 	.port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | 
 | 464 |  | 
 | 465 | 	.phy_reset = true, | 
| Enric Balletbo i Serra | f6b7453 | 2010-03-01 15:02:36 +0000 | [diff] [blame] | 466 | 	.reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET, | 
 | 467 | 	.reset_gpio_port[1] = -EINVAL, | 
| Enric Balletbo i Serra | d088548 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 468 | 	.reset_gpio_port[2] = -EINVAL, | 
 | 469 | }; | 
 | 470 |  | 
| Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 471 | #ifdef CONFIG_OMAP_MUX | 
 | 472 | static struct omap_board_mux board_mux[] __initdata = { | 
 | 473 | 	{ .reg_offset = OMAP_MUX_TERMINATOR }, | 
 | 474 | }; | 
 | 475 | #else | 
 | 476 | #define board_mux	NULL | 
 | 477 | #endif | 
 | 478 |  | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 479 | static void __init igep2_init(void) | 
 | 480 | { | 
| Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 481 | 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 482 | 	igep2_i2c_init(); | 
| Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 483 | 	platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices)); | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 484 | 	omap_serial_init(); | 
| Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 485 | 	usb_musb_init(&musb_board_data); | 
| Enric Balletbo i Serra | d088548 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 486 | 	usb_ehci_init(&ehci_pdata); | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 487 |  | 
| Enric Balletbo i Serra | cddb483 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 488 | 	igep2_flash_init(); | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 489 | 	igep2_init_led(); | 
| Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 490 | 	igep2_display_init(); | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 491 | 	igep2_init_smsc911x(); | 
 | 492 |  | 
 | 493 | 	/* GPIO userspace leds */ | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 494 | #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) | 
 | 495 | 	if ((gpio_request(IGEP2_GPIO_LED0_RED, "led0:red") == 0) && | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 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 |  | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 502 | 	if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "led0:green") == 0) && | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 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"); | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 508 |  | 
 | 509 | 	if ((gpio_request(IGEP2_GPIO_LED1_RED, "led1:red") == 0) && | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 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"); | 
| Jonas Zetterberg | b344d87 | 2010-02-14 19:33:26 +0000 | [diff] [blame] | 515 | #endif | 
| Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 516 |  | 
| Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 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"); | 
 | 524 |  | 
 | 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"); | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 533 | } | 
 | 534 |  | 
 | 535 | static void __init igep2_map_io(void) | 
 | 536 | { | 
 | 537 | 	omap2_set_globals_343x(); | 
| Tony Lindgren | 6fbd55d | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 538 | 	omap34xx_map_common_io(); | 
| Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 539 | } | 
 | 540 |  | 
 | 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 |