From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C2973AFAFF; Mon, 15 Jun 2026 05:58:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781503119; cv=none; b=QF8S506WOaTblQ9QBFQf53sCldzyXfMwyPaEPx70o/lpg6/9rfWFCcWfW4lUaTB5i43pNLtGfhcNea9Au0AzPV7pitoJUiIHS/xZPGH6f9diJojVLcEJT5ikqB7+o5BbV5J6VSJ7ePj598hHziPGlipruf8V992Z8T/uN4kW77Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781503119; c=relaxed/simple; bh=SS/uJZRsXXasD0BBkT0x8L8HcjDGIkeq8sn2Pkbk8WA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=msJCoMaAvTwVCvY/6uOjTeIt/yfYXbjyp92vVmVEPKgxIg/XnoI7cSfgFMTxXlqnvZ/7m6lKrAnLpr/x1GpotS2rayi0Juup8TZFeYRcJ7moorA6yNo6tEaOQO3AodsjUZvURRB6o6zYg+czl9vHNduH6PleiC57xuQ60YPUw1k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=uQhKKn3V; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="uQhKKn3V" X-UUID: 386624ee687f11f18dc8c9802ae25ab1-20260615 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=7lono346LLiByVxDpmcbPatLkqlMCZPQmgQ7Az+Hj/8=; b=uQhKKn3VU2BqIva/rYfTrP1E8olZRBH13h7CWit43p6ckhEMz+ZvdD6MwySSdbZpb4c2rg5H0L/ORnP0gCwgJnn3KlOf7WQrhH91Hn5SNrLR4XelhHUzfB/c/UJ3DlnYKJpggHTo+vbCRezkajodYQJ/pNuTn2MM6fXH10Hstsk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.3.15,REQID:a48269bc-cead-4e58-890b-9756826d92d8,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:e276073,CLOUDID:0815cd30-7784-4a77-a538-47ed6151d81b,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|123|836|865|888|898,TC:-5, Content:0|15|50,EDM:-3,IP:nil,URL:0,File:130,RT:0,Bulk:nil,QS:nil,BEC:-1,C OL:0,OSI:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0 X-CID-BVR: 2,SSN|SDN X-CID-BAS: 2,SSN|SDN,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-CID-RHF: D41D8CD98F00B204E9800998ECF8427E X-UUID: 386624ee687f11f18dc8c9802ae25ab1-20260615 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 154393648; Mon, 15 Jun 2026 13:58:24 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by MTKMBS09N2.mediatek.inc (172.21.101.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Mon, 15 Jun 2026 13:58:22 +0800 Received: from mtksitap99.mediatek.inc (10.233.130.16) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.2562.29 via Frontend Transport; Mon, 15 Jun 2026 13:58:22 +0800 From: To: , , , , , , Matthias Brugger , AngeloGioacchino Del Regno CC: , , , , , , , , Ed Tsai Subject: [PATCH v3 1/3] ufs: core: Add get_hba_nortt callback for vendor-specific RTT capability Date: Mon, 15 Jun 2026 13:57:15 +0800 Message-ID: <20260615055802.105479-2-ed.tsai@mediatek.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20260615055802.105479-1-ed.tsai@mediatek.com> References: <20260615055802.105479-1-ed.tsai@mediatek.com> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N From: Ed Tsai The number of outstanding RTTs read from host controller capability register is problematic on some platforms. Add a new vendor callback get_hba_nortt() to allow platform vendors to override the default RTT capability value with platform-specific handling. This patch keeps max_num_rtt field for bisectability and will be removed in a later patch once all platforms are migrated. Signed-off-by: Ed Tsai --- drivers/ufs/core/ufshcd.c | 5 ++++- include/ufs/ufshcd.h | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index c3f08957d179..382b6041c716 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2529,7 +2529,10 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) hba->nutmrs = ((hba->capabilities & MASK_TASK_MANAGEMENT_REQUEST_SLOTS) >> 16) + 1; - hba->nortt = FIELD_GET(MASK_NUMBER_OUTSTANDING_RTT, hba->capabilities) + 1; + if (hba->vops && hba->vops->get_hba_nortt) + hba->nortt = hba->vops->get_hba_nortt(hba); + else + hba->nortt = FIELD_GET(MASK_NUMBER_OUTSTANDING_RTT, hba->capabilities) + 1; /* Read crypto capabilities */ err = ufshcd_hba_init_crypto_capabilities(hba); diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index cfbc75d8df83..421c286481e8 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -415,6 +415,8 @@ struct ufshcd_tx_eq_params { * @get_rx_fom: called to get Figure of Merit (FOM) value. * @tx_eqtr_notify: called before and after TX Equalization Training procedure * to allow platform vendor specific configs to take place. + * @get_hba_nortt: called to get maximum number of outstanding RTTs supported by + * the controller. */ struct ufs_hba_variant_ops { const char *name; @@ -477,6 +479,7 @@ struct ufs_hba_variant_ops { int (*tx_eqtr_notify)(struct ufs_hba *hba, enum ufs_notify_change_status status, struct ufs_pa_layer_attr *pwr_mode); + int (*get_hba_nortt)(struct ufs_hba *hba); }; /* clock gating state */ -- 2.45.2