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