| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 1 | /* | 
 | 2 |  * linux/arch/arm/mach-omap2/board-omap3beagle.c | 
 | 3 |  * | 
 | 4 |  * Copyright (C) 2008 Texas Instruments | 
 | 5 |  * | 
 | 6 |  * Modified from mach-omap2/board-3430sdp.c | 
 | 7 |  * | 
 | 8 |  * Initial code: Syed Mohammed Khasim | 
 | 9 |  * | 
 | 10 |  * This program is free software; you can redistribute it and/or modify | 
 | 11 |  * it under the terms of the GNU General Public License version 2 as | 
 | 12 |  * published by the Free Software Foundation. | 
 | 13 |  */ | 
 | 14 |  | 
 | 15 | #include <linux/kernel.h> | 
 | 16 | #include <linux/init.h> | 
 | 17 | #include <linux/platform_device.h> | 
 | 18 | #include <linux/delay.h> | 
 | 19 | #include <linux/err.h> | 
 | 20 | #include <linux/clk.h> | 
 | 21 | #include <linux/io.h> | 
 | 22 | #include <linux/leds.h> | 
 | 23 | #include <linux/gpio.h> | 
 | 24 | #include <linux/input.h> | 
 | 25 | #include <linux/gpio_keys.h> | 
 | 26 |  | 
 | 27 | #include <linux/mtd/mtd.h> | 
 | 28 | #include <linux/mtd/partitions.h> | 
 | 29 | #include <linux/mtd/nand.h> | 
 | 30 |  | 
| David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 31 | #include <linux/regulator/machine.h> | 
| Santosh Shilimkar | b07682b | 2009-12-13 20:05:51 +0100 | [diff] [blame] | 32 | #include <linux/i2c/twl.h> | 
| Tony Lindgren | 145d9c9 | 2009-01-15 13:09:53 +0200 | [diff] [blame] | 33 |  | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 34 | #include <mach/hardware.h> | 
 | 35 | #include <asm/mach-types.h> | 
 | 36 | #include <asm/mach/arch.h> | 
 | 37 | #include <asm/mach/map.h> | 
 | 38 | #include <asm/mach/flash.h> | 
 | 39 |  | 
| Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 40 | #include <plat/board.h> | 
 | 41 | #include <plat/common.h> | 
| Koen Kooi | 044d32f | 2010-04-22 10:23:42 +0200 | [diff] [blame] | 42 | #include <plat/display.h> | 
| Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 43 | #include <plat/gpmc.h> | 
 | 44 | #include <plat/nand.h> | 
| Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 45 | #include <plat/usb.h> | 
 | 46 | #include <plat/timer-gp.h> | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 47 |  | 
| Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 48 | #include "mux.h" | 
| Adrian Hunter | d02a900 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 49 | #include "hsmmc.h" | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 50 |  | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 51 | #define NAND_BLOCK_SIZE		SZ_128K | 
 | 52 |  | 
 | 53 | static struct mtd_partition omap3beagle_nand_partitions[] = { | 
 | 54 | 	/* All the partition sizes are listed in terms of NAND block size */ | 
 | 55 | 	{ | 
 | 56 | 		.name		= "X-Loader", | 
 | 57 | 		.offset		= 0, | 
 | 58 | 		.size		= 4 * NAND_BLOCK_SIZE, | 
 | 59 | 		.mask_flags	= MTD_WRITEABLE,	/* force read-only */ | 
 | 60 | 	}, | 
 | 61 | 	{ | 
 | 62 | 		.name		= "U-Boot", | 
 | 63 | 		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x80000 */ | 
 | 64 | 		.size		= 15 * NAND_BLOCK_SIZE, | 
 | 65 | 		.mask_flags	= MTD_WRITEABLE,	/* force read-only */ | 
 | 66 | 	}, | 
 | 67 | 	{ | 
 | 68 | 		.name		= "U-Boot Env", | 
 | 69 | 		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x260000 */ | 
 | 70 | 		.size		= 1 * NAND_BLOCK_SIZE, | 
 | 71 | 	}, | 
 | 72 | 	{ | 
 | 73 | 		.name		= "Kernel", | 
 | 74 | 		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x280000 */ | 
 | 75 | 		.size		= 32 * NAND_BLOCK_SIZE, | 
 | 76 | 	}, | 
 | 77 | 	{ | 
 | 78 | 		.name		= "File System", | 
 | 79 | 		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x680000 */ | 
 | 80 | 		.size		= MTDPART_SIZ_FULL, | 
 | 81 | 	}, | 
 | 82 | }; | 
 | 83 |  | 
 | 84 | static struct omap_nand_platform_data omap3beagle_nand_data = { | 
 | 85 | 	.options	= NAND_BUSWIDTH_16, | 
 | 86 | 	.parts		= omap3beagle_nand_partitions, | 
 | 87 | 	.nr_parts	= ARRAY_SIZE(omap3beagle_nand_partitions), | 
 | 88 | 	.dma_channel	= -1,		/* disable DMA in OMAP NAND driver */ | 
 | 89 | 	.nand_setup	= NULL, | 
 | 90 | 	.dev_ready	= NULL, | 
 | 91 | }; | 
 | 92 |  | 
