Skip to contentSkip to conversation

ufs: Exted cmd line

PATCH Superseded Raz Ben Yehuda 2 participants 8 messages Jun 7 – Jun 26 SCSI

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover ufs: Exted cmd line

The UFS command provides utilities for querying, displaying, and modifying UFS device configuration and descriptor information. It is commonly used to configure UFS logical units (LUNs) in U-Boot, allowing storage devices to be provisioned and reconfigured as needed.

Features:

* Display Device, Geometry, Unit, Configuration, and Power Descriptors
* Display LUN configuration and calculated capacities
* Modify fields in Device, Configuration, and Unit Descriptors
* Query common UFS runtime flags
* Commit configuration changes or clear all LUN configurations
* Decode and format descriptor contents for easier debugging
* Provision and configure UFS logical units

Changes in v2:

* Add HBA ID support
* Move ufs_tool.c to cmd/ufs.c
* Add myself as reviewer
* Rename patch subject to "ufs: document the UFS command"

---
Raz Ben Yehuda (5):
ufs: Expose selected UFS functions
ufs: Add flags according
ufs: extending ufs cmd line
ufs: document the UFS command
MAINTAINERS: Add myself to the list of UFS maintainers

 MAINTAINERS              |    3 +
 cmd/Makefile             |    1 +
 cmd/ufs.c                | 1309 +++++++++++++++++++++++++++++++++++++++++++++-
 doc/usage/cmd/ufs.rst    |  226 ++++++++
 drivers/ufs/ufs-uclass.c |   18 +-
 drivers/ufs/ufs.h        |   16 +
 include/ufs.h            |  374 ++++++++++++-
 7 files changed, 1929 insertions(+), 18 deletions(-)

---
base-commit: 0c035ff60c1e8caee7fccd2673ce75380dee825b
change-id: 20260607-ufs_tool2-11c3493690c4

Best regards,

Signature · 1 line
Raz Ben Yehuda <[email protected]>
#1 lore raw

PATCH v2 1/5 ufs: Expose selected UFS functions

Remove static qualifier from selected functios to allow future use

---
 drivers/ufs/ufs-uclass.c | 18 +++++++++---------
 drivers/ufs/ufs.h        | 13 +++++++++++++
 2 files changed, 22 insertions(+), 9 deletions(-)
drivers/ufs/ufs-uclass.c +9 -9
index 6a51f337e47..78f6064ddea 100644
@@ -757,7 +757,7 @@ static inline u8 ufshcd_get_upmcrs(struct ufs_hba *hba)
  *
  * Flush cache in aligned address..address+size range.
  */
