diff options
Diffstat (limited to 'arch/arm/mach-omap2/powerdomain.c')
-rw-r--r-- | arch/arm/mach-omap2/powerdomain.c | 56 |
1 files changed, 43 insertions, 13 deletions
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index ebfce7d1a5d3..a2904aa7065e 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
@@ -5,8 +5,8 @@ | |||
5 | * Copyright (C) 2007-2009 Nokia Corporation | 5 | * Copyright (C) 2007-2009 Nokia Corporation |
6 | * | 6 | * |
7 | * Written by Paul Walmsley | 7 | * Written by Paul Walmsley |
8 | * | ||
9 | * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com> | 8 | * Added OMAP4 specific support by Abhijit Pagare <abhijitpagare@ti.com> |
9 | * State counting code by Tero Kristo <tero.kristo@nokia.com> | ||
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License version 2 as | 12 | * it under the terms of the GNU General Public License version 2 as |
@@ -64,10 +64,10 @@ static u16 pwrstst_reg_offs; | |||
64 | #define OMAP_MEM4_ONSTATE_MASK OMAP4430_OCP_NRET_BANK_ONSTATE_MASK | 64 | #define OMAP_MEM4_ONSTATE_MASK OMAP4430_OCP_NRET_BANK_ONSTATE_MASK |
65 | 65 | ||
66 | /* OMAP3 and OMAP4 Memory Retstate Masks (common across all power domains) */ | 66 | /* OMAP3 and OMAP4 Memory Retstate Masks (common across all power domains) */ |
67 | #define OMAP_MEM0_RETSTATE_MASK OMAP3430_SHAREDL1CACHEFLATRETSTATE | 67 | #define OMAP_MEM0_RETSTATE_MASK OMAP3430_SHAREDL1CACHEFLATRETSTATE_MASK |
68 | #define OMAP_MEM1_RETSTATE_MASK OMAP3430_L1FLATMEMRETSTATE | 68 | #define OMAP_MEM1_RETSTATE_MASK OMAP3430_L1FLATMEMRETSTATE_MASK |
69 | #define OMAP_MEM2_RETSTATE_MASK OMAP3430_SHAREDL2CACHEFLATRETSTATE | 69 | #define OMAP_MEM2_RETSTATE_MASK OMAP3430_SHAREDL2CACHEFLATRETSTATE_MASK |
70 | #define OMAP_MEM3_RETSTATE_MASK OMAP3430_L2FLATMEMRETSTATE | 70 | #define OMAP_MEM3_RETSTATE_MASK OMAP3430_L2FLATMEMRETSTATE_MASK |
71 | #define OMAP_MEM4_RETSTATE_MASK OMAP4430_OCP_NRET_BANK_RETSTATE_MASK | 71 | #define OMAP_MEM4_RETSTATE_MASK OMAP4430_OCP_NRET_BANK_RETSTATE_MASK |
72 | 72 | ||
73 | /* OMAP3 and OMAP4 Memory Status bits */ | 73 | /* OMAP3 and OMAP4 Memory Status bits */ |
@@ -511,6 +511,8 @@ int pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | |||
511 | */ | 511 | */ |
512 | int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | 512 | int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) |
513 | { | 513 | { |
514 | u32 v; | ||
515 | |||
514 | if (!pwrdm) | 516 | if (!pwrdm) |
515 | return -EINVAL; | 517 | return -EINVAL; |
516 | 518 | ||
@@ -526,9 +528,9 @@ int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | |||
526 | * but the type of value returned is the same for each | 528 | * but the type of value returned is the same for each |
527 | * powerdomain. | 529 | * powerdomain. |
528 | */ | 530 | */ |
529 | prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE, | 531 | v = pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE_MASK); |
530 | (pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE)), | 532 | prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE_MASK, v, |
531 | pwrdm->prcm_offs, pwrstctrl_reg_offs); | 533 | pwrdm->prcm_offs, pwrstctrl_reg_offs); |
532 | 534 | ||
533 | return 0; | 535 | return 0; |
534 | } | 536 | } |
@@ -676,8 +678,8 @@ int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | |||
676 | if (!pwrdm) | 678 | if (!pwrdm) |
677 | return -EINVAL; | 679 | return -EINVAL; |
678 | 680 | ||
679 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, | 681 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, pwrstst_reg_offs, |
680 | pwrstst_reg_offs, OMAP3430_LOGICSTATEST); | 682 | OMAP3430_LOGICSTATEST_MASK); |
681 | } | 683 | } |
682 | 684 | ||
683 | /** | 685 | /** |
@@ -700,7 +702,7 @@ int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) | |||
700 | * powerdomain. | 702 | * powerdomain. |
701 | */ | 703 | */ |
702 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST, | 704 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST, |
703 | OMAP3430_LASTLOGICSTATEENTERED); | 705 | OMAP3430_LASTLOGICSTATEENTERED_MASK); |
704 | } | 706 | } |
705 | 707 | ||
706 | /** | 708 | /** |
@@ -723,7 +725,7 @@ int pwrdm_read_logic_retst(struct powerdomain *pwrdm) | |||
723 | * powerdomain. | 725 | * powerdomain. |
724 | */ | 726 | */ |
725 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, pwrstctrl_reg_offs, | 727 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, pwrstctrl_reg_offs, |
726 | OMAP3430_LOGICSTATEST); | 728 | OMAP3430_LOGICSTATEST_MASK); |
727 | } | 729 | } |
728 | 730 | ||
729 | /** | 731 | /** |
@@ -978,6 +980,34 @@ bool pwrdm_has_hdwr_sar(struct powerdomain *pwrdm) | |||
978 | } | 980 | } |
979 | 981 | ||
980 | /** | 982 | /** |
983 | * pwrdm_set_lowpwrstchange - Request a low power state change | ||
984 | * @pwrdm: struct powerdomain * | ||
985 | * | ||
986 | * Allows a powerdomain to transtion to a lower power sleep state | ||
987 | * from an existing sleep state without waking up the powerdomain. | ||
988 | * Returns -EINVAL if the powerdomain pointer is null or if the | ||
989 | * powerdomain does not support LOWPOWERSTATECHANGE, or returns 0 | ||
990 | * upon success. | ||
991 | */ | ||
992 | int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm) | ||
993 | { | ||
994 | if (!pwrdm) | ||
995 | return -EINVAL; | ||
996 | |||
997 | if (!(pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) | ||
998 | return -EINVAL; | ||
999 | |||
1000 | pr_debug("powerdomain: %s: setting LOWPOWERSTATECHANGE bit\n", | ||
1001 | pwrdm->name); | ||
1002 | |||
1003 | prm_rmw_mod_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK, | ||
1004 | (1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT), | ||
1005 | pwrdm->prcm_offs, pwrstctrl_reg_offs); | ||
1006 | |||
1007 | return 0; | ||
1008 | } | ||
1009 | |||
1010 | /** | ||
981 | * pwrdm_wait_transition - wait for powerdomain power transition to finish | 1011 | * pwrdm_wait_transition - wait for powerdomain power transition to finish |
982 | * @pwrdm: struct powerdomain * to wait for | 1012 | * @pwrdm: struct powerdomain * to wait for |
983 | * | 1013 | * |
@@ -1002,7 +1032,7 @@ int pwrdm_wait_transition(struct powerdomain *pwrdm) | |||
1002 | 1032 | ||
1003 | /* XXX Is this udelay() value meaningful? */ | 1033 | /* XXX Is this udelay() value meaningful? */ |
1004 | while ((prm_read_mod_reg(pwrdm->prcm_offs, pwrstst_reg_offs) & | 1034 | while ((prm_read_mod_reg(pwrdm->prcm_offs, pwrstst_reg_offs) & |
1005 | OMAP_INTRANSITION) && | 1035 | OMAP_INTRANSITION_MASK) && |
1006 | (c++ < PWRDM_TRANSITION_BAILOUT)) | 1036 | (c++ < PWRDM_TRANSITION_BAILOUT)) |
1007 | udelay(1); | 1037 | udelay(1); |
1008 | 1038 | ||