| Koen Kooi | 044d32f | 2010-04-22 10:23:42 +0200 | [diff] [blame] | 93 | /* DSS */ | 
 | 94 |  | 
 | 95 | static int beagle_enable_dvi(struct omap_dss_device *dssdev) | 
 | 96 | { | 
 | 97 | 	if (gpio_is_valid(dssdev->reset_gpio)) | 
 | 98 | 		gpio_set_value(dssdev->reset_gpio, 1); | 
 | 99 |  | 
 | 100 | 	return 0; | 
 | 101 | } | 
 | 102 |  | 
 | 103 | static void beagle_disable_dvi(struct omap_dss_device *dssdev) | 
 | 104 | { | 
 | 105 | 	if (gpio_is_valid(dssdev->reset_gpio)) | 
 | 106 | 		gpio_set_value(dssdev->reset_gpio, 0); | 
 | 107 | } | 
 | 108 |  | 
 | 109 | static struct omap_dss_device beagle_dvi_device = { | 
 | 110 | 	.type = OMAP_DISPLAY_TYPE_DPI, | 
 | 111 | 	.name = "dvi", | 
 | 112 | 	.driver_name = "generic_panel", | 
 | 113 | 	.phy.dpi.data_lines = 24, | 
 | 114 | 	.reset_gpio = 170, | 
 | 115 | 	.platform_enable = beagle_enable_dvi, | 
 | 116 | 	.platform_disable = beagle_disable_dvi, | 
 | 117 | }; | 
 | 118 |  | 
 | 119 | static struct omap_dss_device beagle_tv_device = { | 
 | 120 | 	.name = "tv", | 
 | 121 | 	.driver_name = "venc", | 
 | 122 | 	.type = OMAP_DISPLAY_TYPE_VENC, | 
 | 123 | 	.phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | 
 | 124 | }; | 
 | 125 |  | 
 | 126 | static struct omap_dss_device *beagle_dss_devices[] = { | 
 | 127 | 	&beagle_dvi_device, | 
 | 128 | 	&beagle_tv_device, | 
 | 129 | }; | 
 | 130 |  | 
 | 131 | static struct omap_dss_board_info beagle_dss_data = { | 
 | 132 | 	.num_devices = ARRAY_SIZE(beagle_dss_devices), | 
 | 133 | 	.devices = beagle_dss_devices, | 
 | 134 | 	.default_device = &beagle_dvi_device, | 
 | 135 | }; | 
 | 136 |  | 
 | 137 | static struct platform_device beagle_dss_device = { | 
 | 138 | 	.name          = "omapdss", | 
 | 139 | 	.id            = -1, | 
 | 140 | 	.dev            = { | 
 | 141 | 		.platform_data = &beagle_dss_data, | 
 | 142 | 	}, | 
 | 143 | }; | 
 | 144 |  | 
 | 145 | static struct regulator_consumer_supply beagle_vdac_supply = | 
 | 146 | 	REGULATOR_SUPPLY("vdda_dac", "omapdss"); | 
 | 147 |  | 
 | 148 | static struct regulator_consumer_supply beagle_vdvi_supply = | 
 | 149 | 	REGULATOR_SUPPLY("vdds_dsi", "omapdss"); | 
 | 150 |  | 
 | 151 | static void __init beagle_display_init(void) | 
 | 152 | { | 
 | 153 | 	int r; | 
 | 154 |  | 
 | 155 | 	r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset"); | 
 | 156 | 	if (r < 0) { | 
 | 157 | 		printk(KERN_ERR "Unable to get DVI reset GPIO\n"); | 
 | 158 | 		return; | 
 | 159 | 	} | 
 | 160 |  | 
 | 161 | 	gpio_direction_output(beagle_dvi_device.reset_gpio, 0); | 
 | 162 | } | 
 | 163 |  | 
