blob: 6e21fbb1685ceea926427691baa43599753e60f9 [file] [log] [blame]
Faiz Abbasa539c8b2019-10-15 18:24:40 +05301// SPDX-License-Identifier: GPL-2.0+
2/**
Michal Simek1be82af2023-05-17 09:17:16 +02003 * ufs.c - UFS specific U-Boot commands
Faiz Abbasa539c8b2019-10-15 18:24:40 +05304 *
Nishanth Menona94a4072023-11-01 15:56:03 -05005 * Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com
Faiz Abbasa539c8b2019-10-15 18:24:40 +05306 *
7 */
Faiz Abbasa539c8b2019-10-15 18:24:40 +05308#include <command.h>
9#include <ufs.h>
Tom Rini301bac62024-04-27 08:10:59 -060010#include <vsprintf.h>
Faiz Abbasa539c8b2019-10-15 18:24:40 +053011
Simon Glass09140112020-05-10 11:40:03 -060012static int do_ufs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Faiz Abbasa539c8b2019-10-15 18:24:40 +053013{
14 int dev, ret;
15
16 if (argc >= 2) {
17 if (!strcmp(argv[1], "init")) {
18 if (argc == 3) {
Simon Glass0b1284e2021-07-24 09:03:30 -060019 dev = dectoul(argv[2], NULL);
Faiz Abbasa539c8b2019-10-15 18:24:40 +053020 ret = ufs_probe_dev(dev);
21 if (ret)
22 return CMD_RET_FAILURE;
23 } else {
24 ufs_probe();
25 }
26
27 return CMD_RET_SUCCESS;
28 }
29 }
30
31 return CMD_RET_USAGE;
32}
33
34U_BOOT_CMD(ufs, 3, 1, do_ufs,
Bin Mengba537e92023-10-11 21:15:47 +080035 "UFS sub-system",
Faiz Abbasa539c8b2019-10-15 18:24:40 +053036 "init [dev] - init UFS subsystem\n"
37);