diff options
author | Robin Gong <b38343@freescale.com> | 2015-05-26 17:08:11 +0800 |
---|---|---|
committer | Robin Gong <b38343@freescale.com> | 2015-05-28 10:50:49 +0800 |
commit | 1567901fabb18bb3975c71565577b9f208754faa (patch) | |
tree | 738f175d0366f041aa6dbb3912ebc079b73eed2f | |
parent | a3f1ec65143855347c867e1e67546f938a1a8020 (diff) |
MLK-10983 : ARM: imx: gpc: wait PU LDO ramp before GPU power up on i.mx6qp
Wait PU LDO ramp before GPU power on once system resume back on i.mx6qp,
otherwise, GPU resume may hang.
Signed-off-by: Robin Gong <b38343@freescale.com>
(cherry picked from commit f9cc58435590b5427a0a1bfac8b27d3ca1620b4a)
-rw-r--r-- | arch/arm/mach-imx/anatop.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/arch/arm/mach-imx/anatop.c b/arch/arm/mach-imx/anatop.c index 14535f636115..4ae26b737355 100644 --- a/arch/arm/mach-imx/anatop.c +++ b/arch/arm/mach-imx/anatop.c @@ -9,6 +9,7 @@ * http://www.gnu.org/copyleft/gpl.html */ +#include <linux/delay.h> #include <linux/err.h> #include <linux/io.h> #include <linux/of.h> @@ -30,6 +31,7 @@ #define ANADIG_REG_2P5 0x130 #define ANADIG_REG_CORE 0x140 #define ANADIG_ANA_MISC0 0x150 +#define ANADIG_ANA_MISC2 0x170 #define ANADIG_USB1_CHRG_DETECT 0x1b0 #define ANADIG_USB2_CHRG_DETECT 0x210 #define ANADIG_DIGPROG 0x260 @@ -41,12 +43,18 @@ #define BM_ANADIG_REG_CORE_FET_ODRIVE 0x20000000 #define BM_ANADIG_REG_CORE_REG1 (0x1f << 9) #define BM_ANADIG_REG_CORE_REG2 (0x1f << 18) +#define BP_ANADIG_REG_CORE_REG2 (18) #define BM_ANADIG_ANA_MISC0_STOP_MODE_CONFIG 0x1000 +#define BM_ANADIG_ANA_MISC2_REG1_STEP_TIME (0x3 << 26) +#define BP_ANADIG_ANA_MISC2_REG1_STEP_TIME (26) /* Below MISC0_DISCON_HIGH_SNVS is only for i.MX6SL */ #define BM_ANADIG_ANA_MISC0_DISCON_HIGH_SNVS 0x2000 #define BM_ANADIG_USB_CHRG_DETECT_CHK_CHRG_B 0x80000 #define BM_ANADIG_USB_CHRG_DETECT_EN_B 0x100000 +#define LDO_RAMP_UP_UNIT_IN_CYCLES 64 /* 64 cycles per step */ +#define LDO_RAMP_UP_FREQ_IN_MHZ 24 /* cycle based on 24M OSC */ + static struct regmap *anatop; static void imx_anatop_enable_weak2p5(bool enable) @@ -82,7 +90,7 @@ static inline void imx_anatop_disconnect_high_snvs(bool enable) static void imx_anatop_disable_pu(bool off) { - u32 val, soc; + u32 val, soc, delay; if (off) { regmap_read(anatop, ANADIG_REG_CORE, &val); val &= ~BM_ANADIG_REG_CORE_REG1; @@ -94,6 +102,14 @@ static void imx_anatop_disable_pu(bool off) val &= ~BM_ANADIG_REG_CORE_REG1; val |= soc >> 9; regmap_write(anatop, ANADIG_REG_CORE, val); + /* wait PU LDO ramp */ + regmap_read(anatop, ANADIG_ANA_MISC2, &val); + val &= BM_ANADIG_ANA_MISC2_REG1_STEP_TIME; + val >>= BP_ANADIG_ANA_MISC2_REG1_STEP_TIME; + delay = (soc >> BP_ANADIG_REG_CORE_REG2) * + (LDO_RAMP_UP_UNIT_IN_CYCLES << val) / + LDO_RAMP_UP_FREQ_IN_MHZ + 1; + udelay(delay); } } |