| Paul Walmsley | 2e12bd7 | 2009-05-28 14:03:59 -0700 | [diff] [blame] | 164 | #include "sdram-micron-mt46h32m32lf-6.h" | 
 | 165 |  | 
| Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 166 | static struct omap2_hsmmc_info mmc[] = { | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 167 | 	{ | 
 | 168 | 		.mmc		= 1, | 
 | 169 | 		.wires		= 8, | 
 | 170 | 		.gpio_wp	= 29, | 
 | 171 | 	}, | 
 | 172 | 	{}	/* Terminator */ | 
 | 173 | }; | 
 | 174 |  | 
| David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 175 | static struct regulator_consumer_supply beagle_vmmc1_supply = { | 
 | 176 | 	.supply			= "vmmc", | 
 | 177 | }; | 
 | 178 |  | 
 | 179 | static struct regulator_consumer_supply beagle_vsim_supply = { | 
 | 180 | 	.supply			= "vmmc_aux", | 
 | 181 | }; | 
 | 182 |  | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 183 | static struct gpio_led gpio_leds[]; | 
 | 184 |  | 
 | 185 | static int beagle_twl_gpio_setup(struct device *dev, | 
 | 186 | 		unsigned gpio, unsigned ngpio) | 
 | 187 | { | 
| Jarkko Nikula | 44e7484 | 2009-09-24 16:23:17 -0700 | [diff] [blame] | 188 | 	if (system_rev >= 0x20 && system_rev <= 0x34301000) { | 
| Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 189 | 		omap_mux_init_gpio(23, OMAP_PIN_INPUT); | 
| Jarkko Nikula | 44e7484 | 2009-09-24 16:23:17 -0700 | [diff] [blame] | 190 | 		mmc[0].gpio_wp = 23; | 
 | 191 | 	} else { | 
| Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 192 | 		omap_mux_init_gpio(29, OMAP_PIN_INPUT); | 
| Jarkko Nikula | 44e7484 | 2009-09-24 16:23:17 -0700 | [diff] [blame] | 193 | 	} | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 194 | 	/* gpio + 0 is "mmc0_cd" (input/IRQ) */ | 
| Tony Lindgren | 145d9c9 | 2009-01-15 13:09:53 +0200 | [diff] [blame] | 195 | 	mmc[0].gpio_cd = gpio + 0; | 
| Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 196 | 	omap2_hsmmc_init(mmc); | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 197 |  | 
| David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 198 | 	/* link regulators to MMC adapters */ | 
 | 199 | 	beagle_vmmc1_supply.dev = mmc[0].dev; | 
 | 200 | 	beagle_vsim_supply.dev = mmc[0].dev; | 
 | 201 |  | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 202 | 	/* REVISIT: need ehci-omap hooks for external VBUS | 
 | 203 | 	 * power switch and overcurrent detect | 
 | 204 | 	 */ | 
 | 205 |  | 
 | 206 | 	gpio_request(gpio + 1, "EHCI_nOC"); | 
 | 207 | 	gpio_direction_input(gpio + 1); | 
 | 208 |  | 
 | 209 | 	/* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ | 
 | 210 | 	gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); | 
| Jarkko Nikula | e9840dc | 2009-11-11 11:00:36 -0800 | [diff] [blame] | 211 | 	gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 212 |  | 
 | 213 | 	/* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ | 
 | 214 | 	gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; | 
 | 215 |  | 
 | 216 | 	return 0; | 
 | 217 | } | 
 | 218 |  | 
 | 219 | static struct twl4030_gpio_platform_data beagle_gpio_data = { | 
 | 220 | 	.gpio_base	= OMAP_MAX_GPIO_LINES, | 
 | 221 | 	.irq_base	= TWL4030_GPIO_IRQ_BASE, | 
 | 222 | 	.irq_end	= TWL4030_GPIO_IRQ_END, | 
 | 223 | 	.use_leds	= true, | 
 | 224 | 	.pullups	= BIT(1), | 
 | 225 | 	.pulldowns	= BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13) | 
 | 226 | 				| BIT(15) | BIT(16) | BIT(17), | 
 | 227 | 	.setup		= beagle_twl_gpio_setup, | 
 | 228 | }; | 
 | 229 |  | 
| David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 230 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ | 
 | 231 | static struct regulator_init_data beagle_vmmc1 = { | 
 | 232 | 	.constraints = { | 
 | 233 | 		.min_uV			= 1850000, | 
 | 234 | 		.max_uV			= 3150000, | 
 | 235 | 		.valid_modes_mask	= REGULATOR_MODE_NORMAL | 
 | 236 | 					| REGULATOR_MODE_STANDBY, | 
 | 237 | 		.valid_ops_mask		= REGULATOR_CHANGE_VOLTAGE | 
 | 238 | 					| REGULATOR_CHANGE_MODE | 
 | 239 | 					| REGULATOR_CHANGE_STATUS, | 
 | 240 | 	}, | 
 | 241 | 	.num_consumer_supplies	= 1, | 
 | 242 | 	.consumer_supplies	= &beagle_vmmc1_supply, | 
 | 243 | }; | 
 | 244 |  | 
 | 245 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ | 
 | 246 | static struct regulator_init_data beagle_vsim = { | 
 | 247 | 	.constraints = { | 
 | 248 | 		.min_uV			= 1800000, | 
 | 249 | 		.max_uV			= 3000000, | 
 | 250 | 		.valid_modes_mask	= REGULATOR_MODE_NORMAL | 
 | 251 | 					| REGULATOR_MODE_STANDBY, | 
 | 252 | 		.valid_ops_mask		= REGULATOR_CHANGE_VOLTAGE | 
 | 253 | 					| REGULATOR_CHANGE_MODE | 
 | 254 | 					| REGULATOR_CHANGE_STATUS, | 
 | 255 | 	}, | 
 | 256 | 	.num_consumer_supplies	= 1, | 
 | 257 | 	.consumer_supplies	= &beagle_vsim_supply, | 
 | 258 | }; | 
 | 259 |  | 
 | 260 | /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */ | 
 | 261 | static struct regulator_init_data beagle_vdac = { | 
 | 262 | 	.constraints = { | 
 | 263 | 		.min_uV			= 1800000, | 
 | 264 | 		.max_uV			= 1800000, | 
 | 265 | 		.valid_modes_mask	= REGULATOR_MODE_NORMAL | 
 | 266 | 					| REGULATOR_MODE_STANDBY, | 
 | 267 | 		.valid_ops_mask		= REGULATOR_CHANGE_MODE | 
 | 268 | 					| REGULATOR_CHANGE_STATUS, | 
 | 269 | 	}, | 
 | 270 | 	.num_consumer_supplies	= 1, | 
 | 271 | 	.consumer_supplies	= &beagle_vdac_supply, | 
 | 272 | }; | 
 | 273 |  | 
 | 274 | /* VPLL2 for digital video outputs */ | 
 | 275 | static struct regulator_init_data beagle_vpll2 = { | 
 | 276 | 	.constraints = { | 
 | 277 | 		.name			= "VDVI", | 
 | 278 | 		.min_uV			= 1800000, | 
 | 279 | 		.max_uV			= 1800000, | 
 | 280 | 		.valid_modes_mask	= REGULATOR_MODE_NORMAL | 
 | 281 | 					| REGULATOR_MODE_STANDBY, | 
 | 282 | 		.valid_ops_mask		= REGULATOR_CHANGE_MODE | 
 | 283 | 					| REGULATOR_CHANGE_STATUS, | 
 | 284 | 	}, | 
 | 285 | 	.num_consumer_supplies	= 1, | 
 | 286 | 	.consumer_supplies	= &beagle_vdvi_supply, | 
 | 287 | }; | 
 | 288 |  | 
| Felipe Balbi | bd04e46 | 2009-08-28 11:24:15 -0700 | [diff] [blame] | 289 | static struct twl4030_usb_data beagle_usb_data = { | 
 | 290 | 	.usb_mode	= T2_USB_MODE_ULPI, | 
 | 291 | }; | 
 | 292 |  | 
| Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 293 | static struct twl4030_codec_audio_data beagle_audio_data = { | 
 | 294 | 	.audio_mclk = 26000000, | 
 | 295 | }; | 
 | 296 |  | 
 | 297 | static struct twl4030_codec_data beagle_codec_data = { | 
| Peter Ujfalusi | 6df74ef | 2009-11-04 09:58:18 +0200 | [diff] [blame] | 298 | 	.audio_mclk = 26000000, | 
| Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 299 | 	.audio = &beagle_audio_data, | 
 | 300 | }; | 
 | 301 |  | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 302 | static struct twl4030_platform_data beagle_twldata = { | 
 | 303 | 	.irq_base	= TWL4030_IRQ_BASE, | 
 | 304 | 	.irq_end	= TWL4030_IRQ_END, | 
 | 305 |  | 
 | 306 | 	/* platform_data for children goes here */ | 
| Felipe Balbi | bd04e46 | 2009-08-28 11:24:15 -0700 | [diff] [blame] | 307 | 	.usb		= &beagle_usb_data, | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 308 | 	.gpio		= &beagle_gpio_data, | 
| Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 309 | 	.codec		= &beagle_codec_data, | 
| David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 310 | 	.vmmc1		= &beagle_vmmc1, | 
 | 311 | 	.vsim		= &beagle_vsim, | 
 | 312 | 	.vdac		= &beagle_vdac, | 
 | 313 | 	.vpll2		= &beagle_vpll2, | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 314 | }; | 
 | 315 |  | 
 | 316 | static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { | 
 | 317 | 	{ | 
 | 318 | 		I2C_BOARD_INFO("twl4030", 0x48), | 
 | 319 | 		.flags = I2C_CLIENT_WAKE, | 
 | 320 | 		.irq = INT_34XX_SYS_NIRQ, | 
 | 321 | 		.platform_data = &beagle_twldata, | 
 | 322 | 	}, | 
 | 323 | }; | 
 | 324 |  | 
 | 325 | static int __init omap3_beagle_i2c_init(void) | 
 | 326 | { | 
 | 327 | 	omap_register_i2c_bus(1, 2600, beagle_i2c_boardinfo, | 
 | 328 | 			ARRAY_SIZE(beagle_i2c_boardinfo)); | 
| Koen Kooi | 8ca7fe2 | 2009-03-04 10:07:42 -0800 | [diff] [blame] | 329 | 	/* Bus 3 is attached to the DVI port where devices like the pico DLP | 
 | 330 | 	 * projector don't work reliably with 400kHz */ | 
 | 331 | 	omap_register_i2c_bus(3, 100, NULL, 0); | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 332 | 	return 0; | 
 | 333 | } | 
 | 334 |  | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 335 | static struct gpio_led gpio_leds[] = { | 
 | 336 | 	{ | 
 | 337 | 		.name			= "beagleboard::usr0", | 
 | 338 | 		.default_trigger	= "heartbeat", | 
 | 339 | 		.gpio			= 150, | 
 | 340 | 	}, | 
 | 341 | 	{ | 
 | 342 | 		.name			= "beagleboard::usr1", | 
 | 343 | 		.default_trigger	= "mmc0", | 
 | 344 | 		.gpio			= 149, | 
 | 345 | 	}, | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 346 | 	{ | 
 | 347 | 		.name			= "beagleboard::pmu_stat", | 
 | 348 | 		.gpio			= -EINVAL,	/* gets replaced */ | 
 | 349 | 		.active_low		= true, | 
 | 350 | 	}, | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 351 | }; | 
 | 352 |  | 
 | 353 | static struct gpio_led_platform_data gpio_led_info = { | 
 | 354 | 	.leds		= gpio_leds, | 
 | 355 | 	.num_leds	= ARRAY_SIZE(gpio_leds), | 
 | 356 | }; | 
 | 357 |  | 
 | 358 | static struct platform_device leds_gpio = { | 
 | 359 | 	.name	= "leds-gpio", | 
 | 360 | 	.id	= -1, | 
 | 361 | 	.dev	= { | 
 | 362 | 		.platform_data	= &gpio_led_info, | 
 | 363 | 	}, | 
 | 364 | }; | 
 | 365 |  | 
 | 366 | static struct gpio_keys_button gpio_buttons[] = { | 
 | 367 | 	{ | 
 | 368 | 		.code			= BTN_EXTRA, | 
 | 369 | 		.gpio			= 7, | 
 | 370 | 		.desc			= "user", | 
 | 371 | 		.wakeup			= 1, | 
 | 372 | 	}, | 
 | 373 | }; | 
 | 374 |  | 
 | 375 | static struct gpio_keys_platform_data gpio_key_info = { | 
 | 376 | 	.buttons	= gpio_buttons, | 
 | 377 | 	.nbuttons	= ARRAY_SIZE(gpio_buttons), | 
 | 378 | }; | 
 | 379 |  | 
 | 380 | static struct platform_device keys_gpio = { | 
 | 381 | 	.name	= "gpio-keys", | 
 | 382 | 	.id	= -1, | 
 | 383 | 	.dev	= { | 
 | 384 | 		.platform_data	= &gpio_key_info, | 
 | 385 | 	}, | 
 | 386 | }; | 
 | 387 |  | 
| Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 388 | static void __init omap3_beagle_init_irq(void) | 
 | 389 | { | 
| Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 390 | 	omap2_init_common_hw(mt46h32m32lf6_sdrc_params, | 
 | 391 | 			     mt46h32m32lf6_sdrc_params); | 
 | 392 | 	omap_init_irq(); | 
 | 393 | #ifdef CONFIG_OMAP_32K_TIMER | 
 | 394 | 	omap2_gp_clockevent_set_gptimer(12); | 
 | 395 | #endif | 
 | 396 | 	omap_gpio_init(); | 
 | 397 | } | 
 | 398 |  | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 399 | static struct platform_device *omap3_beagle_devices[] __initdata = { | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 400 | 	&leds_gpio, | 
 | 401 | 	&keys_gpio, | 
| Koen Kooi | 044d32f | 2010-04-22 10:23:42 +0200 | [diff] [blame] | 402 | 	&beagle_dss_device, | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 403 | }; | 
 | 404 |  | 
 | 405 | static void __init omap3beagle_flash_init(void) | 
 | 406 | { | 
 | 407 | 	u8 cs = 0; | 
 | 408 | 	u8 nandcs = GPMC_CS_NUM + 1; | 
 | 409 |  | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 410 | 	/* find out the chip-select on which NAND exists */ | 
 | 411 | 	while (cs < GPMC_CS_NUM) { | 
 | 412 | 		u32 ret = 0; | 
 | 413 | 		ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | 
 | 414 |  | 
 | 415 | 		if ((ret & 0xC00) == 0x800) { | 
 | 416 | 			printk(KERN_INFO "Found NAND on CS%d\n", cs); | 
 | 417 | 			if (nandcs > GPMC_CS_NUM) | 
 | 418 | 				nandcs = cs; | 
 | 419 | 		} | 
 | 420 | 		cs++; | 
 | 421 | 	} | 
 | 422 |  | 
 | 423 | 	if (nandcs > GPMC_CS_NUM) { | 
 | 424 | 		printk(KERN_INFO "NAND: Unable to find configuration " | 
 | 425 | 				 "in GPMC\n "); | 
 | 426 | 		return; | 
 | 427 | 	} | 
 | 428 |  | 
 | 429 | 	if (nandcs < GPMC_CS_NUM) { | 
 | 430 | 		omap3beagle_nand_data.cs = nandcs; | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 431 |  | 
 | 432 | 		printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); | 
| Sukumar Ghorai | f450d86 | 2010-07-09 09:14:46 +0000 | [diff] [blame] | 433 | 		if (gpmc_nand_init(&omap3beagle_nand_data) < 0) | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 434 | 			printk(KERN_ERR "Unable to register NAND device\n"); | 
 | 435 | 	} | 
 | 436 | } | 
 | 437 |  | 
