aboutsummaryrefslogtreecommitdiff
path: root/board/xilinx
diff options
context:
space:
mode:
authorMichal Simek2021-05-19 15:16:19 +0200
committerMichal Simek2021-06-23 09:48:35 +0200
commit476588c9b484d9483a1d309499cd83dad49cec73 (patch)
treeac73a01178332905698d54b5d5f3fcb16533c936 /board/xilinx
parent02ac1553b8329f866c1761f5d9fe66972817782c (diff)
arm64: zynqmp: Handle MMC seq number based on boot device
K26 has EMMC and SD and default 0 is not working when system is booting out of SD which is controller 1. Add controller autodetection via mmc_get_env_dev(). The same code is used for distro_boot selection done in board_late_init(). bootseq variable can't be reused because this is called so late. Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'board/xilinx')
-rw-r--r--board/xilinx/zynqmp/zynqmp.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index d3c68260d3f..208eadef454 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -720,6 +720,41 @@ int checkboard(void)
return 0;
}
+int mmc_get_env_dev(void)
+{
+ struct udevice *dev;
+ int bootseq = 0;
+
+ switch (zynqmp_get_bootmode()) {
+ case EMMC_MODE:
+ case SD_MODE:
+ if (uclass_get_device_by_name(UCLASS_MMC,
+ "mmc@ff160000", &dev) &&
+ uclass_get_device_by_name(UCLASS_MMC,
+ "sdhci@ff160000", &dev)) {
+ return -1;
+ }
+ bootseq = dev_seq(dev);
+ break;
+ case SD1_LSHFT_MODE:
+ case SD_MODE1:
+ if (uclass_get_device_by_name(UCLASS_MMC,
+ "mmc@ff170000", &dev) &&
+ uclass_get_device_by_name(UCLASS_MMC,
+ "sdhci@ff170000", &dev)) {
+ return -1;
+ }
+ bootseq = dev_seq(dev);
+ break;
+ default:
+ break;
+ }
+
+ debug("bootseq %d\n", bootseq);
+
+ return bootseq;
+}
+
enum env_location env_get_location(enum env_operation op, int prio)
{
u32 bootmode = zynqmp_get_bootmode();