Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-omap2/board-3430sdp.c |
| 3 | * |
| 4 | * Copyright (C) 2007 Texas Instruments |
| 5 | * |
| 6 | * Modified from mach-omap2/board-generic.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/input.h> |
Janusz Krzysztofik | 6135434 | 2009-10-22 14:43:17 -0700 | [diff] [blame] | 20 | #include <linux/input/matrix_keypad.h> |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 21 | #include <linux/spi/spi.h> |
| 22 | #include <linux/spi/ads7846.h> |
Santosh Shilimkar | b07682b | 2009-12-13 20:05:51 +0100 | [diff] [blame] | 23 | #include <linux/i2c/twl.h> |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 24 | #include <linux/regulator/machine.h> |
| 25 | #include <linux/io.h> |
| 26 | #include <linux/gpio.h> |
| 27 | |
| 28 | #include <mach/hardware.h> |
| 29 | #include <asm/mach-types.h> |
| 30 | #include <asm/mach/arch.h> |
| 31 | #include <asm/mach/map.h> |
| 32 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 33 | #include <plat/mcspi.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 34 | #include <plat/board.h> |
| 35 | #include <plat/usb.h> |
| 36 | #include <plat/common.h> |
| 37 | #include <plat/dma.h> |
| 38 | #include <plat/gpmc.h> |
Tomi Valkeinen | d9056ce | 2009-12-09 18:25:18 +0200 | [diff] [blame] | 39 | #include <plat/display.h> |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 40 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 41 | #include <plat/control.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 42 | #include <plat/gpmc-smc91x.h> |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 43 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 44 | #include "mux.h" |
Paul Walmsley | 17a722c | 2009-05-28 14:03:59 -0700 | [diff] [blame] | 45 | #include "sdram-qimonda-hyb18m512160af-6.h" |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 46 | #include "mmc-twl4030.h" |
| 47 | |
| 48 | #define CONFIG_DISABLE_HFCLK 1 |
| 49 | |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 50 | #define SDP3430_TS_GPIO_IRQ_SDPV1 3 |
| 51 | #define SDP3430_TS_GPIO_IRQ_SDPV2 2 |
| 52 | |
| 53 | #define ENABLE_VAUX3_DEDICATED 0x03 |
| 54 | #define ENABLE_VAUX3_DEV_GRP 0x20 |
| 55 | |
| 56 | #define TWL4030_MSECURE_GPIO 22 |
| 57 | |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 58 | static int board_keymap[] = { |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 59 | KEY(0, 0, KEY_LEFT), |
| 60 | KEY(0, 1, KEY_RIGHT), |
| 61 | KEY(0, 2, KEY_A), |
| 62 | KEY(0, 3, KEY_B), |
| 63 | KEY(0, 4, KEY_C), |
| 64 | KEY(1, 0, KEY_DOWN), |
| 65 | KEY(1, 1, KEY_UP), |
| 66 | KEY(1, 2, KEY_E), |
| 67 | KEY(1, 3, KEY_F), |
| 68 | KEY(1, 4, KEY_G), |
| 69 | KEY(2, 0, KEY_ENTER), |
| 70 | KEY(2, 1, KEY_I), |
| 71 | KEY(2, 2, KEY_J), |
| 72 | KEY(2, 3, KEY_K), |
| 73 | KEY(2, 4, KEY_3), |
| 74 | KEY(3, 0, KEY_M), |
| 75 | KEY(3, 1, KEY_N), |
| 76 | KEY(3, 2, KEY_O), |
| 77 | KEY(3, 3, KEY_P), |
| 78 | KEY(3, 4, KEY_Q), |
| 79 | KEY(4, 0, KEY_R), |
| 80 | KEY(4, 1, KEY_4), |
| 81 | KEY(4, 2, KEY_T), |
| 82 | KEY(4, 3, KEY_U), |
| 83 | KEY(4, 4, KEY_D), |
| 84 | KEY(5, 0, KEY_V), |
| 85 | KEY(5, 1, KEY_W), |
| 86 | KEY(5, 2, KEY_L), |
| 87 | KEY(5, 3, KEY_S), |
| 88 | KEY(5, 4, KEY_H), |
| 89 | 0 |
| 90 | }; |
| 91 | |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 92 | static struct matrix_keymap_data board_map_data = { |
| 93 | .keymap = board_keymap, |
| 94 | .keymap_size = ARRAY_SIZE(board_keymap), |
| 95 | }; |
| 96 | |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 97 | static struct twl4030_keypad_data sdp3430_kp_data = { |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 98 | .keymap_data = &board_map_data, |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 99 | .rows = 5, |
| 100 | .cols = 6, |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 101 | .rep = 1, |
| 102 | }; |
| 103 | |
| 104 | static int ts_gpio; /* Needed for ads7846_get_pendown_state */ |
| 105 | |
| 106 | /** |
| 107 | * @brief ads7846_dev_init : Requests & sets GPIO line for pen-irq |
| 108 | * |
| 109 | * @return - void. If request gpio fails then Flag KERN_ERR. |
| 110 | */ |
| 111 | static void ads7846_dev_init(void) |
| 112 | { |
| 113 | if (gpio_request(ts_gpio, "ADS7846 pendown") < 0) { |
| 114 | printk(KERN_ERR "can't get ads746 pen down GPIO\n"); |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | gpio_direction_input(ts_gpio); |
| 119 | |
| 120 | omap_set_gpio_debounce(ts_gpio, 1); |
| 121 | omap_set_gpio_debounce_time(ts_gpio, 0xa); |
| 122 | } |
| 123 | |
| 124 | static int ads7846_get_pendown_state(void) |
| 125 | { |
| 126 | return !gpio_get_value(ts_gpio); |
| 127 | } |
| 128 | |
| 129 | static struct ads7846_platform_data tsc2046_config __initdata = { |
| 130 | .get_pendown_state = ads7846_get_pendown_state, |
| 131 | .keep_vref_on = 1, |
| 132 | }; |
| 133 | |
| 134 | |
| 135 | static struct omap2_mcspi_device_config tsc2046_mcspi_config = { |
| 136 | .turbo_mode = 0, |
| 137 | .single_channel = 1, /* 0: slave, 1: master */ |
| 138 | }; |
| 139 | |
| 140 | static struct spi_board_info sdp3430_spi_board_info[] __initdata = { |
| 141 | [0] = { |
| 142 | /* |
| 143 | * TSC2046 operates at a max freqency of 2MHz, so |
| 144 | * operate slightly below at 1.5MHz |
| 145 | */ |
| 146 | .modalias = "ads7846", |
| 147 | .bus_num = 1, |
| 148 | .chip_select = 0, |
| 149 | .max_speed_hz = 1500000, |
| 150 | .controller_data = &tsc2046_mcspi_config, |
| 151 | .irq = 0, |
| 152 | .platform_data = &tsc2046_config, |
| 153 | }, |
| 154 | }; |
| 155 | |
Tomi Valkeinen | d9056ce | 2009-12-09 18:25:18 +0200 | [diff] [blame] | 156 | |
| 157 | #define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8 |
| 158 | #define SDP3430_LCD_PANEL_ENABLE_GPIO 5 |
| 159 | |
| 160 | static unsigned backlight_gpio; |
| 161 | static unsigned enable_gpio; |
| 162 | static int lcd_enabled; |
| 163 | static int dvi_enabled; |
| 164 | |
| 165 | static void __init sdp3430_display_init(void) |
| 166 | { |
| 167 | int r; |
| 168 | |
| 169 | enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO; |
| 170 | backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO; |
| 171 | |
| 172 | r = gpio_request(enable_gpio, "LCD reset"); |
| 173 | if (r) { |
| 174 | printk(KERN_ERR "failed to get LCD reset GPIO\n"); |
| 175 | goto err0; |
| 176 | } |
| 177 | |
| 178 | r = gpio_request(backlight_gpio, "LCD Backlight"); |
| 179 | if (r) { |
| 180 | printk(KERN_ERR "failed to get LCD backlight GPIO\n"); |
| 181 | goto err1; |
| 182 | } |
| 183 | |
| 184 | gpio_direction_output(enable_gpio, 0); |
| 185 | gpio_direction_output(backlight_gpio, 0); |
| 186 | |
| 187 | return; |
| 188 | err1: |
| 189 | gpio_free(enable_gpio); |
| 190 | err0: |
| 191 | return; |
| 192 | } |
| 193 | |
| 194 | static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) |
| 195 | { |
| 196 | if (dvi_enabled) { |
| 197 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); |
| 198 | return -EINVAL; |
| 199 | } |
| 200 | |
| 201 | gpio_direction_output(enable_gpio, 1); |
| 202 | gpio_direction_output(backlight_gpio, 1); |
| 203 | |
| 204 | lcd_enabled = 1; |
| 205 | |
| 206 | return 0; |
| 207 | } |
| 208 | |
| 209 | static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev) |
| 210 | { |
| 211 | lcd_enabled = 0; |
| 212 | |
| 213 | gpio_direction_output(enable_gpio, 0); |
| 214 | gpio_direction_output(backlight_gpio, 0); |
| 215 | } |
| 216 | |
| 217 | static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) |
| 218 | { |
| 219 | if (lcd_enabled) { |
| 220 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); |
| 221 | return -EINVAL; |
| 222 | } |
| 223 | |
| 224 | dvi_enabled = 1; |
| 225 | |
| 226 | return 0; |
| 227 | } |
| 228 | |
| 229 | static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev) |
| 230 | { |
| 231 | dvi_enabled = 0; |
| 232 | } |
| 233 | |
| 234 | static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev) |
| 235 | { |
| 236 | return 0; |
| 237 | } |
| 238 | |
| 239 | static void sdp3430_panel_disable_tv(struct omap_dss_device *dssdev) |
| 240 | { |
| 241 | } |
| 242 | |
| 243 | |
| 244 | static struct omap_dss_device sdp3430_lcd_device = { |
| 245 | .name = "lcd", |
| 246 | .driver_name = "sharp_ls_panel", |
| 247 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 248 | .phy.dpi.data_lines = 16, |
| 249 | .platform_enable = sdp3430_panel_enable_lcd, |
| 250 | .platform_disable = sdp3430_panel_disable_lcd, |
| 251 | }; |
| 252 | |
| 253 | static struct omap_dss_device sdp3430_dvi_device = { |
| 254 | .name = "dvi", |
| 255 | .driver_name = "generic_panel", |
| 256 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 257 | .phy.dpi.data_lines = 24, |
| 258 | .platform_enable = sdp3430_panel_enable_dvi, |
| 259 | .platform_disable = sdp3430_panel_disable_dvi, |
| 260 | }; |
| 261 | |
| 262 | static struct omap_dss_device sdp3430_tv_device = { |
| 263 | .name = "tv", |
| 264 | .driver_name = "venc", |
| 265 | .type = OMAP_DISPLAY_TYPE_VENC, |
| 266 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, |
| 267 | .platform_enable = sdp3430_panel_enable_tv, |
| 268 | .platform_disable = sdp3430_panel_disable_tv, |
| 269 | }; |
| 270 | |
| 271 | |
| 272 | static struct omap_dss_device *sdp3430_dss_devices[] = { |
| 273 | &sdp3430_lcd_device, |
| 274 | &sdp3430_dvi_device, |
| 275 | &sdp3430_tv_device, |
| 276 | }; |
| 277 | |
| 278 | static struct omap_dss_board_info sdp3430_dss_data = { |
| 279 | .num_devices = ARRAY_SIZE(sdp3430_dss_devices), |
| 280 | .devices = sdp3430_dss_devices, |
| 281 | .default_device = &sdp3430_lcd_device, |
| 282 | }; |
| 283 | |
| 284 | static struct platform_device sdp3430_dss_device = { |
| 285 | .name = "omapdss", |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 286 | .id = -1, |
Tomi Valkeinen | d9056ce | 2009-12-09 18:25:18 +0200 | [diff] [blame] | 287 | .dev = { |
| 288 | .platform_data = &sdp3430_dss_data, |
| 289 | }, |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 290 | }; |
| 291 | |
Tomi Valkeinen | d9056ce | 2009-12-09 18:25:18 +0200 | [diff] [blame] | 292 | static struct regulator_consumer_supply sdp3430_vdda_dac_supply = { |
| 293 | .supply = "vdda_dac", |
| 294 | .dev = &sdp3430_dss_device.dev, |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 295 | }; |
| 296 | |
| 297 | static struct platform_device *sdp3430_devices[] __initdata = { |
Tomi Valkeinen | d9056ce | 2009-12-09 18:25:18 +0200 | [diff] [blame] | 298 | &sdp3430_dss_device, |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 299 | }; |
| 300 | |
| 301 | static struct omap_board_config_kernel sdp3430_config[] __initdata = { |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 302 | }; |
| 303 | |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 304 | static void __init omap_3430sdp_init_irq(void) |
| 305 | { |
| 306 | omap_board_config = sdp3430_config; |
| 307 | omap_board_config_size = ARRAY_SIZE(sdp3430_config); |
| 308 | omap2_init_common_hw(hyb18m512160af6_sdrc_params, NULL); |
| 309 | omap_init_irq(); |
| 310 | omap_gpio_init(); |
| 311 | } |
| 312 | |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 313 | static int sdp3430_batt_table[] = { |
| 314 | /* 0 C*/ |
| 315 | 30800, 29500, 28300, 27100, |
| 316 | 26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900, |
| 317 | 17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100, |
| 318 | 11600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310, |
| 319 | 8020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830, |
| 320 | 5640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170, |
| 321 | 4040, 3910, 3790, 3670, 3550 |
| 322 | }; |
| 323 | |
| 324 | static struct twl4030_bci_platform_data sdp3430_bci_data = { |
| 325 | .battery_tmp_tbl = sdp3430_batt_table, |
| 326 | .tblsize = ARRAY_SIZE(sdp3430_batt_table), |
| 327 | }; |
| 328 | |
| 329 | static struct twl4030_hsmmc_info mmc[] = { |
| 330 | { |
| 331 | .mmc = 1, |
| 332 | /* 8 bits (default) requires S6.3 == ON, |
| 333 | * so the SIM card isn't used; else 4 bits. |
| 334 | */ |
| 335 | .wires = 8, |
| 336 | .gpio_wp = 4, |
| 337 | }, |
| 338 | { |
| 339 | .mmc = 2, |
| 340 | .wires = 8, |
| 341 | .gpio_wp = 7, |
| 342 | }, |
| 343 | {} /* Terminator */ |
| 344 | }; |
| 345 | |
| 346 | static struct regulator_consumer_supply sdp3430_vmmc1_supply = { |
| 347 | .supply = "vmmc", |
| 348 | }; |
| 349 | |
| 350 | static struct regulator_consumer_supply sdp3430_vsim_supply = { |
| 351 | .supply = "vmmc_aux", |
| 352 | }; |
| 353 | |
| 354 | static struct regulator_consumer_supply sdp3430_vmmc2_supply = { |
| 355 | .supply = "vmmc", |
| 356 | }; |
| 357 | |
| 358 | static int sdp3430_twl_gpio_setup(struct device *dev, |
| 359 | unsigned gpio, unsigned ngpio) |
| 360 | { |
| 361 | /* gpio + 0 is "mmc0_cd" (input/IRQ), |
| 362 | * gpio + 1 is "mmc1_cd" (input/IRQ) |
| 363 | */ |
| 364 | mmc[0].gpio_cd = gpio + 0; |
| 365 | mmc[1].gpio_cd = gpio + 1; |
| 366 | twl4030_mmc_init(mmc); |
| 367 | |
| 368 | /* link regulators to MMC adapters ... we "know" the |
| 369 | * regulators will be set up only *after* we return. |
| 370 | */ |
| 371 | sdp3430_vmmc1_supply.dev = mmc[0].dev; |
| 372 | sdp3430_vsim_supply.dev = mmc[0].dev; |
| 373 | sdp3430_vmmc2_supply.dev = mmc[1].dev; |
| 374 | |
| 375 | /* gpio + 7 is "sub_lcd_en_bkl" (output/PWM1) */ |
| 376 | gpio_request(gpio + 7, "sub_lcd_en_bkl"); |
| 377 | gpio_direction_output(gpio + 7, 0); |
| 378 | |
| 379 | /* gpio + 15 is "sub_lcd_nRST" (output) */ |
| 380 | gpio_request(gpio + 15, "sub_lcd_nRST"); |
| 381 | gpio_direction_output(gpio + 15, 0); |
| 382 | |
| 383 | return 0; |
| 384 | } |
| 385 | |
| 386 | static struct twl4030_gpio_platform_data sdp3430_gpio_data = { |
| 387 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 388 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 389 | .irq_end = TWL4030_GPIO_IRQ_END, |
| 390 | .pulldowns = BIT(2) | BIT(6) | BIT(8) | BIT(13) |
| 391 | | BIT(16) | BIT(17), |
| 392 | .setup = sdp3430_twl_gpio_setup, |
| 393 | }; |
| 394 | |
| 395 | static struct twl4030_usb_data sdp3430_usb_data = { |
| 396 | .usb_mode = T2_USB_MODE_ULPI, |
| 397 | }; |
| 398 | |
| 399 | static struct twl4030_madc_platform_data sdp3430_madc_data = { |
| 400 | .irq_line = 1, |
| 401 | }; |
| 402 | |
| 403 | /* |
| 404 | * Apply all the fixed voltages since most versions of U-Boot |
| 405 | * don't bother with that initialization. |
| 406 | */ |
| 407 | |
| 408 | /* VAUX1 for mainboard (irda and sub-lcd) */ |
| 409 | static struct regulator_init_data sdp3430_vaux1 = { |
| 410 | .constraints = { |
| 411 | .min_uV = 2800000, |
| 412 | .max_uV = 2800000, |
| 413 | .apply_uV = true, |
| 414 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 415 | | REGULATOR_MODE_STANDBY, |
| 416 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 417 | | REGULATOR_CHANGE_STATUS, |
| 418 | }, |
| 419 | }; |
| 420 | |
| 421 | /* VAUX2 for camera module */ |
| 422 | static struct regulator_init_data sdp3430_vaux2 = { |
| 423 | .constraints = { |
| 424 | .min_uV = 2800000, |
| 425 | .max_uV = 2800000, |
| 426 | .apply_uV = true, |
| 427 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 428 | | REGULATOR_MODE_STANDBY, |
| 429 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 430 | | REGULATOR_CHANGE_STATUS, |
| 431 | }, |
| 432 | }; |
| 433 | |
| 434 | /* VAUX3 for LCD board */ |
| 435 | static struct regulator_init_data sdp3430_vaux3 = { |
| 436 | .constraints = { |
| 437 | .min_uV = 2800000, |
| 438 | .max_uV = 2800000, |
| 439 | .apply_uV = true, |
| 440 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 441 | | REGULATOR_MODE_STANDBY, |
| 442 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 443 | | REGULATOR_CHANGE_STATUS, |
| 444 | }, |
| 445 | }; |
| 446 | |
| 447 | /* VAUX4 for OMAP VDD_CSI2 (camera) */ |
| 448 | static struct regulator_init_data sdp3430_vaux4 = { |
| 449 | .constraints = { |
| 450 | .min_uV = 1800000, |
| 451 | .max_uV = 1800000, |
| 452 | .apply_uV = true, |
| 453 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 454 | | REGULATOR_MODE_STANDBY, |
| 455 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 456 | | REGULATOR_CHANGE_STATUS, |
| 457 | }, |
| 458 | }; |
| 459 | |
| 460 | /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ |
| 461 | static struct regulator_init_data sdp3430_vmmc1 = { |
| 462 | .constraints = { |
| 463 | .min_uV = 1850000, |
| 464 | .max_uV = 3150000, |
| 465 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 466 | | REGULATOR_MODE_STANDBY, |
| 467 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 468 | | REGULATOR_CHANGE_MODE |
| 469 | | REGULATOR_CHANGE_STATUS, |
| 470 | }, |
| 471 | .num_consumer_supplies = 1, |
| 472 | .consumer_supplies = &sdp3430_vmmc1_supply, |
| 473 | }; |
| 474 | |
| 475 | /* VMMC2 for MMC2 card */ |
| 476 | static struct regulator_init_data sdp3430_vmmc2 = { |
| 477 | .constraints = { |
| 478 | .min_uV = 1850000, |
| 479 | .max_uV = 1850000, |
| 480 | .apply_uV = true, |
| 481 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 482 | | REGULATOR_MODE_STANDBY, |
| 483 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 484 | | REGULATOR_CHANGE_STATUS, |
| 485 | }, |
| 486 | .num_consumer_supplies = 1, |
| 487 | .consumer_supplies = &sdp3430_vmmc2_supply, |
| 488 | }; |
| 489 | |
| 490 | /* VSIM for OMAP VDD_MMC1A (i/o for DAT4..DAT7) */ |
| 491 | static struct regulator_init_data sdp3430_vsim = { |
| 492 | .constraints = { |
| 493 | .min_uV = 1800000, |
| 494 | .max_uV = 3000000, |
| 495 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 496 | | REGULATOR_MODE_STANDBY, |
| 497 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 498 | | REGULATOR_CHANGE_MODE |
| 499 | | REGULATOR_CHANGE_STATUS, |
| 500 | }, |
| 501 | .num_consumer_supplies = 1, |
| 502 | .consumer_supplies = &sdp3430_vsim_supply, |
| 503 | }; |
| 504 | |
| 505 | /* VDAC for DSS driving S-Video */ |
| 506 | static struct regulator_init_data sdp3430_vdac = { |
| 507 | .constraints = { |
| 508 | .min_uV = 1800000, |
| 509 | .max_uV = 1800000, |
| 510 | .apply_uV = true, |
| 511 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 512 | | REGULATOR_MODE_STANDBY, |
| 513 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 514 | | REGULATOR_CHANGE_STATUS, |
| 515 | }, |
| 516 | .num_consumer_supplies = 1, |
Tomi Valkeinen | d9056ce | 2009-12-09 18:25:18 +0200 | [diff] [blame] | 517 | .consumer_supplies = &sdp3430_vdda_dac_supply, |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 518 | }; |
| 519 | |
| 520 | /* VPLL2 for digital video outputs */ |
Tomi Valkeinen | d9056ce | 2009-12-09 18:25:18 +0200 | [diff] [blame] | 521 | static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = { |
| 522 | { |
| 523 | .supply = "vdvi", |
| 524 | .dev = &sdp3430_lcd_device.dev, |
| 525 | }, |
| 526 | { |
| 527 | .supply = "vdds_dsi", |
| 528 | .dev = &sdp3430_dss_device.dev, |
| 529 | } |
| 530 | }; |
| 531 | |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 532 | static struct regulator_init_data sdp3430_vpll2 = { |
| 533 | .constraints = { |
| 534 | .name = "VDVI", |
| 535 | .min_uV = 1800000, |
| 536 | .max_uV = 1800000, |
Tomi Valkeinen | d9056ce | 2009-12-09 18:25:18 +0200 | [diff] [blame] | 537 | .apply_uV = true, |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 538 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 539 | | REGULATOR_MODE_STANDBY, |
| 540 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 541 | | REGULATOR_CHANGE_STATUS, |
| 542 | }, |
Tomi Valkeinen | d9056ce | 2009-12-09 18:25:18 +0200 | [diff] [blame] | 543 | .num_consumer_supplies = ARRAY_SIZE(sdp3430_vpll2_supplies), |
| 544 | .consumer_supplies = sdp3430_vpll2_supplies, |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 545 | }; |
| 546 | |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 547 | static struct twl4030_codec_audio_data sdp3430_audio = { |
| 548 | .audio_mclk = 26000000, |
| 549 | }; |
| 550 | |
| 551 | static struct twl4030_codec_data sdp3430_codec = { |
Peter Ujfalusi | 6df74ef | 2009-11-04 09:58:18 +0200 | [diff] [blame] | 552 | .audio_mclk = 26000000, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 553 | .audio = &sdp3430_audio, |
| 554 | }; |
| 555 | |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 556 | static struct twl4030_platform_data sdp3430_twldata = { |
| 557 | .irq_base = TWL4030_IRQ_BASE, |
| 558 | .irq_end = TWL4030_IRQ_END, |
| 559 | |
| 560 | /* platform_data for children goes here */ |
| 561 | .bci = &sdp3430_bci_data, |
| 562 | .gpio = &sdp3430_gpio_data, |
| 563 | .madc = &sdp3430_madc_data, |
| 564 | .keypad = &sdp3430_kp_data, |
| 565 | .usb = &sdp3430_usb_data, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 566 | .codec = &sdp3430_codec, |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 567 | |
| 568 | .vaux1 = &sdp3430_vaux1, |
| 569 | .vaux2 = &sdp3430_vaux2, |
| 570 | .vaux3 = &sdp3430_vaux3, |
| 571 | .vaux4 = &sdp3430_vaux4, |
| 572 | .vmmc1 = &sdp3430_vmmc1, |
| 573 | .vmmc2 = &sdp3430_vmmc2, |
| 574 | .vsim = &sdp3430_vsim, |
| 575 | .vdac = &sdp3430_vdac, |
| 576 | .vpll2 = &sdp3430_vpll2, |
| 577 | }; |
| 578 | |
| 579 | static struct i2c_board_info __initdata sdp3430_i2c_boardinfo[] = { |
| 580 | { |
| 581 | I2C_BOARD_INFO("twl4030", 0x48), |
| 582 | .flags = I2C_CLIENT_WAKE, |
| 583 | .irq = INT_34XX_SYS_NIRQ, |
| 584 | .platform_data = &sdp3430_twldata, |
| 585 | }, |
| 586 | }; |
| 587 | |
| 588 | static int __init omap3430_i2c_init(void) |
| 589 | { |
| 590 | /* i2c1 for PMIC only */ |
| 591 | omap_register_i2c_bus(1, 2600, sdp3430_i2c_boardinfo, |
| 592 | ARRAY_SIZE(sdp3430_i2c_boardinfo)); |
| 593 | /* i2c2 on camera connector (for sensor control) and optional isp1301 */ |
| 594 | omap_register_i2c_bus(2, 400, NULL, 0); |
| 595 | /* i2c3 on display connector (for DVI, tfp410) */ |
| 596 | omap_register_i2c_bus(3, 400, NULL, 0); |
| 597 | return 0; |
| 598 | } |
| 599 | |
Tony Lindgren | 1a48e15 | 2009-05-28 13:23:52 -0700 | [diff] [blame] | 600 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 601 | |
| 602 | static struct omap_smc91x_platform_data board_smc91x_data = { |
| 603 | .cs = 3, |
| 604 | .flags = GPMC_MUX_ADD_DATA | GPMC_TIMINGS_SMC91C96 | |
| 605 | IORESOURCE_IRQ_LOWLEVEL, |
| 606 | }; |
| 607 | |
| 608 | static void __init board_smc91x_init(void) |
| 609 | { |
| 610 | if (omap_rev() > OMAP3430_REV_ES1_0) |
| 611 | board_smc91x_data.gpio_irq = 6; |
| 612 | else |
| 613 | board_smc91x_data.gpio_irq = 29; |
| 614 | |
| 615 | gpmc_smc91x_init(&board_smc91x_data); |
| 616 | } |
| 617 | |
| 618 | #else |
| 619 | |
| 620 | static inline void board_smc91x_init(void) |
| 621 | { |
| 622 | } |
| 623 | |
| 624 | #endif |
| 625 | |
Reddy, Teerth | 5110b29 | 2009-08-24 11:58:59 +0530 | [diff] [blame] | 626 | static void enable_board_wakeup_source(void) |
| 627 | { |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 628 | /* T2 interrupt line (keypad) */ |
| 629 | omap_mux_init_signal("sys_nirq", |
| 630 | OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP); |
Reddy, Teerth | 5110b29 | 2009-08-24 11:58:59 +0530 | [diff] [blame] | 631 | } |
| 632 | |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 633 | static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
| 634 | |
| 635 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, |
| 636 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, |
| 637 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 638 | |
| 639 | .phy_reset = true, |
| 640 | .reset_gpio_port[0] = 57, |
| 641 | .reset_gpio_port[1] = 61, |
| 642 | .reset_gpio_port[2] = -EINVAL |
| 643 | }; |
| 644 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 645 | #ifdef CONFIG_OMAP_MUX |
| 646 | static struct omap_board_mux board_mux[] __initdata = { |
| 647 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 648 | }; |
| 649 | #else |
| 650 | #define board_mux NULL |
| 651 | #endif |
| 652 | |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 653 | static void __init omap_3430sdp_init(void) |
| 654 | { |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 655 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 656 | omap3430_i2c_init(); |
| 657 | platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices)); |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 658 | if (omap_rev() > OMAP3430_REV_ES1_0) |
| 659 | ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV2; |
| 660 | else |
| 661 | ts_gpio = SDP3430_TS_GPIO_IRQ_SDPV1; |
| 662 | sdp3430_spi_board_info[0].irq = gpio_to_irq(ts_gpio); |
| 663 | spi_register_board_info(sdp3430_spi_board_info, |
| 664 | ARRAY_SIZE(sdp3430_spi_board_info)); |
| 665 | ads7846_dev_init(); |
| 666 | omap_serial_init(); |
| 667 | usb_musb_init(); |
Tony Lindgren | 1a48e15 | 2009-05-28 13:23:52 -0700 | [diff] [blame] | 668 | board_smc91x_init(); |
Tomi Valkeinen | d9056ce | 2009-12-09 18:25:18 +0200 | [diff] [blame] | 669 | sdp3430_display_init(); |
Reddy, Teerth | 5110b29 | 2009-08-24 11:58:59 +0530 | [diff] [blame] | 670 | enable_board_wakeup_source(); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 671 | usb_ehci_init(&ehci_pdata); |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 672 | } |
| 673 | |
| 674 | static void __init omap_3430sdp_map_io(void) |
| 675 | { |
| 676 | omap2_set_globals_343x(); |
| 677 | omap2_map_common_io(); |
| 678 | } |
| 679 | |
| 680 | MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board") |
| 681 | /* Maintainer: Syed Khasim - Texas Instruments Inc */ |
| 682 | .phys_io = 0x48000000, |
Santosh Shilimkar | b4224b2 | 2009-10-19 17:25:55 -0700 | [diff] [blame] | 683 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
Syed Mohammed Khasim | 6fdc29e | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 684 | .boot_params = 0x80000100, |
| 685 | .map_io = omap_3430sdp_map_io, |
| 686 | .init_irq = omap_3430sdp_init_irq, |
| 687 | .init_machine = omap_3430sdp_init, |
| 688 | .timer = &omap_timer, |
| 689 | MACHINE_END |