| Felipe Balbi | 6f69a18 | 2010-03-04 09:45:53 +0200 | [diff] [blame] | 438 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { | 
| Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 439 |  | 
 | 440 | 	.port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, | 
 | 441 | 	.port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, | 
 | 442 | 	.port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, | 
 | 443 |  | 
 | 444 | 	.phy_reset  = true, | 
 | 445 | 	.reset_gpio_port[0]  = -EINVAL, | 
 | 446 | 	.reset_gpio_port[1]  = 147, | 
 | 447 | 	.reset_gpio_port[2]  = -EINVAL | 
 | 448 | }; | 
 | 449 |  | 
| Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 450 | #ifdef CONFIG_OMAP_MUX | 
 | 451 | static struct omap_board_mux board_mux[] __initdata = { | 
 | 452 | 	{ .reg_offset = OMAP_MUX_TERMINATOR }, | 
 | 453 | }; | 
 | 454 | #else | 
 | 455 | #define board_mux	NULL | 
 | 456 | #endif | 
 | 457 |  | 
| Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 458 | static struct omap_musb_board_data musb_board_data = { | 
 | 459 | 	.interface_type		= MUSB_INTERFACE_ULPI, | 
 | 460 | 	.mode			= MUSB_OTG, | 
 | 461 | 	.power			= 100, | 
 | 462 | }; | 
 | 463 |  | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 464 | static void __init omap3_beagle_init(void) | 
 | 465 | { | 
| Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 466 | 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 467 | 	omap3_beagle_i2c_init(); | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 468 | 	platform_add_devices(omap3_beagle_devices, | 
 | 469 | 			ARRAY_SIZE(omap3_beagle_devices)); | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 470 | 	omap_serial_init(); | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 471 |  | 
| Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 472 | 	omap_mux_init_gpio(170, OMAP_PIN_INPUT); | 
| Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 473 | 	gpio_request(170, "DVI_nPD"); | 
 | 474 | 	/* REVISIT leave DVI powered down until it's needed ... */ | 
 | 475 | 	gpio_direction_output(170, true); | 
 | 476 |  | 
| Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 477 | 	usb_musb_init(&musb_board_data); | 
| Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 478 | 	usb_ehci_init(&ehci_pdata); | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 479 | 	omap3beagle_flash_init(); | 
| Jean Pihet | 9fb9741 | 2009-07-24 19:43:25 -0600 | [diff] [blame] | 480 |  | 
 | 481 | 	/* Ensure SDRC pins are mux'd for self-refresh */ | 
| Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 482 | 	omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); | 
 | 483 | 	omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); | 
