aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx/anatop.c
diff options
context:
space:
mode:
authorAnson Huang <b20788@freescale.com>2013-03-21 10:58:06 -0400
committerShawn Guo <shawn.guo@linaro.org>2013-04-12 07:01:43 -0400
commit263475d4e0b0623fb7a22f8ac0a5c01017eabf20 (patch)
tree9d8ffb5e1df3cf19d0b7881e514f585d6387b546 /arch/arm/mach-imx/anatop.c
parente7b82d645d8b0345508d4b7be85e10f961fbfa3e (diff)
ARM: imx: enable RBC to support anatop LPM mode
RBC is to control whether some ANATOP sub modules can enter lpm mode when SOC is into STOP mode, if RBC is enabled and PMIC_VSTBY_REQ is set, ANATOP will have below behaviors: 1. Digital LDOs(CORE, SOC and PU) are bypassed; 2. Analog LDOs(1P1, 2P5, 3P0) are disabled; As the 2P5 is necessary for DRAM IO pre-drive in STOP mode, so we need to enable weak 2P5 in STOP mode when 2P5 LDO is disabled. For RBC settings, there are some rules as below due to hardware design: 1. All interrupts must be masked during operating RBC registers; 2. At least 2 CKIL(32K) cycles is needed after the RBC setting is changed. Signed-off-by: Anson Huang <b20788@freescale.com> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'arch/arm/mach-imx/anatop.c')
-rw-r--r--arch/arm/mach-imx/anatop.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/anatop.c b/arch/arm/mach-imx/anatop.c
index b396b92526d3..8b18b3c3bcf0 100644
--- a/arch/arm/mach-imx/anatop.c
+++ b/arch/arm/mach-imx/anatop.c
@@ -19,17 +19,34 @@
19#define REG_SET 0x4 19#define REG_SET 0x4
20#define REG_CLR 0x8 20#define REG_CLR 0x8
21 21
22#define ANADIG_REG_2P5 0x130
22#define ANADIG_REG_CORE 0x140 23#define ANADIG_REG_CORE 0x140
24#define ANADIG_ANA_MISC0 0x150
23#define ANADIG_USB1_CHRG_DETECT 0x1b0 25#define ANADIG_USB1_CHRG_DETECT 0x1b0
24#define ANADIG_USB2_CHRG_DETECT 0x210 26#define ANADIG_USB2_CHRG_DETECT 0x210
25#define ANADIG_DIGPROG 0x260 27#define ANADIG_DIGPROG 0x260
26 28
29#define BM_ANADIG_REG_2P5_ENABLE_WEAK_LINREG 0x40000
27#define BM_ANADIG_REG_CORE_FET_ODRIVE 0x20000000 30#define BM_ANADIG_REG_CORE_FET_ODRIVE 0x20000000
31#define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG 0x1000
28#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x80000 32#define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x80000
29#define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x100000 33#define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x100000
30 34
31static struct regmap *anatop; 35static struct regmap *anatop;
32 36
37static void imx_anatop_enable_weak2p5(bool enable)
38{
39 u32 reg, val;
40
41 regmap_read(anatop, ANADIG_ANA_MISC0, &val);
42
43 /* can only be enabled when stop_mode_config is clear. */
44 reg = ANADIG_REG_2P5;
45 reg += (enable && (val & BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG) == 0) ?
46 REG_SET : REG_CLR;
47 regmap_write(anatop, reg, BM_ANADIG_REG_2P5_ENABLE_WEAK_LINREG);
48}
49
33static void imx_anatop_enable_fet_odrive(bool enable) 50static void imx_anatop_enable_fet_odrive(bool enable)
34{ 51{
35 regmap_write(anatop, ANADIG_REG_CORE + (enable ? REG_SET : REG_CLR), 52 regmap_write(anatop, ANADIG_REG_CORE + (enable ? REG_SET : REG_CLR),
@@ -38,12 +55,14 @@ static void imx_anatop_enable_fet_odrive(bool enable)
38 55
39void imx_anatop_pre_suspend(void) 56void imx_anatop_pre_suspend(void)
40{ 57{
58 imx_anatop_enable_weak2p5(true);
41 imx_anatop_enable_fet_odrive(true); 59 imx_anatop_enable_fet_odrive(true);
42} 60}
43 61
44void imx_anatop_post_resume(void) 62void imx_anatop_post_resume(void)
45{ 63{
46 imx_anatop_enable_fet_odrive(false); 64 imx_anatop_enable_fet_odrive(false);
65 imx_anatop_enable_weak2p5(false);
47} 66}
48 67
49void imx_anatop_usb_chrg_detect_disable(void) 68void imx_anatop_usb_chrg_detect_disable(void)