1 // SPDX-License-Identifier: GPL-2.0+
2 /**
3 * ufs.c - UFS specific U-Boot commands
4 *
5 * Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com
6 *
7 */
8 #include <command.h>
9 #include <ufs.h>
10 #include <vsprintf.h>
11 #include <linux/string.h>
12
do_ufs(struct cmd_tbl * cmdtp,int flag,int argc,char * const argv[])13 static int do_ufs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
14 {
15 int dev, ret;
16
17 if (argc >= 2) {
18 if (!strcmp(argv[1], "init")) {
19 if (argc == 3) {
20 dev = dectoul(argv[2], NULL);
21 ret = ufs_probe_dev(dev);
22 if (ret)
23 return CMD_RET_FAILURE;
24 } else {
25 ufs_probe();
26 }
27
28 return CMD_RET_SUCCESS;
29 }
30 }
31
32 return CMD_RET_USAGE;
33 }
34
35 U_BOOT_CMD(ufs, 3, 1, do_ufs,
36 "UFS sub-system",
37 "init [dev] - init UFS subsystem\n"
38 );
39