From: Martin K. Petersen Date: Tue, 5 May 2026 07:28:56 +0000 (-0400) Subject: Merge patch series "scsi: ufs: Add persistent TX Equalization settings support" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=877073467dd6bc33aa0fe851356ba589d942e006;p=thirdparty%2Flinux.git Merge patch series "scsi: ufs: Add persistent TX Equalization settings support" Can Guo says: Hi, This series is a follow-up to the earlier TX Equalization enablement series: https://lore.kernel.org/all/20260325152154.1604082-1-can.guo@oss.qualcomm.com In that cover letter, the "Next" section mentioned adding support for UFS v5.0 Attributes qTxEQGnSettings and wTxEQGnSettingsExt, and enabling persistent storage/retrieval of optimal TX Equalization settings. This 2-patch series implements that part. Motivation ========== TX EQTR procedure is required to find the optimal TX Equalization settings for HS Gears (4-6) before changing Power Mode to the target HS Gears. However, TX EQTR procedure introduces latencies to the first Power Mode change. With optimal TX Equalization settings stored in UFS v5.0 Attributes qTxEQGnSettings and wTxEQGnSettingsExt, host software can reuse known-good settings and avoid going through the TX EQTR procedure. Array Attribute Model ===================== qTxEQGnSettings and wTxEQGnSettingsExt are array-type Attributes. Each element in an array-type Attribute is selected by an (Index, Selector) pair. For these two attributes: - Valid Index range: [0, Max HS Gear - 1] - Valid Selector range: [0, 1] This effectively forms a 2-dimensional array. For HS-Gear n, its TX Equalization settings are stored/retrieved at Index (n - 1). Selector is configurable via a module parameter so that platforms can choose the Selector policy that matches their use. Implementation Overview ======================= 1. Introduce a generic helper for 64-bit query attributes: ufshcd_query_attr_qword(). 2. Add TX EQ settings persistence flow: - Read stored settings from qTxEQGnSettings & wTxEQGnSettingsExt. - Decode and populate per-gear TX EQ parameters. - Use Bit[15] in wTxEQGnSettingsExt as validity indication. - Store trained settings back to these attributes for future reuse. 3. Integrate with existing lifecycle: - Retrieve settings during device parameter initialization. - Store settings during shutdown. New Module Parameters ===================== Three module parameters are added for TX EQ settings persistence control: - txeq_setting_sel (default: 0, range: 0..1) Selects which selector value is used when reading/writing qTxEQGnSettings and wTxEQGnSettingsExt. - retrieve_txeq_setting (default: true) Enables/disables retrieving stored TX EQ settings from device attributes during initialization. - store_txeq_setting (default: true) Enables/disables storing last trained TX EQ settings into device attributes during shutdown. Testing ======= Tested on a UFS v5.0 platform: - TX Equalization setting store path, settings were correctly encoded and stored. - TX Equalization setting retrieval path, settings were correctly extracted and reused. - Full TX EQTR procedure was skipped for a given HS Gear when valid TX EQ settings were provided in qTxEQGnSettings & wTxEQGnSettingsExt for the given HS-Gear. Link: https://patch.msgid.link/20260424151420.111675-1-can.guo@oss.qualcomm.com Signed-off-by: Martin K. Petersen --- 877073467dd6bc33aa0fe851356ba589d942e006