[U-Boot] [PATCH 10/13] arm: imx-common: init: rework wdog settings for imx6/imx7

Adrian Alonso aalonso at freescale.com
Tue Sep 1 18:22:28 CEST 2015


Rework imx_set_wdog_powerdown to be reused by imx6 and imx7

Signed-off-by: Adrian Alonso <aalonso at freescale.com>
---
Changes for V2:
Rework for common sys_proto header file

 arch/arm/cpu/armv7/mx6/soc.c                | 14 --------------
 arch/arm/imx-common/init.c                  | 21 +++++++++++++++++++++
 arch/arm/include/asm/imx-common/sys_proto.h |  1 +
 3 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 06f63da..282302b 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -250,20 +250,6 @@ static int set_ldo_voltage(enum ldo_reg ldo, u32 mv)
 	return 0;
 }
 
-static void imx_set_wdog_powerdown(bool enable)
-{
-	struct wdog_regs *wdog1 = (struct wdog_regs *)WDOG1_BASE_ADDR;
-	struct wdog_regs *wdog2 = (struct wdog_regs *)WDOG2_BASE_ADDR;
-	struct wdog_regs *wdog3 = (struct wdog_regs *)WDOG3_BASE_ADDR;
-
-	if (is_cpu_type(MXC_CPU_MX6SX) || is_cpu_type(MXC_CPU_MX6UL))
-		writew(enable, &wdog3->wmcr);
-
-	/* Write to the PDE (Power Down Enable) bit */
-	writew(enable, &wdog1->wmcr);
-	writew(enable, &wdog2->wmcr);
-}
-
 static void set_ahb_rate(u32 val)
 {
 	struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
diff --git a/arch/arm/imx-common/init.c b/arch/arm/imx-common/init.c
index f1d4314..56d5010 100644
--- a/arch/arm/imx-common/init.c
+++ b/arch/arm/imx-common/init.c
@@ -66,6 +66,27 @@ void init_aips(void)
 	}
 }
 
+void imx_set_wdog_powerdown(bool enable)
+{
+	struct wdog_regs *wdog1 = (struct wdog_regs *)WDOG1_BASE_ADDR;
+	struct wdog_regs *wdog2 = (struct wdog_regs *)WDOG2_BASE_ADDR;
+	struct wdog_regs *wdog3 = (struct wdog_regs *)WDOG3_BASE_ADDR;
+#ifdef CONFIG_MX7D
+	struct wdog_regs *wdog4 = (struct wdog_regs *)WDOG4_BASE_ADDR;
+#endif
+
+	/* Write to the PDE (Power Down Enable) bit */
+	writew(enable, &wdog1->wmcr);
+	writew(enable, &wdog2->wmcr);
+
+	if (is_cpu_type(MXC_CPU_MX6SX) || is_cpu_type(MXC_CPU_MX6UL) ||
+			is_soc_type(MXC_SOC_MX7))
+		writew(enable, &wdog3->wmcr);
+#ifdef CONFIG_MX7D
+	writew(enable, &wdog4->wmcr);
+#endif
+}
+
 #define SRC_SCR_WARM_RESET_ENABLE	0
 
 void init_src(void)
diff --git a/arch/arm/include/asm/imx-common/sys_proto.h b/arch/arm/include/asm/imx-common/sys_proto.h
index fda126b..1ffdec0 100644
--- a/arch/arm/include/asm/imx-common/sys_proto.h
+++ b/arch/arm/include/asm/imx-common/sys_proto.h
@@ -37,6 +37,7 @@ void set_chipselect_size(int const);
 
 void init_aips(void);
 void init_src(void);
+void imx_set_wdog_powerdown(bool enable);
 
 /*
  * Initializes on-chip ethernet controllers.
-- 
2.1.4



More information about the U-Boot mailing list