Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373911
b: refs/heads/master
c: e7b82d6
h: refs/heads/master
i:
  373909: 8b95250
  373907: dc1416a
  373903: df91c6b
v: v3
  • Loading branch information
Anson Huang authored and Shawn Guo committed Apr 12, 2013
1 parent 33b82a9 commit 5d668aa
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 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: e95dddb34c896f33e89f97365491e7932f89a0c0
refs/heads/master: e7b82d645d8b0345508d4b7be85e10f961fbfa3e
30 changes: 29 additions & 1 deletion trunk/arch/arm/mach-imx/clk-imx6q.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2011 Freescale Semiconductor, Inc.
* Copyright 2011-2013 Freescale Semiconductor, Inc.
* Copyright 2011 Linaro Ltd.
*
* The code contained herein is licensed under the GNU General Public
Expand All @@ -23,6 +23,9 @@
#include "clk.h"
#include "common.h"

#define CCR 0x0
#define BM_CCR_WB_COUNT (0x7 << 16)

#define CCGR0 0x68
#define CCGR1 0x6c
#define CCGR2 0x70
Expand Down Expand Up @@ -67,13 +70,37 @@ void imx6q_set_chicken_bit(void)
writel_relaxed(val, ccm_base + CGPR);
}

static void imx6q_enable_wb(bool enable)
{
u32 val;
static bool last_wb_mode;

if (last_wb_mode == enable)
return;

/* configure well bias enable bit */
val = readl_relaxed(ccm_base + CLPCR);
val &= ~BM_CLPCR_WB_PER_AT_LPM;
val |= enable ? BM_CLPCR_WB_PER_AT_LPM : 0;
writel_relaxed(val, ccm_base + CLPCR);

/* configure well bias count */
val = readl_relaxed(ccm_base + CCR);
val &= ~BM_CCR_WB_COUNT;
val |= enable ? BM_CCR_WB_COUNT : 0;
writel_relaxed(val, ccm_base + CCR);

last_wb_mode = enable;
}

int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
{
u32 val = readl_relaxed(ccm_base + CLPCR);

val &= ~BM_CLPCR_LPM;
switch (mode) {
case WAIT_CLOCKED:
imx6q_enable_wb(false);
break;
case WAIT_UNCLOCKED:
val |= 0x1 << BP_CLPCR_LPM;
Expand All @@ -92,6 +119,7 @@ int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode)
val |= 0x3 << BP_CLPCR_STBY_COUNT;
val |= BM_CLPCR_VSTBY;
val |= BM_CLPCR_SBYOS;
imx6q_enable_wb(true);
break;
default:
return -EINVAL;
Expand Down

0 comments on commit 5d668aa

Please sign in to comment.