All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
@ 2018-02-03  7:29 Lukasz Majewski
  2018-02-03 13:00 ` Fabio Estevam
  2018-02-08 12:27 ` [U-Boot] [U-Boot, " Tom Rini
  0 siblings, 2 replies; 12+ messages in thread
From: Lukasz Majewski @ 2018-02-03  7:29 UTC (permalink / raw)
  To: u-boot

The goal of this patch is to clean up the code related to choosing SPL
MMC boot mode.

The spl_boot_mode() now is called only in spl_mmc_load_image() function,
which is only compiled in if CONFIG_SPL_MMC_SUPPORT is enabled.

To achieve the goal, all per mach/arch implementations eligible for
unification has been replaced with one __weak implementation.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
Reviewed-by: Marek Vasut <marex@denx.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
Acked-by: Michal Simek <michal.simek@xilinx.com> (For ZynqMP)

---

Changes in v2:
- Update the code to be applied on top of newest master:
  SHA1: b2153075f42c2d46d310778e226bcb11f0af47f5

Travis-Ci:
https://travis-ci.org/lmajewski/u-boot-dfu/builds/336770052

 arch/arm/cpu/arm1136/mx35/generic.c       | 21 ---------------------
 arch/arm/cpu/armv7/ls102xa/spl.c          | 17 -----------------
 arch/arm/cpu/armv8/fsl-layerscape/spl.c   | 17 -----------------
 arch/arm/cpu/armv8/zynqmp/spl.c           | 14 --------------
 arch/arm/mach-at91/spl.c                  | 15 ---------------
 arch/arm/mach-davinci/spl.c               |  5 -----
 arch/arm/mach-imx/spl.c                   | 23 -----------------------
 arch/arm/mach-mvebu/spl.c                 |  7 -------
 arch/arm/mach-rockchip/rk3188-board-spl.c |  5 -----
 arch/arm/mach-rockchip/rk3288-board-spl.c |  5 -----
 arch/arm/mach-rockchip/rk3368-board-spl.c |  5 -----
 arch/arm/mach-rockchip/rk3399-board-spl.c |  5 -----
 arch/arm/mach-socfpga/spl.c               | 11 -----------
 arch/arm/mach-sunxi/board.c               |  6 ------
 arch/arm/mach-zynq/spl.c                  |  7 -------
 common/spl/spl_mmc.c                      | 11 +++++++++++
 16 files changed, 11 insertions(+), 163 deletions(-)

diff --git a/arch/arm/cpu/arm1136/mx35/generic.c b/arch/arm/cpu/arm1136/mx35/generic.c
index 5297d62d00..4dcfc72656 100644
--- a/arch/arm/cpu/arm1136/mx35/generic.c
+++ b/arch/arm/cpu/arm1136/mx35/generic.c
@@ -524,24 +524,3 @@ u32 spl_boot_device(void)
 
 	return BOOT_DEVICE_NONE;
 }
-
-#ifdef CONFIG_SPL_BUILD
-u32 spl_boot_mode(const u32 boot_device)
-{
-	switch (spl_boot_device()) {
-	case BOOT_DEVICE_MMC1:
-#ifdef CONFIG_SPL_FAT_SUPPORT
-		return MMCSD_MODE_FS;
-#else
-		return MMCSD_MODE_RAW;
-#endif
-		break;
-	case BOOT_DEVICE_NAND:
-		return 0;
-		break;
-	default:
-		puts("spl: ERROR:  unsupported device\n");
-		hang();
-	}
-}
-#endif
diff --git a/arch/arm/cpu/armv7/ls102xa/spl.c b/arch/arm/cpu/armv7/ls102xa/spl.c
index 1246eed2ca..1e4a1641cb 100644
--- a/arch/arm/cpu/armv7/ls102xa/spl.c
+++ b/arch/arm/cpu/armv7/ls102xa/spl.c
@@ -14,20 +14,3 @@ u32 spl_boot_device(void)
 #endif
 	return BOOT_DEVICE_NAND;
 }
-
-u32 spl_boot_mode(const u32 boot_device)
-{
-	switch (spl_boot_device()) {
-	case BOOT_DEVICE_MMC1:
-#ifdef CONFIG_SPL_FAT_SUPPORT
-		return MMCSD_MODE_FS;
-#else
-		return MMCSD_MODE_RAW;
-#endif
-	case BOOT_DEVICE_NAND:
-		return 0;
-	default:
-		puts("spl: error: unsupported device\n");
-		hang();
-	}
-}
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/spl.c b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
index 4093d15e56..3a74040b97 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/spl.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
@@ -26,23 +26,6 @@ u32 spl_boot_device(void)
 	return 0;
 }
 
-u32 spl_boot_mode(const u32 boot_device)
-{
-	switch (spl_boot_device()) {
-	case BOOT_DEVICE_MMC1:
-#ifdef CONFIG_SPL_FAT_SUPPORT
-		return MMCSD_MODE_FS;
-#else
-		return MMCSD_MODE_RAW;
-#endif
-	case BOOT_DEVICE_NAND:
-		return 0;
-	default:
-		puts("spl: error: unsupported device\n");
-		hang();
-	}
-}
-
 #ifdef CONFIG_SPL_BUILD
 
 void spl_board_init(void)
diff --git a/arch/arm/cpu/armv8/zynqmp/spl.c b/arch/arm/cpu/armv8/zynqmp/spl.c
index bc7313a88b..0bfa5c1c4d 100644
--- a/arch/arm/cpu/armv8/zynqmp/spl.c
+++ b/arch/arm/cpu/armv8/zynqmp/spl.c
@@ -115,20 +115,6 @@ u32 spl_boot_device(void)
 	return 0;
 }
 
-u32 spl_boot_mode(const u32 boot_device)
-{
-	switch (boot_device) {
-	case BOOT_DEVICE_RAM:
-		return 0;
-	case BOOT_DEVICE_MMC1:
-	case BOOT_DEVICE_MMC2:
-		return MMCSD_MODE_FS;
-	default:
-		puts("spl: error: unsupported device\n");
-		hang();
-	}
-}
-
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
diff --git a/arch/arm/mach-at91/spl.c b/arch/arm/mach-at91/spl.c
index 7e7e24bbe6..91add921c6 100644
--- a/arch/arm/mach-at91/spl.c
+++ b/arch/arm/mach-at91/spl.c
@@ -87,18 +87,3 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_NONE;
 }
 #endif
