env_set("dfu_alt_info", buf);
}
+
+/**
+ * fwu_plat_get_bootidx() - Get the value of the boot index
+ * @boot_idx: Boot index value
+ *
+ * Get the value of the bank(partition) from which the platform
+ * has booted. This value is passed to U-Boot from the earlier
+ * stage bootloader which loads and boots all the relevant
+ * firmware images
+ */
+void fwu_plat_get_bootidx(uint *boot_idx)
+{
+ int ret;
+ u32 buf;
+ size_t readlen;
+ struct mtd_info *mtd;
+
+ *boot_idx = 0;
+
+ mtd_probe_devices();
+ mtd = get_mtd_device_nm("nor1");
+ if (IS_ERR_OR_NULL(mtd))
+ return;
+
+ ret = mtd_read(mtd, SCB_PLAT_METADATA_OFFSET, sizeof(buf),
+ &readlen, (u_char *)&buf);
+ if (ret < 0)
+ return;
+
+ *boot_idx = buf;
+}