Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 1 | /* |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 2 | * linux/arch/arm/mach-omap2/board-rx51-peripherals.c |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2008-2009 Nokia |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/input.h> |
Janusz Krzysztofik | 6135434 | 2009-10-22 14:43:17 -0700 | [diff] [blame] | 15 | #include <linux/input/matrix_keypad.h> |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 16 | #include <linux/spi/spi.h> |
Kalle Valo | a24e61a | 2009-11-18 18:41:06 -0800 | [diff] [blame] | 17 | #include <linux/spi/wl12xx.h> |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 18 | #include <linux/i2c.h> |
Balaji T K | ebeb53e | 2009-12-15 20:09:02 +0530 | [diff] [blame] | 19 | #include <linux/i2c/twl.h> |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 20 | #include <linux/clk.h> |
| 21 | #include <linux/delay.h> |
| 22 | #include <linux/regulator/machine.h> |
| 23 | #include <linux/gpio.h> |
Jani Nikula | f014ee3 | 2009-11-05 22:59:47 -0800 | [diff] [blame] | 24 | #include <linux/gpio_keys.h> |
Adrian Hunter | 5e763d2 | 2009-09-22 16:45:05 -0700 | [diff] [blame] | 25 | #include <linux/mmc/host.h> |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 26 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 27 | #include <plat/mcspi.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 28 | #include <plat/board.h> |
| 29 | #include <plat/common.h> |
| 30 | #include <plat/dma.h> |
| 31 | #include <plat/gpmc.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 32 | #include <plat/onenand.h> |
| 33 | #include <plat/gpmc-smc91x.h> |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 34 | |
Jarkko Nikula | 87581fd | 2010-08-02 13:18:02 +0300 | [diff] [blame] | 35 | #include <sound/tlv320aic3x.h> |
Jarkko Nikula | 64d0669 | 2010-08-02 13:18:03 +0300 | [diff] [blame^] | 36 | #include <sound/tpa6130a2-plat.h> |
Jarkko Nikula | 87581fd | 2010-08-02 13:18:02 +0300 | [diff] [blame] | 37 | |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 38 | #include "mux.h" |
Adrian Hunter | d02a900b | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 39 | #include "hsmmc.h" |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 40 | |
Adrian Hunter | f52eeee | 2009-05-28 14:04:04 -0700 | [diff] [blame] | 41 | #define SYSTEM_REV_B_USES_VAUX3 0x1699 |
| 42 | #define SYSTEM_REV_S_USES_VAUX3 0x8 |
| 43 | |
Kalle Valo | a24e61a | 2009-11-18 18:41:06 -0800 | [diff] [blame] | 44 | #define RX51_WL1251_POWER_GPIO 87 |
| 45 | #define RX51_WL1251_IRQ_GPIO 42 |
| 46 | |
| 47 | /* list all spi devices here */ |
| 48 | enum { |
| 49 | RX51_SPI_WL1251, |
Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 50 | RX51_SPI_MIPID, /* LCD panel */ |
Roger Quadros | 6996e7f | 2010-03-22 17:16:25 +0200 | [diff] [blame] | 51 | RX51_SPI_TSC2005, /* Touch Controller */ |
Kalle Valo | a24e61a | 2009-11-18 18:41:06 -0800 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | static struct wl12xx_platform_data wl1251_pdata; |
| 55 | |
| 56 | static struct omap2_mcspi_device_config wl1251_mcspi_config = { |
| 57 | .turbo_mode = 0, |
| 58 | .single_channel = 1, |
| 59 | }; |
| 60 | |
Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 61 | static struct omap2_mcspi_device_config mipid_mcspi_config = { |
| 62 | .turbo_mode = 0, |
| 63 | .single_channel = 1, |
| 64 | }; |
| 65 | |
Roger Quadros | 6996e7f | 2010-03-22 17:16:25 +0200 | [diff] [blame] | 66 | static struct omap2_mcspi_device_config tsc2005_mcspi_config = { |
| 67 | .turbo_mode = 0, |
| 68 | .single_channel = 1, |
| 69 | }; |
| 70 | |
Kalle Valo | a24e61a | 2009-11-18 18:41:06 -0800 | [diff] [blame] | 71 | static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = { |
| 72 | [RX51_SPI_WL1251] = { |
| 73 | .modalias = "wl1251", |
| 74 | .bus_num = 4, |
| 75 | .chip_select = 0, |
| 76 | .max_speed_hz = 48000000, |
Kalle Valo | 860fc97 | 2009-12-11 16:16:37 -0800 | [diff] [blame] | 77 | .mode = SPI_MODE_3, |
Kalle Valo | a24e61a | 2009-11-18 18:41:06 -0800 | [diff] [blame] | 78 | .controller_data = &wl1251_mcspi_config, |
| 79 | .platform_data = &wl1251_pdata, |
| 80 | }, |
Roger Quadros | 03e1110 | 2010-05-10 10:35:17 +0200 | [diff] [blame] | 81 | [RX51_SPI_MIPID] = { |
| 82 | .modalias = "acx565akm", |
| 83 | .bus_num = 1, |
| 84 | .chip_select = 2, |
| 85 | .max_speed_hz = 6000000, |
| 86 | .controller_data = &mipid_mcspi_config, |
| 87 | }, |
Roger Quadros | 6996e7f | 2010-03-22 17:16:25 +0200 | [diff] [blame] | 88 | [RX51_SPI_TSC2005] = { |
| 89 | .modalias = "tsc2005", |
| 90 | .bus_num = 1, |
| 91 | .chip_select = 0, |
| 92 | /* .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),*/ |
| 93 | .max_speed_hz = 6000000, |
| 94 | .controller_data = &tsc2005_mcspi_config, |
| 95 | /* .platform_data = &tsc2005_config,*/ |
| 96 | }, |
Kalle Valo | a24e61a | 2009-11-18 18:41:06 -0800 | [diff] [blame] | 97 | }; |
| 98 | |
Jani Nikula | f014ee3 | 2009-11-05 22:59:47 -0800 | [diff] [blame] | 99 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
| 100 | |
| 101 | #define RX51_GPIO_CAMERA_LENS_COVER 110 |
| 102 | #define RX51_GPIO_CAMERA_FOCUS 68 |
| 103 | #define RX51_GPIO_CAMERA_CAPTURE 69 |
| 104 | #define RX51_GPIO_KEYPAD_SLIDE 71 |
| 105 | #define RX51_GPIO_LOCK_BUTTON 113 |
| 106 | #define RX51_GPIO_PROXIMITY 89 |
| 107 | |
| 108 | #define RX51_GPIO_DEBOUNCE_TIMEOUT 10 |
| 109 | |
| 110 | static struct gpio_keys_button rx51_gpio_keys[] = { |
| 111 | { |
| 112 | .desc = "Camera Lens Cover", |
| 113 | .type = EV_SW, |
| 114 | .code = SW_CAMERA_LENS_COVER, |
| 115 | .gpio = RX51_GPIO_CAMERA_LENS_COVER, |
| 116 | .active_low = 1, |
| 117 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, |
| 118 | }, { |
| 119 | .desc = "Camera Focus", |
| 120 | .type = EV_KEY, |
| 121 | .code = KEY_CAMERA_FOCUS, |
| 122 | .gpio = RX51_GPIO_CAMERA_FOCUS, |
| 123 | .active_low = 1, |
| 124 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, |
| 125 | }, { |
| 126 | .desc = "Camera Capture", |
| 127 | .type = EV_KEY, |
| 128 | .code = KEY_CAMERA, |
| 129 | .gpio = RX51_GPIO_CAMERA_CAPTURE, |
| 130 | .active_low = 1, |
| 131 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, |
| 132 | }, { |
| 133 | .desc = "Lock Button", |
| 134 | .type = EV_KEY, |
| 135 | .code = KEY_SCREENLOCK, |
| 136 | .gpio = RX51_GPIO_LOCK_BUTTON, |
| 137 | .active_low = 1, |
| 138 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, |
| 139 | }, { |
| 140 | .desc = "Keypad Slide", |
| 141 | .type = EV_SW, |
| 142 | .code = SW_KEYPAD_SLIDE, |
| 143 | .gpio = RX51_GPIO_KEYPAD_SLIDE, |
| 144 | .active_low = 1, |
| 145 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, |
| 146 | }, { |
| 147 | .desc = "Proximity Sensor", |
| 148 | .type = EV_SW, |
| 149 | .code = SW_FRONT_PROXIMITY, |
| 150 | .gpio = RX51_GPIO_PROXIMITY, |
| 151 | .active_low = 0, |
| 152 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, |
| 153 | } |
| 154 | }; |
| 155 | |
| 156 | static struct gpio_keys_platform_data rx51_gpio_keys_data = { |
| 157 | .buttons = rx51_gpio_keys, |
| 158 | .nbuttons = ARRAY_SIZE(rx51_gpio_keys), |
| 159 | }; |
| 160 | |
| 161 | static struct platform_device rx51_gpio_keys_device = { |
| 162 | .name = "gpio-keys", |
| 163 | .id = -1, |
| 164 | .dev = { |
| 165 | .platform_data = &rx51_gpio_keys_data, |
| 166 | }, |
| 167 | }; |
| 168 | |
| 169 | static void __init rx51_add_gpio_keys(void) |
| 170 | { |
| 171 | platform_device_register(&rx51_gpio_keys_device); |
| 172 | } |
| 173 | #else |
| 174 | static void __init rx51_add_gpio_keys(void) |
| 175 | { |
| 176 | } |
| 177 | #endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */ |
| 178 | |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 179 | static int board_keymap[] = { |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 180 | KEY(0, 0, KEY_Q), |
Amit Kucheria | acf442d | 2009-10-05 21:43:44 -0700 | [diff] [blame] | 181 | KEY(0, 1, KEY_O), |
| 182 | KEY(0, 2, KEY_P), |
| 183 | KEY(0, 3, KEY_COMMA), |
| 184 | KEY(0, 4, KEY_BACKSPACE), |
| 185 | KEY(0, 6, KEY_A), |
| 186 | KEY(0, 7, KEY_S), |
| 187 | KEY(1, 0, KEY_W), |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 188 | KEY(1, 1, KEY_D), |
Amit Kucheria | acf442d | 2009-10-05 21:43:44 -0700 | [diff] [blame] | 189 | KEY(1, 2, KEY_F), |
| 190 | KEY(1, 3, KEY_G), |
| 191 | KEY(1, 4, KEY_H), |
| 192 | KEY(1, 5, KEY_J), |
| 193 | KEY(1, 6, KEY_K), |
| 194 | KEY(1, 7, KEY_L), |
| 195 | KEY(2, 0, KEY_E), |
| 196 | KEY(2, 1, KEY_DOT), |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 197 | KEY(2, 2, KEY_UP), |
Amit Kucheria | acf442d | 2009-10-05 21:43:44 -0700 | [diff] [blame] | 198 | KEY(2, 3, KEY_ENTER), |
| 199 | KEY(2, 5, KEY_Z), |
| 200 | KEY(2, 6, KEY_X), |
| 201 | KEY(2, 7, KEY_C), |
| 202 | KEY(3, 0, KEY_R), |
| 203 | KEY(3, 1, KEY_V), |
| 204 | KEY(3, 2, KEY_B), |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 205 | KEY(3, 3, KEY_N), |
Amit Kucheria | acf442d | 2009-10-05 21:43:44 -0700 | [diff] [blame] | 206 | KEY(3, 4, KEY_M), |
| 207 | KEY(3, 5, KEY_SPACE), |
| 208 | KEY(3, 6, KEY_SPACE), |
| 209 | KEY(3, 7, KEY_LEFT), |
| 210 | KEY(4, 0, KEY_T), |
| 211 | KEY(4, 1, KEY_DOWN), |
| 212 | KEY(4, 2, KEY_RIGHT), |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 213 | KEY(4, 4, KEY_LEFTCTRL), |
Amit Kucheria | acf442d | 2009-10-05 21:43:44 -0700 | [diff] [blame] | 214 | KEY(4, 5, KEY_RIGHTALT), |
| 215 | KEY(4, 6, KEY_LEFTSHIFT), |
| 216 | KEY(5, 0, KEY_Y), |
| 217 | KEY(6, 0, KEY_U), |
| 218 | KEY(7, 0, KEY_I), |
| 219 | KEY(7, 1, KEY_F7), |
| 220 | KEY(7, 2, KEY_F8), |
| 221 | KEY(0xff, 2, KEY_F9), |
| 222 | KEY(0xff, 4, KEY_F10), |
| 223 | KEY(0xff, 5, KEY_F11), |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 224 | }; |
| 225 | |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 226 | static struct matrix_keymap_data board_map_data = { |
| 227 | .keymap = board_keymap, |
| 228 | .keymap_size = ARRAY_SIZE(board_keymap), |
| 229 | }; |
| 230 | |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 231 | static struct twl4030_keypad_data rx51_kp_data = { |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 232 | .keymap_data = &board_map_data, |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 233 | .rows = 8, |
| 234 | .cols = 8, |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 235 | .rep = 1, |
| 236 | }; |
| 237 | |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 238 | static struct twl4030_madc_platform_data rx51_madc_data = { |
| 239 | .irq_line = 1, |
| 240 | }; |
| 241 | |
Adrian Hunter | ce6f001 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 242 | /* Enable input logic and pull all lines up when eMMC is on. */ |
| 243 | static struct omap_board_mux rx51_mmc2_on_mux[] = { |
| 244 | OMAP3_MUX(SDMMC2_CMD, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), |
| 245 | OMAP3_MUX(SDMMC2_DAT0, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), |
| 246 | OMAP3_MUX(SDMMC2_DAT1, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), |
| 247 | OMAP3_MUX(SDMMC2_DAT2, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), |
| 248 | OMAP3_MUX(SDMMC2_DAT3, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), |
| 249 | OMAP3_MUX(SDMMC2_DAT4, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), |
| 250 | OMAP3_MUX(SDMMC2_DAT5, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), |
| 251 | OMAP3_MUX(SDMMC2_DAT6, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), |
| 252 | OMAP3_MUX(SDMMC2_DAT7, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0), |
| 253 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 254 | }; |
| 255 | |
| 256 | /* Disable input logic and pull all lines down when eMMC is off. */ |
| 257 | static struct omap_board_mux rx51_mmc2_off_mux[] = { |
| 258 | OMAP3_MUX(SDMMC2_CMD, OMAP_PULL_ENA | OMAP_MUX_MODE0), |
| 259 | OMAP3_MUX(SDMMC2_DAT0, OMAP_PULL_ENA | OMAP_MUX_MODE0), |
| 260 | OMAP3_MUX(SDMMC2_DAT1, OMAP_PULL_ENA | OMAP_MUX_MODE0), |
| 261 | OMAP3_MUX(SDMMC2_DAT2, OMAP_PULL_ENA | OMAP_MUX_MODE0), |
| 262 | OMAP3_MUX(SDMMC2_DAT3, OMAP_PULL_ENA | OMAP_MUX_MODE0), |
| 263 | OMAP3_MUX(SDMMC2_DAT4, OMAP_PULL_ENA | OMAP_MUX_MODE0), |
| 264 | OMAP3_MUX(SDMMC2_DAT5, OMAP_PULL_ENA | OMAP_MUX_MODE0), |
| 265 | OMAP3_MUX(SDMMC2_DAT6, OMAP_PULL_ENA | OMAP_MUX_MODE0), |
| 266 | OMAP3_MUX(SDMMC2_DAT7, OMAP_PULL_ENA | OMAP_MUX_MODE0), |
| 267 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 268 | }; |
| 269 | |
| 270 | /* |
| 271 | * Current flows to eMMC when eMMC is off and the data lines are pulled up, |
| 272 | * so pull them down. N.B. we pull 8 lines because we are using 8 lines. |
| 273 | */ |
| 274 | static void rx51_mmc2_remux(struct device *dev, int slot, int power_on) |
| 275 | { |
| 276 | if (power_on) |
| 277 | omap_mux_write_array(rx51_mmc2_on_mux); |
| 278 | else |
| 279 | omap_mux_write_array(rx51_mmc2_off_mux); |
| 280 | } |
| 281 | |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 282 | static struct omap2_hsmmc_info mmc[] __initdata = { |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 283 | { |
| 284 | .name = "external", |
| 285 | .mmc = 1, |
| 286 | .wires = 4, |
| 287 | .cover_only = true, |
| 288 | .gpio_cd = 160, |
| 289 | .gpio_wp = -EINVAL, |
Adrian Hunter | 5e763d2 | 2009-09-22 16:45:05 -0700 | [diff] [blame] | 290 | .power_saving = true, |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 291 | }, |
| 292 | { |
| 293 | .name = "internal", |
| 294 | .mmc = 2, |
Adrian Hunter | ce6f001 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 295 | .wires = 8, /* See also rx51_mmc2_remux */ |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 296 | .gpio_cd = -EINVAL, |
| 297 | .gpio_wp = -EINVAL, |
Adrian Hunter | 5e763d2 | 2009-09-22 16:45:05 -0700 | [diff] [blame] | 298 | .nonremovable = true, |
| 299 | .power_saving = true, |
Adrian Hunter | ce6f001 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 300 | .remux = rx51_mmc2_remux, |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 301 | }, |
| 302 | {} /* Terminator */ |
| 303 | }; |
| 304 | |
Jarkko Nikula | 5c7d9bb | 2010-08-02 13:18:02 +0300 | [diff] [blame] | 305 | static struct regulator_consumer_supply rx51_vmmc1_supply = |
| 306 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.0"); |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 307 | |
Jarkko Nikula | 5c7d9bb | 2010-08-02 13:18:02 +0300 | [diff] [blame] | 308 | static struct regulator_consumer_supply rx51_vaux3_supply = |
| 309 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1"); |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 310 | |
Jarkko Nikula | 5c7d9bb | 2010-08-02 13:18:02 +0300 | [diff] [blame] | 311 | static struct regulator_consumer_supply rx51_vsim_supply = |
| 312 | REGULATOR_SUPPLY("vmmc_aux", "mmci-omap-hs.1"); |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 313 | |
Jarkko Nikula | 4cfcaef | 2010-05-10 14:29:19 -0700 | [diff] [blame] | 314 | static struct regulator_consumer_supply rx51_vmmc2_supplies[] = { |
| 315 | /* tlv320aic3x analog supplies */ |
Jarkko Nikula | 5c7d9bb | 2010-08-02 13:18:02 +0300 | [diff] [blame] | 316 | REGULATOR_SUPPLY("AVDD", "2-0018"), |
| 317 | REGULATOR_SUPPLY("DRVDD", "2-0018"), |
Jarkko Nikula | 64d0669 | 2010-08-02 13:18:03 +0300 | [diff] [blame^] | 318 | /* tpa6130a2 */ |
| 319 | REGULATOR_SUPPLY("Vdd", "2-0060"), |
Jarkko Nikula | 4cfcaef | 2010-05-10 14:29:19 -0700 | [diff] [blame] | 320 | /* Keep vmmc as last item. It is not iterated for newer boards */ |
Jarkko Nikula | 5c7d9bb | 2010-08-02 13:18:02 +0300 | [diff] [blame] | 321 | REGULATOR_SUPPLY("vmmc", "mmci-omap-hs.1"), |
Jarkko Nikula | 4cfcaef | 2010-05-10 14:29:19 -0700 | [diff] [blame] | 322 | }; |
| 323 | |
| 324 | static struct regulator_consumer_supply rx51_vio_supplies[] = { |
| 325 | /* tlv320aic3x digital supplies */ |
Jarkko Nikula | 5c7d9bb | 2010-08-02 13:18:02 +0300 | [diff] [blame] | 326 | REGULATOR_SUPPLY("IOVDD", "2-0018"), |
| 327 | REGULATOR_SUPPLY("DVDD", "2-0018"), |
Jarkko Nikula | 4cfcaef | 2010-05-10 14:29:19 -0700 | [diff] [blame] | 328 | }; |
| 329 | |
Roger Quadros | 0581b52 | 2010-05-12 11:48:47 +0300 | [diff] [blame] | 330 | #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) |
| 331 | extern struct platform_device rx51_display_device; |
| 332 | #endif |
| 333 | |
| 334 | static struct regulator_consumer_supply rx51_vaux1_consumers[] = { |
| 335 | #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) |
| 336 | { |
| 337 | .supply = "vdds_sdi", |
| 338 | .dev = &rx51_display_device.dev, |
| 339 | }, |
| 340 | #endif |
| 341 | }; |
| 342 | |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 343 | static struct regulator_init_data rx51_vaux1 = { |
| 344 | .constraints = { |
| 345 | .name = "V28", |
| 346 | .min_uV = 2800000, |
| 347 | .max_uV = 2800000, |
Jarkko Nikula | 000d534 | 2010-08-02 13:18:02 +0300 | [diff] [blame] | 348 | .always_on = true, /* due battery cover sensor */ |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 349 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 350 | | REGULATOR_MODE_STANDBY, |
| 351 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 352 | | REGULATOR_CHANGE_STATUS, |
| 353 | }, |
Roger Quadros | 0581b52 | 2010-05-12 11:48:47 +0300 | [diff] [blame] | 354 | .num_consumer_supplies = ARRAY_SIZE(rx51_vaux1_consumers), |
| 355 | .consumer_supplies = rx51_vaux1_consumers, |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 356 | }; |
| 357 | |
| 358 | static struct regulator_init_data rx51_vaux2 = { |
| 359 | .constraints = { |
| 360 | .name = "VCSI", |
| 361 | .min_uV = 1800000, |
| 362 | .max_uV = 1800000, |
| 363 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 364 | | REGULATOR_MODE_STANDBY, |
| 365 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 366 | | REGULATOR_CHANGE_STATUS, |
| 367 | }, |
| 368 | }; |
| 369 | |
| 370 | /* VAUX3 - adds more power to VIO_18 rail */ |
Adrian Hunter | f52eeee | 2009-05-28 14:04:04 -0700 | [diff] [blame] | 371 | static struct regulator_init_data rx51_vaux3_cam = { |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 372 | .constraints = { |
| 373 | .name = "VCAM_DIG_18", |
| 374 | .min_uV = 1800000, |
| 375 | .max_uV = 1800000, |
| 376 | .apply_uV = true, |
| 377 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 378 | | REGULATOR_MODE_STANDBY, |
| 379 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 380 | | REGULATOR_CHANGE_STATUS, |
| 381 | }, |
| 382 | }; |
| 383 | |
Adrian Hunter | f52eeee | 2009-05-28 14:04:04 -0700 | [diff] [blame] | 384 | static struct regulator_init_data rx51_vaux3_mmc = { |
| 385 | .constraints = { |
| 386 | .name = "VMMC2_30", |
| 387 | .min_uV = 2800000, |
| 388 | .max_uV = 3000000, |
| 389 | .apply_uV = true, |
| 390 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 391 | | REGULATOR_MODE_STANDBY, |
| 392 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 393 | | REGULATOR_CHANGE_MODE |
| 394 | | REGULATOR_CHANGE_STATUS, |
| 395 | }, |
| 396 | .num_consumer_supplies = 1, |
Jarkko Nikula | 4cfcaef | 2010-05-10 14:29:19 -0700 | [diff] [blame] | 397 | .consumer_supplies = &rx51_vaux3_supply, |
Adrian Hunter | f52eeee | 2009-05-28 14:04:04 -0700 | [diff] [blame] | 398 | }; |
| 399 | |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 400 | static struct regulator_init_data rx51_vaux4 = { |
| 401 | .constraints = { |
| 402 | .name = "VCAM_ANA_28", |
| 403 | .min_uV = 2800000, |
| 404 | .max_uV = 2800000, |
| 405 | .apply_uV = true, |
| 406 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 407 | | REGULATOR_MODE_STANDBY, |
| 408 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 409 | | REGULATOR_CHANGE_STATUS, |
| 410 | }, |
| 411 | }; |
| 412 | |
| 413 | static struct regulator_init_data rx51_vmmc1 = { |
| 414 | .constraints = { |
| 415 | .min_uV = 1850000, |
| 416 | .max_uV = 3150000, |
| 417 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 418 | | REGULATOR_MODE_STANDBY, |
| 419 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 420 | | REGULATOR_CHANGE_MODE |
| 421 | | REGULATOR_CHANGE_STATUS, |
| 422 | }, |
| 423 | .num_consumer_supplies = 1, |
| 424 | .consumer_supplies = &rx51_vmmc1_supply, |
| 425 | }; |
| 426 | |
| 427 | static struct regulator_init_data rx51_vmmc2 = { |
| 428 | .constraints = { |
Jarkko Nikula | f2add1d | 2010-05-10 14:29:18 -0700 | [diff] [blame] | 429 | .name = "V28_A", |
| 430 | .min_uV = 2800000, |
| 431 | .max_uV = 3000000, |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 432 | .apply_uV = true, |
| 433 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 434 | | REGULATOR_MODE_STANDBY, |
| 435 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 436 | | REGULATOR_CHANGE_MODE |
| 437 | | REGULATOR_CHANGE_STATUS, |
| 438 | }, |
Jarkko Nikula | 4cfcaef | 2010-05-10 14:29:19 -0700 | [diff] [blame] | 439 | .num_consumer_supplies = ARRAY_SIZE(rx51_vmmc2_supplies), |
| 440 | .consumer_supplies = rx51_vmmc2_supplies, |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 441 | }; |
| 442 | |
| 443 | static struct regulator_init_data rx51_vsim = { |
| 444 | .constraints = { |
| 445 | .name = "VMMC2_IO_18", |
| 446 | .min_uV = 1800000, |
| 447 | .max_uV = 1800000, |
| 448 | .apply_uV = true, |
| 449 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 450 | | REGULATOR_MODE_STANDBY, |
| 451 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 452 | | REGULATOR_CHANGE_STATUS, |
| 453 | }, |
| 454 | .num_consumer_supplies = 1, |
| 455 | .consumer_supplies = &rx51_vsim_supply, |
| 456 | }; |
| 457 | |
| 458 | static struct regulator_init_data rx51_vdac = { |
| 459 | .constraints = { |
| 460 | .min_uV = 1800000, |
| 461 | .max_uV = 1800000, |
| 462 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 463 | | REGULATOR_MODE_STANDBY, |
| 464 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 465 | | REGULATOR_CHANGE_MODE |
| 466 | | REGULATOR_CHANGE_STATUS, |
| 467 | }, |
| 468 | }; |
| 469 | |
Jarkko Nikula | 4cfcaef | 2010-05-10 14:29:19 -0700 | [diff] [blame] | 470 | static struct regulator_init_data rx51_vio = { |
| 471 | .constraints = { |
| 472 | .min_uV = 1800000, |
| 473 | .max_uV = 1800000, |
| 474 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 475 | | REGULATOR_MODE_STANDBY, |
| 476 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 477 | | REGULATOR_CHANGE_MODE |
| 478 | | REGULATOR_CHANGE_STATUS, |
| 479 | }, |
| 480 | .num_consumer_supplies = ARRAY_SIZE(rx51_vio_supplies), |
| 481 | .consumer_supplies = rx51_vio_supplies, |
| 482 | }; |
| 483 | |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 484 | static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n) |
| 485 | { |
| 486 | /* FIXME this gpio setup is just a placeholder for now */ |
| 487 | gpio_request(gpio + 6, "backlight_pwm"); |
| 488 | gpio_direction_output(gpio + 6, 0); |
| 489 | gpio_request(gpio + 7, "speaker_en"); |
| 490 | gpio_direction_output(gpio + 7, 1); |
| 491 | |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 492 | return 0; |
| 493 | } |
| 494 | |
| 495 | static struct twl4030_gpio_platform_data rx51_gpio_data = { |
| 496 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 497 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 498 | .irq_end = TWL4030_GPIO_IRQ_END, |
| 499 | .pulldowns = BIT(0) | BIT(1) | BIT(2) | BIT(3) |
| 500 | | BIT(4) | BIT(5) |
| 501 | | BIT(8) | BIT(9) | BIT(10) | BIT(11) |
| 502 | | BIT(12) | BIT(13) | BIT(14) | BIT(15) |
| 503 | | BIT(16) | BIT(17) , |
| 504 | .setup = rx51_twlgpio_setup, |
| 505 | }; |
| 506 | |
Roger Quadros | dfc27b3 | 2009-08-10 14:49:51 +0300 | [diff] [blame] | 507 | static struct twl4030_usb_data rx51_usb_data = { |
| 508 | .usb_mode = T2_USB_MODE_ULPI, |
| 509 | }; |
| 510 | |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 511 | static struct twl4030_ins sleep_on_seq[] __initdata = { |
| 512 | /* |
Amit Kucheria | 3c684e84 | 2009-10-19 15:11:08 +0300 | [diff] [blame] | 513 | * Turn off everything |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 514 | */ |
Amit Kucheria | 3c684e84 | 2009-10-19 15:11:08 +0300 | [diff] [blame] | 515 | {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2}, |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 516 | }; |
| 517 | |
| 518 | static struct twl4030_script sleep_on_script __initdata = { |
| 519 | .script = sleep_on_seq, |
| 520 | .size = ARRAY_SIZE(sleep_on_seq), |
| 521 | .flags = TWL4030_SLEEP_SCRIPT, |
| 522 | }; |
| 523 | |
| 524 | static struct twl4030_ins wakeup_seq[] __initdata = { |
| 525 | /* |
Amit Kucheria | 3c684e84 | 2009-10-19 15:11:08 +0300 | [diff] [blame] | 526 | * Reenable everything |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 527 | */ |
Amit Kucheria | 3c684e84 | 2009-10-19 15:11:08 +0300 | [diff] [blame] | 528 | {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2}, |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 529 | }; |
| 530 | |
| 531 | static struct twl4030_script wakeup_script __initdata = { |
| 532 | .script = wakeup_seq, |
| 533 | .size = ARRAY_SIZE(wakeup_seq), |
| 534 | .flags = TWL4030_WAKEUP12_SCRIPT, |
| 535 | }; |
| 536 | |
| 537 | static struct twl4030_ins wakeup_p3_seq[] __initdata = { |
| 538 | /* |
Amit Kucheria | 3c684e84 | 2009-10-19 15:11:08 +0300 | [diff] [blame] | 539 | * Reenable everything |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 540 | */ |
Amit Kucheria | 3c684e84 | 2009-10-19 15:11:08 +0300 | [diff] [blame] | 541 | {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2}, |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 542 | }; |
| 543 | |
| 544 | static struct twl4030_script wakeup_p3_script __initdata = { |
| 545 | .script = wakeup_p3_seq, |
| 546 | .size = ARRAY_SIZE(wakeup_p3_seq), |
| 547 | .flags = TWL4030_WAKEUP3_SCRIPT, |
| 548 | }; |
| 549 | |
| 550 | static struct twl4030_ins wrst_seq[] __initdata = { |
| 551 | /* |
| 552 | * Reset twl4030. |
| 553 | * Reset VDD1 regulator. |
| 554 | * Reset VDD2 regulator. |
| 555 | * Reset VPLL1 regulator. |
| 556 | * Enable sysclk output. |
| 557 | * Reenable twl4030. |
| 558 | */ |
| 559 | {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2}, |
| 560 | {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE), |
| 561 | 0x13}, |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 562 | {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13}, |
| 563 | {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13}, |
| 564 | {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13}, |
| 565 | {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35}, |
Amit Kucheria | 3c684e84 | 2009-10-19 15:11:08 +0300 | [diff] [blame] | 566 | {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2}, |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 567 | {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2}, |
| 568 | }; |
| 569 | |
| 570 | static struct twl4030_script wrst_script __initdata = { |
| 571 | .script = wrst_seq, |
| 572 | .size = ARRAY_SIZE(wrst_seq), |
| 573 | .flags = TWL4030_WRST_SCRIPT, |
| 574 | }; |
| 575 | |
| 576 | static struct twl4030_script *twl4030_scripts[] __initdata = { |
| 577 | /* wakeup12 script should be loaded before sleep script, otherwise a |
| 578 | board might hit retention before loading of wakeup script is |
| 579 | completed. This can cause boot failures depending on timing issues. |
| 580 | */ |
| 581 | &wakeup_script, |
| 582 | &sleep_on_script, |
| 583 | &wakeup_p3_script, |
| 584 | &wrst_script, |
| 585 | }; |
| 586 | |
| 587 | static struct twl4030_resconfig twl4030_rconfig[] __initdata = { |
Amit Kucheria | 3c684e84 | 2009-10-19 15:11:08 +0300 | [diff] [blame] | 588 | { .resource = RES_VDD1, .devgroup = -1, |
| 589 | .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF, |
| 590 | .remap_sleep = RES_STATE_OFF |
| 591 | }, |
| 592 | { .resource = RES_VDD2, .devgroup = -1, |
| 593 | .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF, |
| 594 | .remap_sleep = RES_STATE_OFF |
| 595 | }, |
| 596 | { .resource = RES_VPLL1, .devgroup = -1, |
| 597 | .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF, |
| 598 | .remap_sleep = RES_STATE_OFF |
| 599 | }, |
| 600 | { .resource = RES_VPLL2, .devgroup = -1, |
| 601 | .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1 |
| 602 | }, |
| 603 | { .resource = RES_VAUX1, .devgroup = -1, |
| 604 | .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1 |
| 605 | }, |
| 606 | { .resource = RES_VAUX2, .devgroup = -1, |
| 607 | .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1 |
| 608 | }, |
| 609 | { .resource = RES_VAUX3, .devgroup = -1, |
| 610 | .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1 |
| 611 | }, |
| 612 | { .resource = RES_VAUX4, .devgroup = -1, |
| 613 | .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1 |
| 614 | }, |
| 615 | { .resource = RES_VMMC1, .devgroup = -1, |
| 616 | .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1 |
| 617 | }, |
| 618 | { .resource = RES_VMMC2, .devgroup = -1, |
| 619 | .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1 |
| 620 | }, |
| 621 | { .resource = RES_VDAC, .devgroup = -1, |
| 622 | .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1 |
| 623 | }, |
| 624 | { .resource = RES_VSIM, .devgroup = -1, |
| 625 | .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1 |
| 626 | }, |
| 627 | { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3, |
| 628 | .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 |
| 629 | }, |
| 630 | { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3, |
| 631 | .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 |
| 632 | }, |
| 633 | { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3, |
| 634 | .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 |
| 635 | }, |
| 636 | { .resource = RES_VIO, .devgroup = DEV_GRP_P3, |
| 637 | .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 |
| 638 | }, |
| 639 | { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3, |
| 640 | .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1 |
| 641 | }, |
| 642 | { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3, |
| 643 | .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 |
| 644 | }, |
| 645 | { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3, |
| 646 | .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 |
| 647 | }, |
| 648 | { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3, |
| 649 | .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 |
| 650 | }, |
| 651 | { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3, |
| 652 | .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 |
| 653 | }, |
| 654 | { .resource = RES_32KCLKOUT, .devgroup = -1, |
| 655 | .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 |
| 656 | }, |
| 657 | { .resource = RES_RESET, .devgroup = -1, |
| 658 | .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 |
| 659 | }, |
| 660 | { .resource = RES_Main_Ref, .devgroup = -1, |
| 661 | .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1 |
| 662 | }, |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 663 | { 0, 0}, |
| 664 | }; |
| 665 | |
| 666 | static struct twl4030_power_data rx51_t2scripts_data __initdata = { |
| 667 | .scripts = twl4030_scripts, |
| 668 | .num = ARRAY_SIZE(twl4030_scripts), |
| 669 | .resource_config = twl4030_rconfig, |
| 670 | }; |
| 671 | |
| 672 | |
| 673 | |
| 674 | static struct twl4030_platform_data rx51_twldata __initdata = { |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 675 | .irq_base = TWL4030_IRQ_BASE, |
| 676 | .irq_end = TWL4030_IRQ_END, |
| 677 | |
| 678 | /* platform_data for children goes here */ |
| 679 | .gpio = &rx51_gpio_data, |
| 680 | .keypad = &rx51_kp_data, |
| 681 | .madc = &rx51_madc_data, |
Roger Quadros | dfc27b3 | 2009-08-10 14:49:51 +0300 | [diff] [blame] | 682 | .usb = &rx51_usb_data, |
Amit Kucheria | 9312fff | 2009-08-27 20:27:57 +0200 | [diff] [blame] | 683 | .power = &rx51_t2scripts_data, |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 684 | |
| 685 | .vaux1 = &rx51_vaux1, |
| 686 | .vaux2 = &rx51_vaux2, |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 687 | .vaux4 = &rx51_vaux4, |
| 688 | .vmmc1 = &rx51_vmmc1, |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 689 | .vsim = &rx51_vsim, |
| 690 | .vdac = &rx51_vdac, |
Jarkko Nikula | 4cfcaef | 2010-05-10 14:29:19 -0700 | [diff] [blame] | 691 | .vio = &rx51_vio, |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 692 | }; |
| 693 | |
Jarkko Nikula | 87581fd | 2010-08-02 13:18:02 +0300 | [diff] [blame] | 694 | static struct aic3x_pdata rx51_aic3x_data __initdata = { |
| 695 | .gpio_reset = 60, |
| 696 | }; |
| 697 | |
Jarkko Nikula | 64d0669 | 2010-08-02 13:18:03 +0300 | [diff] [blame^] | 698 | static struct tpa6130a2_platform_data rx51_tpa6130a2_data __initdata = { |
| 699 | .id = TPA6130A2, |
| 700 | .power_gpio = 98, |
| 701 | }; |
| 702 | |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 703 | static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = { |
| 704 | { |
| 705 | I2C_BOARD_INFO("twl5030", 0x48), |
| 706 | .flags = I2C_CLIENT_WAKE, |
| 707 | .irq = INT_34XX_SYS_NIRQ, |
| 708 | .platform_data = &rx51_twldata, |
| 709 | }, |
| 710 | }; |
| 711 | |
Jarkko Nikula | dabe929 | 2010-05-10 14:29:18 -0700 | [diff] [blame] | 712 | static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = { |
| 713 | { |
| 714 | I2C_BOARD_INFO("tlv320aic3x", 0x18), |
Jarkko Nikula | 87581fd | 2010-08-02 13:18:02 +0300 | [diff] [blame] | 715 | .platform_data = &rx51_aic3x_data, |
Jarkko Nikula | dabe929 | 2010-05-10 14:29:18 -0700 | [diff] [blame] | 716 | }, |
Jarkko Nikula | 64d0669 | 2010-08-02 13:18:03 +0300 | [diff] [blame^] | 717 | { |
| 718 | I2C_BOARD_INFO("tpa6130a2", 0x60), |
| 719 | .platform_data = &rx51_tpa6130a2_data, |
| 720 | } |
Jarkko Nikula | dabe929 | 2010-05-10 14:29:18 -0700 | [diff] [blame] | 721 | }; |
| 722 | |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 723 | static int __init rx51_i2c_init(void) |
| 724 | { |
Adrian Hunter | f52eeee | 2009-05-28 14:04:04 -0700 | [diff] [blame] | 725 | if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) || |
Jarkko Nikula | 4cfcaef | 2010-05-10 14:29:19 -0700 | [diff] [blame] | 726 | system_rev >= SYSTEM_REV_B_USES_VAUX3) { |
Adrian Hunter | f52eeee | 2009-05-28 14:04:04 -0700 | [diff] [blame] | 727 | rx51_twldata.vaux3 = &rx51_vaux3_mmc; |
Jarkko Nikula | 4cfcaef | 2010-05-10 14:29:19 -0700 | [diff] [blame] | 728 | /* Only older boards use VMMC2 for internal MMC */ |
| 729 | rx51_vmmc2.num_consumer_supplies--; |
| 730 | } else { |
Adrian Hunter | f52eeee | 2009-05-28 14:04:04 -0700 | [diff] [blame] | 731 | rx51_twldata.vaux3 = &rx51_vaux3_cam; |
Adrian Hunter | f52eeee | 2009-05-28 14:04:04 -0700 | [diff] [blame] | 732 | } |
Jarkko Nikula | 4cfcaef | 2010-05-10 14:29:19 -0700 | [diff] [blame] | 733 | rx51_twldata.vmmc2 = &rx51_vmmc2; |
Aaro Koskinen | cb3cc45 | 2009-10-14 09:56:34 -0700 | [diff] [blame] | 734 | omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1, |
Jarkko Nikula | dabe929 | 2010-05-10 14:29:18 -0700 | [diff] [blame] | 735 | ARRAY_SIZE(rx51_peripherals_i2c_board_info_1)); |
| 736 | omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2, |
| 737 | ARRAY_SIZE(rx51_peripherals_i2c_board_info_2)); |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 738 | omap_register_i2c_bus(3, 400, NULL, 0); |
| 739 | return 0; |
| 740 | } |
| 741 | |
Juha Yrjola | aa62e90 | 2009-05-28 13:23:52 -0700 | [diff] [blame] | 742 | #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ |
| 743 | defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) |
| 744 | |
| 745 | static struct mtd_partition onenand_partitions[] = { |
| 746 | { |
| 747 | .name = "bootloader", |
| 748 | .offset = 0, |
| 749 | .size = 0x20000, |
| 750 | .mask_flags = MTD_WRITEABLE, /* Force read-only */ |
| 751 | }, |
| 752 | { |
| 753 | .name = "config", |
| 754 | .offset = MTDPART_OFS_APPEND, |
| 755 | .size = 0x60000, |
| 756 | }, |
| 757 | { |
| 758 | .name = "log", |
| 759 | .offset = MTDPART_OFS_APPEND, |
| 760 | .size = 0x40000, |
| 761 | }, |
| 762 | { |
| 763 | .name = "kernel", |
| 764 | .offset = MTDPART_OFS_APPEND, |
| 765 | .size = 0x200000, |
| 766 | }, |
| 767 | { |
| 768 | .name = "initfs", |
| 769 | .offset = MTDPART_OFS_APPEND, |
| 770 | .size = 0x200000, |
| 771 | }, |
| 772 | { |
| 773 | .name = "rootfs", |
| 774 | .offset = MTDPART_OFS_APPEND, |
| 775 | .size = MTDPART_SIZ_FULL, |
| 776 | }, |
| 777 | }; |
| 778 | |
| 779 | static struct omap_onenand_platform_data board_onenand_data = { |
| 780 | .cs = 0, |
| 781 | .gpio_irq = 65, |
| 782 | .parts = onenand_partitions, |
| 783 | .nr_parts = ARRAY_SIZE(onenand_partitions), |
Adrian Hunter | c8e6488 | 2009-06-23 13:30:25 +0300 | [diff] [blame] | 784 | .flags = ONENAND_SYNC_READWRITE, |
Juha Yrjola | aa62e90 | 2009-05-28 13:23:52 -0700 | [diff] [blame] | 785 | }; |
| 786 | |
| 787 | static void __init board_onenand_init(void) |
| 788 | { |
| 789 | gpmc_onenand_init(&board_onenand_data); |
| 790 | } |
| 791 | |
| 792 | #else |
| 793 | |
| 794 | static inline void board_onenand_init(void) |
| 795 | { |
| 796 | } |
| 797 | |
| 798 | #endif |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 799 | |
Tony Lindgren | 1a48e15 | 2009-05-28 13:23:52 -0700 | [diff] [blame] | 800 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
| 801 | |
| 802 | static struct omap_smc91x_platform_data board_smc91x_data = { |
| 803 | .cs = 1, |
| 804 | .gpio_irq = 54, |
| 805 | .gpio_pwrdwn = 86, |
| 806 | .gpio_reset = 164, |
| 807 | .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL, |
| 808 | }; |
| 809 | |
| 810 | static void __init board_smc91x_init(void) |
| 811 | { |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 812 | omap_mux_init_gpio(54, OMAP_PIN_INPUT_PULLDOWN); |
| 813 | omap_mux_init_gpio(86, OMAP_PIN_OUTPUT); |
| 814 | omap_mux_init_gpio(164, OMAP_PIN_OUTPUT); |
Tony Lindgren | 1a48e15 | 2009-05-28 13:23:52 -0700 | [diff] [blame] | 815 | |
| 816 | gpmc_smc91x_init(&board_smc91x_data); |
| 817 | } |
| 818 | |
| 819 | #else |
| 820 | |
| 821 | static inline void board_smc91x_init(void) |
| 822 | { |
| 823 | } |
| 824 | |
| 825 | #endif |
| 826 | |
Kalle Valo | a24e61a | 2009-11-18 18:41:06 -0800 | [diff] [blame] | 827 | static void rx51_wl1251_set_power(bool enable) |
| 828 | { |
| 829 | gpio_set_value(RX51_WL1251_POWER_GPIO, enable); |
| 830 | } |
| 831 | |
| 832 | static void __init rx51_init_wl1251(void) |
| 833 | { |
| 834 | int irq, ret; |
| 835 | |
| 836 | ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power"); |
| 837 | if (ret < 0) |
| 838 | goto error; |
| 839 | |
| 840 | ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0); |
| 841 | if (ret < 0) |
| 842 | goto err_power; |
| 843 | |
| 844 | ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq"); |
| 845 | if (ret < 0) |
| 846 | goto err_power; |
| 847 | |
| 848 | ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO); |
| 849 | if (ret < 0) |
| 850 | goto err_irq; |
| 851 | |
| 852 | irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO); |
| 853 | if (irq < 0) |
| 854 | goto err_irq; |
| 855 | |
| 856 | wl1251_pdata.set_power = rx51_wl1251_set_power; |
| 857 | rx51_peripherals_spi_board_info[RX51_SPI_WL1251].irq = irq; |
| 858 | |
| 859 | return; |
| 860 | |
| 861 | err_irq: |
| 862 | gpio_free(RX51_WL1251_IRQ_GPIO); |
| 863 | |
| 864 | err_power: |
| 865 | gpio_free(RX51_WL1251_POWER_GPIO); |
| 866 | |
| 867 | error: |
| 868 | printk(KERN_ERR "wl1251 board initialisation failed\n"); |
| 869 | wl1251_pdata.set_power = NULL; |
| 870 | |
| 871 | /* |
| 872 | * Now rx51_peripherals_spi_board_info[1].irq is zero and |
| 873 | * set_power is null, and wl1251_probe() will fail. |
| 874 | */ |
| 875 | } |
| 876 | |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 877 | void __init rx51_peripherals_init(void) |
| 878 | { |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 879 | rx51_i2c_init(); |
Juha Yrjola | aa62e90 | 2009-05-28 13:23:52 -0700 | [diff] [blame] | 880 | board_onenand_init(); |
Tony Lindgren | 1a48e15 | 2009-05-28 13:23:52 -0700 | [diff] [blame] | 881 | board_smc91x_init(); |
Jani Nikula | f014ee3 | 2009-11-05 22:59:47 -0800 | [diff] [blame] | 882 | rx51_add_gpio_keys(); |
Kalle Valo | a24e61a | 2009-11-18 18:41:06 -0800 | [diff] [blame] | 883 | rx51_init_wl1251(); |
| 884 | spi_register_board_info(rx51_peripherals_spi_board_info, |
| 885 | ARRAY_SIZE(rx51_peripherals_spi_board_info)); |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 886 | omap2_hsmmc_init(mmc); |
Lauri Leukkunen | ffe7f95 | 2009-03-23 18:38:17 -0700 | [diff] [blame] | 887 | } |
| 888 | |