Commit 99b0b68a1ddf248e9766b194821da97045f04a4f

Authored by Robin Gong
1 parent bf7ffcfd66

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 <b38343@freescale.com>
(cherry picked from commit 93d457e4c601ee5266bc30b7dfa5fa1bbfa8500a)

Showing 2 changed files with 21 additions and 15 deletions Side-by-side Diff

arch/arm/cpu/armv7/mx6/soc.c
... ... @@ -923,22 +923,9 @@
923 923 #endif
924 924 }
925 925  
926   -int set_anatop_bypass(int wdog_reset_pin)
  926 +void set_wdog_reset(struct wdog_regs *wdog)
927 927 {
928   - struct mxc_ccm_reg *ccm_regs = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
929   - struct wdog_regs *wdog;
930   - u32 reg = readl(&ccm_regs->reg_core);
931   -
932   - /* bypass VDDARM/VDDSOC */
933   - reg = reg | (0x1F << 18) | 0x1F;
934   - writel(reg, &ccm_regs->reg_core);
935   -
936   - if (wdog_reset_pin == 2)
937   - wdog = (struct wdog_regs *) WDOG2_BASE_ADDR;
938   - else if (wdog_reset_pin == 1)
939   - wdog = (struct wdog_regs *) WDOG1_BASE_ADDR;
940   - else
941   - return arm_orig_podf;
  928 + u32 reg = readw(&wdog->wcr);
942 929 /*
943 930 * use WDOG_B mode to reset external pmic because it's risky for the
944 931 * following watchdog reboot in case of cpu freq at lowest 400Mhz with
945 932  
... ... @@ -956,7 +943,25 @@
956 943 */
957 944 reg |= 1 << 0;
958 945 writew(reg, &wdog->wcr);
  946 +}
959 947  
  948 +int set_anatop_bypass(int wdog_reset_pin)
  949 +{
  950 + struct mxc_ccm_reg *ccm_regs = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
  951 + struct wdog_regs *wdog;
  952 + u32 reg = readl(&ccm_regs->reg_core);
  953 +
  954 + /* bypass VDDARM/VDDSOC */
  955 + reg = reg | (0x1F << 18) | 0x1F;
  956 + writel(reg, &ccm_regs->reg_core);
  957 +
  958 + if (wdog_reset_pin == 2)
  959 + wdog = (struct wdog_regs *) WDOG2_BASE_ADDR;
  960 + else if (wdog_reset_pin == 1)
  961 + wdog = (struct wdog_regs *) WDOG1_BASE_ADDR;
  962 + else
  963 + return arm_orig_podf;
  964 + set_wdog_reset(wdog);
960 965 return arm_orig_podf;
961 966 }
962 967  
arch/arm/include/asm/arch-mx6/sys_proto.h
... ... @@ -22,6 +22,7 @@
22 22  
23 23 const char *get_imx_type(u32 imxtype);
24 24 unsigned imx_ddr_size(void);
  25 +void set_wdog_reset(struct wdog_regs *wdog);
25 26  
26 27 #ifdef CONFIG_LDO_BYPASS_CHECK
27 28 int check_ldo_bypass(void);