blob: 790dab50f183146cbded44a03b38d1e3e75d2475 [file] [log] [blame]
Faiz Abbas61e9fbb2019-10-15 18:24:40 +05301// SPDX-License-Identifier: GPL-2.0+
2/**
Michal Simek50fa1182023-05-17 09:17:16 +02003 * ufs.c - UFS specific U-Boot commands
Faiz Abbas61e9fbb2019-10-15 18:24:40 +05304 *
Nishanth Menoneaa39c62023-11-01 15:56:03 -05005 * Copyright (C) 2019 Texas Instruments Incorporated - https://www.ti.com
Faiz Abbas61e9fbb2019-10-15 18:24:40 +05306 *
7 */
Faiz Abbas61e9fbb2019-10-15 18:24:40 +05308#include <command.h>
9#include <ufs.h>
Tom Rinidec7ea02024-05-20 13:35:03 -060010#include <vsprintf.h>
Tom Riniee8ed542025-05-14 16:46:00 -060011#include <linux/string.h>
Faiz Abbas61e9fbb2019-10-15 18:24:40 +053012
Simon Glassed38aef2020-05-10 11:40:03 -060013static int do_ufs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
Faiz Abbas61e9fbb2019-10-15 18:24:40 +053014{
15 int dev, ret;
16
17 if (argc >= 2) {
18 if (!strcmp(argv[1], "init")) {
19 if (argc == 3) {
Simon Glassff9b9032021-07-24 09:03:30 -060020 dev = dectoul(argv[2], NULL);
Faiz Abbas61e9fbb2019-10-15 18:24:40 +053021 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
35U_BOOT_CMD(ufs, 3, 1, do_ufs,
Bin Meng5b962032023-10-11 21:15:47 +080036 "UFS sub-system",
Faiz Abbas61e9fbb2019-10-15 18:24:40 +053037 "init [dev] - init UFS subsystem\n"
38);