-
-u32 spl_boot_mode(const u32 boot_device)
-{
-	switch (boot_device) {
-#if defined(CONFIG_SYS_USE_MMC) || defined(CONFIG_SD_BOOT)
-	case BOOT_DEVICE_MMC1:
-	case BOOT_DEVICE_MMC2:
-		return MMCSD_MODE_FS;
-		break;
-#endif
-	case BOOT_DEVICE_NONE:
-	default:
-		hang();
-	}
-}
diff --git a/arch/arm/mach-davinci/spl.c b/arch/arm/mach-davinci/spl.c
index 564c2008e0..4c74db9ed0 100644
--- a/arch/arm/mach-davinci/spl.c
+++ b/arch/arm/mach-davinci/spl.c
@@ -45,11 +45,6 @@ void spl_board_init(void)
 	preloader_console_init();
 }
 
-u32 spl_boot_mode(const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-
 u32 spl_boot_device(void)
 {
 	switch (davinci_syscfg_regs->bootcfg) {
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index 6c16872f59..08a7e0071f 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -130,29 +130,6 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 }
 #endif
 
-#if defined(CONFIG_SPL_MMC_SUPPORT)
-/* called from spl_mmc to see type of boot mode for storage (RAW or FAT) */
-u32 spl_boot_mode(const u32 boot_device)
-{
-	switch (spl_boot_device()) {
-	/* for MMC return either RAW or FAT mode */
-	case BOOT_DEVICE_MMC1:
-	case BOOT_DEVICE_MMC2:
-#if defined(CONFIG_SPL_FAT_SUPPORT)
-		return MMCSD_MODE_FS;
-#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
-		return MMCSD_MODE_EMMCBOOT;
-#else
-		return MMCSD_MODE_RAW;
-#endif
-		break;
-	default:
-		puts("spl: ERROR:  unsupported device\n");
-		hang();
-	}
-}
-#endif
-
 #if defined(CONFIG_SECURE_BOOT)
 
 /*
diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index d16a62d2dd..a5086f16fb 100644
--- a/arch/arm/mach-mvebu/spl.c
+++ b/arch/arm/mach-mvebu/spl.c
@@ -70,13 +70,6 @@ u32 spl_boot_device(void)
 	return get_boot_device();
 }
 
-#ifdef CONFIG_SPL_MMC_SUPPORT
-u32 spl_boot_mode(const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-#endif
-
 void board_init_f(ulong dummy)
 {
 	int ret;
diff --git a/arch/arm/mach-rockchip/rk3188-board-spl.c b/arch/arm/mach-rockchip/rk3188-board-spl.c
index 8e3b8ae3ba..74771d3a0b 100644
--- a/arch/arm/mach-rockchip/rk3188-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3188-board-spl.c
@@ -72,11 +72,6 @@ fallback:
 	return BOOT_DEVICE_MMC1;
 }
 
-u32 spl_boot_mode(const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-
 static int setup_arm_clock(void)
 {
 	struct udevice *dev;
diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-rockchip/rk3288-board-spl.c
index f64a54843f..f3ea624277 100644
--- a/arch/arm/mach-rockchip/rk3288-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
@@ -78,11 +78,6 @@ fallback:
 	return BOOT_DEVICE_MMC1;
 }
 
-u32 spl_boot_mode(const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-
 #ifdef CONFIG_SPL_MMC_SUPPORT
 static int configure_emmc(struct udevice *pinctrl)
 {
diff --git a/arch/arm/mach-rockchip/rk3368-board-spl.c b/arch/arm/mach-rockchip/rk3368-board-spl.c
index 72d2c97d36..8055ae538f 100644
--- a/arch/arm/mach-rockchip/rk3368-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3368-board-spl.c
@@ -57,11 +57,6 @@ void board_init_f(ulong dummy)
 	}
 }
 
-u32 spl_boot_mode(const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-
 u32 spl_boot_device(void)
 {
 	return BOOT_DEVICE_MMC1;
diff --git a/arch/arm/mach-rockchip/rk3399-board-spl.c b/arch/arm/mach-rockchip/rk3399-board-spl.c
index b96903e70f..d35990efd6 100644
--- a/arch/arm/mach-rockchip/rk3399-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3399-board-spl.c
@@ -60,11 +60,6 @@ u32 spl_boot_device(void)
 	return boot_device;
 }
 
-u32 spl_boot_mode(const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-
 #define TIMER_CHN10_BASE	0xff8680a0
 #define TIMER_END_COUNT_L	0x00
 #define TIMER_END_COUNT_H	0x04
diff --git a/arch/arm/mach-socfpga/spl.c b/arch/arm/mach-socfpga/spl.c
index 71bae827a1..9bf3b9a446 100644
--- a/arch/arm/mach-socfpga/spl.c
+++ b/arch/arm/mach-socfpga/spl.c
@@ -66,17 +66,6 @@ u32 spl_boot_device(void)
 	}
 }
 
-#ifdef CONFIG_SPL_MMC_SUPPORT
-u32 spl_boot_mode(const u32 boot_device)
-{
-#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
-	return MMCSD_MODE_FS;
-#else
-	return MMCSD_MODE_RAW;
-#endif
-}
-#endif
-
 #if defined(CONFIG_TARGET_SOCFPGA_GEN5)
 static void socfpga_nic301_slave_ns(void)
 {
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 0c60ee04da..1753faec1d 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -260,12 +260,6 @@ u32 spl_boot_device(void)
 	return sunxi_get_boot_device();
 }
 
-/* No confirmation data available in SPL yet. Hardcode bootmode */
-u32 spl_boot_mode(const u32 boot_device)
-{
-	return MMCSD_MODE_RAW;
-}
-
 void board_init_f(ulong dummy)
 {
 	spl_init();
diff --git a/arch/arm/mach-zynq/spl.c b/arch/arm/mach-zynq/spl.c
index b7e6d98f08..0a303f41eb 100644
--- a/arch/arm/mach-zynq/spl.c
+++ b/arch/arm/mach-zynq/spl.c
@@ -69,13 +69,6 @@ u32 spl_boot_device(void)
 	return mode;
 }
 
-#ifdef CONFIG_SPL_MMC_SUPPORT
-u32 spl_boot_mode(const u32 boot_device)
-{
-	return MMCSD_MODE_FS;
-}
-#endif
-
 #ifdef CONFIG_SPL_OS_BOOT
 int spl_start_uboot(void)
 {
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index b57e0b04e4..351f4edd41 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -281,6 +281,17 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
 }
 #endif
 
+u32 __weak spl_boot_mode(const u32 boot_device)
+{
+#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
+	return MMCSD_MODE_FS;
+#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
+	return MMCSD_MODE_EMMCBOOT;
+#else
+	return MMCSD_MODE_RAW;
+#endif
+}
+
 int spl_mmc_load_image(struct spl_image_info *spl_image,
 		       struct spl_boot_device *bootdev)
 {
-- 
2.11.0

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

* [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
  2018-02-03  7:29 [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function Lukasz Majewski
@ 2018-02-03 13:00 ` Fabio Estevam
  2018-02-09 23:53   ` Jonathan Gray
  2018-02-08 12:27 ` [U-Boot] [U-Boot, " Tom Rini
  1 sibling, 1 reply; 12+ messages in thread
From: Fabio Estevam @ 2018-02-03 13:00 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 3, 2018 at 5:29 AM, Lukasz Majewski <lukma@denx.de> wrote:
> The goal of this patch is to clean up the code related to choosing SPL
> MMC boot mode.
>
> The spl_boot_mode() now is called only in spl_mmc_load_image() function,
> which is only compiled in if CONFIG_SPL_MMC_SUPPORT is enabled.
>
> To achieve the goal, all per mach/arch implementations eligible for
> unification has been replaced with one __weak implementation.
>
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> Reviewed-by: Marek Vasut <marex@denx.de>
> Reviewed-by: Stefano Babic <sbabic@denx.de>
> Acked-by: Michal Simek <michal.simek@xilinx.com> (For ZynqMP)

Nice cleanup:

Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

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

* [U-Boot] [U-Boot, v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
  2018-02-03  7:29 [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function Lukasz Majewski
  2018-02-03 13:00 ` Fabio Estevam
@ 2018-02-08 12:27 ` Tom Rini
  1 sibling, 0 replies; 12+ messages in thread
From: Tom Rini @ 2018-02-08 12:27 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 03, 2018 at 08:29:52AM +0100, Lukasz Majewski wrote:

> The goal of this patch is to clean up the code related to choosing SPL
> MMC boot mode.
> 
> The spl_boot_mode() now is called only in spl_mmc_load_image() function,
> which is only compiled in if CONFIG_SPL_MMC_SUPPORT is enabled.
> 
> To achieve the goal, all per mach/arch implementations eligible for
> unification has been replaced with one __weak implementation.
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> Reviewed-by: Marek Vasut <marex@denx.de>
> Reviewed-by: Stefano Babic <sbabic@denx.de>
> Acked-by: Michal Simek <michal.simek@xilinx.com> (For ZynqMP)
> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180208/20f235e3/attachment.sig>

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

* [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
  2018-02-03 13:00 ` Fabio Estevam
@ 2018-02-09 23:53   ` Jonathan Gray
  2018-02-10  0:45     ` Lukasz Majewski
  0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Gray @ 2018-02-09 23:53 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 03, 2018 at 11:00:35AM -0200, Fabio Estevam wrote:
> On Sat, Feb 3, 2018 at 5:29 AM, Lukasz Majewski <lukma@denx.de> wrote:
> > The goal of this patch is to clean up the code related to choosing SPL
> > MMC boot mode.
> >
> > The spl_boot_mode() now is called only in spl_mmc_load_image() function,
> > which is only compiled in if CONFIG_SPL_MMC_SUPPORT is enabled.
> >
> > To achieve the goal, all per mach/arch implementations eligible for
> > unification has been replaced with one __weak implementation.
> >
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > Reviewed-by: Marek Vasut <marex@denx.de>
> > Reviewed-by: Stefano Babic <sbabic@denx.de>
> > Acked-by: Michal Simek <michal.simek@xilinx.com> (For ZynqMP)
> 
> Nice cleanup:
> 
> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>

This has broken booting via mmc with mx6cuboxi for me.

SPL loops on

U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33 +1300)
Trying to boot from MMC1
Failed to mount ext2 filesystem...
spl_load_image_ext: ext4fs mount err - 0

There is no ext2/ext3/ext4 fs, next U-Boot stage is raw, ie

dd if=mx6cuboxi/SPL of=/dev/sd2c bs=1024 seek=1
dd if=mx6cuboxi/u-boot.img of=/dev/sd2c bs=1024 seek=69

=> part list mmc 0

Partition Map for MMC device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     2048            32768           00000000-01     0c Boot
  4     34816           15642624        00000000-04     a6

With this commit reverted:

U-Boot SPL 2018.03-rc1-00214-ge3f2485203 (Feb 10 2018 - 12:38:46 +1300)
Trying to boot from MMC1


U-Boot 2018.03-rc1-00214-ge3f2485203 (Feb 10 2018 - 12:38:46 +1300)

CPU:   Freescale i.MX6Q rev1.5 996 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 27C
Reset cause: POR
Board: MX6 Cubox-i
DRAM:  2 GiB
MMC:   FSL_SDHC: 0
Loading Environment from MMC... OK
No panel detected: default to HDMI
Display: HDMI (1024x768)
In:    serial
Out:   serial
Err:   serial
Net:   FEC
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
37503 bytes read in 18 ms (2 MiB/s)
Found EFI removable media binary efi/boot/bootarm.efi
Scanning disks on usb...
Disk usb0 not ready
Disk usb1 not ready
Disk usb2 not ready
Disk usb3 not ready
Scanning disks on mmc...
MMC Device 1 not found
MMC Device 2 not found
MMC Device 3 not found
Scanning disks on sata...
Disk sata0 not ready
Found 3 disks
76528 bytes read in 30 ms (2.4 MiB/s)
## Starting EFI application at 12000000 ...
>> OpenBSD/armv7 BOOTARM 1.0
boot> 
booting sd0a:/bsd: 4531856+203028+560156 [277405+90+281904+244582]=0x5d6b88

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

* [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
  2018-02-09 23:53   ` Jonathan Gray
@ 2018-02-10  0:45     ` Lukasz Majewski
  2018-02-10  3:21       ` Jonathan Gray
  0 siblings, 1 reply; 12+ messages in thread
From: Lukasz Majewski @ 2018-02-10  0:45 UTC (permalink / raw)
  To: u-boot

Hi Jonathan,

> On Sat, Feb 03, 2018 at 11:00:35AM -0200, Fabio Estevam wrote:
> > On Sat, Feb 3, 2018 at 5:29 AM, Lukasz Majewski <lukma@denx.de>
> > wrote:  
> > > The goal of this patch is to clean up the code related to
> > > choosing SPL MMC boot mode.
> > >
> > > The spl_boot_mode() now is called only in spl_mmc_load_image()
> > > function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT is
> > > enabled.
> > >
> > > To achieve the goal, all per mach/arch implementations eligible
> > > for unification has been replaced with one __weak implementation.
> > >
> > > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > > Reviewed-by: Marek Vasut <marex@denx.de>
> > > Reviewed-by: Stefano Babic <sbabic@denx.de>
> > > Acked-by: Michal Simek <michal.simek@xilinx.com> (For ZynqMP)  
> > 
> > Nice cleanup:
> > 
> > Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>  
> 
> This has broken booting via mmc with mx6cuboxi for me.
> 
> SPL loops on
> 
> U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33
> +1300) Trying to boot from MMC1
> Failed to mount ext2 filesystem...
> spl_load_image_ext: ext4fs mount err - 0

Could you check what is the status of following defines in your .config
file:

CONFIG_SPL_FAT_SUPPORT
CONFIG_SUPPORT_EMMC_BOOT

And if by any chance your don't have:
CONFIG_SPL_EXT_SUPPORT defined?

From what you have written above I assume that you boot from the
same medium - i.e. eMMC (so SPL and u-boot.img are on the same medium) ?


Best regards,
Łukasz Majewski

> 
> There is no ext2/ext3/ext4 fs, next U-Boot stage is raw, ie
> 
> dd if=mx6cuboxi/SPL of=/dev/sd2c bs=1024 seek=1
> dd if=mx6cuboxi/u-boot.img of=/dev/sd2c bs=1024 seek=69
> 
> => part list mmc 0  
> 
> Partition Map for MMC device 0  --   Partition Type: DOS
> 
> Part    Start Sector    Num Sectors     UUID            Type
>   1     2048            32768           00000000-01     0c Boot
>   4     34816           15642624        00000000-04     a6
> 
> With this commit reverted:
> 
> U-Boot SPL 2018.03-rc1-00214-ge3f2485203 (Feb 10 2018 - 12:38:46
> +1300) Trying to boot from MMC1
> 
> 
> U-Boot 2018.03-rc1-00214-ge3f2485203 (Feb 10 2018 - 12:38:46 +1300)
> 
> CPU:   Freescale i.MX6Q rev1.5 996 MHz (running at 792 MHz)
> CPU:   Extended Commercial temperature grade (-20C to 105C) at 27C
> Reset cause: POR
> Board: MX6 Cubox-i
> DRAM:  2 GiB
> MMC:   FSL_SDHC: 0
> Loading Environment from MMC... OK
> No panel detected: default to HDMI
> Display: HDMI (1024x768)
> In:    serial
> Out:   serial
> Err:   serial
> Net:   FEC
> Hit any key to stop autoboot:  0
> switch to partitions #0, OK
> mmc0 is current device
> Scanning mmc 0:1...
> 37503 bytes read in 18 ms (2 MiB/s)
> Found EFI removable media binary efi/boot/bootarm.efi
> Scanning disks on usb...
> Disk usb0 not ready
> Disk usb1 not ready
> Disk usb2 not ready
> Disk usb3 not ready
> Scanning disks on mmc...
> MMC Device 1 not found
> MMC Device 2 not found
> MMC Device 3 not found
> Scanning disks on sata...
> Disk sata0 not ready
> Found 3 disks
> 76528 bytes read in 30 ms (2.4 MiB/s)
> ## Starting EFI application at 12000000 ...
> >> OpenBSD/armv7 BOOTARM 1.0  
> boot>   
> booting sd0a:/bsd: 4531856+203028+560156
> [277405+90+281904+244582]=0x5d6b88




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180210/91a6a8a2/attachment.sig>

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

* [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
  2018-02-10  0:45     ` Lukasz Majewski
@ 2018-02-10  3:21       ` Jonathan Gray
  2018-02-10  9:57         ` Lukasz Majewski
  0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Gray @ 2018-02-10  3:21 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 10, 2018 at 01:45:16AM +0100, Lukasz Majewski wrote:
> Hi Jonathan,
> 
> > On Sat, Feb 03, 2018 at 11:00:35AM -0200, Fabio Estevam wrote:
> > > On Sat, Feb 3, 2018 at 5:29 AM, Lukasz Majewski <lukma@denx.de>
> > > wrote:  
> > > > The goal of this patch is to clean up the code related to
> > > > choosing SPL MMC boot mode.
> > > >
> > > > The spl_boot_mode() now is called only in spl_mmc_load_image()
> > > > function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT is
> > > > enabled.
> > > >
> > > > To achieve the goal, all per mach/arch implementations eligible
> > > > for unification has been replaced with one __weak implementation.
> > > >
> > > > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > > > Reviewed-by: Marek Vasut <marex@denx.de>
> > > > Reviewed-by: Stefano Babic <sbabic@denx.de>
> > > > Acked-by: Michal Simek <michal.simek@xilinx.com> (For ZynqMP)  
> > > 
> > > Nice cleanup:
> > > 
> > > Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>  
> > 
> > This has broken booting via mmc with mx6cuboxi for me.
> > 
> > SPL loops on
> > 
> > U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33
> > +1300) Trying to boot from MMC1
> > Failed to mount ext2 filesystem...
> > spl_load_image_ext: ext4fs mount err - 0
> 
> Could you check what is the status of following defines in your .config
> file:
> 
> CONFIG_SPL_FAT_SUPPORT
> CONFIG_SUPPORT_EMMC_BOOT

"# CONFIG_SPL_FAT_SUPPORT is not set"

CONFIG_SUPPORT_EMMC_BOOT is not in the .config at all

CONFIG_SPL_EXT_SUPPORT previously for imx6 would result in
MMCSD_MODE_RAW but now it results in MMCSD_MODE_FS.

> 
> And if by any chance your don't have:
> CONFIG_SPL_EXT_SUPPORT defined?

CONFIG_SPL_EXT_SUPPORT=y
CONFIG_SPL_MMC_SUPPORT=y

mx6cuboxi_defconfig with no changes

> 
> From what you have written above I assume that you boot from the
> same medium - i.e. eMMC (so SPL and u-boot.img are on the same medium) ?

Both SPL and u-boot.img are on a microsd card.

The set CONFIG_SPL_* in .config are

CONFIG_SPL_SYS_THUMB_BUILD=y
CONFIG_SPL_USE_ARCH_MEMCPY=y
CONFIG_SPL_USE_ARCH_MEMSET=y
CONFIG_SPL_LDSCRIPT="arch/arm/mach-omap2/u-boot-spl.lds"
CONFIG_SPL_GPIO_SUPPORT=y
CONFIG_SPL_LIBCOMMON_SUPPORT=y
CONFIG_SPL_LIBGENERIC_SUPPORT=y
CONFIG_SPL_MMC_SUPPORT=y
CONFIG_SPL_SERIAL_SUPPORT=y
CONFIG_SPL_LIBDISK_SUPPORT=y
CONFIG_SPL_WATCHDOG_SUPPORT=y
CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
CONFIG_SPL_BOOTSTAGE_RECORD_COUNT=5
CONFIG_SPL_LOGLEVEL=4
CONFIG_SPL=y
CONFIG_SPL_LEGACY_IMAGE_SUPPORT=y
CONFIG_SPL_EXT_SUPPORT=y
CONFIG_SPL_I2C_SUPPORT=y
CONFIG_SPL_DOS_PARTITION=y
CONFIG_SPL_ISO_PARTITION=y
CONFIG_SPL_EFI_PARTITION=y

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

* [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
  2018-02-10  3:21       ` Jonathan Gray
@ 2018-02-10  9:57         ` Lukasz Majewski
  2018-02-10 10:00           ` Marek Vasut
  2018-02-10 10:39           ` Jonathan Gray
  0 siblings, 2 replies; 12+ messages in thread
From: Lukasz Majewski @ 2018-02-10  9:57 UTC (permalink / raw)
  To: u-boot

Hi Jonathan,

> On Sat, Feb 10, 2018 at 01:45:16AM +0100, Lukasz Majewski wrote:
> > Hi Jonathan,
> >   
> > > On Sat, Feb 03, 2018 at 11:00:35AM -0200, Fabio Estevam wrote:  
> > > > On Sat, Feb 3, 2018 at 5:29 AM, Lukasz Majewski <lukma@denx.de>
> > > > wrote:    
> > > > > The goal of this patch is to clean up the code related to
> > > > > choosing SPL MMC boot mode.
> > > > >
> > > > > The spl_boot_mode() now is called only in spl_mmc_load_image()
> > > > > function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT
> > > > > is enabled.
> > > > >
> > > > > To achieve the goal, all per mach/arch implementations
> > > > > eligible for unification has been replaced with one __weak
> > > > > implementation.
> > > > >
> > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > > > > Reviewed-by: Marek Vasut <marex@denx.de>
> > > > > Reviewed-by: Stefano Babic <sbabic@denx.de>
> > > > > Acked-by: Michal Simek <michal.simek@xilinx.com> (For
> > > > > ZynqMP)    
> > > > 
> > > > Nice cleanup:
> > > > 
> > > > Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>    
> > > 
> > > This has broken booting via mmc with mx6cuboxi for me.
> > > 
> > > SPL loops on
> > > 
> > > U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33
> > > +1300) Trying to boot from MMC1
> > > Failed to mount ext2 filesystem...
> > > spl_load_image_ext: ext4fs mount err - 0  
> > 
> > Could you check what is the status of following defines in
> > your .config file:
> > 
> > CONFIG_SPL_FAT_SUPPORT
> > CONFIG_SUPPORT_EMMC_BOOT  
> 
> "# CONFIG_SPL_FAT_SUPPORT is not set"
> 
> CONFIG_SUPPORT_EMMC_BOOT is not in the .config at all
> 
> CONFIG_SPL_EXT_SUPPORT previously for imx6 would result in
> MMCSD_MODE_RAW but now it results in MMCSD_MODE_FS.
> 
> > 
> > And if by any chance your don't have:
> > CONFIG_SPL_EXT_SUPPORT defined?  
> 
> CONFIG_SPL_EXT_SUPPORT=y

Could you for test comment out the above define?

Thanks in advance,
Łukasz

> CONFIG_SPL_MMC_SUPPORT=y
> 
> mx6cuboxi_defconfig with no changes
> 
> > 
> > From what you have written above I assume that you boot from the
> > same medium - i.e. eMMC (so SPL and u-boot.img are on the same
> > medium) ?  
> 
> Both SPL and u-boot.img are on a microsd card.
> 
> The set CONFIG_SPL_* in .config are
> 
> CONFIG_SPL_SYS_THUMB_BUILD=y
> CONFIG_SPL_USE_ARCH_MEMCPY=y
> CONFIG_SPL_USE_ARCH_MEMSET=y
> CONFIG_SPL_LDSCRIPT="arch/arm/mach-omap2/u-boot-spl.lds"
> CONFIG_SPL_GPIO_SUPPORT=y
> CONFIG_SPL_LIBCOMMON_SUPPORT=y
> CONFIG_SPL_LIBGENERIC_SUPPORT=y
> CONFIG_SPL_MMC_SUPPORT=y
> CONFIG_SPL_SERIAL_SUPPORT=y
> CONFIG_SPL_LIBDISK_SUPPORT=y
> CONFIG_SPL_WATCHDOG_SUPPORT=y
> CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
> CONFIG_SPL_BOOTSTAGE_RECORD_COUNT=5
> CONFIG_SPL_LOGLEVEL=4
> CONFIG_SPL=y
> CONFIG_SPL_LEGACY_IMAGE_SUPPORT=y
> CONFIG_SPL_EXT_SUPPORT=y
> CONFIG_SPL_I2C_SUPPORT=y
> CONFIG_SPL_DOS_PARTITION=y
> CONFIG_SPL_ISO_PARTITION=y
> CONFIG_SPL_EFI_PARTITION=y




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180210/a4b2995b/attachment.sig>

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

* [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
  2018-02-10  9:57         ` Lukasz Majewski
@ 2018-02-10 10:00           ` Marek Vasut
  2018-02-10 10:25             ` Lukasz Majewski
  2018-02-10 10:39           ` Jonathan Gray
  1 sibling, 1 reply; 12+ messages in thread
From: Marek Vasut @ 2018-02-10 10:00 UTC (permalink / raw)
  To: u-boot

On 02/10/2018 10:57 AM, Lukasz Majewski wrote:
> Hi Jonathan,
> 
>> On Sat, Feb 10, 2018 at 01:45:16AM +0100, Lukasz Majewski wrote:
>>> Hi Jonathan,
>>>   
>>>> On Sat, Feb 03, 2018 at 11:00:35AM -0200, Fabio Estevam wrote:  
>>>>> On Sat, Feb 3, 2018 at 5:29 AM, Lukasz Majewski <lukma@denx.de>
>>>>> wrote:    
>>>>>> The goal of this patch is to clean up the code related to
>>>>>> choosing SPL MMC boot mode.
>>>>>>
>>>>>> The spl_boot_mode() now is called only in spl_mmc_load_image()
>>>>>> function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT
>>>>>> is enabled.
>>>>>>
>>>>>> To achieve the goal, all per mach/arch implementations
>>>>>> eligible for unification has been replaced with one __weak
>>>>>> implementation.
>>>>>>
>>>>>> Signed-off-by: Lukasz Majewski <lukma@denx.de>
>>>>>> Reviewed-by: Marek Vasut <marex@denx.de>
>>>>>> Reviewed-by: Stefano Babic <sbabic@denx.de>
>>>>>> Acked-by: Michal Simek <michal.simek@xilinx.com> (For
>>>>>> ZynqMP)    
>>>>>
>>>>> Nice cleanup:
>>>>>
>>>>> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>    
>>>>
>>>> This has broken booting via mmc with mx6cuboxi for me.
>>>>
>>>> SPL loops on
>>>>
>>>> U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33
>>>> +1300) Trying to boot from MMC1
>>>> Failed to mount ext2 filesystem...
>>>> spl_load_image_ext: ext4fs mount err - 0  
>>>
>>> Could you check what is the status of following defines in
>>> your .config file:
>>>
>>> CONFIG_SPL_FAT_SUPPORT
>>> CONFIG_SUPPORT_EMMC_BOOT  
>>
>> "# CONFIG_SPL_FAT_SUPPORT is not set"
>>
>> CONFIG_SUPPORT_EMMC_BOOT is not in the .config at all
>>
>> CONFIG_SPL_EXT_SUPPORT previously for imx6 would result in
>> MMCSD_MODE_RAW but now it results in MMCSD_MODE_FS.
>>
>>>
>>> And if by any chance your don't have:
>>> CONFIG_SPL_EXT_SUPPORT defined?  
>>
>> CONFIG_SPL_EXT_SUPPORT=y
> 
> Could you for test comment out the above define?

If you look at the logic in spl_mmc.c , you'll see this will work. But
what about users who have EXT enabled and want to use it as fallback
after loading from RAW failed ? :)

-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
  2018-02-10 10:00           ` Marek Vasut
@ 2018-02-10 10:25             ` Lukasz Majewski
  2018-02-10 10:34               ` Marek Vasut
  0 siblings, 1 reply; 12+ messages in thread
From: Lukasz Majewski @ 2018-02-10 10:25 UTC (permalink / raw)
  To: u-boot

On Sat, 10 Feb 2018 11:00:12 +0100
Marek Vasut <marex@denx.de> wrote:

> On 02/10/2018 10:57 AM, Lukasz Majewski wrote:
> > Hi Jonathan,
> >   
> >> On Sat, Feb 10, 2018 at 01:45:16AM +0100, Lukasz Majewski wrote:  
> >>> Hi Jonathan,
> >>>     
> >>>> On Sat, Feb 03, 2018 at 11:00:35AM -0200, Fabio Estevam
> >>>> wrote:    
> >>>>> On Sat, Feb 3, 2018 at 5:29 AM, Lukasz Majewski <lukma@denx.de>
> >>>>> wrote:      
> >>>>>> The goal of this patch is to clean up the code related to
> >>>>>> choosing SPL MMC boot mode.
> >>>>>>
> >>>>>> The spl_boot_mode() now is called only in spl_mmc_load_image()
> >>>>>> function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT
> >>>>>> is enabled.
> >>>>>>
> >>>>>> To achieve the goal, all per mach/arch implementations
> >>>>>> eligible for unification has been replaced with one __weak
> >>>>>> implementation.
> >>>>>>
> >>>>>> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> >>>>>> Reviewed-by: Marek Vasut <marex@denx.de>
> >>>>>> Reviewed-by: Stefano Babic <sbabic@denx.de>
> >>>>>> Acked-by: Michal Simek <michal.simek@xilinx.com> (For
> >>>>>> ZynqMP)      
> >>>>>
> >>>>> Nice cleanup:
> >>>>>
> >>>>> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>      
> >>>>
> >>>> This has broken booting via mmc with mx6cuboxi for me.
> >>>>
> >>>> SPL loops on
> >>>>
> >>>> U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33
> >>>> +1300) Trying to boot from MMC1
> >>>> Failed to mount ext2 filesystem...
> >>>> spl_load_image_ext: ext4fs mount err - 0    
> >>>
> >>> Could you check what is the status of following defines in
> >>> your .config file:
> >>>
> >>> CONFIG_SPL_FAT_SUPPORT
> >>> CONFIG_SUPPORT_EMMC_BOOT    
> >>
> >> "# CONFIG_SPL_FAT_SUPPORT is not set"
> >>
> >> CONFIG_SUPPORT_EMMC_BOOT is not in the .config at all
> >>
> >> CONFIG_SPL_EXT_SUPPORT previously for imx6 would result in
> >> MMCSD_MODE_RAW but now it results in MMCSD_MODE_FS.
> >>  
> >>>
> >>> And if by any chance your don't have:
> >>> CONFIG_SPL_EXT_SUPPORT defined?    
> >>
> >> CONFIG_SPL_EXT_SUPPORT=y  
> > 
> > Could you for test comment out the above define?  
> 
> If you look at the logic in spl_mmc.c , you'll see this will work. But
> what about users who have EXT enabled and want to use it as fallback
> after loading from RAW failed ? :)
> 

The code now in __weak function has been took directly from socfpga
port (as looked as clean and simple). 

Apparently, this port did not provide such fallback facility :-)

It seems to me that the code from imx function would need to be used
instead.


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180210/7020dfe0/attachment.sig>

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

* [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
  2018-02-10 10:25             ` Lukasz Majewski
@ 2018-02-10 10:34               ` Marek Vasut
  0 siblings, 0 replies; 12+ messages in thread
From: Marek Vasut @ 2018-02-10 10:34 UTC (permalink / raw)
  To: u-boot

On 02/10/2018 11:25 AM, Lukasz Majewski wrote:
> On Sat, 10 Feb 2018 11:00:12 +0100
> Marek Vasut <marex@denx.de> wrote:
> 
>> On 02/10/2018 10:57 AM, Lukasz Majewski wrote:
>>> Hi Jonathan,
>>>   
>>>> On Sat, Feb 10, 2018 at 01:45:16AM +0100, Lukasz Majewski wrote:  
>>>>> Hi Jonathan,
>>>>>     
>>>>>> On Sat, Feb 03, 2018 at 11:00:35AM -0200, Fabio Estevam
>>>>>> wrote:    
>>>>>>> On Sat, Feb 3, 2018 at 5:29 AM, Lukasz Majewski <lukma@denx.de>
>>>>>>> wrote:      
>>>>>>>> The goal of this patch is to clean up the code related to
>>>>>>>> choosing SPL MMC boot mode.
>>>>>>>>
>>>>>>>> The spl_boot_mode() now is called only in spl_mmc_load_image()
>>>>>>>> function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT
>>>>>>>> is enabled.
>>>>>>>>
>>>>>>>> To achieve the goal, all per mach/arch implementations
>>>>>>>> eligible for unification has been replaced with one __weak
>>>>>>>> implementation.
>>>>>>>>
>>>>>>>> Signed-off-by: Lukasz Majewski <lukma@denx.de>
>>>>>>>> Reviewed-by: Marek Vasut <marex@denx.de>
>>>>>>>> Reviewed-by: Stefano Babic <sbabic@denx.de>
>>>>>>>> Acked-by: Michal Simek <michal.simek@xilinx.com> (For
>>>>>>>> ZynqMP)      
>>>>>>>
>>>>>>> Nice cleanup:
>>>>>>>
>>>>>>> Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>      
>>>>>>
>>>>>> This has broken booting via mmc with mx6cuboxi for me.
>>>>>>
>>>>>> SPL loops on
>>>>>>
>>>>>> U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33
>>>>>> +1300) Trying to boot from MMC1
>>>>>> Failed to mount ext2 filesystem...
>>>>>> spl_load_image_ext: ext4fs mount err - 0    
>>>>>
>>>>> Could you check what is the status of following defines in
>>>>> your .config file:
>>>>>
>>>>> CONFIG_SPL_FAT_SUPPORT
>>>>> CONFIG_SUPPORT_EMMC_BOOT    
>>>>
>>>> "# CONFIG_SPL_FAT_SUPPORT is not set"
>>>>
>>>> CONFIG_SUPPORT_EMMC_BOOT is not in the .config at all
>>>>
>>>> CONFIG_SPL_EXT_SUPPORT previously for imx6 would result in
>>>> MMCSD_MODE_RAW but now it results in MMCSD_MODE_FS.
>>>>  
>>>>>
>>>>> And if by any chance your don't have:
>>>>> CONFIG_SPL_EXT_SUPPORT defined?    
>>>>
>>>> CONFIG_SPL_EXT_SUPPORT=y  
>>>
>>> Could you for test comment out the above define?  
>>
>> If you look at the logic in spl_mmc.c , you'll see this will work. But
>> what about users who have EXT enabled and want to use it as fallback
>> after loading from RAW failed ? :)
>>
> 
> The code now in __weak function has been took directly from socfpga
> port (as looked as clean and simple). 
> 
> Apparently, this port did not provide such fallback facility :-)

That's correct (for reasons which are beyond the scope of this discussion).

> It seems to me that the code from imx function would need to be used
> instead.
The code in IMX will fail if you have only CONFIG_SPL_FAT_SUPPORT
enabled in SPL .

Give it some more thought and look esp. for the case fallthroughs in the
spl_mmc code, that makes it nasty.

The RAW support is there only to support legacy stuff until those ports
discover filesystems and their benefits (IMO).

-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
  2018-02-10  9:57         ` Lukasz Majewski
  2018-02-10 10:00           ` Marek Vasut
@ 2018-02-10 10:39           ` Jonathan Gray
  2018-02-10 10:45             ` Lukasz Majewski
  1 sibling, 1 reply; 12+ messages in thread
From: Jonathan Gray @ 2018-02-10 10:39 UTC (permalink / raw)
  To: u-boot

On Sat, Feb 10, 2018 at 10:57:26AM +0100, Lukasz Majewski wrote:
> Hi Jonathan,
> 
> > On Sat, Feb 10, 2018 at 01:45:16AM +0100, Lukasz Majewski wrote:
> > > Hi Jonathan,
> > >   
> > > > On Sat, Feb 03, 2018 at 11:00:35AM -0200, Fabio Estevam wrote:  
> > > > > On Sat, Feb 3, 2018 at 5:29 AM, Lukasz Majewski <lukma@denx.de>
> > > > > wrote:    
> > > > > > The goal of this patch is to clean up the code related to
> > > > > > choosing SPL MMC boot mode.
> > > > > >
> > > > > > The spl_boot_mode() now is called only in spl_mmc_load_image()
> > > > > > function, which is only compiled in if CONFIG_SPL_MMC_SUPPORT
> > > > > > is enabled.
> > > > > >
> > > > > > To achieve the goal, all per mach/arch implementations
> > > > > > eligible for unification has been replaced with one __weak
> > > > > > implementation.
> > > > > >
> > > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > > > > > Reviewed-by: Marek Vasut <marex@denx.de>
> > > > > > Reviewed-by: Stefano Babic <sbabic@denx.de>
> > > > > > Acked-by: Michal Simek <michal.simek@xilinx.com> (For
> > > > > > ZynqMP)    
> > > > > 
> > > > > Nice cleanup:
> > > > > 
> > > > > Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>    
> > > > 
> > > > This has broken booting via mmc with mx6cuboxi for me.
> > > > 
> > > > SPL loops on
> > > > 
> > > > U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 - 11:04:33
> > > > +1300) Trying to boot from MMC1
> > > > Failed to mount ext2 filesystem...
> > > > spl_load_image_ext: ext4fs mount err - 0  
> > > 
> > > Could you check what is the status of following defines in
> > > your .config file:
> > > 
> > > CONFIG_SPL_FAT_SUPPORT
> > > CONFIG_SUPPORT_EMMC_BOOT  
> > 
> > "# CONFIG_SPL_FAT_SUPPORT is not set"
> > 
> > CONFIG_SUPPORT_EMMC_BOOT is not in the .config at all
> > 
> > CONFIG_SPL_EXT_SUPPORT previously for imx6 would result in
> > MMCSD_MODE_RAW but now it results in MMCSD_MODE_FS.
> > 
> > > 
> > > And if by any chance your don't have:
> > > CONFIG_SPL_EXT_SUPPORT defined?  
> > 
> > CONFIG_SPL_EXT_SUPPORT=y
> 
> Could you for test comment out the above define?

Removing CONFIG_SPL_EXT_SUPPORT=y from the defconfig or using the
following diff makes the system boot.

diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 351f4edd41..1541a4837d 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -283,7 +283,7 @@ static int spl_mmc_do_fs_boot(struct spl_image_info *spl_image, struct mmc *mmc)
 
 u32 __weak spl_boot_mode(const u32 boot_device)
 {
-#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
+#if defined(CONFIG_SPL_FAT_SUPPORT)
 	return MMCSD_MODE_FS;
 #elif defined(CONFIG_SUPPORT_EMMC_BOOT)
 	return MMCSD_MODE_EMMCBOOT;

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

* [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function
  2018-02-10 10:39           ` Jonathan Gray
@ 2018-02-10 10:45             ` Lukasz Majewski
  0 siblings, 0 replies; 12+ messages in thread
From: Lukasz Majewski @ 2018-02-10 10:45 UTC (permalink / raw)
  To: u-boot

Hi Jonathan,

> On Sat, Feb 10, 2018 at 10:57:26AM +0100, Lukasz Majewski wrote:
> > Hi Jonathan,
> >   
> > > On Sat, Feb 10, 2018 at 01:45:16AM +0100, Lukasz Majewski wrote:  
> > > > Hi Jonathan,
> > > >     
> > > > > On Sat, Feb 03, 2018 at 11:00:35AM -0200, Fabio Estevam
> > > > > wrote:    
> > > > > > On Sat, Feb 3, 2018 at 5:29 AM, Lukasz Majewski
> > > > > > <lukma@denx.de> wrote:      
> > > > > > > The goal of this patch is to clean up the code related to
> > > > > > > choosing SPL MMC boot mode.
> > > > > > >
> > > > > > > The spl_boot_mode() now is called only in
> > > > > > > spl_mmc_load_image() function, which is only compiled in
> > > > > > > if CONFIG_SPL_MMC_SUPPORT is enabled.
> > > > > > >
> > > > > > > To achieve the goal, all per mach/arch implementations
> > > > > > > eligible for unification has been replaced with one __weak
> > > > > > > implementation.
> > > > > > >
> > > > > > > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > > > > > > Reviewed-by: Marek Vasut <marex@denx.de>
> > > > > > > Reviewed-by: Stefano Babic <sbabic@denx.de>
> > > > > > > Acked-by: Michal Simek <michal.simek@xilinx.com> (For
> > > > > > > ZynqMP)      
> > > > > > 
> > > > > > Nice cleanup:
> > > > > > 
> > > > > > Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>      
> > > > > 
> > > > > This has broken booting via mmc with mx6cuboxi for me.
> > > > > 
> > > > > SPL loops on
> > > > > 
> > > > > U-Boot SPL 2018.03-rc1-00212-g48914fc119 (Feb 10 2018 -
> > > > > 11:04:33 +1300) Trying to boot from MMC1
> > > > > Failed to mount ext2 filesystem...
> > > > > spl_load_image_ext: ext4fs mount err - 0    
> > > > 
> > > > Could you check what is the status of following defines in
> > > > your .config file:
> > > > 
> > > > CONFIG_SPL_FAT_SUPPORT
> > > > CONFIG_SUPPORT_EMMC_BOOT    
> > > 
> > > "# CONFIG_SPL_FAT_SUPPORT is not set"
> > > 
> > > CONFIG_SUPPORT_EMMC_BOOT is not in the .config at all
> > > 
> > > CONFIG_SPL_EXT_SUPPORT previously for imx6 would result in
> > > MMCSD_MODE_RAW but now it results in MMCSD_MODE_FS.
> > >   
> > > > 
> > > > And if by any chance your don't have:
> > > > CONFIG_SPL_EXT_SUPPORT defined?    
> > > 
> > > CONFIG_SPL_EXT_SUPPORT=y  
> > 
> > Could you for test comment out the above define?  
> 
> Removing CONFIG_SPL_EXT_SUPPORT=y from the defconfig or using the
> following diff makes the system boot.
> 
> diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
> index 351f4edd41..1541a4837d 100644
> --- a/common/spl/spl_mmc.c
> +++ b/common/spl/spl_mmc.c
> @@ -283,7 +283,7 @@ static int spl_mmc_do_fs_boot(struct
> spl_image_info *spl_image, struct mmc *mmc) 
>  u32 __weak spl_boot_mode(const u32 boot_device)
>  {
> -#if defined(CONFIG_SPL_FAT_SUPPORT) ||
> defined(CONFIG_SPL_EXT_SUPPORT) +#if defined(CONFIG_SPL_FAT_SUPPORT)
>  	return MMCSD_MODE_FS;
>  #elif defined(CONFIG_SUPPORT_EMMC_BOOT)
>  	return MMCSD_MODE_EMMCBOOT;


Original iMX code (CONFIG_SPL_EXT_SUPPORT is not taken into account at
all):
----------------------------------------------------------------------------

-#if defined(CONFIG_SPL_MMC_SUPPORT)
-/* called from spl_mmc to see type of boot mode for storage (RAW or
FAT) */ -u32 spl_boot_mode(const u32 boot_device)
-{
-	switch (spl_boot_device()) {
-	/* for MMC return either RAW or FAT mode */
-	case BOOT_DEVICE_MMC1:
-	case BOOT_DEVICE_MMC2:
-#if defined(CONFIG_SPL_FAT_SUPPORT)
-		return MMCSD_MODE_FS;
-#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
-		return MMCSD_MODE_EMMCBOOT;
-#else
-		return MMCSD_MODE_RAW;
-#endif
-		break;
-	default:
-		puts("spl: ERROR:  unsupported device\n");
-		hang();
-	}
-}
-#endif

Current code (socfpga):

+u32 __weak spl_boot_mode(const u32 boot_device)
+{
+#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
+	return MMCSD_MODE_FS;
+#elif defined(CONFIG_SUPPORT_EMMC_BOOT)
+	return MMCSD_MODE_EMMCBOOT;
+#else
+	return MMCSD_MODE_RAW;
+#endif
+}


So with the original iMX code the MMCSD_MODE_RAW is returned even when
you do have CONFIG_SPL_EXT_SUPPORT enabled.



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180210/c664eaee/attachment.sig>

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

end of thread, other threads:[~2018-02-10 10:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-03  7:29 [U-Boot] [PATCH v2] spl: eMMC/SD: Provide one __weak spl_boot_mode() function Lukasz Majewski
2018-02-03 13:00 ` Fabio Estevam
2018-02-09 23:53   ` Jonathan Gray
2018-02-10  0:45     ` Lukasz Majewski
2018-02-10  3:21       ` Jonathan Gray
2018-02-10  9:57         ` Lukasz Majewski
2018-02-10 10:00           ` Marek Vasut
2018-02-10 10:25             ` Lukasz Majewski
2018-02-10 10:34               ` Marek Vasut
2018-02-10 10:39           ` Jonathan Gray
2018-02-10 10:45             ` Lukasz Majewski
2018-02-08 12:27 ` [U-Boot] [U-Boot, " Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.