2 * Copyright (C) 2016 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5 * SPDX-License-Identifier: GPL-2.0+
10 #include <linux/errno.h>
12 static int find_first_mmc_device(void)
17 for (i = 0; (mmc = find_mmc_device(i)); i++) {
18 if (!mmc_init(mmc) && IS_MMC(mmc))
25 int mmc_get_env_dev(void)
27 return find_first_mmc_device();
30 static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
34 dev = find_first_mmc_device();
36 return CMD_RET_FAILURE;
38 setenv_ulong("mmc_first_dev", dev);
39 return CMD_RET_SUCCESS;
43 mmcsetn, 1, 1, do_mmcsetn,
44 "Set the first MMC (not SD) dev number to \"mmc_first_dev\" environment",