* [PATCH] sunxi: spl: h616: fix booting from high MMC offset
@ 2024-05-09 23:13 Andre Przywara
2024-05-28 14:53 ` Chen-Yu Tsai
2024-05-29 2:47 ` Ryan Walklin
0 siblings, 2 replies; 3+ messages in thread
From: Andre Przywara @ 2024-05-09 23:13 UTC (permalink / raw)
To: Jagan Teki; +Cc: u-boot, linux-sunxi, Chris Morgan, Ryan Walklin
The BootROM in the Allwinner H616 tries to load the initial boot code
from sector 16 (8KB) of an SD card or eMMC device, but also looks at
sector 512 (256KB). This helps with GPT formatted cards.
A "high" boot offset is also used on previous SoCs, but it's sector 256
(128KB) there instead.
Extend the existing offset calculation code to consider the different
sector offset when running on an H616 SoC. This allows to load U-Boot
on any H616 device when the SPL is not located at 8KB.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
arch/arm/mach-sunxi/board.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index 0140b07d32a..046e9fbfc67 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -333,7 +333,8 @@ uint32_t sunxi_get_spl_size(void)
* The eGON SPL image can be located at 8KB or at 128KB into an SD card or
* an eMMC device. The boot source has bit 4 set in the latter case.
* By adding 120KB to the normal offset when booting from a "high" location
- * we can support both cases.
+ * we can support both cases. The H616 has the alternative location
+ * moved up to 256 KB instead of 128KB, so cater for that, too.
* Also U-Boot proper is located at least 32KB after the SPL, but will
* immediately follow the SPL if that is bigger than that.
*/
@@ -349,6 +350,8 @@ unsigned long board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc,
case SUNXI_BOOTED_FROM_MMC0_HIGH:
case SUNXI_BOOTED_FROM_MMC2_HIGH:
sector += (128 - 8) * 2;
+ if (IS_ENABLED(CONFIG_MACH_SUN50I_H616))
+ sector += 128 * 2;
break;
}
--
2.35.8
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] sunxi: spl: h616: fix booting from high MMC offset
2024-05-09 23:13 [PATCH] sunxi: spl: h616: fix booting from high MMC offset Andre Przywara
@ 2024-05-28 14:53 ` Chen-Yu Tsai
2024-05-29 2:47 ` Ryan Walklin
1 sibling, 0 replies; 3+ messages in thread
From: Chen-Yu Tsai @ 2024-05-28 14:53 UTC (permalink / raw)
To: Andre Przywara
Cc: Jagan Teki, u-boot, linux-sunxi, Chris Morgan, Ryan Walklin
On Fri, May 10, 2024 at 7:13 AM Andre Przywara <andre.przywara@arm.com> wrote:
>
> The BootROM in the Allwinner H616 tries to load the initial boot code
> from sector 16 (8KB) of an SD card or eMMC device, but also looks at
> sector 512 (256KB). This helps with GPT formatted cards.
> A "high" boot offset is also used on previous SoCs, but it's sector 256
> (128KB) there instead.
>
> Extend the existing offset calculation code to consider the different
> sector offset when running on an H616 SoC. This allows to load U-Boot
> on any H616 device when the SPL is not located at 8KB.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Make sense.
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] sunxi: spl: h616: fix booting from high MMC offset
2024-05-09 23:13 [PATCH] sunxi: spl: h616: fix booting from high MMC offset Andre Przywara
2024-05-28 14:53 ` Chen-Yu Tsai
@ 2024-05-29 2:47 ` Ryan Walklin
1 sibling, 0 replies; 3+ messages in thread
From: Ryan Walklin @ 2024-05-29 2:47 UTC (permalink / raw)
To: Andre Przywara, Jagan Teki; +Cc: u-boot, linux-sunxi, Chris Morgan
On Fri, 10 May 2024, at 11:13 AM, Andre Przywara wrote:
> Extend the existing offset calculation code to consider the different
> sector offset when running on an H616 SoC. This allows to load U-Boot
> on any H616 device when the SPL is not located at 8KB.
Thanks Andre,
Confirmed with an H700-based board and u-boot at the 512-sector/256KB offset.
Tested-by: Ryan Walklin <ryan@testtoast.com>
Regards,
Ryan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-29 2:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-09 23:13 [PATCH] sunxi: spl: h616: fix booting from high MMC offset Andre Przywara
2024-05-28 14:53 ` Chen-Yu Tsai
2024-05-29 2:47 ` Ryan Walklin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox