Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 1 | /* |
| 2 | * board-omap3pandora.c (Pandora Handheld Console) |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * version 2 as published by the Free Software Foundation. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, but |
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | * General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU General Public License |
| 14 | * along with this program; if not, write to the Free Software |
| 15 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 16 | * 02110-1301 USA |
| 17 | * |
| 18 | */ |
| 19 | |
| 20 | #include <linux/init.h> |
| 21 | #include <linux/kernel.h> |
| 22 | #include <linux/platform_device.h> |
| 23 | |
| 24 | #include <linux/spi/spi.h> |
| 25 | #include <linux/spi/ads7846.h> |
Grazvydas Ignotas | 64f535a | 2009-05-28 14:04:04 -0700 | [diff] [blame] | 26 | #include <linux/regulator/machine.h> |
Santosh Shilimkar | b07682b | 2009-12-13 20:05:51 +0100 | [diff] [blame] | 27 | #include <linux/i2c/twl.h> |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 28 | #include <linux/leds.h> |
| 29 | #include <linux/input.h> |
Janusz Krzysztofik | 6135434 | 2009-10-22 14:43:17 -0700 | [diff] [blame] | 30 | #include <linux/input/matrix_keypad.h> |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 31 | #include <linux/gpio_keys.h> |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 32 | |
| 33 | #include <asm/mach-types.h> |
| 34 | #include <asm/mach/arch.h> |
| 35 | #include <asm/mach/map.h> |
| 36 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 37 | #include <plat/board.h> |
| 38 | #include <plat/common.h> |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 39 | #include <mach/gpio.h> |
| 40 | #include <mach/hardware.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 41 | #include <plat/mcspi.h> |
| 42 | #include <plat/usb.h> |
Grazvydas Ignotas | 7b09789 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 43 | #include <plat/display.h> |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 44 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 45 | #include "mux.h" |
Paul Walmsley | 2e12bd7 | 2009-05-28 14:03:59 -0700 | [diff] [blame] | 46 | #include "sdram-micron-mt46h32m32lf-6.h" |
Adrian Hunter | d02a900b | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 47 | #include "hsmmc.h" |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 48 | |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 49 | #define OMAP3_PANDORA_TS_GPIO 94 |
| 50 | |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 51 | /* hardware debounce: (value + 1) * 31us */ |
| 52 | #define GPIO_DEBOUNCE_TIME 127 |
| 53 | |
| 54 | static struct gpio_led pandora_gpio_leds[] = { |
| 55 | { |
| 56 | .name = "pandora::sd1", |
| 57 | .default_trigger = "mmc0", |
| 58 | .gpio = 128, |
| 59 | }, { |
| 60 | .name = "pandora::sd2", |
| 61 | .default_trigger = "mmc1", |
| 62 | .gpio = 129, |
| 63 | }, { |
| 64 | .name = "pandora::bluetooth", |
| 65 | .gpio = 158, |
| 66 | }, { |
| 67 | .name = "pandora::wifi", |
| 68 | .gpio = 159, |
| 69 | }, |
| 70 | }; |
| 71 | |
| 72 | static struct gpio_led_platform_data pandora_gpio_led_data = { |
| 73 | .leds = pandora_gpio_leds, |
| 74 | .num_leds = ARRAY_SIZE(pandora_gpio_leds), |
| 75 | }; |
| 76 | |
| 77 | static struct platform_device pandora_leds_gpio = { |
| 78 | .name = "leds-gpio", |
| 79 | .id = -1, |
| 80 | .dev = { |
| 81 | .platform_data = &pandora_gpio_led_data, |
| 82 | }, |
| 83 | }; |
| 84 | |
| 85 | #define GPIO_BUTTON(gpio_num, ev_type, ev_code, act_low, descr) \ |
| 86 | { \ |
| 87 | .gpio = gpio_num, \ |
| 88 | .type = ev_type, \ |
| 89 | .code = ev_code, \ |
| 90 | .active_low = act_low, \ |
| 91 | .desc = "btn " descr, \ |
| 92 | } |
| 93 | |
| 94 | #define GPIO_BUTTON_LOW(gpio_num, event_code, description) \ |
| 95 | GPIO_BUTTON(gpio_num, EV_KEY, event_code, 1, description) |
| 96 | |
| 97 | static struct gpio_keys_button pandora_gpio_keys[] = { |
| 98 | GPIO_BUTTON_LOW(110, KEY_UP, "up"), |
| 99 | GPIO_BUTTON_LOW(103, KEY_DOWN, "down"), |
| 100 | GPIO_BUTTON_LOW(96, KEY_LEFT, "left"), |
| 101 | GPIO_BUTTON_LOW(98, KEY_RIGHT, "right"), |
Grazvydas Ignotas | 8d88f7f | 2009-12-11 16:16:34 -0800 | [diff] [blame] | 102 | GPIO_BUTTON_LOW(109, KEY_KP1, "game 1"), |
| 103 | GPIO_BUTTON_LOW(111, KEY_KP2, "game 2"), |
| 104 | GPIO_BUTTON_LOW(106, KEY_KP3, "game 3"), |
| 105 | GPIO_BUTTON_LOW(101, KEY_KP4, "game 4"), |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 106 | GPIO_BUTTON_LOW(102, BTN_TL, "l"), |
| 107 | GPIO_BUTTON_LOW(97, BTN_TL2, "l2"), |
| 108 | GPIO_BUTTON_LOW(105, BTN_TR, "r"), |
| 109 | GPIO_BUTTON_LOW(107, BTN_TR2, "r2"), |
| 110 | GPIO_BUTTON_LOW(104, KEY_LEFTCTRL, "ctrl"), |
| 111 | GPIO_BUTTON_LOW(99, KEY_MENU, "menu"), |
| 112 | GPIO_BUTTON_LOW(176, KEY_COFFEE, "hold"), |
| 113 | GPIO_BUTTON(100, EV_KEY, KEY_LEFTALT, 0, "alt"), |
| 114 | GPIO_BUTTON(108, EV_SW, SW_LID, 1, "lid"), |
| 115 | }; |
| 116 | |
| 117 | static struct gpio_keys_platform_data pandora_gpio_key_info = { |
| 118 | .buttons = pandora_gpio_keys, |
| 119 | .nbuttons = ARRAY_SIZE(pandora_gpio_keys), |
| 120 | }; |
| 121 | |
| 122 | static struct platform_device pandora_keys_gpio = { |
| 123 | .name = "gpio-keys", |
| 124 | .id = -1, |
| 125 | .dev = { |
| 126 | .platform_data = &pandora_gpio_key_info, |
| 127 | }, |
| 128 | }; |
| 129 | |
| 130 | static void __init pandora_keys_gpio_init(void) |
| 131 | { |
| 132 | /* set debounce time for GPIO banks 4 and 6 */ |
| 133 | omap_set_gpio_debounce_time(32 * 3, GPIO_DEBOUNCE_TIME); |
| 134 | omap_set_gpio_debounce_time(32 * 5, GPIO_DEBOUNCE_TIME); |
| 135 | } |
| 136 | |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 137 | static int board_keymap[] = { |
Grazvydas Ignotas | 24de042 | 2009-11-11 11:00:35 -0800 | [diff] [blame] | 138 | /* row, col, code */ |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 139 | KEY(0, 0, KEY_9), |
Grazvydas Ignotas | 24de042 | 2009-11-11 11:00:35 -0800 | [diff] [blame] | 140 | KEY(0, 1, KEY_8), |
| 141 | KEY(0, 2, KEY_I), |
| 142 | KEY(0, 3, KEY_J), |
| 143 | KEY(0, 4, KEY_N), |
| 144 | KEY(0, 5, KEY_M), |
| 145 | KEY(1, 0, KEY_0), |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 146 | KEY(1, 1, KEY_7), |
Grazvydas Ignotas | 24de042 | 2009-11-11 11:00:35 -0800 | [diff] [blame] | 147 | KEY(1, 2, KEY_U), |
| 148 | KEY(1, 3, KEY_H), |
| 149 | KEY(1, 4, KEY_B), |
| 150 | KEY(1, 5, KEY_SPACE), |
| 151 | KEY(2, 0, KEY_BACKSPACE), |
| 152 | KEY(2, 1, KEY_6), |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 153 | KEY(2, 2, KEY_Y), |
Grazvydas Ignotas | 24de042 | 2009-11-11 11:00:35 -0800 | [diff] [blame] | 154 | KEY(2, 3, KEY_G), |
| 155 | KEY(2, 4, KEY_V), |
| 156 | KEY(2, 5, KEY_FN), |
| 157 | KEY(3, 0, KEY_O), |
| 158 | KEY(3, 1, KEY_5), |
| 159 | KEY(3, 2, KEY_T), |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 160 | KEY(3, 3, KEY_F), |
Grazvydas Ignotas | 24de042 | 2009-11-11 11:00:35 -0800 | [diff] [blame] | 161 | KEY(3, 4, KEY_C), |
| 162 | KEY(4, 0, KEY_P), |
| 163 | KEY(4, 1, KEY_4), |
| 164 | KEY(4, 2, KEY_R), |
| 165 | KEY(4, 3, KEY_D), |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 166 | KEY(4, 4, KEY_X), |
Grazvydas Ignotas | 24de042 | 2009-11-11 11:00:35 -0800 | [diff] [blame] | 167 | KEY(5, 0, KEY_K), |
| 168 | KEY(5, 1, KEY_3), |
| 169 | KEY(5, 2, KEY_E), |
| 170 | KEY(5, 3, KEY_S), |
| 171 | KEY(5, 4, KEY_Z), |
| 172 | KEY(6, 0, KEY_L), |
| 173 | KEY(6, 1, KEY_2), |
| 174 | KEY(6, 2, KEY_W), |
| 175 | KEY(6, 3, KEY_A), |
| 176 | KEY(6, 4, KEY_DOT), |
| 177 | KEY(7, 0, KEY_ENTER), |
| 178 | KEY(7, 1, KEY_1), |
| 179 | KEY(7, 2, KEY_Q), |
| 180 | KEY(7, 3, KEY_LEFTSHIFT), |
| 181 | KEY(7, 4, KEY_COMMA), |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 182 | }; |
| 183 | |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 184 | static struct matrix_keymap_data board_map_data = { |
| 185 | .keymap = board_keymap, |
| 186 | .keymap_size = ARRAY_SIZE(board_keymap), |
| 187 | }; |
| 188 | |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 189 | static struct twl4030_keypad_data pandora_kp_data = { |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 190 | .keymap_data = &board_map_data, |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 191 | .rows = 8, |
| 192 | .cols = 6, |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 193 | .rep = 1, |
| 194 | }; |
| 195 | |
Grazvydas Ignotas | 7b09789 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 196 | static struct omap_dss_device pandora_lcd_device = { |
| 197 | .name = "lcd", |
| 198 | .driver_name = "tpo_td043mtea1_panel", |
| 199 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 200 | .phy.dpi.data_lines = 24, |
| 201 | .reset_gpio = 157, |
| 202 | }; |
| 203 | |
| 204 | static struct omap_dss_device pandora_tv_device = { |
| 205 | .name = "tv", |
| 206 | .driver_name = "venc", |
| 207 | .type = OMAP_DISPLAY_TYPE_VENC, |
| 208 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, |
| 209 | }; |
| 210 | |
| 211 | static struct omap_dss_device *pandora_dss_devices[] = { |
| 212 | &pandora_lcd_device, |
| 213 | &pandora_tv_device, |
| 214 | }; |
| 215 | |
| 216 | static struct omap_dss_board_info pandora_dss_data = { |
| 217 | .num_devices = ARRAY_SIZE(pandora_dss_devices), |
| 218 | .devices = pandora_dss_devices, |
| 219 | .default_device = &pandora_lcd_device, |
| 220 | }; |
| 221 | |
| 222 | static struct platform_device pandora_dss_device = { |
| 223 | .name = "omapdss", |
| 224 | .id = -1, |
| 225 | .dev = { |
| 226 | .platform_data = &pandora_dss_data, |
| 227 | }, |
| 228 | }; |
| 229 | |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 230 | static struct omap2_hsmmc_info omap3pandora_mmc[] = { |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 231 | { |
| 232 | .mmc = 1, |
| 233 | .wires = 4, |
| 234 | .gpio_cd = -EINVAL, |
| 235 | .gpio_wp = 126, |
| 236 | .ext_clock = 0, |
| 237 | }, |
| 238 | { |
| 239 | .mmc = 2, |
| 240 | .wires = 4, |
| 241 | .gpio_cd = -EINVAL, |
| 242 | .gpio_wp = 127, |
| 243 | .ext_clock = 1, |
David Brownell | 0329c37 | 2009-03-23 18:23:47 -0700 | [diff] [blame] | 244 | .transceiver = true, |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 245 | }, |
Grazvydas Ignotas | 07d83cc | 2009-03-23 18:23:47 -0700 | [diff] [blame] | 246 | { |
| 247 | .mmc = 3, |
| 248 | .wires = 4, |
| 249 | .gpio_cd = -EINVAL, |
| 250 | .gpio_wp = -EINVAL, |
| 251 | }, |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 252 | {} /* Terminator */ |
| 253 | }; |
| 254 | |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 255 | static int omap3pandora_twl_gpio_setup(struct device *dev, |
| 256 | unsigned gpio, unsigned ngpio) |
| 257 | { |
| 258 | /* gpio + {0,1} is "mmc{0,1}_cd" (input/IRQ) */ |
| 259 | omap3pandora_mmc[0].gpio_cd = gpio + 0; |
| 260 | omap3pandora_mmc[1].gpio_cd = gpio + 1; |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 261 | omap2_hsmmc_init(omap3pandora_mmc); |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 262 | |
| 263 | return 0; |
| 264 | } |
| 265 | |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 266 | static struct twl4030_gpio_platform_data omap3pandora_gpio_data = { |
| 267 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 268 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 269 | .irq_end = TWL4030_GPIO_IRQ_END, |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 270 | .setup = omap3pandora_twl_gpio_setup, |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 271 | }; |
| 272 | |
Grazvydas Ignotas | f6873ee | 2010-02-17 14:09:25 -0800 | [diff] [blame] | 273 | static struct regulator_consumer_supply pandora_vmmc1_supply = |
| 274 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0"); |
| 275 | |
| 276 | static struct regulator_consumer_supply pandora_vmmc2_supply = |
| 277 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1"); |
| 278 | |
| 279 | static struct regulator_consumer_supply pandora_vdda_dac_supply = |
| 280 | REGULATOR_SUPPLY("vdda_dac", "omapdss"); |
| 281 | |
| 282 | static struct regulator_consumer_supply pandora_vdds_supplies[] = { |
| 283 | REGULATOR_SUPPLY("vdds_sdi", "omapdss"), |
| 284 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"), |
| 285 | }; |
| 286 | |
| 287 | static struct regulator_consumer_supply pandora_vcc_lcd_supply = |
| 288 | REGULATOR_SUPPLY("vcc", "display0"); |
| 289 | |
| 290 | static struct regulator_consumer_supply pandora_usb_phy_supply = |
| 291 | REGULATOR_SUPPLY("hsusb0", "ehci-omap.0"); |
| 292 | |
| 293 | /* ads7846 on SPI and 2 nub controllers on I2C */ |
| 294 | static struct regulator_consumer_supply pandora_vaux4_supplies[] = { |
| 295 | REGULATOR_SUPPLY("vcc", "spi1.0"), |
| 296 | REGULATOR_SUPPLY("vcc", "3-0066"), |
| 297 | REGULATOR_SUPPLY("vcc", "3-0067"), |
| 298 | }; |
| 299 | |
| 300 | static struct regulator_consumer_supply pandora_adac_supply = |
| 301 | REGULATOR_SUPPLY("vcc", "soc-audio"); |
| 302 | |
Grazvydas Ignotas | 64f535a | 2009-05-28 14:04:04 -0700 | [diff] [blame] | 303 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
| 304 | static struct regulator_init_data pandora_vmmc1 = { |
| 305 | .constraints = { |
| 306 | .min_uV = 1850000, |
| 307 | .max_uV = 3150000, |
| 308 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 309 | | REGULATOR_MODE_STANDBY, |
| 310 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 311 | | REGULATOR_CHANGE_MODE |
| 312 | | REGULATOR_CHANGE_STATUS, |
| 313 | }, |
| 314 | .num_consumer_supplies = 1, |
| 315 | .consumer_supplies = &pandora_vmmc1_supply, |
| 316 | }; |
| 317 | |
| 318 | /* VMMC2 for MMC2 pins CMD, CLK, DAT0..DAT3 (max 100 mA) */ |
| 319 | static struct regulator_init_data pandora_vmmc2 = { |
| 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 = &pandora_vmmc2_supply, |
| 331 | }; |
| 332 | |
Grazvydas Ignotas | 7b09789 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 333 | /* VDAC for DSS driving S-Video */ |
| 334 | static struct regulator_init_data pandora_vdac = { |
| 335 | .constraints = { |
| 336 | .min_uV = 1800000, |
| 337 | .max_uV = 1800000, |
| 338 | .apply_uV = true, |
| 339 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 340 | | REGULATOR_MODE_STANDBY, |
| 341 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 342 | | REGULATOR_CHANGE_STATUS, |
| 343 | }, |
| 344 | .num_consumer_supplies = 1, |
| 345 | .consumer_supplies = &pandora_vdda_dac_supply, |
| 346 | }; |
| 347 | |
| 348 | /* VPLL2 for digital video outputs */ |
| 349 | static struct regulator_init_data pandora_vpll2 = { |
| 350 | .constraints = { |
| 351 | .min_uV = 1800000, |
| 352 | .max_uV = 1800000, |
| 353 | .apply_uV = true, |
| 354 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 355 | | REGULATOR_MODE_STANDBY, |
| 356 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 357 | | REGULATOR_CHANGE_STATUS, |
| 358 | }, |
| 359 | .num_consumer_supplies = ARRAY_SIZE(pandora_vdds_supplies), |
| 360 | .consumer_supplies = pandora_vdds_supplies, |
| 361 | }; |
| 362 | |
| 363 | /* VAUX1 for LCD */ |
| 364 | static struct regulator_init_data pandora_vaux1 = { |
| 365 | .constraints = { |
| 366 | .min_uV = 3000000, |
| 367 | .max_uV = 3000000, |
| 368 | .apply_uV = true, |
| 369 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 370 | | REGULATOR_MODE_STANDBY, |
| 371 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 372 | | REGULATOR_CHANGE_STATUS, |
| 373 | }, |
| 374 | .num_consumer_supplies = 1, |
| 375 | .consumer_supplies = &pandora_vcc_lcd_supply, |
| 376 | }; |
| 377 | |
Grazvydas Ignotas | f6873ee | 2010-02-17 14:09:25 -0800 | [diff] [blame] | 378 | /* VAUX2 for USB host PHY */ |
| 379 | static struct regulator_init_data pandora_vaux2 = { |
| 380 | .constraints = { |
| 381 | .min_uV = 1800000, |
| 382 | .max_uV = 1800000, |
| 383 | .apply_uV = true, |
| 384 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 385 | | REGULATOR_MODE_STANDBY, |
| 386 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 387 | | REGULATOR_CHANGE_STATUS, |
| 388 | }, |
| 389 | .num_consumer_supplies = 1, |
| 390 | .consumer_supplies = &pandora_usb_phy_supply, |
| 391 | }; |
| 392 | |
| 393 | /* VAUX4 for ads7846 and nubs */ |
| 394 | static struct regulator_init_data pandora_vaux4 = { |
| 395 | .constraints = { |
| 396 | .min_uV = 2800000, |
| 397 | .max_uV = 2800000, |
| 398 | .apply_uV = true, |
| 399 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 400 | | REGULATOR_MODE_STANDBY, |
| 401 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 402 | | REGULATOR_CHANGE_STATUS, |
| 403 | }, |
| 404 | .num_consumer_supplies = ARRAY_SIZE(pandora_vaux4_supplies), |
| 405 | .consumer_supplies = pandora_vaux4_supplies, |
| 406 | }; |
| 407 | |
| 408 | /* VSIM for audio DAC */ |
| 409 | static struct regulator_init_data pandora_vsim = { |
| 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 | .num_consumer_supplies = 1, |
| 420 | .consumer_supplies = &pandora_adac_supply, |
| 421 | }; |
| 422 | |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 423 | static struct twl4030_usb_data omap3pandora_usb_data = { |
| 424 | .usb_mode = T2_USB_MODE_ULPI, |
| 425 | }; |
| 426 | |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 427 | static struct twl4030_codec_audio_data omap3pandora_audio_data = { |
| 428 | .audio_mclk = 26000000, |
| 429 | }; |
| 430 | |
| 431 | static struct twl4030_codec_data omap3pandora_codec_data = { |
Peter Ujfalusi | 6df74ef | 2009-11-04 09:58:18 +0200 | [diff] [blame] | 432 | .audio_mclk = 26000000, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 433 | .audio = &omap3pandora_audio_data, |
| 434 | }; |
| 435 | |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 436 | static struct twl4030_platform_data omap3pandora_twldata = { |
| 437 | .irq_base = TWL4030_IRQ_BASE, |
| 438 | .irq_end = TWL4030_IRQ_END, |
| 439 | .gpio = &omap3pandora_gpio_data, |
| 440 | .usb = &omap3pandora_usb_data, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 441 | .codec = &omap3pandora_codec_data, |
Grazvydas Ignotas | 64f535a | 2009-05-28 14:04:04 -0700 | [diff] [blame] | 442 | .vmmc1 = &pandora_vmmc1, |
| 443 | .vmmc2 = &pandora_vmmc2, |
Grazvydas Ignotas | 7b09789 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 444 | .vdac = &pandora_vdac, |
| 445 | .vpll2 = &pandora_vpll2, |
| 446 | .vaux1 = &pandora_vaux1, |
Grazvydas Ignotas | f6873ee | 2010-02-17 14:09:25 -0800 | [diff] [blame] | 447 | .vaux2 = &pandora_vaux2, |
| 448 | .vaux4 = &pandora_vaux4, |
| 449 | .vsim = &pandora_vsim, |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 450 | .keypad = &pandora_kp_data, |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 451 | }; |
| 452 | |
| 453 | static struct i2c_board_info __initdata omap3pandora_i2c_boardinfo[] = { |
| 454 | { |
| 455 | I2C_BOARD_INFO("tps65950", 0x48), |
| 456 | .flags = I2C_CLIENT_WAKE, |
| 457 | .irq = INT_34XX_SYS_NIRQ, |
| 458 | .platform_data = &omap3pandora_twldata, |
| 459 | }, |
| 460 | }; |
| 461 | |
| 462 | static int __init omap3pandora_i2c_init(void) |
| 463 | { |
| 464 | omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo, |
| 465 | ARRAY_SIZE(omap3pandora_i2c_boardinfo)); |
| 466 | /* i2c2 pins are not connected */ |
Grazvydas Ignotas | 8d88f7f | 2009-12-11 16:16:34 -0800 | [diff] [blame] | 467 | omap_register_i2c_bus(3, 100, NULL, 0); |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 468 | return 0; |
| 469 | } |
| 470 | |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 471 | static void __init omap3pandora_ads7846_init(void) |
| 472 | { |
| 473 | int gpio = OMAP3_PANDORA_TS_GPIO; |
| 474 | int ret; |
| 475 | |
| 476 | ret = gpio_request(gpio, "ads7846_pen_down"); |
| 477 | if (ret < 0) { |
| 478 | printk(KERN_ERR "Failed to request GPIO %d for " |
| 479 | "ads7846 pen down IRQ\n", gpio); |
| 480 | return; |
| 481 | } |
| 482 | |
| 483 | gpio_direction_input(gpio); |
| 484 | } |
| 485 | |
| 486 | static int ads7846_get_pendown_state(void) |
| 487 | { |
| 488 | return !gpio_get_value(OMAP3_PANDORA_TS_GPIO); |
| 489 | } |
| 490 | |
| 491 | static struct ads7846_platform_data ads7846_config = { |
| 492 | .x_max = 0x0fff, |
| 493 | .y_max = 0x0fff, |
| 494 | .x_plate_ohms = 180, |
| 495 | .pressure_max = 255, |
| 496 | .debounce_max = 10, |
| 497 | .debounce_tol = 3, |
| 498 | .debounce_rep = 1, |
| 499 | .get_pendown_state = ads7846_get_pendown_state, |
| 500 | .keep_vref_on = 1, |
| 501 | }; |
| 502 | |
| 503 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { |
| 504 | .turbo_mode = 0, |
| 505 | .single_channel = 1, /* 0: slave, 1: master */ |
| 506 | }; |
| 507 | |
| 508 | static struct spi_board_info omap3pandora_spi_board_info[] __initdata = { |
| 509 | { |
| 510 | .modalias = "ads7846", |
| 511 | .bus_num = 1, |
| 512 | .chip_select = 0, |
| 513 | .max_speed_hz = 1500000, |
| 514 | .controller_data = &ads7846_mcspi_config, |
| 515 | .irq = OMAP_GPIO_IRQ(OMAP3_PANDORA_TS_GPIO), |
| 516 | .platform_data = &ads7846_config, |
Grazvydas Ignotas | 7b09789 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 517 | }, { |
| 518 | .modalias = "tpo_td043mtea1_panel_spi", |
| 519 | .bus_num = 1, |
| 520 | .chip_select = 1, |
| 521 | .max_speed_hz = 375000, |
| 522 | .platform_data = &pandora_lcd_device, |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 523 | } |
| 524 | }; |
| 525 | |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 526 | static void __init omap3pandora_init_irq(void) |
| 527 | { |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 528 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, |
| 529 | mt46h32m32lf6_sdrc_params); |
| 530 | omap_init_irq(); |
| 531 | omap_gpio_init(); |
| 532 | } |
| 533 | |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 534 | static struct platform_device *omap3pandora_devices[] __initdata = { |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 535 | &pandora_leds_gpio, |
| 536 | &pandora_keys_gpio, |
Grazvydas Ignotas | 7b09789 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 537 | &pandora_dss_device, |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 538 | }; |
| 539 | |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 540 | static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
| 541 | |
| 542 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, |
| 543 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 544 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 545 | |
| 546 | .phy_reset = true, |
| 547 | .reset_gpio_port[0] = 16, |
| 548 | .reset_gpio_port[1] = -EINVAL, |
| 549 | .reset_gpio_port[2] = -EINVAL |
| 550 | }; |
| 551 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 552 | #ifdef CONFIG_OMAP_MUX |
| 553 | static struct omap_board_mux board_mux[] __initdata = { |
| 554 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 555 | }; |
| 556 | #else |
| 557 | #define board_mux NULL |
| 558 | #endif |
| 559 | |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 560 | static void __init omap3pandora_init(void) |
| 561 | { |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 562 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 563 | omap3pandora_i2c_init(); |
| 564 | platform_add_devices(omap3pandora_devices, |
| 565 | ARRAY_SIZE(omap3pandora_devices)); |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 566 | omap_serial_init(); |
| 567 | spi_register_board_info(omap3pandora_spi_board_info, |
| 568 | ARRAY_SIZE(omap3pandora_spi_board_info)); |
| 569 | omap3pandora_ads7846_init(); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 570 | usb_ehci_init(&ehci_pdata); |
Grazvydas Ignotas | 7419045 | 2009-05-28 14:15:44 -0700 | [diff] [blame] | 571 | pandora_keys_gpio_init(); |
Felipe Balbi | 18cb7ac | 2009-03-23 18:34:06 -0700 | [diff] [blame] | 572 | usb_musb_init(); |
Jean Pihet | 9fb9741 | 2009-07-24 19:43:25 -0600 | [diff] [blame] | 573 | |
| 574 | /* Ensure SDRC pins are mux'd for self-refresh */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 575 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
| 576 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | static void __init omap3pandora_map_io(void) |
| 580 | { |
| 581 | omap2_set_globals_343x(); |
Tony Lindgren | 6fbd55d | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 582 | omap34xx_map_common_io(); |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 583 | } |
| 584 | |
| 585 | MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console") |
| 586 | .phys_io = 0x48000000, |
Santosh Shilimkar | b4224b2 | 2009-10-19 17:25:55 -0700 | [diff] [blame] | 587 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
Grazvydas Ignotas | da17724 | 2008-12-10 17:36:54 -0800 | [diff] [blame] | 588 | .boot_params = 0x80000100, |
| 589 | .map_io = omap3pandora_map_io, |
| 590 | .init_irq = omap3pandora_init_irq, |
| 591 | .init_machine = omap3pandora_init, |
| 592 | .timer = &omap_timer, |
| 593 | MACHINE_END |