[U-Boot] [PATCH 16/16] engicam: common: Move board_late_init

Jagan Teki jagan at openedev.com
Sat May 6 21:13:15 UTC 2017


From: Jagan Teki <jagan at amarulasolutions.com>

Move board_late_init into common area from supported boards.

Cc: Stefano Babic <sbabic at denx.de>
Cc: Matteo Lisi <matteo.lisi at engicam.com>
Cc: Michael Trimarchi <michael at amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan at amarulasolutions.com>
---
 board/engicam/common/board.c            | 28 +++++++++++++++++++++++++++-
 board/engicam/common/board.h            |  2 +-
 board/engicam/geam6ul/geam6ul.c         | 21 +--------------------
 board/engicam/icorem6/icorem6.c         | 21 +--------------------
 board/engicam/icorem6_rqs/icorem6_rqs.c | 20 +-------------------
 board/engicam/isiotmx6ul/isiotmx6ul.c   | 23 +----------------------
 6 files changed, 32 insertions(+), 83 deletions(-)

diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c
index 8a83608..af4ef28 100644
--- a/board/engicam/common/board.c
+++ b/board/engicam/common/board.c
@@ -15,7 +15,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_ENV_IS_IN_MMC
-void mmc_late_init(void)
+static void mmc_late_init(void)
 {
 	char cmd[32];
 	char mmcblk[32];
@@ -32,6 +32,32 @@ void mmc_late_init(void)
 }
 #endif
 
+int board_late_init(void)
+{
+	switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
+			IMX6_BMODE_SHIFT) {
+	case IMX6_BMODE_SD:
+	case IMX6_BMODE_ESD:
+	case IMX6_BMODE_MMC:
+	case IMX6_BMODE_EMMC:
+#ifdef CONFIG_ENV_IS_IN_MMC
+		mmc_late_init();
+#endif
+		setenv("modeboot", "mmcboot");
+		break;
+	case IMX6_BMODE_NAND:
+		setenv("modeboot", "nandboot");
+		break;
+	default:
+		setenv("modeboot", "");
+		break;
+	}
+
+	setenv_fdt_file();
+
+	return 0;
+}
+
 int board_init(void)
 {
 	/* Address of boot parameters */
diff --git a/board/engicam/common/board.h b/board/engicam/common/board.h
index 9717e40..f364a23 100644
--- a/board/engicam/common/board.h
+++ b/board/engicam/common/board.h
@@ -6,7 +6,7 @@
 
 #ifndef _BOARD_H_
 #define _BOARD_H_
-void mmc_late_init(void);
+void setenv_fdt_file(void);
 void setup_gpmi_nand(void);
 void setup_display(void);
 #endif /* _BOARD_H_ */
diff --git a/board/engicam/geam6ul/geam6ul.c b/board/engicam/geam6ul/geam6ul.c
index c992035..841ade9 100644
--- a/board/engicam/geam6ul/geam6ul.c
+++ b/board/engicam/geam6ul/geam6ul.c
@@ -90,29 +90,10 @@ void setup_gpmi_nand(void)
 }
 #endif /* CONFIG_NAND_MXS */
 
-int board_late_init(void)
+void setenv_fdt_file(void)
 {
-	switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
-			IMX6_BMODE_SHIFT) {
-	case IMX6_BMODE_SD:
-	case IMX6_BMODE_ESD:
-#ifdef CONFIG_ENV_IS_IN_MMC
-		mmc_late_init();
-#endif
-		setenv("modeboot", "mmcboot");
-		break;
-	case IMX6_BMODE_NAND:
-		setenv("modeboot", "nandboot");
-		break;
-	default:
-		setenv("modeboot", "");
-		break;
-	}
-
 	if (is_mx6ul())
 		setenv("fdt_file", "imx6ul-geam-kit.dtb");
