Skip to contentSkip to conversation

spl: mmc: fix switch statement

PATCH Superseded Max Krummenacher 3 participants 13 messages Oct 15, 2016 – Oct 17, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 spl: mmc: fix switch statement

If CONFIG_SPL_LIBCOMMON_SUPPORT is not defined there is a lone case statement at the end of the switch leading to a compile error.
Remove the offending case statement.

| common/spl/spl_mmc.c:339:7: error: label at end of compound statement

---

 common/spl/spl_mmc.c | 1 -
 1 file changed, 1 deletion(-)
common/spl/spl_mmc.c +0 -1
index c674e61..367b4e4 100644
@@ -342,7 +342,6 @@ static int spl_mmc_load_image(struct spl_image_info *spl_image,
 			return err;
 
 		break;
-	case MMCSD_MODE_UNDEFINED:
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 	default:
 		puts("spl: mmc: wrong boot mode\n");
Signature · 1 line
2.6.6
#1 lore raw

PATCH 2/3 imx: make ipu's di configurable

The ipu has two display interfaces. Make the used one a parameter in struct display_info_t instead of using unconditionally DI0. DI0 is the default setting.

---

 arch/arm/imx-common/video.c             | 2 +-
 arch/arm/include/asm/imx-common/video.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm/imx-common/video.c +1 -1
index fdc987f..549bf9d 100644
@@ -34,7 +34,7 @@ int board_video_skip(void)
 	}
 
 	if (i < display_count) {
-		ret = ipuv3_fb_init(&displays[i].mode, 0,
+		ret = ipuv3_fb_init(&displays[i].mode, displays[i].di ? 1 : 0,
 				    displays[i].pixfmt);
 		if (!ret) {
 			if (displays[i].enable)
arch/arm/include/asm/imx-common/video.h +1 -0
index cad5f86..941a031 100644
@@ -12,6 +12,7 @@ struct display_info_t {
 	int	bus;
 	int	addr;
 	int	pixfmt;
+	int	di;
 	int	(*detect)(struct display_info_t const *dev);
 	void	(*enable)(struct display_info_t const *dev);
 	struct	fb_videomode mode;
Signature · 1 line
2.6.6
#2 lore raw

PATCH 3/3 mx6: synchronize SPL to u-boot offset

In reply to Max Krummenacher

Synchronize CONFIG_SPL_PAD_TO (used at build time for u-boot-with-spl.imx) with CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR (used by SPL to read u-boot image).

---

 include/configs/imx6_spl.h | 3 +++
 1 file changed, 3 insertions(+)
include/configs/imx6_spl.h +3 -0
index 76d1ca0..0b426bb 100644
@@ -23,6 +23,8 @@
  *    which consists of a 4K header in front of us that contains the IVT, DCD
  *    and some padding thus 'our' max size is really 0x00908000 - 0x00918000
  *    or 64KB
+ *  - Padding between start of SPL(with IVT...) and U-Boot is 68KB, SPL starts
+ *    at 1KB, U-Boot at 69kB into the storage media.
  */
 #define CONFIG_SYS_THUMB_BUILD
 #define CONFIG_SPL_LDSCRIPT	"arch/arm/cpu/armv7/omap-common/u-boot-spl.lds"
@@ -38,6 +40,7 @@
 /* MMC support */
 #if defined(CONFIG_SPL_MMC_SUPPORT)
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	138 /* offset 69KB */
+#define CONFIG_SPL_PAD_TO			0x11000 /* offset 68KB */
 #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS	800 /* 400 KB */
 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
 #define CONFIG_SYS_MONITOR_LEN  (CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS/2*1024)
Signature · 1 line
2.6.6
#3 lore raw

PATCH 3/3 mx6: synchronize SPL to u-boot offset

Quoted 23 lines · Max Krummenacher

Synchronize CONFIG_SPL_PAD_TO (used at build time for u-boot-with-spl.imx) with CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR (used by SPL to read u-boot image).

---

 include/configs/imx6_spl.h | 3 +++
 1 file changed, 3 insertions(+)
include/configs/imx6_spl.h +2 -0
index 76d1ca0..0b426bb 100644
@@ -23,6 +23,8 @@
  *    which consists of a 4K header in front of us that contains the IVT, DCD
  *    and some padding thus 'our' max size is really 0x00908000 - 0x00918000
  *    or 64KB
+ *  - Padding between start of SPL(with IVT...) and U-Boot is 68KB, SPL starts
+ *    at 1KB, U-Boot at 69kB into the storage media.
  */
 #define CONFIG_SYS_THUMB_BUILD
 #define CONFIG_SPL_LDSCRIPT	"arch/arm/cpu/armv7/omap-common/u-boot-spl.lds"

include/configs/imx6_spl.h line 43

Quoted 4 lines
include/configs/imx6_spl.h +1 -0
@@ -38,6 +40,7 @@
 /* MMC support */
 #if defined(CONFIG_SPL_MMC_SUPPORT)
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	138 /* offset 69KB */
+#define CONFIG_SPL_PAD_TO			0x11000 /* offset 68KB */

Does this mess up boards which can boot from both SD and other boot media (NAND, SPI NOR, PNOR...) ?

Quoted 4 lines
include/configs/imx6_spl.h +0 -0
 #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS	800 /* 400 KB */
 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
 #define CONFIG_SYS_MONITOR_LEN  (CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS/2*1024)
Signature · 2 lines
Best regards,
Marek Vasut
#4 lore raw

PATCH 3/3 mx6: synchronize SPL to u-boot offset

Hi Marak

Quoted 17 lines
Quoted 17 lines
include/configs/imx6_spl.h +0 -0
@@ -23,6 +23,8 @@
  *    which consists of a 4K header in front of us that contains

the IVT, DCD
* and some padding thus 'our' max size is really 0x00908000 -
0x00918000
* or 64KB
+ * - Padding between start of SPL(with IVT...) and U-Boot is 68KB, SPL starts
+ * at 1KB, U-Boot at 69kB into the storage media.
*/
#define CONFIG_SYS_THUMB_BUILD
#define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/omap

include/configs/imx6_spl.h +0 -1
-common/u-boot-spl.lds"
@@ -38,6 +40,7 @@
 /* MMC support */
Quoted 8 lines
Quoted 5 lines
include/configs/imx6_spl.h +0 -0
 #if defined(CONFIG_SPL_MMC_SUPPORT)
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	138 /*

offset 69KB */
+#define CONFIG_SPL_PAD_TO 0x11000 /* offset
68KB */

Does this mess up boards which can boot from both SD and other boot media (NAND, SPI NOR, PNOR...) ?

Good point.
CONFIG_SPL_PAD_TO is used to create the combined SPL/U-Boot binary. While I have not found any use of this by any config which includes imx6_spl.h it might hinder future boards.
So it's probably best to define CONFIG_SPL_PAD_TO in the individual board configs and skip this patch.

Max

#5 lore raw

PATCH 3/3 mx6: synchronize SPL to u-boot offset

Quoted 28 lines · Max Krummenacher

Hi Marak

Quoted 17 lines
Quoted 17 lines
include/configs/imx6_spl.h +0 -0
@@ -23,6 +23,8 @@
  *    which consists of a 4K header in front of us that contains

the IVT, DCD
* and some padding thus 'our' max size is really 0x00908000 -
0x00918000
* or 64KB
+ * - Padding between start of SPL(with IVT...) and U-Boot is 68KB, SPL starts
+ * at 1KB, U-Boot at 69kB into the storage media.
*/
#define CONFIG_SYS_THUMB_BUILD
#define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/omap

include/configs/imx6_spl.h +0 -1
-common/u-boot-spl.lds"
@@ -38,6 +40,7 @@
 /* MMC support */
Quoted 8 lines
Quoted 5 lines
include/configs/imx6_spl.h +0 -0
 #if defined(CONFIG_SPL_MMC_SUPPORT)
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR	138 /*

offset 69KB */
+#define CONFIG_SPL_PAD_TO 0x11000 /* offset
68KB */

Does this mess up boards which can boot from both SD and other boot media (NAND, SPI NOR, PNOR...) ?

Quoted 6 lines

Good point.
CONFIG_SPL_PAD_TO is used to create the combined SPL/U-Boot binary. While I have not found any use of this by any config which includes imx6_spl.h it might hinder future boards.
So it's probably best to define CONFIG_SPL_PAD_TO in the individual board configs and skip this patch.

So how did you come up with this patch ? What was the thought process?

Signature · 2 lines
Best regards,
Marek Vasut
#6 lore raw

PATCH 3/3 mx6: synchronize SPL to u-boot offset

Hi Marek

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines

#if defined(CONFIG_SPL_MMC_SUPPORT)
#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 138 /*
offset 69KB */
+#define CONFIG_SPL_PAD_TO 0x11000 /* offset
68KB */

Does this mess up boards which can boot from both SD and other boot media (NAND, SPI NOR, PNOR...) ?

Quoted 9 lines
Quoted 6 lines

Good point.
CONFIG_SPL_PAD_TO is used to create the combined SPL/U-Boot binary. While I have not found any use of this by any config which includes imx6_spl.h it might hinder future boards.
So it's probably best to define CONFIG_SPL_PAD_TO in the individual board configs and skip this patch.

So how did you come up with this patch ? What was the thought process?

I'm preparing patches for submission of new boards, Colibri iMX6, Apalis iMX6. They rely on this patchset
https://www.mail-archive.com/u-boot at lists.denx.de/msg227944.html, so the board patches are not yet ready for submission.

I forward ported from a downstream 2015.04 U-Boot where 'make u-boot-with-spl.imx' used an offset of 68KB between SPL and U-Boot binary matching the SPL code which later loads U-Boot. With the current master it used an offset of 64KB resulting in an SPL not loading U-Boot.
Probably the 4KB stem from now counting SPL_PAD_TO from the start of the IVT/DCD region and earlier counting from the start of SPL.

Max

#7 lore raw

PATCH 3/3 mx6: synchronize SPL to u-boot offset

Quoted 18 lines · Max Krummenacher

Hi Marek

Quoted 16 lines
Quoted 15 lines
Quoted 8 lines
Quoted 5 lines

#if defined(CONFIG_SPL_MMC_SUPPORT)
#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 138 /*
offset 69KB */
+#define CONFIG_SPL_PAD_TO 0x11000 /* offset
68KB */

Does this mess up boards which can boot from both SD and other boot media (NAND, SPI NOR, PNOR...) ?

Good point.
CONFIG_SPL_PAD_TO is used to create the combined SPL/U-Boot binary. While I have not found any use of this by any config which includes imx6_spl.h it might hinder future boards.
So it's probably best to define CONFIG_SPL_PAD_TO in the individual board configs and skip this patch.

Quoted 6 lines
Quoted 2 lines

So how did you come up with this patch ? What was the thought process?

I'm preparing patches for submission of new boards, Colibri iMX6, Apalis iMX6. They rely on this patchset
https://www.mail-archive.com/u-boot at lists.denx.de/msg227944.html, so the board patches are not yet ready for submission.

OT: Can you make those boards load u-boot.img from extfs partition instead ?

Quoted 7 lines

I forward ported from a downstream 2015.04 U-Boot where 'make u-boot-with-spl.imx' used an offset of 68KB between SPL and U-Boot binary matching the SPL code which later loads U-Boot. With the current master it used an offset of 64KB resulting in an SPL not loading U-Boot.
Probably the 4KB stem from now counting SPL_PAD_TO from the start of the IVT/DCD region and earlier counting from the start of SPL.

I see, thanks for clarifying.

Quoted 2 lines

Max

Signature · 2 lines
Best regards,
Marek Vasut
#8 lore raw

PATCH 3/3 mx6: synchronize SPL to u-boot offset

2016-10-17 14:45 GMT+02:00 Marek Vasut <[email protected]>:

Quoted 19 lines · Max Krummenacher
Quoted 18 lines

Hi Marek

Quoted 16 lines
Quoted 15 lines
Quoted 8 lines
Quoted 5 lines

#if defined(CONFIG_SPL_MMC_SUPPORT)
#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 138 /*
offset 69KB */
+#define CONFIG_SPL_PAD_TO 0x11000 /* offset
68KB */

Does this mess up boards which can boot from both SD and other boot media (NAND, SPI NOR, PNOR...) ?

Good point.
CONFIG_SPL_PAD_TO is used to create the combined SPL/U-Boot binary. While I have not found any use of this by any config which includes imx6_spl.h it might hinder future boards.
So it's probably best to define CONFIG_SPL_PAD_TO in the individual board configs and skip this patch.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

So how did you come up with this patch ? What was the thought process?

I'm preparing patches for submission of new boards, Colibri iMX6, Apalis iMX6. They rely on this patchset
https://www.mail-archive.com/u-boot at lists.denx.de/msg227944.html, so the board patches are not yet ready for submission.

OT: Can you make those boards load u-boot.img from extfs partition instead ?

I probably could but did not try.

Also it would change the way we use U-Boot across our module family and I'm worried that we more often need to recover over USB due to a corrupted filesystem.
On top of that I made some measurements on loading the kernel from an ext2 instead of an fat fs and have seen differences bigger than 100ms. So parsing into a filesystem twice would probably add even more overhead.

Max

Quoted 18 lines
Quoted 8 lines

I forward ported from a downstream 2015.04 U-Boot where 'make u-boot-with-spl.imx' used an offset of 68KB between SPL and U-Boot binary matching the SPL code which later loads U-Boot. With the current master it used an offset of 64KB resulting in an SPL not loading U-Boot.
Probably the 4KB stem from now counting SPL_PAD_TO from the start of the IVT/DCD region and earlier counting from the start of SPL.

I see, thanks for clarifying.

Quoted 2 lines

Max

--
Best regards,
Marek Vasut

#9 lore raw

PATCH 1/3 spl: mmc: fix switch statement

In reply to Max Krummenacher
Quoted 17 lines · Max Krummenacher

If CONFIG_SPL_LIBCOMMON_SUPPORT is not defined there is a lone case statement at the end of the switch leading to a compile error.
Remove the offending case statement.

| common/spl/spl_mmc.c:339:7: error: label at end of compound statement

---

 common/spl/spl_mmc.c | 1 -
 1 file changed, 1 deletion(-)
common/spl/spl_mmc.c +0 -0
index c674e61..367b4e4 100644

common/spl/spl_mmc.c static int spl_mmc_load_image(struct spl_image_info *spl_image, · line 345

Quoted 4 lines
common/spl/spl_mmc.c +0 -1
@@ -342,7 +342,6 @@ static int spl_mmc_load_image(struct spl_image_info *spl_image,
 			return err;
 
 		break;
-	case MMCSD_MODE_UNDEFINED:

This patch is wrong -- in case CONFIG_SPL_LIBCOMMON_SUPPORT is enabled and mode is MMCSD_MODE_UNDEFINED, the message in the puts() below would be printed. After applying this change, the message won't be printed .

The fix is probably something like:

case foo:
default:

#ifdef CONFIG_BAR
    puts();
#endif
    break;
Quoted 4 lines
common/spl/spl_mmc.c +0 -0
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 	default:
 		puts("spl: mmc: wrong boot mode\n");
Signature · 2 lines
Best regards,
Marek Vasut
#10 lore raw

PATCH 1/3 spl: mmc: fix switch statement

Hi Marek

Am Samstag, den 15.10.2016, 19:29 +0200 schrieb Marek Vasut:

Quoted 23 lines · Max Krummenacher
Quoted 22 lines

If CONFIG_SPL_LIBCOMMON_SUPPORT is not defined there is a lone case statement
at the end of the switch leading to a compile error. Remove the offending case statement.

Quoted 2 lines

common/spl/spl_mmc.c:339:7: error: label at end of compound statement

---

 common/spl/spl_mmc.c | 1 -
 1 file changed, 1 deletion(-)
common/spl/spl_mmc.c +0 -0
index c674e61..367b4e4 100644
@@ -342,7 +342,6 @@ static int spl_mmc_load_image(struct
 spl_image_info *spl_image,
 			return err;
 
Quoted 8 lines

common/spl/spl_mmc.c static int spl_mmc_load_image(struct spl_image_info *spl_image, · line 345

Quoted 2 lines
common/spl/spl_mmc.c +0 -1
 		break;
-	case MMCSD_MODE_UNDEFINED:

This patch is wrong -- in case CONFIG_SPL_LIBCOMMON_SUPPORT is enabled
and mode is MMCSD_MODE_UNDEFINED, the message in the puts() below would
be printed. After applying this change, the message won't be printed

I disagree.

With CONFIG_SPL_LIBCOMMON_SUPPORT we had something like this:
switch(bar) {
...
case foo:
default:

	put("bla\n");
}

as 'case foo:' falls through into 'default:' removing the specific case does not change anything.

Regards
Max

Quoted 14 lines

The fix is probably something like:

case foo:
default:

#ifdef CONFIG_BAR
    puts();
#endif
    break;
Quoted 4 lines
common/spl/spl_mmc.c +0 -0
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 	default:

puts("spl: mmc: wrong boot mode\n");

#11 lore raw

PATCH 1/3 spl: mmc: fix switch statement

Quoted 43 lines · Max Krummenacher

Hi Marek

Am Samstag, den 15.10.2016, 19:29 +0200 schrieb Marek Vasut:

Quoted 23 lines · Max Krummenacher
Quoted 22 lines

If CONFIG_SPL_LIBCOMMON_SUPPORT is not defined there is a lone case statement
at the end of the switch leading to a compile error. Remove the offending case statement.

Quoted 2 lines

common/spl/spl_mmc.c:339:7: error: label at end of compound statement

---

 common/spl/spl_mmc.c | 1 -
 1 file changed, 1 deletion(-)
common/spl/spl_mmc.c +0 -0
index c674e61..367b4e4 100644
@@ -342,7 +342,6 @@ static int spl_mmc_load_image(struct
 spl_image_info *spl_image,
 			return err;
 
Quoted 8 lines

common/spl/spl_mmc.c static int spl_mmc_load_image(struct spl_image_info *spl_image, · line 345

Quoted 2 lines
common/spl/spl_mmc.c +0 -1
 		break;
-	case MMCSD_MODE_UNDEFINED:

This patch is wrong -- in case CONFIG_SPL_LIBCOMMON_SUPPORT is enabled
and mode is MMCSD_MODE_UNDEFINED, the message in the puts() below would
be printed. After applying this change, the message won't be printed

I disagree.

With CONFIG_SPL_LIBCOMMON_SUPPORT we had something like this:
switch(bar) {
...
case foo:
default:

Quoted 5 lines
	put("bla\n");
}

as 'case foo:' falls through into 'default:' removing the specific case does not change anything.

Oh, that's a good point, I missed that and that's in fact pretty elegant fix. Thanks.

[...]

Signature · 2 lines
Best regards,
Marek Vasut
#12 lore raw

PATCH 1/3 spl: mmc: fix switch statement

In reply to Max Krummenacher
Quoted 7 lines · Max Krummenacher

If CONFIG_SPL_LIBCOMMON_SUPPORT is not defined there is a lone case statement at the end of the switch leading to a compile error.
Remove the offending case statement.

| common/spl/spl_mmc.c:339:7: error: label at end of compound statement

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20161016/5bce30e7/attachment.sig>