Skip to contentSkip to conversation

ARM: dts: imx: Fix eMMC boot on Data Modul i.MX8M Plus eDM SBC

PATCH In review Marek Vasut 4 participants 4 messages Jul 5, 2023 – Jul 11, 2023 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: dts: imx: Fix eMMC boot on Data Modul i.MX8M Plus eDM SBC

In case the i.MX8M Plus starts from eMMC BOOT1/BOOT2 HW partitions, the flash.bin container is stored at offset 0 from the start, that means the fitImage itb is at offset 0x2c0 instead of 0x300 sectors from the start. Handle this difference in custom spl_mmc_get_uboot_raw_sector() .

---
Cc: Fabio Estevam <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>

---
 board/data_modul/imx8mp_edm_sbc/spl.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
board/data_modul/imx8mp_edm_sbc/spl.c +14 -0
index c30185e48d4..2fdd95a730c 100644
@@ -107,6 +107,20 @@ void board_boot_order(u32 *spl_boot_list)
 	spl_boot_list[4] = BOOT_DEVICE_NONE;
 }
 
+unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned long sect)
+{
+	const u32 boot_dev = spl_boot_device();
+	int part;
+
+	if (boot_dev == BOOT_DEVICE_MMC2) {	/* eMMC */
+		part = spl_mmc_emmc_boot_partition(mmc);
+		if (part == 1 || part == 2)	/* eMMC BOOT1/BOOT2 HW partitions */
+			return sect - 0x40;
+	}
+
+	return sect;
+}
+
 static struct dram_timing_info *dram_timing_info[8] = {
 	&dmo_imx8mp_sbc_dram_timing_32_32,	/* 32 Gbit x32 */
 	NULL,					/* 32 Gbit x16 */
Signature · 1 line
2.40.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Marek Vasut

In case the i.MX8M Plus starts from eMMC BOOT1/BOOT2 HW partitions, the flash.bin container is stored at offset 0 from the start, that means the fitImage itb is at offset 0x2c0 instead of 0x300 sectors from the start. Handle this difference in custom spl_mmc_get_uboot_raw_sector() .

Quoted 33 lines

---
Cc: Fabio Estevam <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>

---
  board/data_modul/imx8mp_edm_sbc/spl.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)
board/data_modul/imx8mp_edm_sbc/spl.c +14 -0
index c30185e48d4..2fdd95a730c 100644
@@ -107,6 +107,20 @@ void board_boot_order(u32 *spl_boot_list)
  	spl_boot_list[4] = BOOT_DEVICE_NONE;
  }
 
+unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned long sect)
+{
+	const u32 boot_dev = spl_boot_device();
+	int part;
+
+	if (boot_dev == BOOT_DEVICE_MMC2) {	/* eMMC */
+		part = spl_mmc_emmc_boot_partition(mmc);
+		if (part == 1 || part == 2)	/* eMMC BOOT1/BOOT2 HW partitions */
+			return sect - 0x40;
+	}
+
+	return sect;
+}
+
  static struct dram_timing_info *dram_timing_info[8] = {
  	&dmo_imx8mp_sbc_dram_timing_32_32,	/* 32 Gbit x32 */
  	NULL,					/* 32 Gbit x16 */
Reviewed-by
#2 lore raw
Quoted 13 lines

-----Original Message-----
From: U-Boot <[email protected]> On Behalf Of Peng Fan
Sent: Thursday, July 6, 2023 5:01 PM
To: Marek Vasut <[email protected]>; [email protected]
Cc: [email protected]; Fabio Estevam <[email protected]>; Peng Fan <[email protected]>; Stefano Babic <[email protected]>
Subject: Re: [PATCH] ARM: dts: imx: Fix eMMC boot on Data Modul i.MX8M Plus eDM SBC

On 7/6/2023 7:26 AM, Marek Vasut wrote:

Quoted 8 lines
Quoted 6 lines

In case the i.MX8M Plus starts from eMMC BOOT1/BOOT2 HW partitions, the flash.bin container is stored at offset 0 from the start, that means the fitImage itb is at offset 0x2c0 instead of 0x300 sectors from the start. Handle this difference in custom spl_mmc_get_uboot_raw_sector() .

Best Regards,
Jaehoon Chung

Quoted 34 lines
Quoted 34 lines

---
Cc: Fabio Estevam <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Stefano Babic <[email protected]>

---
  board/data_modul/imx8mp_edm_sbc/spl.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)
board/data_modul/imx8mp_edm_sbc/spl.c +14 -0
index c30185e48d4..2fdd95a730c 100644
@@ -107,6 +107,20 @@ void board_boot_order(u32 *spl_boot_list)
  	spl_boot_list[4] = BOOT_DEVICE_NONE;
  }
 
+unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned long sect)
+{
+	const u32 boot_dev = spl_boot_device();
+	int part;
+
+	if (boot_dev == BOOT_DEVICE_MMC2) {	/* eMMC */
+		part = spl_mmc_emmc_boot_partition(mmc);
+		if (part == 1 || part == 2)	/* eMMC BOOT1/BOOT2 HW partitions */
+			return sect - 0x40;
+	}
+
+	return sect;
+}
+
  static struct dram_timing_info *dram_timing_info[8] = {
  	&dmo_imx8mp_sbc_dram_timing_32_32,	/* 32 Gbit x32 */
  	NULL,					/* 32 Gbit x16 */
#3 lore raw

PATCH 1/1 ARM: dts: imx: Fix eMMC boot on Data Modul i.MX8M Plus eDM SBC

In reply to Marek Vasut
Quoted 7 lines

In case the i.MX8M Plus starts from eMMC BOOT1/BOOT2 HW partitions, the flash.bin container is stored at offset 0 from the start, that means the fitImage itb is at offset 0x2c0 instead of 0x300 sectors from the start. Handle this difference in custom spl_mmc_get_uboot_raw_sector() .

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,        Managing Director: Erika Unter  
HRB 165235 Munich,   Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: [email protected]
=====================================================================