1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2016 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
9 #include <linux/errno.h>
11 static int find_first_mmc_device(void)
16 for (i = 0; (mmc = find_mmc_device(i)); i++) {
17 if (!mmc_init(mmc) && IS_MMC(mmc))
24 int mmc_get_env_dev(void)
26 return find_first_mmc_device();
29 static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
33 dev = find_first_mmc_device();
35 return CMD_RET_FAILURE;
37 env_set_ulong("mmc_first_dev", dev);
38 return CMD_RET_SUCCESS;
42 mmcsetn, 1, 1, do_mmcsetn,
43 "Set the first MMC (not SD) dev number to \"mmc_first_dev\" environment",