public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2 1/4] imx: mx7dsabresd: move mmc_get_env_devno to soc code
@ 2015-12-17  4:43 Peng Fan
  2015-12-17  4:43 ` [U-Boot] [PATCH V2 2/4] common: env_mmc: support loading env from different cards Peng Fan
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Peng Fan @ 2015-12-17  4:43 UTC (permalink / raw)
  To: u-boot

Move mmc_get_env_devno to soc.c
Introduce a weak function board_mmc_get_env_devno. Different
boards can implement this according to sdhc controller which
is used by the board.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
---

Changes V2:
 new patch. mx7dsabresd implemented mmc_get_env_devno. So need to
 refactor it for patch 2/4

 arch/arm/cpu/armv7/mx7/soc.c              | 19 +++++++++++++++++++
 board/freescale/mx7dsabresd/mx7dsabresd.c | 18 ++++--------------
 2 files changed, 23 insertions(+), 14 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx7/soc.c b/arch/arm/cpu/armv7/mx7/soc.c
index c777922..d0891ea 100644
--- a/arch/arm/cpu/armv7/mx7/soc.c
+++ b/arch/arm/cpu/armv7/mx7/soc.c
@@ -268,6 +268,25 @@ enum boot_device get_boot_device(void)
 	return boot_dev;
 }
 
+__weak int board_mmc_get_env_devno(int devno)
+{
+	return CONFIG_SYS_MMC_ENV_DEV;
+}
+
+int mmc_get_env_devno(void)
+{
+	struct bootrom_sw_info **p =
+		(struct bootrom_sw_info **)ROM_SW_INFO_ADDR;
+	int devno = (*p)->boot_dev_instance;
+	u8 boot_type = (*p)->boot_dev_type;
+
+	/* If not boot from sd/mmc, use default value */
+	if ((boot_type != BOOT_TYPE_SD) && (boot_type != BOOT_TYPE_MMC))
+		return CONFIG_SYS_MMC_ENV_DEV;
+
+	return board_mmc_get_env_devno(devno);
+}
+
 void s_init(void)
 {
 #if !defined CONFIG_SPL_BUILD
diff --git a/board/freescale/mx7dsabresd/mx7dsabresd.c b/board/freescale/mx7dsabresd/mx7dsabresd.c
index f8ae973..12327c2 100644
--- a/board/freescale/mx7dsabresd/mx7dsabresd.c
+++ b/board/freescale/mx7dsabresd/mx7dsabresd.c
@@ -293,22 +293,12 @@ static struct fsl_esdhc_cfg usdhc_cfg[3] = {
 	{USDHC3_BASE_ADDR},
 };
 
-static int mmc_get_env_devno(void)
+int board_mmc_get_env_devno(int devno)
 {
-	struct bootrom_sw_info **p =
-		(struct bootrom_sw_info **)ROM_SW_INFO_ADDR;
+	if (devno == 2)
+		devno--;
 
-	u8 boot_type = (*p)->boot_dev_type;
-	u8 dev_no = (*p)->boot_dev_instance;
-
-	/* If not boot from sd/mmc, use default value */
-	if ((boot_type != BOOT_TYPE_SD) && (boot_type != BOOT_TYPE_MMC))
-		return CONFIG_SYS_MMC_ENV_DEV;
-
-	if (dev_no == 2)
-		dev_no--;
-
-	return dev_no;
+	return devno;
 }
 
 static int mmc_map_to_kernel_blk(int dev_no)
-- 
2.6.2

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-02-04  9:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-17  4:43 [U-Boot] [PATCH V2 1/4] imx: mx7dsabresd: move mmc_get_env_devno to soc code Peng Fan
2015-12-17  4:43 ` [U-Boot] [PATCH V2 2/4] common: env_mmc: support loading env from different cards Peng Fan
2016-02-02 19:46   ` Stefano Babic
2016-02-03  1:01     ` Peng Fan
2016-02-04  9:13       ` Stefano Babic
2015-12-17  4:43 ` [U-Boot] [PATCH V2 3/4] imx: mx6: implement mmc_get_env_devno Peng Fan
2015-12-17  4:43 ` [U-Boot] [PATCH V2 4/4] imx: mx6: implement board_mmc_get_env_devno Peng Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox