aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmit Kucheria <amit.kucheria@verdurent.com>2009-08-27 14:27:57 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2009-09-17 03:47:23 -0400
commit9312fffbad5661a0ad52b5ca5a04875c763a35fa (patch)
treef7cc1f676d4fa77b2e0b86348f06ea74c6bac43a
parent75a7456539224c5c5c254130afdb18bd7eb2286f (diff)
mfd: OMAP: Board-specifc twl4030 DPS scripts for RX51 board
Add support for Dynamic Power Switching (DPS) for the RX51 board. These scripts are still a work-in-progress. I'll keep sending patches to update the scripts as they are optimised. Signed-off-by: Amit Kucheria <amit.kucheria@verdurent.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c122
1 files changed, 120 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 56d931a425f7..e70baa799018 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/board-rx51-flash.c 2 * linux/arch/arm/mach-omap2/board-rx51-peripherals.c
3 * 3 *
4 * Copyright (C) 2008-2009 Nokia 4 * Copyright (C) 2008-2009 Nokia
5 * 5 *
@@ -282,7 +282,124 @@ static struct twl4030_usb_data rx51_usb_data = {
282 .usb_mode = T2_USB_MODE_ULPI, 282 .usb_mode = T2_USB_MODE_ULPI,
283}; 283};
284 284
285static struct twl4030_platform_data rx51_twldata = { 285static struct twl4030_ins sleep_on_seq[] __initdata = {
286/*
287 * Turn off VDD1 and VDD2.
288 */
289 {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_OFF), 4},
290 {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_OFF), 2},
291/*
292 * And also turn off the OMAP3 PLLs and the sysclk output.
293 */
294 {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_OFF), 3},
295 {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_OFF), 3},
296};
297
298static struct twl4030_script sleep_on_script __initdata = {
299 .script = sleep_on_seq,
300 .size = ARRAY_SIZE(sleep_on_seq),
301 .flags = TWL4030_SLEEP_SCRIPT,
302};
303
304static struct twl4030_ins wakeup_seq[] __initdata = {
305/*
306 * Reenable the OMAP3 PLLs.
307 * Wakeup VDD1 and VDD2.
308 * Reenable sysclk output.
309 */
310 {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_ACTIVE), 0x30},
311 {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_ACTIVE), 0x30},
312 {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_ACTIVE), 0x37},
313 {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 3},
314};
315
316static struct twl4030_script wakeup_script __initdata = {
317 .script = wakeup_seq,
318 .size = ARRAY_SIZE(wakeup_seq),
319 .flags = TWL4030_WAKEUP12_SCRIPT,
320};
321
322static struct twl4030_ins wakeup_p3_seq[] __initdata = {
323/*
324 * Wakeup VDD1 (dummy to be able to insert a delay)
325 * Enable CLKEN
326 */
327 {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_ACTIVE), 3},
328};
329
330static struct twl4030_script wakeup_p3_script __initdata = {
331 .script = wakeup_p3_seq,
332 .size = ARRAY_SIZE(wakeup_p3_seq),
333 .flags = TWL4030_WAKEUP3_SCRIPT,
334};
335
336static struct twl4030_ins wrst_seq[] __initdata = {
337/*
338 * Reset twl4030.
339 * Reset VDD1 regulator.
340 * Reset VDD2 regulator.
341 * Reset VPLL1 regulator.
342 * Enable sysclk output.
343 * Reenable twl4030.
344 */
345 {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
346 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
347 0x13},
348 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 2, RES_STATE_WRST), 0x13},
349 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
350 {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
351 {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
352 {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
353 {MSG_SINGULAR(DEV_GRP_P1, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
354 {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
355};
356
357static struct twl4030_script wrst_script __initdata = {
358 .script = wrst_seq,
359 .size = ARRAY_SIZE(wrst_seq),
360 .flags = TWL4030_WRST_SCRIPT,
361};
362
363static struct twl4030_script *twl4030_scripts[] __initdata = {
364 /* wakeup12 script should be loaded before sleep script, otherwise a
365 board might hit retention before loading of wakeup script is
366 completed. This can cause boot failures depending on timing issues.
367 */
368 &wakeup_script,
369 &sleep_on_script,
370 &wakeup_p3_script,
371 &wrst_script,
372};
373
374static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
375 { .resource = RES_VINTANA1, .devgroup = -1, .type = -1, .type2 = 1 },
376 { .resource = RES_VINTANA2, .devgroup = -1, .type = -1, .type2 = 1 },
377 { .resource = RES_VINTDIG, .devgroup = -1, .type = -1, .type2 = 1 },
378 { .resource = RES_VMMC1, .devgroup = -1, .type = -1, .type2 = 3},
379 { .resource = RES_VMMC2, .devgroup = DEV_GRP_NULL, .type = -1,
380 .type2 = 3},
381 { .resource = RES_VAUX1, .devgroup = -1, .type = -1, .type2 = 3},
382 { .resource = RES_VAUX2, .devgroup = -1, .type = -1, .type2 = 3},
383 { .resource = RES_VAUX3, .devgroup = -1, .type = -1, .type2 = 3},
384 { .resource = RES_VAUX4, .devgroup = -1, .type = -1, .type2 = 3},
385 { .resource = RES_VPLL2, .devgroup = -1, .type = -1, .type2 = 3},
386 { .resource = RES_VDAC, .devgroup = -1, .type = -1, .type2 = 3},
387 { .resource = RES_VSIM, .devgroup = DEV_GRP_NULL, .type = -1,
388 .type2 = 3},
389 { .resource = RES_CLKEN, .devgroup = DEV_GRP_P3, .type = -1,
390 .type2 = 1 },
391 { 0, 0},
392};
393
394static struct twl4030_power_data rx51_t2scripts_data __initdata = {
395 .scripts = twl4030_scripts,
396 .num = ARRAY_SIZE(twl4030_scripts),
397 .resource_config = twl4030_rconfig,
398};
399
400
401
402static struct twl4030_platform_data rx51_twldata __initdata = {
286 .irq_base = TWL4030_IRQ_BASE, 403 .irq_base = TWL4030_IRQ_BASE,
287 .irq_end = TWL4030_IRQ_END, 404 .irq_end = TWL4030_IRQ_END,
288 405
@@ -291,6 +408,7 @@ static struct twl4030_platform_data rx51_twldata = {
291 .keypad = &rx51_kp_data, 408 .keypad = &rx51_kp_data,
292 .madc = &rx51_madc_data, 409 .madc = &rx51_madc_data,
293 .usb = &rx51_usb_data, 410 .usb = &rx51_usb_data,
411 .power = &rx51_t2scripts_data,
294 412
295 .vaux1 = &rx51_vaux1, 413 .vaux1 = &rx51_vaux1,
296 .vaux2 = &rx51_vaux2, 414 .vaux2 = &rx51_vaux2,