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