Skip to contentSkip to conversation

arm64: versal2: Fix emmc boot mode boot_target issue

PATCH Applied Pranav Tilak 2 participants 2 messages Jan 13 – Jan 16

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: versal2: Fix emmc boot mode boot_target issue

The eMMC boot device controller on Versal2 requires device pointer initialization before accessing its sequence number. The EMMC_MODE case was using dev_seq(dev) on an uninitialized pointer, causing corrupted boot_targets entries (mmc7f7fbfbf instead of mmc0/mmc1).

Add uclass_get_device_by_name() call to properly initialize the device pointer before reading the sequence number. The dev sequence number is determined at runtime based on DT aliases.

Fix boot_targets corruption in eMMC boot mode, allowing proper boot device selection instead of falling back to JTAG mode.

---
 board/amd/versal2/board.c | 6 ++++++
 1 file changed, 6 insertions(+)
board/amd/versal2/board.c +6 -0
index 1fd05a1157a..d8079c1cee0 100644
@@ -253,6 +253,12 @@ static int boot_targets_setup(void)
 		break;
 	case EMMC_MODE:
 		puts("EMMC_MODE\n");
+		if (uclass_get_device_by_name(UCLASS_MMC,
+					      "mmc@f1050000", &dev)) {
+			debug("SD1 driver for SD1 device is not present\n");
+			break;
+		}
+		debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev));
 		mode = "mmc";
 		bootseq = dev_seq(dev);
 		break;
Signature · 1 line
2.34.1
Applied
#1 lore raw
Quoted 24 lines · Pranav Tilak

The eMMC boot device controller on Versal2 requires device pointer initialization before accessing its sequence number. The EMMC_MODE case was using dev_seq(dev) on an uninitialized pointer, causing corrupted boot_targets entries (mmc7f7fbfbf instead of mmc0/mmc1).

Add uclass_get_device_by_name() call to properly initialize the device pointer before reading the sequence number. The dev sequence number is determined at runtime based on DT aliases.

Fix boot_targets corruption in eMMC boot mode, allowing proper boot device selection instead of falling back to JTAG mode.

---
  board/amd/versal2/board.c | 6 ++++++
  1 file changed, 6 insertions(+)
board/amd/versal2/board.c +0 -0
index 1fd05a1157a..d8079c1cee0 100644
@@ -253,6 +253,12 @@ static int boot_targets_setup(void)
  		break;
  	case EMMC_MODE:

board/amd/versal2/board.c static int boot_targets_setup(void) · line 264

Quoted 10 lines
board/amd/versal2/board.c +6 -0
  		puts("EMMC_MODE\n");
+		if (uclass_get_device_by_name(UCLASS_MMC,
+					      "mmc@f1050000", &dev)) {
+			debug("SD1 driver for SD1 device is not present\n");
+			break;
+		}
+		debug("mmc1 device found at %p, seq %d\n", dev, dev_seq(dev));
  		mode = "mmc";
  		bootseq = dev_seq(dev);
  		break;

Applied.
M