summaryrefslogtreecommitdiff
path: root/arch/arm/mach-uniphier/mmc-first-dev.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-02-29 08:00:53 -0500
committerTom Rini <trini@konsulko.com>2020-02-29 08:00:53 -0500
commit1e85aaf3723f0ecd06fcf62e2d2482749e1995d6 (patch)
tree4726779c31fb724e6d1e22da052e90e9f2293372 /arch/arm/mach-uniphier/mmc-first-dev.c
parent9e1d65f36b83c5422ece3c0ea28d07a2246cb07f (diff)
parent53265152d2e395bc363d9824a06a1ffd5df3438e (diff)
Merge tag 'uniphier-v2020.04-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-uniphier
UniPhier SoC updates for v2020.04 (3rd) - Enable ADMA and HS400 for the eMMC driver on 64-bit SoCs - Add some convenient environment variables to handle SD card - Sanitize the NAND controller reset sequence and its WP handling - Sync DT with Linux
Diffstat (limited to 'arch/arm/mach-uniphier/mmc-first-dev.c')
-rw-r--r--arch/arm/mach-uniphier/mmc-first-dev.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/arch/arm/mach-uniphier/mmc-first-dev.c b/arch/arm/mach-uniphier/mmc-first-dev.c
index 149e662070f..e2f4f4eb5c7 100644
--- a/arch/arm/mach-uniphier/mmc-first-dev.c
+++ b/arch/arm/mach-uniphier/mmc-first-dev.c
@@ -9,13 +9,14 @@
#include <mmc.h>
#include <linux/errno.h>
-static int find_first_mmc_device(void)
+static int find_first_mmc_device(bool is_sd)
{
struct mmc *mmc;
int i;
for (i = 0; (mmc = find_mmc_device(i)); i++) {
- if (!mmc_init(mmc) && IS_MMC(mmc))
+ if (!mmc_init(mmc) &&
+ ((is_sd && IS_SD(mmc)) || (!is_sd && IS_MMC(mmc))))
return i;
}
@@ -24,14 +25,14 @@ static int find_first_mmc_device(void)
int mmc_get_env_dev(void)
{
- return find_first_mmc_device();
+ return find_first_mmc_device(false);
}
static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
int dev;
- dev = find_first_mmc_device();
+ dev = find_first_mmc_device(false);
if (dev < 0)
return CMD_RET_FAILURE;
@@ -44,3 +45,21 @@ U_BOOT_CMD(
"Set the first MMC (not SD) dev number to \"mmc_first_dev\" environment",
""
);
+
+static int do_sdsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ int dev;
+
+ dev = find_first_mmc_device(true);
+ if (dev < 0)
+ return CMD_RET_FAILURE;
+
+ env_set_ulong("sd_first_dev", dev);
+ return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(
+ sdsetn, 1, 1, do_sdsetn,
+ "Set the first SD dev number to \"sd_first_dev\" environment",
+ ""
+);