Commit | Line | Data |
---|---|---|
ffe7f95b | 1 | /* |
9312fffb | 2 | * linux/arch/arm/mach-omap2/board-rx51-peripherals.c |
ffe7f95b LL |
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> | |
6135434a | 15 | #include <linux/input/matrix_keypad.h> |
ffe7f95b LL |
16 | #include <linux/spi/spi.h> |
17 | #include <linux/i2c.h> | |
18 | #include <linux/i2c/twl4030.h> | |
19 | #include <linux/clk.h> | |
20 | #include <linux/delay.h> | |
21 | #include <linux/regulator/machine.h> | |
22 | #include <linux/gpio.h> | |
f014ee32 | 23 | #include <linux/gpio_keys.h> |
5e763d29 | 24 | #include <linux/mmc/host.h> |
ffe7f95b | 25 | |
ce491cf8 TL |
26 | #include <plat/mcspi.h> |
27 | #include <plat/mux.h> | |
28 | #include <plat/board.h> | |
29 | #include <plat/common.h> | |
30 | #include <plat/dma.h> | |
31 | #include <plat/gpmc.h> | |
ce491cf8 TL |
32 | #include <plat/onenand.h> |
33 | #include <plat/gpmc-smc91x.h> | |
ffe7f95b LL |
34 | |
35 | #include "mmc-twl4030.h" | |
36 | ||
f52eeee8 AH |
37 | #define SYSTEM_REV_B_USES_VAUX3 0x1699 |
38 | #define SYSTEM_REV_S_USES_VAUX3 0x8 | |
39 | ||
f014ee32 JN |
40 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
41 | ||
42 | #define RX51_GPIO_CAMERA_LENS_COVER 110 | |
43 | #define RX51_GPIO_CAMERA_FOCUS 68 | |
44 | #define RX51_GPIO_CAMERA_CAPTURE 69 | |
45 | #define RX51_GPIO_KEYPAD_SLIDE 71 | |
46 | #define RX51_GPIO_LOCK_BUTTON 113 | |
47 | #define RX51_GPIO_PROXIMITY 89 | |
48 | ||
49 | #define RX51_GPIO_DEBOUNCE_TIMEOUT 10 | |
50 | ||
51 | static struct gpio_keys_button rx51_gpio_keys[] = { | |
52 | { | |
53 | .desc = "Camera Lens Cover", | |
54 | .type = EV_SW, | |
55 | .code = SW_CAMERA_LENS_COVER, | |
56 | .gpio = RX51_GPIO_CAMERA_LENS_COVER, | |
57 | .active_low = 1, | |
58 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, | |
59 | }, { | |
60 | .desc = "Camera Focus", | |
61 | .type = EV_KEY, | |
62 | .code = KEY_CAMERA_FOCUS, | |
63 | .gpio = RX51_GPIO_CAMERA_FOCUS, | |
64 | .active_low = 1, | |
65 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, | |
66 | }, { | |
67 | .desc = "Camera Capture", | |
68 | .type = EV_KEY, | |
69 | .code = KEY_CAMERA, | |
70 | .gpio = RX51_GPIO_CAMERA_CAPTURE, | |
71 | .active_low = 1, | |
72 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, | |
73 | }, { | |
74 | .desc = "Lock Button", | |
75 | .type = EV_KEY, | |
76 | .code = KEY_SCREENLOCK, | |
77 | .gpio = RX51_GPIO_LOCK_BUTTON, | |
78 | .active_low = 1, | |
79 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, | |
80 | }, { | |
81 | .desc = "Keypad Slide", | |
82 | .type = EV_SW, | |
83 | .code = SW_KEYPAD_SLIDE, | |
84 | .gpio = RX51_GPIO_KEYPAD_SLIDE, | |
85 | .active_low = 1, | |
86 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, | |
87 | }, { | |
88 | .desc = "Proximity Sensor", | |
89 | .type = EV_SW, | |
90 | .code = SW_FRONT_PROXIMITY, | |
91 | .gpio = RX51_GPIO_PROXIMITY, | |
92 | .active_low = 0, | |
93 | .debounce_interval = RX51_GPIO_DEBOUNCE_TIMEOUT, | |
94 | } | |
95 | }; | |
96 | ||
97 | static struct gpio_keys_platform_data rx51_gpio_keys_data = { | |
98 | .buttons = rx51_gpio_keys, | |
99 | .nbuttons = ARRAY_SIZE(rx51_gpio_keys), | |
100 | }; | |
101 | ||
102 | static struct platform_device rx51_gpio_keys_device = { | |
103 | .name = "gpio-keys", | |
104 | .id = -1, | |
105 | .dev = { | |
106 | .platform_data = &rx51_gpio_keys_data, | |
107 | }, | |
108 | }; | |
109 | ||
110 | static void __init rx51_add_gpio_keys(void) | |
111 | { | |
112 | platform_device_register(&rx51_gpio_keys_device); | |
113 | } | |
114 | #else | |
115 | static void __init rx51_add_gpio_keys(void) | |
116 | { | |
117 | } | |
118 | #endif /* CONFIG_KEYBOARD_GPIO || CONFIG_KEYBOARD_GPIO_MODULE */ | |
119 | ||
4f543332 | 120 | static int board_keymap[] = { |
ffe7f95b | 121 | KEY(0, 0, KEY_Q), |
acf442dc AK |
122 | KEY(0, 1, KEY_O), |
123 | KEY(0, 2, KEY_P), | |
124 | KEY(0, 3, KEY_COMMA), | |
125 | KEY(0, 4, KEY_BACKSPACE), | |
126 | KEY(0, 6, KEY_A), | |
127 | KEY(0, 7, KEY_S), | |
128 | KEY(1, 0, KEY_W), | |
ffe7f95b | 129 | KEY(1, 1, KEY_D), |
acf442dc AK |
130 | KEY(1, 2, KEY_F), |
131 | KEY(1, 3, KEY_G), | |
132 | KEY(1, 4, KEY_H), | |
133 | KEY(1, 5, KEY_J), | |
134 | KEY(1, 6, KEY_K), | |
135 | KEY(1, 7, KEY_L), | |
136 | KEY(2, 0, KEY_E), | |
137 | KEY(2, 1, KEY_DOT), | |
ffe7f95b | 138 | KEY(2, 2, KEY_UP), |
acf442dc AK |
139 | KEY(2, 3, KEY_ENTER), |
140 | KEY(2, 5, KEY_Z), | |
141 | KEY(2, 6, KEY_X), | |
142 | KEY(2, 7, KEY_C), | |
143 | KEY(3, 0, KEY_R), | |
144 | KEY(3, 1, KEY_V), | |
145 | KEY(3, 2, KEY_B), | |
ffe7f95b | 146 | KEY(3, 3, KEY_N), |
acf442dc AK |
147 | KEY(3, 4, KEY_M), |
148 | KEY(3, 5, KEY_SPACE), | |
149 | KEY(3, 6, KEY_SPACE), | |
150 | KEY(3, 7, KEY_LEFT), | |
151 | KEY(4, 0, KEY_T), | |
152 | KEY(4, 1, KEY_DOWN), | |
153 | KEY(4, 2, KEY_RIGHT), | |
ffe7f95b | 154 | KEY(4, 4, KEY_LEFTCTRL), |
acf442dc AK |
155 | KEY(4, 5, KEY_RIGHTALT), |
156 | KEY(4, 6, KEY_LEFTSHIFT), | |
157 | KEY(5, 0, KEY_Y), | |
158 | KEY(6, 0, KEY_U), | |
159 | KEY(7, 0, KEY_I), | |
160 | KEY(7, 1, KEY_F7), | |
161 | KEY(7, 2, KEY_F8), | |
162 | KEY(0xff, 2, KEY_F9), | |
163 | KEY(0xff, 4, KEY_F10), | |
164 | KEY(0xff, 5, KEY_F11), | |
ffe7f95b LL |
165 | }; |
166 | ||
4f543332 TL |
167 | static struct matrix_keymap_data board_map_data = { |
168 | .keymap = board_keymap, | |
169 | .keymap_size = ARRAY_SIZE(board_keymap), | |
170 | }; | |
171 | ||
ffe7f95b | 172 | static struct twl4030_keypad_data rx51_kp_data = { |
4f543332 | 173 | .keymap_data = &board_map_data, |
ffe7f95b LL |
174 | .rows = 8, |
175 | .cols = 8, | |
ffe7f95b LL |
176 | .rep = 1, |
177 | }; | |
178 | ||
ffe7f95b LL |
179 | static struct twl4030_madc_platform_data rx51_madc_data = { |
180 | .irq_line = 1, | |
181 | }; | |
182 | ||
183 | static struct twl4030_hsmmc_info mmc[] = { | |
184 | { | |
185 | .name = "external", | |
186 | .mmc = 1, | |
187 | .wires = 4, | |
188 | .cover_only = true, | |
189 | .gpio_cd = 160, | |
190 | .gpio_wp = -EINVAL, | |
5e763d29 | 191 | .power_saving = true, |
ffe7f95b LL |
192 | }, |
193 | { | |
194 | .name = "internal", | |
195 | .mmc = 2, | |
196 | .wires = 8, | |
197 | .gpio_cd = -EINVAL, | |
198 | .gpio_wp = -EINVAL, | |
5e763d29 AH |
199 | .nonremovable = true, |
200 | .power_saving = true, | |
ffe7f95b LL |
201 | }, |
202 | {} /* Terminator */ | |
203 | }; | |
204 | ||
205 | static struct regulator_consumer_supply rx51_vmmc1_supply = { | |
206 | .supply = "vmmc", | |
207 | }; | |
208 | ||
209 | static struct regulator_consumer_supply rx51_vmmc2_supply = { | |
210 | .supply = "vmmc", | |
211 | }; | |
212 | ||
213 | static struct regulator_consumer_supply rx51_vsim_supply = { | |
214 | .supply = "vmmc_aux", | |
215 | }; | |
216 | ||
217 | static struct regulator_init_data rx51_vaux1 = { | |
218 | .constraints = { | |
219 | .name = "V28", | |
220 | .min_uV = 2800000, | |
221 | .max_uV = 2800000, | |
222 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
223 | | REGULATOR_MODE_STANDBY, | |
224 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
225 | | REGULATOR_CHANGE_STATUS, | |
226 | }, | |
227 | }; | |
228 | ||
229 | static struct regulator_init_data rx51_vaux2 = { | |
230 | .constraints = { | |
231 | .name = "VCSI", | |
232 | .min_uV = 1800000, | |
233 | .max_uV = 1800000, | |
234 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
235 | | REGULATOR_MODE_STANDBY, | |
236 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
237 | | REGULATOR_CHANGE_STATUS, | |
238 | }, | |
239 | }; | |
240 | ||
241 | /* VAUX3 - adds more power to VIO_18 rail */ | |
f52eeee8 | 242 | static struct regulator_init_data rx51_vaux3_cam = { |
ffe7f95b LL |
243 | .constraints = { |
244 | .name = "VCAM_DIG_18", | |
245 | .min_uV = 1800000, | |
246 | .max_uV = 1800000, | |
247 | .apply_uV = true, | |
248 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
249 | | REGULATOR_MODE_STANDBY, | |
250 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
251 | | REGULATOR_CHANGE_STATUS, | |
252 | }, | |
253 | }; | |
254 | ||
f52eeee8 AH |
255 | static struct regulator_init_data rx51_vaux3_mmc = { |
256 | .constraints = { | |
257 | .name = "VMMC2_30", | |
258 | .min_uV = 2800000, | |
259 | .max_uV = 3000000, | |
260 | .apply_uV = true, | |
261 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
262 | | REGULATOR_MODE_STANDBY, | |
263 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
264 | | REGULATOR_CHANGE_MODE | |
265 | | REGULATOR_CHANGE_STATUS, | |
266 | }, | |
267 | .num_consumer_supplies = 1, | |
268 | .consumer_supplies = &rx51_vmmc2_supply, | |
269 | }; | |
270 | ||
ffe7f95b LL |
271 | static struct regulator_init_data rx51_vaux4 = { |
272 | .constraints = { | |
273 | .name = "VCAM_ANA_28", | |
274 | .min_uV = 2800000, | |
275 | .max_uV = 2800000, | |
276 | .apply_uV = true, | |
277 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
278 | | REGULATOR_MODE_STANDBY, | |
279 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
280 | | REGULATOR_CHANGE_STATUS, | |
281 | }, | |
282 | }; | |
283 | ||
284 | static struct regulator_init_data rx51_vmmc1 = { | |
285 | .constraints = { | |
286 | .min_uV = 1850000, | |
287 | .max_uV = 3150000, | |
288 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
289 | | REGULATOR_MODE_STANDBY, | |
290 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
291 | | REGULATOR_CHANGE_MODE | |
292 | | REGULATOR_CHANGE_STATUS, | |
293 | }, | |
294 | .num_consumer_supplies = 1, | |
295 | .consumer_supplies = &rx51_vmmc1_supply, | |
296 | }; | |
297 | ||
298 | static struct regulator_init_data rx51_vmmc2 = { | |
299 | .constraints = { | |
300 | .name = "VMMC2_30", | |
301 | .min_uV = 1850000, | |
302 | .max_uV = 3150000, | |
303 | .apply_uV = true, | |
304 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
305 | | REGULATOR_MODE_STANDBY, | |
306 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
307 | | REGULATOR_CHANGE_MODE | |
308 | | REGULATOR_CHANGE_STATUS, | |
309 | }, | |
310 | .num_consumer_supplies = 1, | |
311 | .consumer_supplies = &rx51_vmmc2_supply, | |
312 | }; | |
313 | ||
314 | static struct regulator_init_data rx51_vsim = { | |
315 | .constraints = { | |
316 | .name = "VMMC2_IO_18", | |
317 | .min_uV = 1800000, | |
318 | .max_uV = 1800000, | |
319 | .apply_uV = true, | |
320 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
321 | | REGULATOR_MODE_STANDBY, | |
322 | .valid_ops_mask = REGULATOR_CHANGE_MODE | |
323 | | REGULATOR_CHANGE_STATUS, | |
324 | }, | |
325 | .num_consumer_supplies = 1, | |
326 | .consumer_supplies = &rx51_vsim_supply, | |
327 | }; | |
328 | ||
329 | static struct regulator_init_data rx51_vdac = { | |
330 | .constraints = { | |
331 | .min_uV = 1800000, | |
332 | .max_uV = 1800000, | |
333 | .valid_modes_mask = REGULATOR_MODE_NORMAL | |
334 | | REGULATOR_MODE_STANDBY, | |
335 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | |
336 | | REGULATOR_CHANGE_MODE | |
337 | | REGULATOR_CHANGE_STATUS, | |
338 | }, | |
339 | }; | |
340 | ||
341 | static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n) | |
342 | { | |
343 | /* FIXME this gpio setup is just a placeholder for now */ | |
344 | gpio_request(gpio + 6, "backlight_pwm"); | |
345 | gpio_direction_output(gpio + 6, 0); | |
346 | gpio_request(gpio + 7, "speaker_en"); | |
347 | gpio_direction_output(gpio + 7, 1); | |
348 | ||
349 | /* set up MMC adapters, linking their regulators to them */ | |
350 | twl4030_mmc_init(mmc); | |
351 | rx51_vmmc1_supply.dev = mmc[0].dev; | |
352 | rx51_vmmc2_supply.dev = mmc[1].dev; | |
353 | rx51_vsim_supply.dev = mmc[1].dev; | |
354 | ||
355 | return 0; | |
356 | } | |
357 | ||
358 | static struct twl4030_gpio_platform_data rx51_gpio_data = { | |
359 | .gpio_base = OMAP_MAX_GPIO_LINES, | |
360 | .irq_base = TWL4030_GPIO_IRQ_BASE, | |
361 | .irq_end = TWL4030_GPIO_IRQ_END, | |
362 | .pulldowns = BIT(0) | BIT(1) | BIT(2) | BIT(3) | |
363 | | BIT(4) | BIT(5) | |
364 | | BIT(8) | BIT(9) | BIT(10) | BIT(11) | |
365 | | BIT(12) | BIT(13) | BIT(14) | BIT(15) | |
366 | | BIT(16) | BIT(17) , | |
367 | .setup = rx51_twlgpio_setup, | |
368 | }; | |
369 | ||
dfc27b34 RQ |
370 | static struct twl4030_usb_data rx51_usb_data = { |
371 | .usb_mode = T2_USB_MODE_ULPI, | |
372 | }; | |
373 | ||
9312fffb AK |
374 | static struct twl4030_ins sleep_on_seq[] __initdata = { |
375 | /* | |
376 | * Turn off VDD1 and VDD2. | |
377 | */ | |
378 | {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_OFF), 4}, | |
379 | {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_OFF), 2}, | |
380 | /* | |
381 | * And also turn off the OMAP3 PLLs and the sysclk output. | |
382 | */ | |
383 | {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_OFF), 3}, | |
384 | {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_OFF), 3}, | |
385 | }; | |
386 | ||
387 | static struct twl4030_script sleep_on_script __initdata = { | |
388 | .script = sleep_on_seq, | |
389 | .size = ARRAY_SIZE(sleep_on_seq), | |
390 | .flags = TWL4030_SLEEP_SCRIPT, | |
391 | }; | |
392 | ||
393 | static struct twl4030_ins wakeup_seq[] __initdata = { | |
394 | /* | |
395 | * Reenable the OMAP3 PLLs. | |
396 | * Wakeup VDD1 and VDD2. | |
397 | * Reenable sysclk output. | |
398 | */ | |
399 | {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_ACTIVE), 0x30}, | |
400 | {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_ACTIVE), 0x30}, | |
401 | {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_ACTIVE), 0x37}, | |
402 | {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 3}, | |
403 | }; | |
404 | ||
405 | static struct twl4030_script wakeup_script __initdata = { | |
406 | .script = wakeup_seq, | |
407 | .size = ARRAY_SIZE(wakeup_seq), | |
408 | .flags = TWL4030_WAKEUP12_SCRIPT, | |
409 | }; | |
410 | ||
411 | static struct twl4030_ins wakeup_p3_seq[] __initdata = { | |
412 | /* | |
413 | * Wakeup VDD1 (dummy to be able to insert a delay) | |
414 | * Enable CLKEN | |
415 | */ | |
416 | {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_ACTIVE), 3}, | |
417 | }; | |
418 | ||
419 | static struct twl4030_script wakeup_p3_script __initdata = { | |
420 | .script = wakeup_p3_seq, | |
421 | .size = ARRAY_SIZE(wakeup_p3_seq), | |
422 | .flags = TWL4030_WAKEUP3_SCRIPT, | |
423 | }; | |
424 | ||
425 | static struct twl4030_ins wrst_seq[] __initdata = { | |
426 | /* | |
427 | * Reset twl4030. | |
428 | * Reset VDD1 regulator. | |
429 | * Reset VDD2 regulator. | |
430 | * Reset VPLL1 regulator. | |
431 | * Enable sysclk output. | |
432 | * Reenable twl4030. | |
433 | */ | |
434 | {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2}, | |
435 | {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE), | |
436 | 0x13}, | |
437 | {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 2, RES_STATE_WRST), 0x13}, | |
438 | {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13}, | |
439 | {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13}, | |
440 | {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13}, | |
441 | {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35}, | |
442 | {MSG_SINGULAR(DEV_GRP_P1, RES_HFCLKOUT, RES_STATE_ACTIVE), 2}, | |
443 | {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2}, | |
444 | }; | |
445 | ||
446 | static struct twl4030_script wrst_script __initdata = { | |
447 | .script = wrst_seq, | |
448 | .size = ARRAY_SIZE(wrst_seq), | |
449 | .flags = TWL4030_WRST_SCRIPT, | |
450 | }; | |
451 | ||
452 | static struct twl4030_script *twl4030_scripts[] __initdata = { | |
453 | /* wakeup12 script should be loaded before sleep script, otherwise a | |
454 | board might hit retention before loading of wakeup script is | |
455 | completed. This can cause boot failures depending on timing issues. | |
456 | */ | |
457 | &wakeup_script, | |
458 | &sleep_on_script, | |
459 | &wakeup_p3_script, | |
460 | &wrst_script, | |
461 | }; | |
462 | ||
463 | static struct twl4030_resconfig twl4030_rconfig[] __initdata = { | |
464 | { .resource = RES_VINTANA1, .devgroup = -1, .type = -1, .type2 = 1 }, | |
465 | { .resource = RES_VINTANA2, .devgroup = -1, .type = -1, .type2 = 1 }, | |
466 | { .resource = RES_VINTDIG, .devgroup = -1, .type = -1, .type2 = 1 }, | |
467 | { .resource = RES_VMMC1, .devgroup = -1, .type = -1, .type2 = 3}, | |
468 | { .resource = RES_VMMC2, .devgroup = DEV_GRP_NULL, .type = -1, | |
469 | .type2 = 3}, | |
470 | { .resource = RES_VAUX1, .devgroup = -1, .type = -1, .type2 = 3}, | |
471 | { .resource = RES_VAUX2, .devgroup = -1, .type = -1, .type2 = 3}, | |
472 | { .resource = RES_VAUX3, .devgroup = -1, .type = -1, .type2 = 3}, | |
473 | { .resource = RES_VAUX4, .devgroup = -1, .type = -1, .type2 = 3}, | |
474 | { .resource = RES_VPLL2, .devgroup = -1, .type = -1, .type2 = 3}, | |
475 | { .resource = RES_VDAC, .devgroup = -1, .type = -1, .type2 = 3}, | |
476 | { .resource = RES_VSIM, .devgroup = DEV_GRP_NULL, .type = -1, | |
477 | .type2 = 3}, | |
478 | { .resource = RES_CLKEN, .devgroup = DEV_GRP_P3, .type = -1, | |
479 | .type2 = 1 }, | |
480 | { 0, 0}, | |
481 | }; | |
482 | ||
483 | static struct twl4030_power_data rx51_t2scripts_data __initdata = { | |
484 | .scripts = twl4030_scripts, | |
485 | .num = ARRAY_SIZE(twl4030_scripts), | |
486 | .resource_config = twl4030_rconfig, | |
487 | }; | |
488 | ||
489 | ||
490 | ||
491 | static struct twl4030_platform_data rx51_twldata __initdata = { | |
ffe7f95b LL |
492 | .irq_base = TWL4030_IRQ_BASE, |
493 | .irq_end = TWL4030_IRQ_END, | |
494 | ||
495 | /* platform_data for children goes here */ | |
496 | .gpio = &rx51_gpio_data, | |
497 | .keypad = &rx51_kp_data, | |
498 | .madc = &rx51_madc_data, | |
dfc27b34 | 499 | .usb = &rx51_usb_data, |
9312fffb | 500 | .power = &rx51_t2scripts_data, |
ffe7f95b LL |
501 | |
502 | .vaux1 = &rx51_vaux1, | |
503 | .vaux2 = &rx51_vaux2, | |
ffe7f95b LL |
504 | .vaux4 = &rx51_vaux4, |
505 | .vmmc1 = &rx51_vmmc1, | |
ffe7f95b LL |
506 | .vsim = &rx51_vsim, |
507 | .vdac = &rx51_vdac, | |
508 | }; | |
509 | ||
510 | static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = { | |
511 | { | |
512 | I2C_BOARD_INFO("twl5030", 0x48), | |
513 | .flags = I2C_CLIENT_WAKE, | |
514 | .irq = INT_34XX_SYS_NIRQ, | |
515 | .platform_data = &rx51_twldata, | |
516 | }, | |
517 | }; | |
518 | ||
519 | static int __init rx51_i2c_init(void) | |
520 | { | |
f52eeee8 AH |
521 | if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) || |
522 | system_rev >= SYSTEM_REV_B_USES_VAUX3) | |
523 | rx51_twldata.vaux3 = &rx51_vaux3_mmc; | |
524 | else { | |
525 | rx51_twldata.vaux3 = &rx51_vaux3_cam; | |
526 | rx51_twldata.vmmc2 = &rx51_vmmc2; | |
527 | } | |
cb3cc45a | 528 | omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1, |
ffe7f95b LL |
529 | ARRAY_SIZE(rx51_peripherals_i2c_board_info_1)); |
530 | omap_register_i2c_bus(2, 100, NULL, 0); | |
531 | omap_register_i2c_bus(3, 400, NULL, 0); | |
532 | return 0; | |
533 | } | |
534 | ||
aa62e90f JY |
535 | #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ |
536 | defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) | |
537 | ||
538 | static struct mtd_partition onenand_partitions[] = { | |
539 | { | |
540 | .name = "bootloader", | |
541 | .offset = 0, | |
542 | .size = 0x20000, | |
543 | .mask_flags = MTD_WRITEABLE, /* Force read-only */ | |
544 | }, | |
545 | { | |
546 | .name = "config", | |
547 | .offset = MTDPART_OFS_APPEND, | |
548 | .size = 0x60000, | |
549 | }, | |
550 | { | |
551 | .name = "log", | |
552 | .offset = MTDPART_OFS_APPEND, | |
553 | .size = 0x40000, | |
554 | }, | |
555 | { | |
556 | .name = "kernel", | |
557 | .offset = MTDPART_OFS_APPEND, | |
558 | .size = 0x200000, | |
559 | }, | |
560 | { | |
561 | .name = "initfs", | |
562 | .offset = MTDPART_OFS_APPEND, | |
563 | .size = 0x200000, | |
564 | }, | |
565 | { | |
566 | .name = "rootfs", | |
567 | .offset = MTDPART_OFS_APPEND, | |
568 | .size = MTDPART_SIZ_FULL, | |
569 | }, | |
570 | }; | |
571 | ||
572 | static struct omap_onenand_platform_data board_onenand_data = { | |
573 | .cs = 0, | |
574 | .gpio_irq = 65, | |
575 | .parts = onenand_partitions, | |
576 | .nr_parts = ARRAY_SIZE(onenand_partitions), | |
c8e6488f | 577 | .flags = ONENAND_SYNC_READWRITE, |
aa62e90f JY |
578 | }; |
579 | ||
580 | static void __init board_onenand_init(void) | |
581 | { | |
582 | gpmc_onenand_init(&board_onenand_data); | |
583 | } | |
584 | ||
585 | #else | |
586 | ||
587 | static inline void board_onenand_init(void) | |
588 | { | |
589 | } | |
590 | ||
591 | #endif | |
ffe7f95b | 592 | |
1a48e157 TL |
593 | #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) |
594 | ||
595 | static struct omap_smc91x_platform_data board_smc91x_data = { | |
596 | .cs = 1, | |
597 | .gpio_irq = 54, | |
598 | .gpio_pwrdwn = 86, | |
599 | .gpio_reset = 164, | |
600 | .flags = GPMC_TIMINGS_SMC91C96 | IORESOURCE_IRQ_HIGHLEVEL, | |
601 | }; | |
602 | ||
603 | static void __init board_smc91x_init(void) | |
604 | { | |
605 | omap_cfg_reg(U8_34XX_GPIO54_DOWN); | |
606 | omap_cfg_reg(G25_34XX_GPIO86_OUT); | |
607 | omap_cfg_reg(H19_34XX_GPIO164_OUT); | |
608 | ||
609 | gpmc_smc91x_init(&board_smc91x_data); | |
610 | } | |
611 | ||
612 | #else | |
613 | ||
614 | static inline void board_smc91x_init(void) | |
615 | { | |
616 | } | |
617 | ||
618 | #endif | |
619 | ||
ffe7f95b LL |
620 | void __init rx51_peripherals_init(void) |
621 | { | |
ffe7f95b | 622 | rx51_i2c_init(); |
aa62e90f | 623 | board_onenand_init(); |
1a48e157 | 624 | board_smc91x_init(); |
f014ee32 | 625 | rx51_add_gpio_keys(); |
ffe7f95b LL |
626 | } |
627 |