From 99b0b68a1ddf248e9766b194821da97045f04a4f Mon Sep 17 00:00:00 2001 From: Robin Gong Date: Wed, 17 Dec 2014 20:56:02 +0800 Subject: MLK-9891-1: ARM: imx6: split WDOG_B setting from set_anatop_bypass() function We set WDOG_B in set_anatop_bypass() before, because it is the only case, but now on i.mx6sabreauto board, we didn't use ldo-bypass mode, but have to use WDOG_B to reboot whole board, so split these code to independent function so that board file can call it freely. Signed-off-by: Robin Gong (cherry picked from commit 93d457e4c601ee5266bc30b7dfa5fa1bbfa8500a) --- arch/arm/cpu/armv7/mx6/soc.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) (limited to 'arch/arm/cpu/armv7') diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c index 01776a6..3c3d2fd 100644 --- a/arch/arm/cpu/armv7/mx6/soc.c +++ b/arch/arm/cpu/armv7/mx6/soc.c @@ -923,22 +923,9 @@ void prep_anatop_bypass(void) #endif } -int set_anatop_bypass(int wdog_reset_pin) +void set_wdog_reset(struct wdog_regs *wdog) { - struct mxc_ccm_reg *ccm_regs = (struct mxc_ccm_reg *)CCM_BASE_ADDR; - struct wdog_regs *wdog; - u32 reg = readl(&ccm_regs->reg_core); - - /* bypass VDDARM/VDDSOC */ - reg = reg | (0x1F << 18) | 0x1F; - writel(reg, &ccm_regs->reg_core); - - if (wdog_reset_pin == 2) - wdog = (struct wdog_regs *) WDOG2_BASE_ADDR; - else if (wdog_reset_pin == 1) - wdog = (struct wdog_regs *) WDOG1_BASE_ADDR; - else - return arm_orig_podf; + u32 reg = readw(&wdog->wcr); /* * use WDOG_B mode to reset external pmic because it's risky for the * following watchdog reboot in case of cpu freq at lowest 400Mhz with @@ -956,7 +943,25 @@ int set_anatop_bypass(int wdog_reset_pin) */ reg |= 1 << 0; writew(reg, &wdog->wcr); +} +int set_anatop_bypass(int wdog_reset_pin) +{ + struct mxc_ccm_reg *ccm_regs = (struct mxc_ccm_reg *)CCM_BASE_ADDR; + struct wdog_regs *wdog; + u32 reg = readl(&ccm_regs->reg_core); + + /* bypass VDDARM/VDDSOC */ + reg = reg | (0x1F << 18) | 0x1F; + writel(reg, &ccm_regs->reg_core); + + if (wdog_reset_pin == 2) + wdog = (struct wdog_regs *) WDOG2_BASE_ADDR; + else if (wdog_reset_pin == 1) + wdog = (struct wdog_regs *) WDOG1_BASE_ADDR; + else + return arm_orig_podf; + set_wdog_reset(wdog); return arm_orig_podf; } -- cgit v1.1