Skip to contentSkip to conversation

venice: show emmc boot hardware partition

PATCH In review Tim Harvey 2 participants 3 messages Apr 26, 2024 – Apr 27, 2024

lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH 1/1 venice: show emmc boot hardware partition

To aid in understanding what emmc hardware partition is being used to boot on power-up, display the hardware partition name in the SPL.

---
 board/gateworks/venice/spl.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
board/gateworks/venice/spl.c +16 -0
index 3b0f11f2fd0f..531bad260b6d 100644
@@ -366,9 +366,25 @@ unsigned long board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned long
 
 const char *spl_board_loader_name(u32 boot_device)
 {
+	struct mmc *mmc;
+	int part;
+
 	switch (boot_device) {
 	/* SDHC2 */
 	case BOOT_DEVICE_MMC1:
+		mmc_init_device(0);
+		mmc = find_mmc_device(0);
+		mmc_init(mmc);
+		part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
+		switch (part) {
+		case 1:
+			return "eMMC boot0";
+		case 2:
+			return "eMMC boot1";
+		case 0:
+		case 7:
+			return "eMMC user";
+		}
 		return "eMMC";
 	/* SDHC3 */
 	case BOOT_DEVICE_MMC2:
Signature · 1 line
2.25.1
#1 lore raw

Hello Tim,

Please see my comments below.

Quoted 30 lines · Tim Harvey

To aid in understanding what emmc hardware partition is being used to boot on power-up, display the hardware partition name in the SPL.

---
 board/gateworks/venice/spl.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
board/gateworks/venice/spl.c +0 -0
index 3b0f11f2fd0f..531bad260b6d 100644
@@ -366,9 +366,25 @@ unsigned long

board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned long

const char *spl_board_loader_name(u32 boot_device) {

board/gateworks/venice/spl.c +9 -0
+	struct mmc *mmc;
+	int part;
+
 	switch (boot_device) {
 	/* SDHC2 */
 	case BOOT_DEVICE_MMC1:
+		mmc_init_device(0);
+		mmc = find_mmc_device(0);
+		mmc_init(mmc);
+		part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
+		switch (part) {
+		case 1:

board/gateworks/venice/spl.c unsigned long board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned long · line 390

Quoted 10 lines
board/gateworks/venice/spl.c +7 -0
+			return "eMMC boot0";
+		case 2:
+			return "eMMC boot1";
+		case 0:
+		case 7:
+			return "eMMC user";
+		}
 		return "eMMC";
 	/* SDHC3 */
 	case BOOT_DEVICE_MMC2:

Your other patch on the mailing list does something similar. [1] Perhaps this is a good oportunity to extract and unify the logic that produces the names of eMMC partitions? That would also allow other boards to use the same logic.

[1] https://lore.kernel.org/u-boot/[email protected]/T/#u

author
#2 lore raw
Quoted 44 lines · Dragan Simic

Hello Tim,

Please see my comments below.

Quoted 38 lines · Tim Harvey

To aid in understanding what emmc hardware partition is being used to boot on power-up, display the hardware partition name in the SPL.

---
 board/gateworks/venice/spl.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
board/gateworks/venice/spl.c +0 -0
index 3b0f11f2fd0f..531bad260b6d 100644
@@ -366,9 +366,25 @@ unsigned long

board_spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned long

const char *spl_board_loader_name(u32 boot_device) {

board/gateworks/venice/spl.c +16 -0
+     struct mmc *mmc;
+     int part;
+
      switch (boot_device) {
      /* SDHC2 */
      case BOOT_DEVICE_MMC1:
+             mmc_init_device(0);
+             mmc = find_mmc_device(0);
+             mmc_init(mmc);
+             part = EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config);
+             switch (part) {
+             case 1:
+                     return "eMMC boot0";
+             case 2:
+                     return "eMMC boot1";
+             case 0:
+             case 7:
+                     return "eMMC user";
+             }
Quoted 9 lines
Quoted 3 lines
              return "eMMC";
      /* SDHC3 */
      case BOOT_DEVICE_MMC2:

Your other patch on the mailing list does something similar. [1] Perhaps this is a good oportunity to extract and unify the logic that produces the names of eMMC partitions? That would also allow other boards to use the same logic.

Hi Dragan,

Fair enough - I will resubmit both patches with this in mind.

Best Regards

Tim