-
-	return 0;
 }
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/board/engicam/icorem6/icorem6.c b/board/engicam/icorem6/icorem6.c
index cb4613b..74cbbc5 100644
--- a/board/engicam/icorem6/icorem6.c
+++ b/board/engicam/icorem6/icorem6.c
@@ -192,31 +192,12 @@ void setup_display(void)
 }
 #endif /* CONFIG_VIDEO_IPUV3 */
 
-int board_late_init(void)
+void setenv_fdt_file(void)
 {
-	switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
-			IMX6_BMODE_SHIFT) {
-	case IMX6_BMODE_SD:
-	case IMX6_BMODE_ESD:
-#ifdef CONFIG_ENV_IS_IN_MMC
-		mmc_late_init();
-#endif
-		setenv("modeboot", "mmcboot");
-		break;
-	case IMX6_BMODE_NAND:
-		setenv("modeboot", "nandboot");
-		break;
-	default:
-		setenv("modeboot", "");
-		break;
-	}
-
 	if (is_mx6dq())
 		setenv("fdt_file", "imx6q-icore.dtb");
 	else if(is_mx6dl() || is_mx6solo())
 		setenv("fdt_file", "imx6dl-icore.dtb");
-
-	return 0;
 }
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/board/engicam/icorem6_rqs/icorem6_rqs.c b/board/engicam/icorem6_rqs/icorem6_rqs.c
index bdd9e0e..c3c3173 100644
--- a/board/engicam/icorem6_rqs/icorem6_rqs.c
+++ b/board/engicam/icorem6_rqs/icorem6_rqs.c
@@ -32,30 +32,12 @@ int board_mmc_get_env_dev(int devno)
 }
 #endif
 
-int board_late_init(void)
+void setenv_fdt_file(void)
 {
-	switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
-			IMX6_BMODE_SHIFT) {
-	case IMX6_BMODE_SD:
-	case IMX6_BMODE_ESD:
-	case IMX6_BMODE_MMC:
-	case IMX6_BMODE_EMMC:
-#ifdef CONFIG_ENV_IS_IN_MMC
-		mmc_late_init();
-#endif
-		setenv("modeboot", "mmcboot");
-		break;
-	default:
-		setenv("modeboot", "");
-		break;
-	}
-
 	if (is_mx6dq())
 		setenv("fdt_file", "imx6q-icore-rqs.dtb");
 	else if(is_mx6dl() || is_mx6solo())
 		setenv("fdt_file", "imx6dl-icore-rqs.dtb");
-
-	return 0;
 }
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/board/engicam/isiotmx6ul/isiotmx6ul.c b/board/engicam/isiotmx6ul/isiotmx6ul.c
index 6607b04..105db73 100644
--- a/board/engicam/isiotmx6ul/isiotmx6ul.c
+++ b/board/engicam/isiotmx6ul/isiotmx6ul.c
@@ -98,27 +98,8 @@ int board_mmc_get_env_dev(int devno)
 }
 #endif
 
-int board_late_init(void)
+void setenv_fdt_file(void)
 {
-	switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
-			IMX6_BMODE_SHIFT) {
-	case IMX6_BMODE_SD:
-	case IMX6_BMODE_ESD:
-	case IMX6_BMODE_MMC:
-	case IMX6_BMODE_EMMC:
-#ifdef CONFIG_ENV_IS_IN_MMC
-		mmc_late_init();
-#endif
-		setenv("modeboot", "mmcboot");
-		break;
-	case IMX6_BMODE_NAND:
-		setenv("modeboot", "nandboot");
-		break;
-	default:
-		setenv("modeboot", "");
-		break;
-	}
-
 	if (is_mx6ul()) {
 #ifdef CONFIG_ENV_IS_IN_MMC
 		setenv("fdt_file", "imx6ul-isiot-emmc.dtb");
@@ -126,8 +107,6 @@ int board_late_init(void)
 		setenv("fdt_file", "imx6ul-isiot-nand.dtb");
 #endif
 	}
-
-	return 0;
 }
 
 #ifdef CONFIG_SPL_BUILD
-- 
1.9.1



More information about the U-Boot mailing list