Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226614
b: refs/heads/master
c: bd2122c
h: refs/heads/master
v: v3
  • Loading branch information
Paul Walmsley committed Dec 22, 2010
1 parent 16ec74d commit 1669356
Show file tree
Hide file tree
Showing 7 changed files with 267 additions and 73 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e4156ee52fe617c2c2d80b5db993ff4bf07d7c3c
refs/heads/master: bd2122ca358fbd5c8e94869ae731a0951b36c757
75 changes: 57 additions & 18 deletions trunk/arch/arm/mach-omap2/clockdomain.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#include "prm2xxx_3xxx.h"
#include "prm-regbits-24xx.h"
#include "cm2xxx_3xxx.h"
#include "cm-regbits-34xx.h"
#include "cminst44xx.h"
#include "prcm44xx.h"

#include <plat/clock.h>
#include <plat/powerdomain.h>
Expand Down Expand Up @@ -247,13 +250,21 @@ static void _enable_hwsup(struct clockdomain *clkdm)

if (cpu_is_omap24xx())
bits = OMAP24XX_CLKSTCTRL_ENABLE_AUTO;
else if (cpu_is_omap34xx() || cpu_is_omap44xx())
else if (cpu_is_omap34xx())
bits = OMAP34XX_CLKSTCTRL_ENABLE_AUTO;
else if (cpu_is_omap44xx())
return omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
clkdm->cm_inst,
clkdm->clkdm_offs);
else
BUG();

bits = bits << __ffs(clkdm->clktrctrl_mask);

/*
* XXX clkstctrl_reg is known on OMAP2 - this clkdm
* field is not needed
*/
v = __raw_readl(clkdm->clkstctrl_reg);
v &= ~(clkdm->clktrctrl_mask);
v |= bits;
Expand All @@ -275,21 +286,27 @@ static void _disable_hwsup(struct clockdomain *clkdm)
{
u32 bits, v;

if (cpu_is_omap24xx()) {
if (cpu_is_omap24xx())
bits = OMAP24XX_CLKSTCTRL_DISABLE_AUTO;
} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
else if (cpu_is_omap34xx())
bits = OMAP34XX_CLKSTCTRL_DISABLE_AUTO;
} else {
else if (cpu_is_omap44xx())
return omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
clkdm->cm_inst,
clkdm->clkdm_offs);
else
BUG();
}

bits = bits << __ffs(clkdm->clktrctrl_mask);

/*
* XXX clkstctrl_reg is known on OMAP2 - this clkdm
* field is not needed
*/
v = __raw_readl(clkdm->clkstctrl_reg);
v &= ~(clkdm->clktrctrl_mask);
v |= bits;
__raw_writel(v, clkdm->clkstctrl_reg);

}

/* Public functions */
Expand Down Expand Up @@ -727,14 +744,20 @@ int clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
*/
static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
{
u32 v;
u32 v = 0;

if (!clkdm)
return -EINVAL;

v = __raw_readl(clkdm->clkstctrl_reg);
v &= clkdm->clktrctrl_mask;
v >>= __ffs(clkdm->clktrctrl_mask);
if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
v = __raw_readl(clkdm->clkstctrl_reg);
v &= clkdm->clktrctrl_mask;
v >>= __ffs(clkdm->clktrctrl_mask);
} else if (cpu_is_omap44xx()) {
pr_warn("OMAP4 clockdomain: missing wakeup/sleep deps\n");
} else {
BUG();
}

return v;
}
Expand All @@ -750,6 +773,8 @@ static int omap2_clkdm_clktrctrl_read(struct clockdomain *clkdm)
*/
int omap2_clkdm_sleep(struct clockdomain *clkdm)
{
u32 bits, v;

if (!clkdm)
return -EINVAL;

Expand All @@ -766,16 +791,22 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);

} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
} else if (cpu_is_omap34xx()) {

u32 bits = (OMAP34XX_CLKSTCTRL_FORCE_SLEEP <<
__ffs(clkdm->clktrctrl_mask));
bits = (OMAP34XX_CLKSTCTRL_FORCE_SLEEP <<
__ffs(clkdm->clktrctrl_mask));

u32 v = __raw_readl(clkdm->clkstctrl_reg);
v = __raw_readl(clkdm->clkstctrl_reg);
v &= ~(clkdm->clktrctrl_mask);
v |= bits;
__raw_writel(v, clkdm->clkstctrl_reg);

} else if (cpu_is_omap44xx()) {

omap4_cminst_clkdm_force_sleep(clkdm->prcm_partition,
clkdm->cm_inst,
clkdm->clkdm_offs);

} else {
BUG();
};
Expand All @@ -794,6 +825,8 @@ int omap2_clkdm_sleep(struct clockdomain *clkdm)
*/
int omap2_clkdm_wakeup(struct clockdomain *clkdm)
{
u32 bits, v;

if (!clkdm)
return -EINVAL;

Expand All @@ -810,16 +843,22 @@ int omap2_clkdm_wakeup(struct clockdomain *clkdm)
omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
clkdm->pwrdm.ptr->prcm_offs, OMAP2_PM_PWSTCTRL);

} else if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
} else if (cpu_is_omap34xx()) {

u32 bits = (OMAP34XX_CLKSTCTRL_FORCE_WAKEUP <<
__ffs(clkdm->clktrctrl_mask));
bits = (OMAP34XX_CLKSTCTRL_FORCE_WAKEUP <<
__ffs(clkdm->clktrctrl_mask));

u32 v = __raw_readl(clkdm->clkstctrl_reg);
v = __raw_readl(clkdm->clkstctrl_reg);
v &= ~(clkdm->clktrctrl_mask);
v |= bits;
__raw_writel(v, clkdm->clkstctrl_reg);

} else if (cpu_is_omap44xx()) {

omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
clkdm->cm_inst,
clkdm->clkdm_offs);

} else {
BUG();
};
Expand Down
Loading

0 comments on commit 1669356

Please sign in to comment.