* [PATCH v1] Fix socfpga GEN5 boot by spl+u-boot sfp on RAW
@ 2025-11-27 19:21 Brian Sune
2025-11-28 10:51 ` Jan Kiszka
0 siblings, 1 reply; 5+ messages in thread
From: Brian Sune @ 2025-11-27 19:21 UTC (permalink / raw)
To: Jan Kiszka, Chee Tien Fong, Tom Rini, u-boot
Thanks to Jan Kiszka had provided info on
u-boot is not able to boot by u-boot-with-spl.sfp.
All three TYPE, #, OFFSET mode methods are
nonfunctionable on combined raw boot.
Explain a bit on the cause and solutions.
The major cause is spl+u-boot structure is
defined as 4x[spl+zero_pad] + u-boot.img.
Deal to this configuration since GEN5 is used,
the spl would require to seek by an offset
on top of the spl offset. This means for
each spl=0x10000 the offset is 0x40000.
However latest u-boot do not consider this
major structure on GEN5 socfpga.
Meanwhile, the default include file as Jan
pointed out is completely wrong syntax and
caused issue.
Combining both concepts, the minimum fix
patch is provide as follows.
1) Offset is control and default set to a
proper offset under:
SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET
2) Only GEN5 socfpga will be affected and
minimized contamination on other devices.
3) Only one compuatation adjustment is made
on spl_mmc_load. And simply introduce the
offset adding by the kconfig offset control.
It should be 0 by default and gate as well.
So no possible harm should be done.
Signed-off-by: Brian Sune <briansune@gmail.com>
---
common/spl/Kconfig | 8 +++++++-
common/spl/spl_mmc.c | 17 ++++++++++++-----
include/part.h | 3 ++-
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 8dade2b501e..554509146d8 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -574,6 +574,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
bool "MMC raw mode: by partition type"
depends on DOS_PARTITION
+ select SPL_LOAD_BLOCK
help
Use partition type for specifying U-Boot partition on MMC/SD in
raw mode. U-Boot will be loaded from the first partition of this
@@ -600,8 +601,13 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
config SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET
hex "U-Boot main hardware partition image offset"
- depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+ depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR || \
+ (SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION && \
+ (TARGET_SOCFPGA_CYCLONE5 || TARGET_SOCFPGA_ARRIA5)) || \
+ (SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE && \
+ (TARGET_SOCFPGA_CYCLONE5 || TARGET_SOCFPGA_ARRIA5))
default 0x10 if ARCH_SUNXI
+ default 0x200 if TARGET_SOCFPGA_CYCLONE5 || TARGET_SOCFPGA_ARRIA5
default 0x0
help
On some platforms SPL location depends on hardware partition. The ROM
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index d8ce3a84614..e50391e49e5 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -5,6 +5,7 @@
*
* Aneesh V <aneesh@ti.com>
*/
+
#include <dm.h>
#include <log.h>
#include <part.h>
@@ -28,7 +29,9 @@ static ulong h_spl_load_read(struct spl_load_info *load, ulong off,
static __maybe_unused unsigned long spl_mmc_raw_uboot_offset(int part)
{
-#if IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR)
+#if IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR) || \
+ IS_ENABLED(CONFIG_TARGET_SOCFPGA_CYCLONE5) || \
+ IS_ENABLED(CONFIG_TARGET_SOCFPGA_ARRIA5)
if (part == 0)
return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET;
#endif
@@ -106,7 +109,8 @@ static int spl_mmc_find_device(struct mmc **mmcp, int mmc_dev)
return 0;
}
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \
+ defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE)
static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
struct spl_boot_device *bootdev,
struct mmc *mmc, int partition,
@@ -136,7 +140,9 @@ static int mmc_load_image_raw_partition(struct spl_image_info *spl_image,
return ret;
}
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR) || \
+ defined(CONFIG_TARGET_SOCFPGA_CYCLONE5) || \
+ defined(CONFIG_TARGET_SOCFPGA_ARRIA5)
return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start + sector);
#else
return mmc_load_image_raw_sector(spl_image, bootdev, mmc, info.start);
@@ -419,10 +425,11 @@ int spl_mmc_load(struct spl_image_info *spl_image,
raw_sect = spl_mmc_get_uboot_raw_sector(mmc, raw_sect);
-#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
+#if defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \
+ defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE)
ret = mmc_load_image_raw_partition(spl_image, bootdev,
mmc, raw_part,
- raw_sect);
+ raw_sect + spl_mmc_raw_uboot_offset(part));
if (!ret)
return 0;
#endif
diff --git a/include/part.h b/include/part.h
index 6caaa6526aa..378769b6bef 100644
--- a/include/part.h
+++ b/include/part.h
@@ -461,7 +461,8 @@ ulong disk_blk_erase(struct udevice *dev, lbaint_t start, lbaint_t blkcnt);
#ifdef CONFIG_XPL_BUILD
# define part_print_ptr(x) NULL
# if defined(CONFIG_SPL_FS_EXT4) || defined(CONFIG_SPL_FS_FAT) || \
- defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION)
+ defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION) || \
+ defined(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE)
# define part_get_info_ptr(x) x
# else
# define part_get_info_ptr(x) NULL
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v1] Fix socfpga GEN5 boot by spl+u-boot sfp on RAW
2025-11-27 19:21 [PATCH v1] Fix socfpga GEN5 boot by spl+u-boot sfp on RAW Brian Sune
@ 2025-11-28 10:51 ` Jan Kiszka
2025-11-28 11:00 ` Sune Brian
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2025-11-28 10:51 UTC (permalink / raw)
To: Brian Sune, Chee Tien Fong, Tom Rini, u-boot
On 27.11.25 20:21, Brian Sune wrote:
> Thanks to Jan Kiszka had provided info on
> u-boot is not able to boot by u-boot-with-spl.sfp.
> All three TYPE, #, OFFSET mode methods are
> nonfunctionable on combined raw boot.
> Explain a bit on the cause and solutions.
> The major cause is spl+u-boot structure is
> defined as 4x[spl+zero_pad] + u-boot.img.
> Deal to this configuration since GEN5 is used,
> the spl would require to seek by an offset
> on top of the spl offset. This means for
> each spl=0x10000 the offset is 0x40000.
> However latest u-boot do not consider this
> major structure on GEN5 socfpga.
>
> Meanwhile, the default include file as Jan
> pointed out is completely wrong syntax and
> caused issue.
>
> Combining both concepts, the minimum fix
> patch is provide as follows.
> 1) Offset is control and default set to a
> proper offset under:
> SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET
>
> 2) Only GEN5 socfpga will be affected and
> minimized contamination on other devices.
>
Most bugs are device-independent. Those should be fixed separately, and
I was even asked in the original series to split further. Let us iterate
on that, I would say.
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] Fix socfpga GEN5 boot by spl+u-boot sfp on RAW
2025-11-28 10:51 ` Jan Kiszka
@ 2025-11-28 11:00 ` Sune Brian
2025-11-28 11:15 ` Jan Kiszka
0 siblings, 1 reply; 5+ messages in thread
From: Sune Brian @ 2025-11-28 11:00 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Chee Tien Fong, Tom Rini, u-boot
> Most bugs are device-independent. Those should be fixed separately, and
> I was even asked in the original series to split further. Let us iterate
> on that, I would say.
No, I disagree.
The terms device-independent had already been considered.
This is a complete patch for GEN5 C5 and A5 only.
Other than that will not be impacted.
Read the patch file carefully.
Or simply apply this patch to check what is the difference.
Thanks,
Brian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] Fix socfpga GEN5 boot by spl+u-boot sfp on RAW
2025-11-28 11:00 ` Sune Brian
@ 2025-11-28 11:15 ` Jan Kiszka
2025-11-28 11:30 ` Sune Brian
0 siblings, 1 reply; 5+ messages in thread
From: Jan Kiszka @ 2025-11-28 11:15 UTC (permalink / raw)
To: Sune Brian; +Cc: Chee Tien Fong, Tom Rini, u-boot
On 28.11.25 12:00, Sune Brian wrote:
>> Most bugs are device-independent. Those should be fixed separately, and
>> I was even asked in the original series to split further. Let us iterate
>> on that, I would say.
>
> No, I disagree.
> The terms device-independent had already been considered.
> This is a complete patch for GEN5 C5 and A5 only.
> Other than that will not be impacted.
>
> Read the patch file carefully.
> Or simply apply this patch to check what is the difference.
>
I read it, and I also disagree - one fix per topic, and there are
multiple topics, affecting particularly
SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE for any board that may want
to use it.
I'm happy to take comments bits by bits, and I'm also happy to drop or
modify patches if there are better solutions. I'm also fine if a subset
of your current patch will go on top of a subset of my series in the end.
Jan
--
Siemens AG, Foundational Technologies
Linux Expert Center
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1] Fix socfpga GEN5 boot by spl+u-boot sfp on RAW
2025-11-28 11:15 ` Jan Kiszka
@ 2025-11-28 11:30 ` Sune Brian
0 siblings, 0 replies; 5+ messages in thread
From: Sune Brian @ 2025-11-28 11:30 UTC (permalink / raw)
To: Jan Kiszka; +Cc: Chee Tien Fong, Tom Rini, u-boot
> I read it, and I also disagree - one fix per topic, and there are
> multiple topics, affecting particularly
> SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE for any board that may want
> to use it.
>
> I'm happy to take comments bits by bits, and I'm also happy to drop or
> modify patches if there are better solutions. I'm also fine if a subset
> of your current patch will go on top of a subset of my series in the end.
This is ONE fi, fixing the RAW boot. splitting file just for reading
purposes and nothing to do with this patch.
Depending on files are must and required to work properly on this topic.
Splitting to different patches for other topics does not fit this patch topic.
So you will simply delay the entire patch flow. For example include files that
need to be fixed due to other functions using it. One topic
Then for include need to run properly Kconfig change need to change a line.
But then due to the RAW function then it requires another fix on the same file.
You can split each line individually by a topic.
If any one has issues due to unreasonable splits then do it as you like.
I can always git apply after pull and remain this patch offline.
This is why reading your patches are confused somehow on some topic.
Thanks,
Brian
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-11-28 11:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-27 19:21 [PATCH v1] Fix socfpga GEN5 boot by spl+u-boot sfp on RAW Brian Sune
2025-11-28 10:51 ` Jan Kiszka
2025-11-28 11:00 ` Sune Brian
2025-11-28 11:15 ` Jan Kiszka
2025-11-28 11:30 ` Sune Brian
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.