Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Board support file for OMAP4430 SDP. |
| 3 | * |
| 4 | * Copyright (C) 2009 Texas Instruments |
| 5 | * |
| 6 | * Author: Santosh Shilimkar <santosh.shilimkar@ti.com> |
| 7 | * |
| 8 | * Based on mach-omap2/board-3430sdp.c |
| 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/io.h> |
| 19 | #include <linux/gpio.h> |
Maulik Mankad | bce0668 | 2010-02-17 14:09:32 -0800 | [diff] [blame] | 20 | #include <linux/usb/otg.h> |
Abraham Arce | b2aa5e5 | 2010-05-14 12:05:26 -0700 | [diff] [blame] | 21 | #include <linux/spi/spi.h> |
Balaji T K | 6e30a7d | 2010-05-12 08:27:30 +0000 | [diff] [blame] | 22 | #include <linux/i2c/twl.h> |
Shubhrajyoti Datta | 94ce7a6 | 2010-09-23 18:22:49 -0700 | [diff] [blame] | 23 | #include <linux/gpio_keys.h> |
Balaji T K | 6e30a7d | 2010-05-12 08:27:30 +0000 | [diff] [blame] | 24 | #include <linux/regulator/machine.h> |
Hemanth V | 509b6d9 | 2010-08-02 13:18:04 +0300 | [diff] [blame] | 25 | #include <linux/leds.h> |
Hemanth V | f389f4c | 2010-12-17 18:15:08 -0800 | [diff] [blame] | 26 | #include <linux/leds_pwm.h> |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 27 | |
| 28 | #include <mach/hardware.h> |
Santosh Shilimkar | fbc9be1 | 2010-05-14 12:05:26 -0700 | [diff] [blame] | 29 | #include <mach/omap4-common.h> |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 30 | #include <asm/mach-types.h> |
| 31 | #include <asm/mach/arch.h> |
| 32 | #include <asm/mach/map.h> |
| 33 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 34 | #include <plat/board.h> |
| 35 | #include <plat/common.h> |
Maulik Mankad | bce0668 | 2010-02-17 14:09:32 -0800 | [diff] [blame] | 36 | #include <plat/usb.h> |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 37 | #include <plat/mmc.h> |
Syed Rafiuddin | 5955676 | 2010-12-27 05:51:45 +0000 | [diff] [blame^] | 38 | #include <plat/omap4-keypad.h> |
Manjunath Kondaiah G | 04aeae7 | 2010-10-08 09:58:35 -0700 | [diff] [blame] | 39 | |
Benoit Cousson | fb6bf63 | 2010-08-10 17:43:15 +0200 | [diff] [blame] | 40 | #include "mux.h" |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 41 | #include "hsmmc.h" |
Manjunath Kondaiah G | 04aeae7 | 2010-10-08 09:58:35 -0700 | [diff] [blame] | 42 | #include "timer-gp.h" |
Paul Walmsley | 4814ced | 2010-10-08 11:40:20 -0600 | [diff] [blame] | 43 | #include "control.h" |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 44 | |
Abraham Arce | b2aa5e5 | 2010-05-14 12:05:26 -0700 | [diff] [blame] | 45 | #define ETH_KS8851_IRQ 34 |
| 46 | #define ETH_KS8851_POWER_ON 48 |
| 47 | #define ETH_KS8851_QUART 138 |
Keshava Munegowda | 6aa85a5 | 2010-11-21 23:23:42 +0530 | [diff] [blame] | 48 | #define OMAP4SDP_MDM_PWR_EN_GPIO 157 |
Shubhrajyoti Datta | 94ce7a6 | 2010-09-23 18:22:49 -0700 | [diff] [blame] | 49 | #define OMAP4_SFH7741_SENSOR_OUTPUT_GPIO 184 |
| 50 | #define OMAP4_SFH7741_ENABLE_GPIO 188 |
Abraham Arce | b2aa5e5 | 2010-05-14 12:05:26 -0700 | [diff] [blame] | 51 | |
Syed Rafiuddin | 5955676 | 2010-12-27 05:51:45 +0000 | [diff] [blame^] | 52 | static const int sdp4430_keymap[] = { |
| 53 | KEY(0, 0, KEY_E), |
| 54 | KEY(0, 1, KEY_R), |
| 55 | KEY(0, 2, KEY_T), |
| 56 | KEY(0, 3, KEY_HOME), |
| 57 | KEY(0, 4, KEY_F5), |
| 58 | KEY(0, 5, KEY_UNKNOWN), |
| 59 | KEY(0, 6, KEY_I), |
| 60 | KEY(0, 7, KEY_LEFTSHIFT), |
| 61 | |
| 62 | KEY(1, 0, KEY_D), |
| 63 | KEY(1, 1, KEY_F), |
| 64 | KEY(1, 2, KEY_G), |
| 65 | KEY(1, 3, KEY_SEND), |
| 66 | KEY(1, 4, KEY_F6), |
| 67 | KEY(1, 5, KEY_UNKNOWN), |
| 68 | KEY(1, 6, KEY_K), |
| 69 | KEY(1, 7, KEY_ENTER), |
| 70 | |
| 71 | KEY(2, 0, KEY_X), |
| 72 | KEY(2, 1, KEY_C), |
| 73 | KEY(2, 2, KEY_V), |
| 74 | KEY(2, 3, KEY_END), |
| 75 | KEY(2, 4, KEY_F7), |
| 76 | KEY(2, 5, KEY_UNKNOWN), |
| 77 | KEY(2, 6, KEY_DOT), |
| 78 | KEY(2, 7, KEY_CAPSLOCK), |
| 79 | |
| 80 | KEY(3, 0, KEY_Z), |
| 81 | KEY(3, 1, KEY_KPPLUS), |
| 82 | KEY(3, 2, KEY_B), |
| 83 | KEY(3, 3, KEY_F1), |
| 84 | KEY(3, 4, KEY_F8), |
| 85 | KEY(3, 5, KEY_UNKNOWN), |
| 86 | KEY(3, 6, KEY_O), |
| 87 | KEY(3, 7, KEY_SPACE), |
| 88 | |
| 89 | KEY(4, 0, KEY_W), |
| 90 | KEY(4, 1, KEY_Y), |
| 91 | KEY(4, 2, KEY_U), |
| 92 | KEY(4, 3, KEY_F2), |
| 93 | KEY(4, 4, KEY_VOLUMEUP), |
| 94 | KEY(4, 5, KEY_UNKNOWN), |
| 95 | KEY(4, 6, KEY_L), |
| 96 | KEY(4, 7, KEY_LEFT), |
| 97 | |
| 98 | KEY(5, 0, KEY_S), |
| 99 | KEY(5, 1, KEY_H), |
| 100 | KEY(5, 2, KEY_J), |
| 101 | KEY(5, 3, KEY_F3), |
| 102 | KEY(5, 4, KEY_F9), |
| 103 | KEY(5, 5, KEY_VOLUMEDOWN), |
| 104 | KEY(5, 6, KEY_M), |
| 105 | KEY(5, 7, KEY_RIGHT), |
| 106 | |
| 107 | KEY(6, 0, KEY_Q), |
| 108 | KEY(6, 1, KEY_A), |
| 109 | KEY(6, 2, KEY_N), |
| 110 | KEY(6, 3, KEY_BACK), |
| 111 | KEY(6, 4, KEY_BACKSPACE), |
| 112 | KEY(6, 5, KEY_UNKNOWN), |
| 113 | KEY(6, 6, KEY_P), |
| 114 | KEY(6, 7, KEY_UP), |
| 115 | |
| 116 | KEY(7, 0, KEY_PROG1), |
| 117 | KEY(7, 1, KEY_PROG2), |
| 118 | KEY(7, 2, KEY_PROG3), |
| 119 | KEY(7, 3, KEY_PROG4), |
| 120 | KEY(7, 4, KEY_F4), |
| 121 | KEY(7, 5, KEY_UNKNOWN), |
| 122 | KEY(7, 6, KEY_OK), |
| 123 | KEY(7, 7, KEY_DOWN), |
| 124 | }; |
| 125 | |
| 126 | static struct matrix_keymap_data sdp4430_keymap_data = { |
| 127 | .keymap = sdp4430_keymap, |
| 128 | .keymap_size = ARRAY_SIZE(sdp4430_keymap), |
| 129 | }; |
| 130 | |
| 131 | static struct omap4_keypad_platform_data sdp4430_keypad_data = { |
| 132 | .keymap_data = &sdp4430_keymap_data, |
| 133 | .rows = 8, |
| 134 | .cols = 8, |
| 135 | }; |
Hemanth V | 509b6d9 | 2010-08-02 13:18:04 +0300 | [diff] [blame] | 136 | static struct gpio_led sdp4430_gpio_leds[] = { |
| 137 | { |
| 138 | .name = "omap4:green:debug0", |
| 139 | .gpio = 61, |
| 140 | }, |
| 141 | { |
| 142 | .name = "omap4:green:debug1", |
| 143 | .gpio = 30, |
| 144 | }, |
| 145 | { |
| 146 | .name = "omap4:green:debug2", |
| 147 | .gpio = 7, |
| 148 | }, |
| 149 | { |
| 150 | .name = "omap4:green:debug3", |
| 151 | .gpio = 8, |
| 152 | }, |
| 153 | { |
| 154 | .name = "omap4:green:debug4", |
| 155 | .gpio = 50, |
| 156 | }, |
| 157 | { |
| 158 | .name = "omap4:blue:user", |
| 159 | .gpio = 169, |
| 160 | }, |
| 161 | { |
| 162 | .name = "omap4:red:user", |
| 163 | .gpio = 170, |
| 164 | }, |
| 165 | { |
| 166 | .name = "omap4:green:user", |
| 167 | .gpio = 139, |
| 168 | }, |
| 169 | |
| 170 | }; |
| 171 | |
Shubhrajyoti Datta | 94ce7a6 | 2010-09-23 18:22:49 -0700 | [diff] [blame] | 172 | static struct gpio_keys_button sdp4430_gpio_keys[] = { |
| 173 | { |
| 174 | .desc = "Proximity Sensor", |
| 175 | .type = EV_SW, |
| 176 | .code = SW_FRONT_PROXIMITY, |
| 177 | .gpio = OMAP4_SFH7741_SENSOR_OUTPUT_GPIO, |
| 178 | .active_low = 0, |
| 179 | } |
| 180 | }; |
| 181 | |
Hemanth V | 509b6d9 | 2010-08-02 13:18:04 +0300 | [diff] [blame] | 182 | static struct gpio_led_platform_data sdp4430_led_data = { |
| 183 | .leds = sdp4430_gpio_leds, |
| 184 | .num_leds = ARRAY_SIZE(sdp4430_gpio_leds), |
| 185 | }; |
| 186 | |
Hemanth V | f389f4c | 2010-12-17 18:15:08 -0800 | [diff] [blame] | 187 | static struct led_pwm sdp4430_pwm_leds[] = { |
| 188 | { |
| 189 | .name = "omap4:green:chrg", |
| 190 | .pwm_id = 1, |
| 191 | .max_brightness = 255, |
| 192 | .pwm_period_ns = 7812500, |
| 193 | }, |
| 194 | }; |
| 195 | |
| 196 | static struct led_pwm_platform_data sdp4430_pwm_data = { |
| 197 | .num_leds = ARRAY_SIZE(sdp4430_pwm_leds), |
| 198 | .leds = sdp4430_pwm_leds, |
| 199 | }; |
| 200 | |
| 201 | static struct platform_device sdp4430_leds_pwm = { |
| 202 | .name = "leds_pwm", |
| 203 | .id = -1, |
| 204 | .dev = { |
| 205 | .platform_data = &sdp4430_pwm_data, |
| 206 | }, |
| 207 | }; |
| 208 | |
Shubhrajyoti Datta | 94ce7a6 | 2010-09-23 18:22:49 -0700 | [diff] [blame] | 209 | static int omap_prox_activate(struct device *dev) |
| 210 | { |
| 211 | gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 1); |
| 212 | return 0; |
| 213 | } |
| 214 | |
| 215 | static void omap_prox_deactivate(struct device *dev) |
| 216 | { |
| 217 | gpio_set_value(OMAP4_SFH7741_ENABLE_GPIO , 0); |
| 218 | } |
| 219 | |
| 220 | static struct gpio_keys_platform_data sdp4430_gpio_keys_data = { |
| 221 | .buttons = sdp4430_gpio_keys, |
| 222 | .nbuttons = ARRAY_SIZE(sdp4430_gpio_keys), |
| 223 | .enable = omap_prox_activate, |
| 224 | .disable = omap_prox_deactivate, |
| 225 | }; |
| 226 | |
| 227 | static struct platform_device sdp4430_gpio_keys_device = { |
| 228 | .name = "gpio-keys", |
| 229 | .id = -1, |
| 230 | .dev = { |
| 231 | .platform_data = &sdp4430_gpio_keys_data, |
| 232 | }, |
| 233 | }; |
| 234 | |
Hemanth V | 509b6d9 | 2010-08-02 13:18:04 +0300 | [diff] [blame] | 235 | static struct platform_device sdp4430_leds_gpio = { |
| 236 | .name = "leds-gpio", |
| 237 | .id = -1, |
| 238 | .dev = { |
| 239 | .platform_data = &sdp4430_led_data, |
| 240 | }, |
| 241 | }; |
Abraham Arce | b2aa5e5 | 2010-05-14 12:05:26 -0700 | [diff] [blame] | 242 | static struct spi_board_info sdp4430_spi_board_info[] __initdata = { |
| 243 | { |
| 244 | .modalias = "ks8851", |
| 245 | .bus_num = 1, |
| 246 | .chip_select = 0, |
| 247 | .max_speed_hz = 24000000, |
| 248 | .irq = ETH_KS8851_IRQ, |
| 249 | }, |
| 250 | }; |
| 251 | |
| 252 | static int omap_ethernet_init(void) |
| 253 | { |
| 254 | int status; |
| 255 | |
| 256 | /* Request of GPIO lines */ |
| 257 | |
| 258 | status = gpio_request(ETH_KS8851_POWER_ON, "eth_power"); |
| 259 | if (status) { |
| 260 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_POWER_ON); |
| 261 | return status; |
| 262 | } |
| 263 | |
| 264 | status = gpio_request(ETH_KS8851_QUART, "quart"); |
| 265 | if (status) { |
| 266 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_QUART); |
| 267 | goto error1; |
| 268 | } |
| 269 | |
| 270 | status = gpio_request(ETH_KS8851_IRQ, "eth_irq"); |
| 271 | if (status) { |
| 272 | pr_err("Cannot request GPIO %d\n", ETH_KS8851_IRQ); |
| 273 | goto error2; |
| 274 | } |
| 275 | |
| 276 | /* Configuration of requested GPIO lines */ |
| 277 | |
| 278 | status = gpio_direction_output(ETH_KS8851_POWER_ON, 1); |
| 279 | if (status) { |
| 280 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_IRQ); |
| 281 | goto error3; |
| 282 | } |
| 283 | |
| 284 | status = gpio_direction_output(ETH_KS8851_QUART, 1); |
| 285 | if (status) { |
| 286 | pr_err("Cannot set output GPIO %d\n", ETH_KS8851_QUART); |
| 287 | goto error3; |
| 288 | } |
| 289 | |
| 290 | status = gpio_direction_input(ETH_KS8851_IRQ); |
| 291 | if (status) { |
| 292 | pr_err("Cannot set input GPIO %d\n", ETH_KS8851_IRQ); |
| 293 | goto error3; |
| 294 | } |
| 295 | |
| 296 | return 0; |
| 297 | |
| 298 | error3: |
| 299 | gpio_free(ETH_KS8851_IRQ); |
| 300 | error2: |
| 301 | gpio_free(ETH_KS8851_QUART); |
| 302 | error1: |
| 303 | gpio_free(ETH_KS8851_POWER_ON); |
| 304 | return status; |
| 305 | } |
| 306 | |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 307 | static struct platform_device sdp4430_lcd_device = { |
| 308 | .name = "sdp4430_lcd", |
| 309 | .id = -1, |
| 310 | }; |
| 311 | |
| 312 | static struct platform_device *sdp4430_devices[] __initdata = { |
| 313 | &sdp4430_lcd_device, |
Shubhrajyoti Datta | 94ce7a6 | 2010-09-23 18:22:49 -0700 | [diff] [blame] | 314 | &sdp4430_gpio_keys_device, |
Hemanth V | 509b6d9 | 2010-08-02 13:18:04 +0300 | [diff] [blame] | 315 | &sdp4430_leds_gpio, |
Hemanth V | f389f4c | 2010-12-17 18:15:08 -0800 | [diff] [blame] | 316 | &sdp4430_leds_pwm, |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 317 | }; |
| 318 | |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 319 | static struct omap_lcd_config sdp4430_lcd_config __initdata = { |
| 320 | .ctrl_name = "internal", |
| 321 | }; |
| 322 | |
| 323 | static struct omap_board_config_kernel sdp4430_config[] __initdata = { |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 324 | { OMAP_TAG_LCD, &sdp4430_lcd_config }, |
| 325 | }; |
| 326 | |
Russell King - ARM Linux | 3dc3bad | 2011-02-14 15:40:20 -0800 | [diff] [blame] | 327 | static void __init omap_4430sdp_init_early(void) |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 328 | { |
Santosh Shilimkar | 5b7815b | 2009-10-22 14:48:14 -0700 | [diff] [blame] | 329 | omap_board_config = sdp4430_config; |
| 330 | omap_board_config_size = ARRAY_SIZE(sdp4430_config); |
Paul Walmsley | 4805734 | 2010-12-21 15:25:10 -0700 | [diff] [blame] | 331 | omap2_init_common_infrastructure(); |
| 332 | omap2_init_common_devices(NULL, NULL); |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 333 | #ifdef CONFIG_OMAP_32K_TIMER |
| 334 | omap2_gp_clockevent_set_gptimer(1); |
| 335 | #endif |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 336 | } |
| 337 | |
Keshava Munegowda | 6aa85a5 | 2010-11-21 23:23:42 +0530 | [diff] [blame] | 338 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
| 339 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, |
| 340 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 341 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 342 | .phy_reset = false, |
| 343 | .reset_gpio_port[0] = -EINVAL, |
| 344 | .reset_gpio_port[1] = -EINVAL, |
| 345 | .reset_gpio_port[2] = -EINVAL, |
| 346 | }; |
| 347 | |
Maulik Mankad | bce0668 | 2010-02-17 14:09:32 -0800 | [diff] [blame] | 348 | static struct omap_musb_board_data musb_board_data = { |
| 349 | .interface_type = MUSB_INTERFACE_UTMI, |
Hema HK | 09e7200 | 2010-12-10 18:11:42 +0530 | [diff] [blame] | 350 | .mode = MUSB_OTG, |
Maulik Mankad | bce0668 | 2010-02-17 14:09:32 -0800 | [diff] [blame] | 351 | .power = 100, |
| 352 | }; |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 353 | |
Hema HK | e70357e | 2010-12-10 18:09:52 +0530 | [diff] [blame] | 354 | static struct twl4030_usb_data omap4_usbphy_data = { |
| 355 | .phy_init = omap4430_phy_init, |
| 356 | .phy_exit = omap4430_phy_exit, |
| 357 | .phy_power = omap4430_phy_power, |
| 358 | .phy_set_clock = omap4430_phy_set_clk, |
| 359 | }; |
| 360 | |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 361 | static struct omap2_hsmmc_info mmc[] = { |
| 362 | { |
| 363 | .mmc = 1, |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 364 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 365 | .gpio_wp = -EINVAL, |
| 366 | }, |
| 367 | { |
| 368 | .mmc = 2, |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 369 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 370 | .gpio_cd = -EINVAL, |
| 371 | .gpio_wp = -EINVAL, |
| 372 | .nonremovable = true, |
kishore kadiyala | 64be978 | 2010-10-01 16:35:28 -0700 | [diff] [blame] | 373 | .ocr_mask = MMC_VDD_29_30, |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 374 | }, |
| 375 | {} /* Terminator */ |
| 376 | }; |
| 377 | |
Santosh Shilimkar | 5026391 | 2010-08-02 13:18:03 +0300 | [diff] [blame] | 378 | static struct regulator_consumer_supply sdp4430_vaux_supply[] = { |
| 379 | { |
| 380 | .supply = "vmmc", |
| 381 | .dev_name = "mmci-omap-hs.1", |
| 382 | }, |
| 383 | }; |
Balaji T K | 6e30a7d | 2010-05-12 08:27:30 +0000 | [diff] [blame] | 384 | static struct regulator_consumer_supply sdp4430_vmmc_supply[] = { |
| 385 | { |
| 386 | .supply = "vmmc", |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 387 | .dev_name = "mmci-omap-hs.0", |
Balaji T K | 6e30a7d | 2010-05-12 08:27:30 +0000 | [diff] [blame] | 388 | }, |
Balaji T K | 6e30a7d | 2010-05-12 08:27:30 +0000 | [diff] [blame] | 389 | }; |
| 390 | |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 391 | static int omap4_twl6030_hsmmc_late_init(struct device *dev) |
| 392 | { |
| 393 | int ret = 0; |
| 394 | struct platform_device *pdev = container_of(dev, |
| 395 | struct platform_device, dev); |
| 396 | struct omap_mmc_platform_data *pdata = dev->platform_data; |
| 397 | |
| 398 | /* Setting MMC1 Card detect Irq */ |
kishore kadiyala | 72f2e2c | 2010-09-24 17:13:20 +0000 | [diff] [blame] | 399 | if (pdev->id == 0) { |
| 400 | ret = twl6030_mmc_card_detect_config(); |
| 401 | if (ret) |
| 402 | pr_err("Failed configuring MMC1 card detect\n"); |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 403 | pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE + |
| 404 | MMCDETECT_INTR_OFFSET; |
kishore kadiyala | 72f2e2c | 2010-09-24 17:13:20 +0000 | [diff] [blame] | 405 | pdata->slots[0].card_detect = twl6030_mmc_card_detect; |
| 406 | } |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 407 | return ret; |
| 408 | } |
| 409 | |
| 410 | static __init void omap4_twl6030_hsmmc_set_late_init(struct device *dev) |
| 411 | { |
Benoit Cousson | 531c21b | 2010-10-01 16:35:26 -0700 | [diff] [blame] | 412 | struct omap_mmc_platform_data *pdata; |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 413 | |
Benoit Cousson | 531c21b | 2010-10-01 16:35:26 -0700 | [diff] [blame] | 414 | /* dev can be null if CONFIG_MMC_OMAP_HS is not set */ |
| 415 | if (!dev) { |
| 416 | pr_err("Failed %s\n", __func__); |
| 417 | return; |
| 418 | } |
| 419 | pdata = dev->platform_data; |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 420 | pdata->init = omap4_twl6030_hsmmc_late_init; |
| 421 | } |
| 422 | |
| 423 | static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) |
| 424 | { |
| 425 | struct omap2_hsmmc_info *c; |
| 426 | |
| 427 | omap2_hsmmc_init(controllers); |
| 428 | for (c = controllers; c->mmc; c++) |
| 429 | omap4_twl6030_hsmmc_set_late_init(c->dev); |
| 430 | |
| 431 | return 0; |
| 432 | } |
| 433 | |
Balaji T K | 6e30a7d | 2010-05-12 08:27:30 +0000 | [diff] [blame] | 434 | static struct regulator_init_data sdp4430_vaux1 = { |
| 435 | .constraints = { |
| 436 | .min_uV = 1000000, |
| 437 | .max_uV = 3000000, |
| 438 | .apply_uV = true, |
| 439 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 440 | | REGULATOR_MODE_STANDBY, |
| 441 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 442 | | REGULATOR_CHANGE_MODE |
| 443 | | REGULATOR_CHANGE_STATUS, |
| 444 | }, |
Santosh Shilimkar | 5026391 | 2010-08-02 13:18:03 +0300 | [diff] [blame] | 445 | .num_consumer_supplies = 1, |
| 446 | .consumer_supplies = sdp4430_vaux_supply, |
Balaji T K | 6e30a7d | 2010-05-12 08:27:30 +0000 | [diff] [blame] | 447 | }; |
| 448 | |
| 449 | static struct regulator_init_data sdp4430_vaux2 = { |
| 450 | .constraints = { |
| 451 | .min_uV = 1200000, |
| 452 | .max_uV = 2800000, |
| 453 | .apply_uV = true, |
| 454 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 455 | | REGULATOR_MODE_STANDBY, |
| 456 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 457 | | REGULATOR_CHANGE_MODE |
| 458 | | REGULATOR_CHANGE_STATUS, |
| 459 | }, |
| 460 | }; |
| 461 | |
| 462 | static struct regulator_init_data sdp4430_vaux3 = { |
| 463 | .constraints = { |
| 464 | .min_uV = 1000000, |
| 465 | .max_uV = 3000000, |
| 466 | .apply_uV = true, |
| 467 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 468 | | REGULATOR_MODE_STANDBY, |
| 469 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 470 | | REGULATOR_CHANGE_MODE |
| 471 | | REGULATOR_CHANGE_STATUS, |
| 472 | }, |
| 473 | }; |
| 474 | |
| 475 | /* VMMC1 for MMC1 card */ |
| 476 | static struct regulator_init_data sdp4430_vmmc = { |
| 477 | .constraints = { |
| 478 | .min_uV = 1200000, |
| 479 | .max_uV = 3000000, |
| 480 | .apply_uV = true, |
| 481 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 482 | | REGULATOR_MODE_STANDBY, |
| 483 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 484 | | REGULATOR_CHANGE_MODE |
| 485 | | REGULATOR_CHANGE_STATUS, |
| 486 | }, |
Santosh Shilimkar | 5026391 | 2010-08-02 13:18:03 +0300 | [diff] [blame] | 487 | .num_consumer_supplies = 1, |
Balaji T K | 6e30a7d | 2010-05-12 08:27:30 +0000 | [diff] [blame] | 488 | .consumer_supplies = sdp4430_vmmc_supply, |
| 489 | }; |
| 490 | |
| 491 | static struct regulator_init_data sdp4430_vpp = { |
| 492 | .constraints = { |
| 493 | .min_uV = 1800000, |
| 494 | .max_uV = 2500000, |
| 495 | .apply_uV = true, |
| 496 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 497 | | REGULATOR_MODE_STANDBY, |
| 498 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 499 | | REGULATOR_CHANGE_MODE |
| 500 | | REGULATOR_CHANGE_STATUS, |
| 501 | }, |
| 502 | }; |
| 503 | |
| 504 | static struct regulator_init_data sdp4430_vusim = { |
| 505 | .constraints = { |
| 506 | .min_uV = 1200000, |
| 507 | .max_uV = 2900000, |
| 508 | .apply_uV = true, |
| 509 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 510 | | REGULATOR_MODE_STANDBY, |
| 511 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 512 | | REGULATOR_CHANGE_MODE |
| 513 | | REGULATOR_CHANGE_STATUS, |
| 514 | }, |
| 515 | }; |
| 516 | |
| 517 | static struct regulator_init_data sdp4430_vana = { |
| 518 | .constraints = { |
| 519 | .min_uV = 2100000, |
| 520 | .max_uV = 2100000, |
| 521 | .apply_uV = true, |
| 522 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 523 | | REGULATOR_MODE_STANDBY, |
| 524 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 525 | | REGULATOR_CHANGE_STATUS, |
| 526 | }, |
| 527 | }; |
| 528 | |
| 529 | static struct regulator_init_data sdp4430_vcxio = { |
| 530 | .constraints = { |
| 531 | .min_uV = 1800000, |
| 532 | .max_uV = 1800000, |
| 533 | .apply_uV = true, |
| 534 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 535 | | REGULATOR_MODE_STANDBY, |
| 536 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 537 | | REGULATOR_CHANGE_STATUS, |
| 538 | }, |
| 539 | }; |
| 540 | |
| 541 | static struct regulator_init_data sdp4430_vdac = { |
| 542 | .constraints = { |
| 543 | .min_uV = 1800000, |
| 544 | .max_uV = 1800000, |
| 545 | .apply_uV = true, |
| 546 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 547 | | REGULATOR_MODE_STANDBY, |
| 548 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 549 | | REGULATOR_CHANGE_STATUS, |
| 550 | }, |
| 551 | }; |
| 552 | |
| 553 | static struct regulator_init_data sdp4430_vusb = { |
| 554 | .constraints = { |
| 555 | .min_uV = 3300000, |
| 556 | .max_uV = 3300000, |
| 557 | .apply_uV = true, |
| 558 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 559 | | REGULATOR_MODE_STANDBY, |
| 560 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 561 | | REGULATOR_CHANGE_STATUS, |
| 562 | }, |
| 563 | }; |
| 564 | |
| 565 | static struct twl4030_platform_data sdp4430_twldata = { |
| 566 | .irq_base = TWL6030_IRQ_BASE, |
| 567 | .irq_end = TWL6030_IRQ_END, |
| 568 | |
| 569 | /* Regulators */ |
| 570 | .vmmc = &sdp4430_vmmc, |
| 571 | .vpp = &sdp4430_vpp, |
| 572 | .vusim = &sdp4430_vusim, |
| 573 | .vana = &sdp4430_vana, |
| 574 | .vcxio = &sdp4430_vcxio, |
| 575 | .vdac = &sdp4430_vdac, |
| 576 | .vusb = &sdp4430_vusb, |
| 577 | .vaux1 = &sdp4430_vaux1, |
| 578 | .vaux2 = &sdp4430_vaux2, |
| 579 | .vaux3 = &sdp4430_vaux3, |
Hema HK | e70357e | 2010-12-10 18:09:52 +0530 | [diff] [blame] | 580 | .usb = &omap4_usbphy_data |
Balaji T K | 6e30a7d | 2010-05-12 08:27:30 +0000 | [diff] [blame] | 581 | }; |
| 582 | |
| 583 | static struct i2c_board_info __initdata sdp4430_i2c_boardinfo[] = { |
| 584 | { |
| 585 | I2C_BOARD_INFO("twl6030", 0x48), |
| 586 | .flags = I2C_CLIENT_WAKE, |
| 587 | .irq = OMAP44XX_IRQ_SYS_1N, |
| 588 | .platform_data = &sdp4430_twldata, |
| 589 | }, |
| 590 | }; |
Shubhrajyoti Datta | 83078f9 | 2010-08-02 13:18:04 +0300 | [diff] [blame] | 591 | static struct i2c_board_info __initdata sdp4430_i2c_3_boardinfo[] = { |
| 592 | { |
| 593 | I2C_BOARD_INFO("tmp105", 0x48), |
| 594 | }, |
Hemanth V | d048aca | 2010-12-17 18:15:08 -0800 | [diff] [blame] | 595 | { |
| 596 | I2C_BOARD_INFO("bh1780", 0x29), |
| 597 | }, |
Shubhrajyoti Datta | 83078f9 | 2010-08-02 13:18:04 +0300 | [diff] [blame] | 598 | }; |
Shubhrajyoti Datta | 0df891b | 2010-09-23 18:22:47 -0700 | [diff] [blame] | 599 | static struct i2c_board_info __initdata sdp4430_i2c_4_boardinfo[] = { |
| 600 | { |
| 601 | I2C_BOARD_INFO("hmc5843", 0x1e), |
| 602 | }, |
| 603 | }; |
Santosh Shilimkar | baeb73e | 2010-05-12 08:27:29 +0000 | [diff] [blame] | 604 | static int __init omap4_i2c_init(void) |
| 605 | { |
| 606 | /* |
| 607 | * Phoenix Audio IC needs I2C1 to |
| 608 | * start with 400 KHz or less |
| 609 | */ |
Balaji T K | 6e30a7d | 2010-05-12 08:27:30 +0000 | [diff] [blame] | 610 | omap_register_i2c_bus(1, 400, sdp4430_i2c_boardinfo, |
| 611 | ARRAY_SIZE(sdp4430_i2c_boardinfo)); |
Santosh Shilimkar | baeb73e | 2010-05-12 08:27:29 +0000 | [diff] [blame] | 612 | omap_register_i2c_bus(2, 400, NULL, 0); |
Shubhrajyoti Datta | 83078f9 | 2010-08-02 13:18:04 +0300 | [diff] [blame] | 613 | omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo, |
| 614 | ARRAY_SIZE(sdp4430_i2c_3_boardinfo)); |
Shubhrajyoti Datta | 0df891b | 2010-09-23 18:22:47 -0700 | [diff] [blame] | 615 | omap_register_i2c_bus(4, 400, sdp4430_i2c_4_boardinfo, |
| 616 | ARRAY_SIZE(sdp4430_i2c_4_boardinfo)); |
Santosh Shilimkar | baeb73e | 2010-05-12 08:27:29 +0000 | [diff] [blame] | 617 | return 0; |
| 618 | } |
Shubhrajyoti Datta | 94ce7a6 | 2010-09-23 18:22:49 -0700 | [diff] [blame] | 619 | |
| 620 | static void __init omap_sfh7741prox_init(void) |
| 621 | { |
| 622 | int error; |
| 623 | |
| 624 | error = gpio_request(OMAP4_SFH7741_ENABLE_GPIO, "sfh7741"); |
| 625 | if (error < 0) { |
| 626 | pr_err("%s:failed to request GPIO %d, error %d\n", |
| 627 | __func__, OMAP4_SFH7741_ENABLE_GPIO, error); |
| 628 | return; |
| 629 | } |
| 630 | |
| 631 | error = gpio_direction_output(OMAP4_SFH7741_ENABLE_GPIO , 0); |
| 632 | if (error < 0) { |
| 633 | pr_err("%s: GPIO configuration failed: GPIO %d,error %d\n", |
| 634 | __func__, OMAP4_SFH7741_ENABLE_GPIO, error); |
| 635 | gpio_free(OMAP4_SFH7741_ENABLE_GPIO); |
| 636 | } |
| 637 | } |
| 638 | |
Benoit Cousson | fb6bf63 | 2010-08-10 17:43:15 +0200 | [diff] [blame] | 639 | #ifdef CONFIG_OMAP_MUX |
| 640 | static struct omap_board_mux board_mux[] __initdata = { |
Tony Lindgren | 7d4ca85 | 2011-01-11 15:31:45 -0800 | [diff] [blame] | 641 | OMAP4_MUX(USBB2_ULPITLL_CLK, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), |
Benoit Cousson | fb6bf63 | 2010-08-10 17:43:15 +0200 | [diff] [blame] | 642 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 643 | }; |
| 644 | #else |
| 645 | #define board_mux NULL |
| 646 | #endif |
| 647 | |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 648 | static void __init omap_4430sdp_init(void) |
| 649 | { |
Abraham Arce | b2aa5e5 | 2010-05-14 12:05:26 -0700 | [diff] [blame] | 650 | int status; |
Benoit Cousson | 6fea7b0 | 2010-09-27 10:50:33 +0200 | [diff] [blame] | 651 | int package = OMAP_PACKAGE_CBS; |
Abraham Arce | b2aa5e5 | 2010-05-14 12:05:26 -0700 | [diff] [blame] | 652 | |
Benoit Cousson | 6fea7b0 | 2010-09-27 10:50:33 +0200 | [diff] [blame] | 653 | if (omap_rev() == OMAP4430_REV_ES1_0) |
| 654 | package = OMAP_PACKAGE_CBL; |
| 655 | omap4_mux_init(board_mux, package); |
| 656 | |
Santosh Shilimkar | baeb73e | 2010-05-12 08:27:29 +0000 | [diff] [blame] | 657 | omap4_i2c_init(); |
Shubhrajyoti Datta | 94ce7a6 | 2010-09-23 18:22:49 -0700 | [diff] [blame] | 658 | omap_sfh7741prox_init(); |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 659 | platform_add_devices(sdp4430_devices, ARRAY_SIZE(sdp4430_devices)); |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 660 | omap_serial_init(); |
kishore kadiyala | 717c1fb | 2010-05-15 18:21:06 +0000 | [diff] [blame] | 661 | omap4_twl6030_hsmmc_init(mmc); |
Keshava Munegowda | 6aa85a5 | 2010-11-21 23:23:42 +0530 | [diff] [blame] | 662 | |
| 663 | /* Power on the ULPI PHY */ |
Tony Lindgren | 7d4ca85 | 2011-01-11 15:31:45 -0800 | [diff] [blame] | 664 | status = gpio_request(OMAP4SDP_MDM_PWR_EN_GPIO, "USBB1 PHY VMDM_3V3"); |
| 665 | if (status) |
| 666 | pr_err("%s: Could not get USBB1 PHY GPIO\n", __func__); |
| 667 | else |
Keshava Munegowda | 6aa85a5 | 2010-11-21 23:23:42 +0530 | [diff] [blame] | 668 | gpio_direction_output(OMAP4SDP_MDM_PWR_EN_GPIO, 1); |
Tony Lindgren | 7d4ca85 | 2011-01-11 15:31:45 -0800 | [diff] [blame] | 669 | |
Keshava Munegowda | 6aa85a5 | 2010-11-21 23:23:42 +0530 | [diff] [blame] | 670 | usb_ehci_init(&ehci_pdata); |
Felipe Balbi | 4696084 | 2010-12-07 09:57:59 +0200 | [diff] [blame] | 671 | usb_musb_init(&musb_board_data); |
Abraham Arce | b2aa5e5 | 2010-05-14 12:05:26 -0700 | [diff] [blame] | 672 | |
| 673 | status = omap_ethernet_init(); |
| 674 | if (status) { |
| 675 | pr_err("Ethernet initialization failed: %d\n", status); |
| 676 | } else { |
| 677 | sdp4430_spi_board_info[0].irq = gpio_to_irq(ETH_KS8851_IRQ); |
| 678 | spi_register_board_info(sdp4430_spi_board_info, |
| 679 | ARRAY_SIZE(sdp4430_spi_board_info)); |
| 680 | } |
Syed Rafiuddin | 5955676 | 2010-12-27 05:51:45 +0000 | [diff] [blame^] | 681 | |
| 682 | status = omap4_keyboard_init(&sdp4430_keypad_data); |
| 683 | if (status) |
| 684 | pr_err("Keypad initialization failed: %d\n", status); |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 685 | } |
| 686 | |
| 687 | static void __init omap_4430sdp_map_io(void) |
| 688 | { |
| 689 | omap2_set_globals_443x(); |
Tony Lindgren | 6fbd55d | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 690 | omap44xx_map_common_io(); |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 691 | } |
| 692 | |
| 693 | MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board") |
| 694 | /* Maintainer: Santosh Shilimkar - Texas Instruments Inc */ |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 695 | .boot_params = 0x80000100, |
Russell King | 71ee7da | 2010-05-23 10:18:16 +0100 | [diff] [blame] | 696 | .reserve = omap_reserve, |
Russell King - ARM Linux | 3dc3bad | 2011-02-14 15:40:20 -0800 | [diff] [blame] | 697 | .map_io = omap_4430sdp_map_io, |
| 698 | .init_early = omap_4430sdp_init_early, |
| 699 | .init_irq = gic_init_irq, |
Santosh Shilimkar | 46ba0ab | 2009-05-28 14:16:05 -0700 | [diff] [blame] | 700 | .init_machine = omap_4430sdp_init, |
| 701 | .timer = &omap_timer, |
| 702 | MACHINE_END |