+int default_spl_mmc_emmc_boot_partition(struct mmc *mmc)
+{
+ int part;
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
+ part = CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION;
+#else
+ /*
+ * We need to check what the partition is configured to.
+ * 1 and 2 match up to boot0 / boot1 and 7 is user data
+ * which is the first physical partition (0).
+ */
+ part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
+ if (part == 7)
+ part = 0;
+#endif
+ return part;
+}
+
+int __weak spl_mmc_emmc_boot_partition(struct mmc *mmc)
+{
+ return default_spl_mmc_emmc_boot_partition(mmc);
+}
+
+static int spl_mmc_get_mmc_devnum(struct mmc *mmc)
+{
+ struct blk_desc *block_dev;
+#if !CONFIG_IS_ENABLED(BLK)
+ block_dev = &mmc->block_dev;
+#else
+ block_dev = dev_get_uclass_plat(mmc->dev);
+#endif
+ return block_dev->devnum;
+}
+