| Koen Kooi | 044d32f | 2010-04-22 10:23:42 +0200 | [diff] [blame] | 484 |  | 
 | 485 | 	beagle_display_init(); | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 486 | } | 
 | 487 |  | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 488 | MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board") | 
 | 489 | 	/* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */ | 
 | 490 | 	.phys_io	= 0x48000000, | 
| Santosh Shilimkar | b4224b2 | 2009-10-19 17:25:55 -0700 | [diff] [blame] | 491 | 	.io_pg_offst	= ((0xfa000000) >> 18) & 0xfffc, | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 492 | 	.boot_params	= 0x80000100, | 
| Mike Rapoport | 869fef4 | 2010-08-04 14:43:18 +0300 | [diff] [blame] | 493 | 	.map_io		= omap3_map_io, | 
| Russell King | 71ee7da | 2010-05-23 10:18:16 +0100 | [diff] [blame] | 494 | 	.reserve	= omap_reserve, | 
| Syed Mohammed, Khasim | 2885f00 | 2008-10-09 17:51:42 +0300 | [diff] [blame] | 495 | 	.init_irq	= omap3_beagle_init_irq, | 
 | 496 | 	.init_machine	= omap3_beagle_init, | 
 | 497 | 	.timer		= &omap_timer, | 
 | 498 | MACHINE_END |