-static void ufshcd_cache_flush(void *addr, unsigned long size)
+void ufshcd_cache_flush(void *addr, unsigned long size)
 {
 	uintptr_t start_addr = (uintptr_t)addr & ~(ARCH_DMA_MINALIGN - 1);
 	uintptr_t end_addr = ALIGN((uintptr_t)addr + size, ARCH_DMA_MINALIGN);
@@ -1089,8 +1089,8 @@ static inline void ufshcd_init_query(struct ufs_hba *hba,
 /**
  * ufshcd_query_flag() - API function for sending flag query requests
  */
-static int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,
-			     enum flag_idn idn, bool *flag_res)
+int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,
+		      enum flag_idn idn, bool *flag_res)
 {
 	struct ufs_query_req *request = NULL;
 	struct ufs_query_res *response = NULL;
@@ -1320,9 +1320,9 @@ out:
 /**
  * ufshcd_query_descriptor_retry - API function for sending descriptor requests
  */
-static int ufshcd_query_descriptor_retry(struct ufs_hba *hba, enum query_opcode opcode,
-					 enum desc_idn idn, u8 index, u8 selector,
-					 u8 *desc_buf, int *buf_len)
+int  ufshcd_query_descriptor_retry(struct ufs_hba *hba, enum query_opcode opcode,
+				   enum desc_idn idn, u8 index, u8 selector,
+				   u8 *desc_buf, int *buf_len)
 {
 	int err;
 	int retries;
@@ -1457,9 +1457,9 @@ static int ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_
  * ufshcd_read_desc_param - read the specified descriptor parameter
  *
  */
-static int ufshcd_read_desc_param(struct ufs_hba *hba, enum desc_idn desc_id,
-				  int desc_index, u8 param_offset,
-				  u8 *param_read_buf, u8 param_size)
+int ufshcd_read_desc_param(struct ufs_hba *hba, enum desc_idn desc_id,
+			   int desc_index, u8 param_offset,
+			   u8 *param_read_buf, u8 param_size)
 {
 	int ret;
 	u8 *desc_buf;
drivers/ufs/ufs.h +13 -0
index 0f6c93fbce7..213b489e5e4 100644
@@ -809,4 +809,17 @@ static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg)
 
 int ufshcd_probe(struct udevice *dev, struct ufs_hba_ops *hba_ops);
 
+int ufshcd_read_desc_param(struct ufs_hba *hba, enum desc_idn desc_id,
+			   int desc_index, u8 param_offset, u8 *param_read_buf,
+			   u8 param_size);
+
+void ufshcd_cache_flush(void *addr, unsigned long size);
+
+int ufshcd_query_flag(struct ufs_hba *hba, enum query_opcode opcode,
+		      enum flag_idn idn, bool *flag_res);
+
+int ufshcd_query_descriptor_retry(struct ufs_hba *hba, enum query_opcode opcode,
+				  enum desc_idn idn, u8 index, u8 selector,
+				  u8 *desc_buf, int *buf_len);
+
 #endif
Signature · 1 line
2.43.0
#2 lore raw

PATCH v2 2/5 ufs: Add flags according

In reply to Raz Ben Yehuda

Some flags are missing according to UFS 3.1

---
 drivers/ufs/ufs.h | 3 +++
 1 file changed, 3 insertions(+)
drivers/ufs/ufs.h +3 -0
index 213b489e5e4..75b7ff83155 100644
@@ -218,6 +218,9 @@ enum flag_idn {
 	QUERY_FLAG_IDN_BUSY_RTC				= 0x09,
 	QUERY_FLAG_IDN_RESERVED3			= 0x0A,
 	QUERY_FLAG_IDN_PERMANENTLY_DISABLE_FW_UPDATE	= 0x0B,
+	QUERY_FLAG_IDN_F_WRITE_BOOSTER_EN               = 0x0E,
+	QUERY_FLAG_IDN_F_WB_BUF_FLUSH_EN                = 0x0F,
+	QUERY_FLAG_IDN_F_WB_BUF_FLUSH_HIBERN8           = 0x10
 };
 
 /* Attribute idn for Query requests */
Signature · 1 line
2.43.0
#3 lore raw

PATCH v2 3/5 ufs: extending ufs cmd line

In reply to Raz Ben Yehuda

The UFS tool provides utilities for querying, displaying, and modifying UFS device configuration and descriptor information.

Features:
- Query and display Device, Geometry, Unit, Configuration, and Power Descriptors
- Display LUN configuration and calculated capacities
- Modify LUN, Configuration, and Device Descriptor fields
- Query common UFS runtime flags
- Commit configuration changes or clear all LUN configurations
- Decode and format descriptor contents
- Provisioning

---
 cmd/Makefile  |    1 +
 cmd/ufs.c     | 1309 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 include/ufs.h |  374 ++++++++++++++++-
 3 files changed, 1675 insertions(+), 9 deletions(-)
cmd/Makefile +1 -0
index bbbdfcc4ded..fef7c054881 100644
@@ -300,3 +300,4 @@ $(obj)/license_data_size.h: $(srctree)/Licenses/gpl-2.0.txt FORCE
 	$(call filechk,data_size)
 
 CFLAGS_ethsw.o := -Wno-enum-conversion
+CFLAGS_ufs.o :=  -include drivers/ufs/ufs.h
cmd/ufs.c +1302 -7

1,329 lines not on this page · raw message

include/ufs.h +372 -2

382 lines not on this page · raw message

Signature · 1 line
2.43.0
#4 lore raw

PATCH v2 4/5 ufs: document the UFS command

In reply to Raz Ben Yehuda

Add documentation for the UFS command-line interface.

The document describes the available UFS subcommands and their usage, and provides a complete command-line reference for configuring and managing UFS devices.

---
 doc/usage/cmd/ufs.rst | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 226 insertions(+)
doc/usage/cmd/ufs.rst new file +226 -0
new file mode 100644
index 00000000000..1553bc28935
@@ -0,0 +1,226 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+ufs Tool
+========
+
+The ``ufs`` tool provides utilities for querying, displaying, and modifying
+UFS device configuration and descriptor information.
+
+Features
+--------
+
+* Query and display Device, Geometry, Unit, Configuration, and Power
+  Descriptors.
+* Display LUN configuration and calculated capacities.
+* Modify LUN, Configuration, and Device Descriptor fields.
+* Configure WriteBooster-related parameters.
+* Query common UFS runtime flags.
+* Commit configuration changes or clear all LUN configurations.
+* Decode and format descriptor contents for easier debugging.
+* Provision UFS devices using exported Configuration Descriptors.
+
+The UFS tool header definitions are based on the JEDEC JESD220E
+*Universal Flash Storage (UFS) Version 3.1* specification.
+
+Usage
+-----
+
+Query descriptors::
+
+    ufs query [lun] [idn]
+
+Descriptor IDs
+~~~~~~~~~~~~~~
+
+::
+
+    0x00  Device Descriptor
+    0x01  Configuration Descriptor
+    0x02  Unit Descriptor
+    0x07  Geometry Descriptor
+    0x08  Power Descriptor
+
+Configure a Logical Unit (LUN)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+    ufs set_lun <lun> <parameter> <value>
+
+Supported parameters::
+
+    lu_enable
+    boot_lun_id
+    lu_write_protect
+    memory_type
+    data_reliability
+    num_allocunits
+    logical_block_size
+    provisioning_type
+    context_capabilities
+    lu_num_write_booster_buffer_allocunits
+
+Modify Device Descriptor fields
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+    ufs set_dev_desc <parameter> <value>
+
+Supported parameters::
+
+    descriptor_idn
+    device
+    device_class
+    device_sub_class
+    number_lu
+    boot_enable
+    descr_access_en
+    init_power_mode
+    high_priority_lun
+    secure_removal_type
+    initactive_icc_level
+    queue_depth
+    write_booster_buffer_preserve_user_space_en
+    write_booster_buffer_type
+    spec_version
+    manufacturer_id
+    periodic_rtc_update
+    device_version
+    psa_max_data_size
+    extended_ufs_features_support
+    num_shared_write_booster_buffer_allocunits
+
+Modify Configuration Descriptor fields
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+    ufs set_cfg_desc <parameter> <value>
+
+Supported parameters::
+
+    length
+    descriptor_idn
+    conf_desc_continue
+    boot_enable
+    descr_access_en
+    initpower_mode
+    high_priority_lun
+    secure_removal_type
+    init_active_icc_level
+    periodic_rtc_update
+    reserved_HPB
+    rpmb_region_enable
+    rpmb_region1_size
+    rpmb_region2_size
+    rpmb_region3_size
+    write_booster_buffer_preserve_user_space_en
+    write_booster_buffer_type
+    num_shared_write_booster_buffer_allocunits
+
+Query UFS flags
+~~~~~~~~~~~~~~~
+
+::
+
+    ufs getflag <flag_name>
+
+Supported flags::
+
+    deviceinit
+    permanent_wpe
+    pwr_on_wpe
+    bkops_en
+    life_span_mode
+    purge_enable
+    fphy_resource_removal
+    busy_rtc
+    permanently_disable_fw_update
+    write_booster_en
+    wb_buf_flush_en
+    wb_buf_flush_h8
+
+Examples
+--------
+
+Create LUN 4::
+
+    ufs query 1 1
+    ufs set_lun 4 num_allocunits 100
+    ufs commit
+    scsi scan
+
+Update WriteBooster configuration::
+
+    ufs query 1 1
+    ufs set_cfg_desc num_shared_write_booster_buffer_allocunits 100000
+    ufs set_cfg_desc write_booster_buffer_type 1
+    ufs commit
+
+Clear all LUN configurations::
+
+    ufs clearall
+
+This command clears all configured LUNs and commits the change.
+
+Set HBA ID
+~~~~~~~~~~~~~~~
+
+::
+
+    ufs sethba <hbaid>
+
+Use an hba id differs from 0.
+
+Provisioning
+------------
+
+To simplify UFS provisioning, the tool displays the memory address and
+size of the Configuration Descriptor (IDN 0x01). This allows the
+descriptor to be exported from one system and imported on another.
+
+Provisioning workflow
+~~~~~~~~~~~~~~~~~~~~~
+
+Source system
+^^^^^^^^^^^^^
+
+1. Display the Configuration Descriptor::
+
+       ufs query 1 1
+
+   The output includes the Configuration Descriptor address and size.
+
+2. Save the Configuration Descriptor to a file::
+
+       tftpput <cfg_desc_addr> <size> <filename>
+
+   Example::
+
+       tftpput 0x8ffffc610 0xe6 luns.bin
+
+   This exports the current UFS configuration, including LUN settings.
+
+Target system
+^^^^^^^^^^^^^
+
+1. Display the current Configuration Descriptor::
+
+       ufs query 1 1
+
+2. Load the configuration file into the Configuration Descriptor buffer
+   using XMODEM or TFTP::
+
+       loadx 0x8ffffce00
+
+   or::
+
+       tftpget 0x8ffffce00 luns.bin
+
+3. Commit the configuration to the UFS device::
+
+       ufs commit
+
+   The imported Configuration Descriptor is written to the device and
+   becomes active after the commit operation completes.
Signature · 1 line
2.43.0
#5 lore raw

Re: [PATCH v2 4/5] ufs: document the UFS command

Hi Raz Ben Yehuda,

Quoted 19 lines · On 6/7/26 5:45 PM, Raz Ben Yehuda via B4 Relay wrote:

From: Raz Ben Yehuda <[email protected]>

Add documentation for the UFS command-line interface.

The document describes the available UFS subcommands and their usage, and provides a complete command-line reference for configuring and managing UFS devices.

---
  doc/usage/cmd/ufs.rst | 226 ++++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 226 insertions(+)
doc/usage/cmd/ufs.rst new file +0 -0
new file mode 100644
index 00000000000..1553bc28935

doc/usage/cmd/ufs.rst line 8

Quoted 8 lines
doc/usage/cmd/ufs.rst new file +8 -0
@@ -0,0 +1,226 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+ufs Tool
+========
+
+The ``ufs`` tool provides utilities for querying, displaying, and modifying
+UFS device configuration and descriptor information.
+

It's not a tool, it's a command.

Please follow the same template as other command documentation.

For example, doc/usage/cmd/sm3sum.rst was recently added.

So:

.. index::
single: ufs (command)

ufs command
===========

Synopsis
--------

::

<output of help ufs from U-Boot and/or all supported ufs commands, similarly to SYNOPSIS section in manpage>

Description
-----------

<description of each command and their options, see the mmc.rst example for something that is likely closer to the ufs command> <you *must* specify if parameters, functions, features, etc... are only available if a specific Kconfig symbol is enabled>

Examples
--------

<typical example usage of the ufs tool with the console output kept>

Configuration
-------------

<specify which Kconfig symbol is necessary to be able to use the ufs command at all> <specify which Kconfig symbols are necessary for subcommands or features>

If the ufs command doesn't follow the general rules applicable to commands (see https://docs.u-boot-project.org/en/latest/usage/cmdline.html#general-rules) then you must make this clear as well. Specifically, are numbers parsed as hex values by default or not. Does it return something else than 0 on success?

This document is also missing

ufs init
ufs luns
ufs clearall

It documents ufs sethba which isn't implemented (at least not provided in the help text of the command).

Quoted 13 lines
doc/usage/cmd/ufs.rst new file +13 -0
+Features
+--------
+
+* Query and display Device, Geometry, Unit, Configuration, and Power
+  Descriptors.
+* Display LUN configuration and calculated capacities.
+* Modify LUN, Configuration, and Device Descriptor fields.
+* Configure WriteBooster-related parameters.
+* Query common UFS runtime flags.
+* Commit configuration changes or clear all LUN configurations.
+* Decode and format descriptor contents for easier debugging.
+* Provision UFS devices using exported Configuration Descriptors.
+

doc/usage/cmd/ufs.rst line 31

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+The UFS tool header definitions are based on the JEDEC JESD220E
+*Universal Flash Storage (UFS) Version 3.1* specification.
+
+Usage
+-----
+
+Query descriptors::
+
+    ufs query [lun] [idn]
+

This is wrong, lun and idn aren't optional.

doc/usage/cmd/ufs.rst line 42

Quoted 11 lines
doc/usage/cmd/ufs.rst new file +11 -0
+Descriptor IDs
+~~~~~~~~~~~~~~
+
+::
+
+    0x00  Device Descriptor
+    0x01  Configuration Descriptor
+    0x02  Unit Descriptor
+    0x07  Geometry Descriptor
+    0x08  Power Descriptor
+

What do they do.

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+Configure a Logical Unit (LUN)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+    ufs set_lun <lun> <parameter> <value>
+
+Supported parameters::
+
+    lu_enable

doc/usage/cmd/ufs.rst line 62

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+    boot_lun_id
+    lu_write_protect
+    memory_type
+    data_reliability
+    num_allocunits
+    logical_block_size
+    provisioning_type
+    context_capabilities
+    lu_num_write_booster_buffer_allocunits
+

What do they do, what are the allowed values.

Quoted 21 lines
doc/usage/cmd/ufs.rst new file +21 -0
+Modify Device Descriptor fields
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+    ufs set_dev_desc <parameter> <value>
+
+Supported parameters::
+
+    descriptor_idn
+    device
+    device_class
+    device_sub_class
+    number_lu
+    boot_enable
+    descr_access_en
+    init_power_mode
+    high_priority_lun
+    secure_removal_type
+    initactive_icc_level
+    queue_depth

doc/usage/cmd/ufs.rst line 93

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+    write_booster_buffer_preserve_user_space_en
+    write_booster_buffer_type
+    spec_version
+    manufacturer_id
+    periodic_rtc_update
+    device_version
+    psa_max_data_size
+    extended_ufs_features_support
+    num_shared_write_booster_buffer_allocunits
+

What do they do, what are the allowed values.

Quoted 18 lines
doc/usage/cmd/ufs.rst new file +18 -0
+Modify Configuration Descriptor fields
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+    ufs set_cfg_desc <parameter> <value>
+
+Supported parameters::
+
+    length
+    descriptor_idn
+    conf_desc_continue
+    boot_enable
+    descr_access_en
+    initpower_mode
+    high_priority_lun
+    secure_removal_type
+    init_active_icc_level

doc/usage/cmd/ufs.rst line 121

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+    periodic_rtc_update
+    reserved_HPB
+    rpmb_region_enable
+    rpmb_region1_size
+    rpmb_region2_size
+    rpmb_region3_size
+    write_booster_buffer_preserve_user_space_en
+    write_booster_buffer_type
+    num_shared_write_booster_buffer_allocunits
+

What do they do, what are the allowed values.

Quoted 12 lines
doc/usage/cmd/ufs.rst new file +12 -0
+Query UFS flags
+~~~~~~~~~~~~~~~
+
+::
+
+    ufs getflag <flag_name>
+
+Supported flags::
+
+    deviceinit
+    permanent_wpe
+    pwr_on_wpe

doc/usage/cmd/ufs.rst line 143

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+    bkops_en
+    life_span_mode
+    purge_enable
+    fphy_resource_removal
+    busy_rtc
+    permanently_disable_fw_update
+    write_booster_en
+    wb_buf_flush_en
+    wb_buf_flush_h8
+

What do they do, what are the allowed values.

Cheers,
Quentin

#6 lore raw

Re: [PATCH v2 4/5] ufs: document the UFS command

Please ignore this mail, I see there is a v5 of this series (without a cover-letter, hence why I missed it when looking for new versions) and at cursory glance at least a few if not all of the comments have been tackled already.

Sorry for the noise

Quoted 236 lines · Quentin Schulz

Hi Raz Ben Yehuda,

Quoted 27 lines · On 6/7/26 5:45 PM, Raz Ben Yehuda via B4 Relay wrote:

From: Raz Ben Yehuda <[email protected]>

Add documentation for the UFS command-line interface.

The document describes the available UFS subcommands and their usage, and provides a complete command-line reference for configuring and managing UFS devices.

---
  doc/usage/cmd/ufs.rst | 226 ++++++++++++++++++++++++++++++++++++++++
++++++++++

  1 file changed, 226 insertions(+)
doc/usage/cmd/ufs.rst new file +6 -0
new file mode 100644
index 00000000000..1553bc28935
@@ -0,0 +1,226 @@
+.. SPDX-License-Identifier: GPL-2.0+
+
+ufs Tool
+========
+
+The ``ufs`` tool provides utilities for querying, displaying, and 

modifying

doc/usage/cmd/ufs.rst

Quoted 2 lines
doc/usage/cmd/ufs.rst new file +2 -0
+UFS device configuration and descriptor information.
+

It's not a tool, it's a command.

Please follow the same template as other command documentation.

For example, doc/usage/cmd/sm3sum.rst was recently added.

So:

.. index::
   single: ufs (command)

ufs command
===========

Synopsis
--------

::

<output of help ufs from U-Boot and/or all supported ufs commands, similarly to SYNOPSIS section in manpage>

Description
-----------

<description of each command and their options, see the mmc.rst example for something that is likely closer to the ufs command> <you *must* specify if parameters, functions, features, etc... are only available if a specific Kconfig symbol is enabled>

Examples
--------

<typical example usage of the ufs tool with the console output kept>

Configuration
-------------

<specify which Kconfig symbol is necessary to be able to use the ufs command at all> <specify which Kconfig symbols are necessary for subcommands or features>

If the ufs command doesn't follow the general rules applicable to commands (see https://eur02.safelinks.protection.outlook.com/? url=https%3A%2F%2Fdocs.u-boot- project.org%2Fen%2Flatest%2Fusage%2Fcmdline.html%23general- rules&data=05%7C02%7Cquentin.schulz%40cherry.de%7C3871837b97374bfac7e808ded36694bb%7C5e0e1b5221b54e7b83bb514ec460677e%7C0%7C0%7C639180634709249262%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=oqfGHsgWJ8kuajTSmBcstmmRyGVu7b29n%2Bd9zWKOiFg%3D&reserved=0) then you must make this clear as well. Specifically, are numbers parsed as hex values by default or not. Does it return something else than 0 on success?

This document is also missing

ufs init
ufs luns
ufs clearall

It documents ufs sethba which isn't implemented (at least not provided in the help text of the command).

Quoted 13 lines
doc/usage/cmd/ufs.rst new file +13 -0
+Features
+--------
+
+* Query and display Device, Geometry, Unit, Configuration, and Power
+  Descriptors.
+* Display LUN configuration and calculated capacities.
+* Modify LUN, Configuration, and Device Descriptor fields.
+* Configure WriteBooster-related parameters.
+* Query common UFS runtime flags.
+* Commit configuration changes or clear all LUN configurations.
+* Decode and format descriptor contents for easier debugging.
+* Provision UFS devices using exported Configuration Descriptors.
+

doc/usage/cmd/ufs.rst line 31

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+The UFS tool header definitions are based on the JEDEC JESD220E
+*Universal Flash Storage (UFS) Version 3.1* specification.
+
+Usage
+-----
+
+Query descriptors::
+
+    ufs query [lun] [idn]
+

This is wrong, lun and idn aren't optional.

doc/usage/cmd/ufs.rst line 42

Quoted 11 lines
doc/usage/cmd/ufs.rst new file +11 -0
+Descriptor IDs
+~~~~~~~~~~~~~~
+
+::
+
+    0x00  Device Descriptor
+    0x01  Configuration Descriptor
+    0x02  Unit Descriptor
+    0x07  Geometry Descriptor
+    0x08  Power Descriptor
+

What do they do.

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+Configure a Logical Unit (LUN)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+    ufs set_lun <lun> <parameter> <value>
+
+Supported parameters::
+
+    lu_enable

doc/usage/cmd/ufs.rst line 62

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+    boot_lun_id
+    lu_write_protect
+    memory_type
+    data_reliability
+    num_allocunits
+    logical_block_size
+    provisioning_type
+    context_capabilities
+    lu_num_write_booster_buffer_allocunits
+

What do they do, what are the allowed values.

Quoted 21 lines
doc/usage/cmd/ufs.rst new file +21 -0
+Modify Device Descriptor fields
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+    ufs set_dev_desc <parameter> <value>
+
+Supported parameters::
+
+    descriptor_idn
+    device
+    device_class
+    device_sub_class
+    number_lu
+    boot_enable
+    descr_access_en
+    init_power_mode
+    high_priority_lun
+    secure_removal_type
+    initactive_icc_level
+    queue_depth

doc/usage/cmd/ufs.rst line 93

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+    write_booster_buffer_preserve_user_space_en
+    write_booster_buffer_type
+    spec_version
+    manufacturer_id
+    periodic_rtc_update
+    device_version
+    psa_max_data_size
+    extended_ufs_features_support
+    num_shared_write_booster_buffer_allocunits
+

What do they do, what are the allowed values.

Quoted 18 lines
doc/usage/cmd/ufs.rst new file +18 -0
+Modify Configuration Descriptor fields
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+::
+
+    ufs set_cfg_desc <parameter> <value>
+
+Supported parameters::
+
+    length
+    descriptor_idn
+    conf_desc_continue
+    boot_enable
+    descr_access_en
+    initpower_mode
+    high_priority_lun
+    secure_removal_type
+    init_active_icc_level

doc/usage/cmd/ufs.rst line 121

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+    periodic_rtc_update
+    reserved_HPB
+    rpmb_region_enable
+    rpmb_region1_size
+    rpmb_region2_size
+    rpmb_region3_size
+    write_booster_buffer_preserve_user_space_en
+    write_booster_buffer_type
+    num_shared_write_booster_buffer_allocunits
+

What do they do, what are the allowed values.

Quoted 12 lines
doc/usage/cmd/ufs.rst new file +12 -0
+Query UFS flags
+~~~~~~~~~~~~~~~
+
+::
+
+    ufs getflag <flag_name>
+
+Supported flags::
+
+    deviceinit
+    permanent_wpe
+    pwr_on_wpe

doc/usage/cmd/ufs.rst line 143

Quoted 10 lines
doc/usage/cmd/ufs.rst new file +10 -0
+    bkops_en
+    life_span_mode
+    purge_enable
+    fphy_resource_removal
+    busy_rtc
+    permanently_disable_fw_update
+    write_booster_en
+    wb_buf_flush_en
+    wb_buf_flush_h8
+

What do they do, what are the allowed values.

Cheers,
Quentin

#7 lore raw

PATCH v2 5/5 MAINTAINERS: Add myself to the list of UFS maintainers

In reply to Raz Ben Yehuda

Adding myself to ufs.

---
 MAINTAINERS | 3 +++
 1 file changed, 3 insertions(+)
MAINTAINERS +3 -0
index 571af196465..d2257a8327c 100644
@@ -1920,8 +1920,11 @@ UFS
 M:	Neil Armstrong <[email protected]>
 M:	Bhupesh Sharma <[email protected]>
 M:	Neha Malcom Francis <[email protected]>
+R:	Raz Ben Yehuda <[email protected]>
 S:	Maintained
+F:	cmd/ufs.c
 F:	common/spl/spl_ufs.c
+F:	doc/usage/cmd/ufs.rst
 F:	drivers/ufs/
 
 UPL
Signature · 1 line
2.43.0