diff options
author | Rajendra Nayak <rnayak@ti.com> | 2010-12-21 22:01:18 -0500 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-12-21 22:01:18 -0500 |
commit | 12627578523d2d9396cae76b1dad0ed3dccf1730 (patch) | |
tree | 0cce660ef2a1bc3390823469fed55a409617194a /arch/arm | |
parent | f327e07b0ef9c60a6018799c9f04de10101d8e5a (diff) |
OMAP: powerdomain: Arch specific funcs for logic control
Define the following architecture specific funtions for omap2/3/4
.pwrdm_set_logic_retst
.pwrdm_read_logic_pwrst
.pwrdm_read_prev_logic_pwrst
.pwrdm_read_logic_retst
Convert the platform-independent framework to call these functions.
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Cc: Benoit Cousson <b-cousson@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>
Reviewed-by: Kevin Hilman <khilman@deeprootsystems.com>
Tested-by: Kevin Hilman <khilman@deeprootsystems.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Rajendra Nayak <rnayak@ti.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-omap2/powerdomain.c | 51 | ||||
-rw-r--r-- | arch/arm/mach-omap2/powerdomain2xxx_3xxx.c | 34 | ||||
-rw-r--r-- | arch/arm/mach-omap2/powerdomain44xx.c | 26 |
3 files changed, 82 insertions, 29 deletions
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 0ae1ebf4e974..562a3fe9db5b 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
@@ -532,7 +532,7 @@ int pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | |||
532 | */ | 532 | */ |
533 | int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | 533 | int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) |
534 | { | 534 | { |
535 | u32 v; | 535 | int ret = -EINVAL; |
536 | 536 | ||
537 | if (!pwrdm) | 537 | if (!pwrdm) |
538 | return -EINVAL; | 538 | return -EINVAL; |
@@ -543,17 +543,10 @@ int pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | |||
543 | pr_debug("powerdomain: setting next logic powerstate for %s to %0x\n", | 543 | pr_debug("powerdomain: setting next logic powerstate for %s to %0x\n", |
544 | pwrdm->name, pwrst); | 544 | pwrdm->name, pwrst); |
545 | 545 | ||
546 | /* | 546 | if (arch_pwrdm && arch_pwrdm->pwrdm_set_logic_retst) |
547 | * The register bit names below may not correspond to the | 547 | ret = arch_pwrdm->pwrdm_set_logic_retst(pwrdm, pwrst); |
548 | * actual names of the bits in each powerdomain's register, | ||
549 | * but the type of value returned is the same for each | ||
550 | * powerdomain. | ||
551 | */ | ||
552 | v = pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE_MASK); | ||
553 | prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE_MASK, v, | ||
554 | pwrdm->prcm_offs, pwrstctrl_reg_offs); | ||
555 | 548 | ||
556 | return 0; | 549 | return ret; |
557 | } | 550 | } |
558 | 551 | ||
559 | /** | 552 | /** |
@@ -696,11 +689,15 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) | |||
696 | */ | 689 | */ |
697 | int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | 690 | int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) |
698 | { | 691 | { |
692 | int ret = -EINVAL; | ||
693 | |||
699 | if (!pwrdm) | 694 | if (!pwrdm) |
700 | return -EINVAL; | 695 | return -EINVAL; |
701 | 696 | ||
702 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, pwrstst_reg_offs, | 697 | if (arch_pwrdm && arch_pwrdm->pwrdm_read_logic_pwrst) |
703 | OMAP3430_LOGICSTATEST_MASK); | 698 | ret = arch_pwrdm->pwrdm_read_logic_pwrst(pwrdm); |
699 | |||
700 | return ret; | ||
704 | } | 701 | } |
705 | 702 | ||
706 | /** | 703 | /** |
@@ -713,17 +710,15 @@ int pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | |||
713 | */ | 710 | */ |
714 | int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) | 711 | int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) |
715 | { | 712 | { |
713 | int ret = -EINVAL; | ||
714 | |||
716 | if (!pwrdm) | 715 | if (!pwrdm) |
717 | return -EINVAL; | 716 | return -EINVAL; |
718 | 717 | ||
719 | /* | 718 | if (arch_pwrdm && arch_pwrdm->pwrdm_read_prev_logic_pwrst) |
720 | * The register bit names below may not correspond to the | 719 | ret = arch_pwrdm->pwrdm_read_prev_logic_pwrst(pwrdm); |
721 | * actual names of the bits in each powerdomain's register, | 720 | |
722 | * but the type of value returned is the same for each | 721 | return ret; |
723 | * powerdomain. | ||
724 | */ | ||
725 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST, | ||
726 | OMAP3430_LASTLOGICSTATEENTERED_MASK); | ||
727 | } | 722 | } |
728 | 723 | ||
729 | /** | 724 | /** |
@@ -736,17 +731,15 @@ int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) | |||
736 | */ | 731 | */ |
737 | int pwrdm_read_logic_retst(struct powerdomain *pwrdm) | 732 | int pwrdm_read_logic_retst(struct powerdomain *pwrdm) |
738 | { | 733 | { |
734 | int ret = -EINVAL; | ||
735 | |||
739 | if (!pwrdm) | 736 | if (!pwrdm) |
740 | return -EINVAL; | 737 | return -EINVAL; |
741 | 738 | ||
742 | /* | 739 | if (arch_pwrdm && arch_pwrdm->pwrdm_read_logic_retst) |
743 | * The register bit names below may not correspond to the | 740 | ret = arch_pwrdm->pwrdm_read_logic_retst(pwrdm); |
744 | * actual names of the bits in each powerdomain's register, | 741 | |
745 | * but the type of value returned is the same for each | 742 | return ret; |
746 | * powerdomain. | ||
747 | */ | ||
748 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, pwrstctrl_reg_offs, | ||
749 | OMAP3430_LOGICSTATEST_MASK); | ||
750 | } | 743 | } |
751 | 744 | ||
752 | /** | 745 | /** |
diff --git a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c index a25dd64d609b..b7ea191539e5 100644 --- a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c +++ b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c | |||
@@ -41,6 +41,17 @@ static int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm) | |||
41 | OMAP2_PM_PWSTST, OMAP_POWERSTATEST_MASK); | 41 | OMAP2_PM_PWSTST, OMAP_POWERSTATEST_MASK); |
42 | } | 42 | } |
43 | 43 | ||
44 | static int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | ||
45 | { | ||
46 | u32 v; | ||
47 | |||
48 | v = pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE_MASK); | ||
49 | prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE_MASK, v, | ||
50 | pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); | ||
51 | |||
52 | return 0; | ||
53 | } | ||
54 | |||
44 | /* Applicable only for OMAP3. Not supported on OMAP2 */ | 55 | /* Applicable only for OMAP3. Not supported on OMAP2 */ |
45 | static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | 56 | static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) |
46 | { | 57 | { |
@@ -48,10 +59,29 @@ static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | |||
48 | OMAP3430_LASTPOWERSTATEENTERED_MASK); | 59 | OMAP3430_LASTPOWERSTATEENTERED_MASK); |
49 | } | 60 | } |
50 | 61 | ||
62 | static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | ||
63 | { | ||
64 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST, | ||
65 | OMAP3430_LOGICSTATEST_MASK); | ||
66 | } | ||
67 | |||
68 | static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm) | ||
69 | { | ||
70 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL, | ||
71 | OMAP3430_LOGICSTATEST_MASK); | ||
72 | } | ||
73 | |||
74 | static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) | ||
75 | { | ||
76 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST, | ||
77 | OMAP3430_LASTLOGICSTATEENTERED_MASK); | ||
78 | } | ||
79 | |||
51 | struct pwrdm_ops omap2_pwrdm_operations = { | 80 | struct pwrdm_ops omap2_pwrdm_operations = { |
52 | .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, | 81 | .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, |
53 | .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, | 82 | .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, |
54 | .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, | 83 | .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, |
84 | .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst, | ||
55 | }; | 85 | }; |
56 | 86 | ||
57 | struct pwrdm_ops omap3_pwrdm_operations = { | 87 | struct pwrdm_ops omap3_pwrdm_operations = { |
@@ -59,4 +89,8 @@ struct pwrdm_ops omap3_pwrdm_operations = { | |||
59 | .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, | 89 | .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, |
60 | .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, | 90 | .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, |
61 | .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst, | 91 | .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst, |
92 | .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst, | ||
93 | .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst, | ||
94 | .pwrdm_read_logic_retst = omap3_pwrdm_read_logic_retst, | ||
95 | .pwrdm_read_prev_logic_pwrst = omap3_pwrdm_read_prev_logic_pwrst, | ||
62 | }; | 96 | }; |
diff --git a/arch/arm/mach-omap2/powerdomain44xx.c b/arch/arm/mach-omap2/powerdomain44xx.c index 5dc337c0e5d5..996790acebc9 100644 --- a/arch/arm/mach-omap2/powerdomain44xx.c +++ b/arch/arm/mach-omap2/powerdomain44xx.c | |||
@@ -47,9 +47,35 @@ static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | |||
47 | OMAP4430_LASTPOWERSTATEENTERED_MASK); | 47 | OMAP4430_LASTPOWERSTATEENTERED_MASK); |
48 | } | 48 | } |
49 | 49 | ||
50 | static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | ||
51 | { | ||
52 | u32 v; | ||
53 | |||
54 | v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK); | ||
55 | prm_rmw_mod_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v, | ||
56 | pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL); | ||
57 | |||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | ||
62 | { | ||
63 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTST, | ||
64 | OMAP4430_LOGICSTATEST_MASK); | ||
65 | } | ||
66 | |||
67 | static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm) | ||
68 | { | ||
69 | return prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL, | ||
70 | OMAP4430_LOGICRETSTATE_MASK); | ||
71 | } | ||
72 | |||
50 | struct pwrdm_ops omap4_pwrdm_operations = { | 73 | struct pwrdm_ops omap4_pwrdm_operations = { |
51 | .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst, | 74 | .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst, |
52 | .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst, | 75 | .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst, |
53 | .pwrdm_read_pwrst = omap4_pwrdm_read_pwrst, | 76 | .pwrdm_read_pwrst = omap4_pwrdm_read_pwrst, |
54 | .pwrdm_read_prev_pwrst = omap4_pwrdm_read_prev_pwrst, | 77 | .pwrdm_read_prev_pwrst = omap4_pwrdm_read_prev_pwrst, |
78 | .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst, | ||
79 | .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst, | ||
80 | .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst, | ||
55 | }; | 81 | }; |