Faiz Abbas | 61e9fbb | 2019-10-15 18:24:40 +0530 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /** |
Michal Simek | 50fa118 | 2023-05-17 09:17:16 +0200 | [diff] [blame] | 3 | * ufs.c - UFS specific U-Boot commands |
Faiz Abbas | 61e9fbb | 2019-10-15 18:24:40 +0530 | [diff] [blame] | 4 | * |
Nishanth Menon | eaa39c6 | 2023-11-01 15:56:03 -0500 | [diff] [blame] | 5 | * Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com |
Faiz Abbas | 61e9fbb | 2019-10-15 18:24:40 +0530 | [diff] [blame] | 6 | * |
| 7 | */ |
Faiz Abbas | 61e9fbb | 2019-10-15 18:24:40 +0530 | [diff] [blame] | 8 | #include <command.h> |
| 9 | #include <ufs.h> |
Tom Rini | 5c1444f | 2024-04-27 08:10:59 -0600 | [diff] [blame] | 10 | #include <vsprintf.h> |
Faiz Abbas | 61e9fbb | 2019-10-15 18:24:40 +0530 | [diff] [blame] | 11 | |
Simon Glass | ed38aef | 2020-05-10 11:40:03 -0600 | [diff] [blame] | 12 | static int do_ufs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
Faiz Abbas | 61e9fbb | 2019-10-15 18:24:40 +0530 | [diff] [blame] | 13 | { |
| 14 | int dev, ret; |
| 15 | |
| 16 | if (argc >= 2) { |
| 17 | if (!strcmp(argv[1], "init")) { |
| 18 | if (argc == 3) { |
Simon Glass | ff9b903 | 2021-07-24 09:03:30 -0600 | [diff] [blame] | 19 | dev = dectoul(argv[2], NULL); |
Faiz Abbas | 61e9fbb | 2019-10-15 18:24:40 +0530 | [diff] [blame] | 20 | 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 | |
| 34 | U_BOOT_CMD(ufs, 3, 1, do_ufs, |
Bin Meng | 5b96203 | 2023-10-11 21:15:47 +0800 | [diff] [blame] | 35 | "UFS sub-system", |
Faiz Abbas | 61e9fbb | 2019-10-15 18:24:40 +0530 | [diff] [blame] | 36 | "init [dev] - init UFS subsystem\n" |
| 37 | ); |