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