#include <cpu_func.h>
#include <env.h>
#include <dm.h>
+#include <dm/uclass-internal.h>
#include <efi_loader.h>
#include <fastboot.h>
#include <hash.h>
return 0;
}
#endif
+
+int mmc_get_env_dev(void)
+{
+ int devnum;
+ const char *boot_device;
+ struct udevice *dev;
+
+#ifdef CONFIG_SYS_MMC_ENV_DEV
+ devnum = CONFIG_SYS_MMC_ENV_DEV;
+#else
+ devnum = 0;
+#endif
+
+ boot_device = ofnode_read_chosen_string("u-boot,spl-boot-device");
+ if (!boot_device) {
+ debug("%s: /chosen/u-boot,spl-boot-device not set\n", __func__);
+ return devnum;
+ }
+
+ debug("%s: booted from %s\n", __func__, boot_device);
+
+ if (uclass_find_device_by_ofnode(UCLASS_MMC, ofnode_path(boot_device), &dev)) {
+ debug("%s: no U-Boot device found for %s\n", __func__, boot_device);
+ return devnum;
+ }
+
+ devnum = dev->seq_;
+ debug("%s: get MMC env from mmc%d\n", __func__, devnum);
+ return devnum;
+}
#include <init.h>
#include <net.h>
#include <netdev.h>
-#include <asm/arch-rockchip/bootrom.h>
-#include <asm/io.h>
static int get_ethaddr_from_eeprom(u8 *addr)
{
return 0;
}
-
-int mmc_get_env_dev(void)
-{
- u32 bootdevice_brom_id = readl(BROM_BOOTSOURCE_ID_ADDR);
-
- if (bootdevice_brom_id == BROM_BOOTSOURCE_EMMC)
- return 0;
-
- return 1;
-}
return 0;
}
-int mmc_get_env_dev(void)
-{
- const char *boot_device =
- ofnode_read_chosen_string("u-boot,spl-boot-device");
- struct udevice *devp;
-
- if (!boot_device) {
- debug("%s: /chosen/u-boot,spl-boot-device not set\n",
- __func__);
-#ifdef CONFIG_SYS_MMC_ENV_DEV
- return CONFIG_SYS_MMC_ENV_DEV;
-#else
- return 0;
-#endif
- }
-
- debug("%s: booted from %s\n", __func__, boot_device);
-
- if (uclass_find_device_by_ofnode(UCLASS_MMC, ofnode_path(boot_device), &devp))
-#ifdef CONFIG_SYS_MMC_ENV_DEV
- return CONFIG_SYS_MMC_ENV_DEV;
-#else
- return 0;
-#endif
-
- debug("%s: get MMC ENV from mmc%d\n", __func__, devp->seq_);
-
- return devp->seq_;
-}
-
enum env_location arch_env_get_location(enum env_operation op, int prio)
{
const char *boot_device =