From nobody Tue Oct 7 22:43:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 93BA72F8C58; Fri, 4 Jul 2025 17:36:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751650581; cv=none; b=JLWgGCIYqWNo7jbRXvNxuBeNJmysjQD1p5Q4NkX0C0U5Ia6OPXEz6JtdLKg4zIz/8VRen8a1ic9IcCPMhCltt+P4Dj3m6j5zxVwhg8BJYhphCE7Xx2MexQiwdv6ASLnTLPXWtBRcDP57w/EtURxV7HcluQ3kAAzZCr7AtxAGvfc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751650581; c=relaxed/simple; bh=8jaz+aYQDTWx1my2TCQZNcKLuM37UT8p2RZdSRV9x5E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RbW/BCh14dVBqgQ6jhpylgWlgc9J1cNcagT5eJuBnYXBQYtMgYAHbewBfkiRqzUBXVxgJNUUxJMb+TNrD7/gk3hZFRtIAaRTlrSlFdzb17YGy0Q6RUfRSKob+W7ABKkPlll3bBmCiDKIiLClPzt9CkvNfPdaiJFkC3lTtPJrl4Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EnlAXUF+; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EnlAXUF+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 490F0C4CEEE; Fri, 4 Jul 2025 17:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751650581; bh=8jaz+aYQDTWx1my2TCQZNcKLuM37UT8p2RZdSRV9x5E=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=EnlAXUF+/QV1mkeIxWRoZBCR51V5lllijW7S19FOq6wohuuVSIccxZLYR8uLNwaZf nTIAOAwJ3Pq0PSBOwZzTnrglK4LwZO/xEoqBDavP1jdz7I0ZdFhccQyuAvQcwLO3dJ 1qNMUCq7INGlLuNaMehBgAmFbVxImM/LyvpyG3F73BZ9t2f6oEBi8cQHRp8o0OputO QzzQ/ciSkVsgXCMcO2S+NTKvVPfSfiz1g7EUN6S2srdeoz3lQ8bY0MCZb0lvUkeMlv 50QsiYLgn0OosRwOi/Pvcoe1uO1Zu6mjCuX06/LmM91brPJTgK1niGXaaY6gctRtIs a4sxERU4XEo4g== From: Konrad Dybcio Date: Fri, 04 Jul 2025 19:36:09 +0200 Subject: [PATCH RFC/RFT 1/5] ufs: ufs-qcom: Fix UFS base region name in MCQ case Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250704-topic-qcom_ufs_mcq_cleanup-v1-1-c70d01b3d334@oss.qualcomm.com> References: <20250704-topic-qcom_ufs_mcq_cleanup-v1-0-c70d01b3d334@oss.qualcomm.com> In-Reply-To: <20250704-topic-qcom_ufs_mcq_cleanup-v1-0-c70d01b3d334@oss.qualcomm.com> To: Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Asutosh Das , Bart Van Assche , Stanley Chu Cc: Marijn Suijten , Can Guo , Nitin Rawat , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751650573; l=946; i=konrad.dybcio@oss.qualcomm.com; s=20230215; h=from:subject:message-id; bh=IbnTdlJA3DyHgeEuZgss0N7Bjbg2NunWI+vgqCmwlLE=; b=wAIG7O7w+MRGN7Scpx2E1RHI/qWDEKaG7e0L2T7hTqmJCedKoOZIoHGv3+obCLfX93+3xKR8j qfMXgbNws9HB98UE91CqKF47AfexB33vGojNVVqz5fSQ3SiiGbDXfjp X-Developer-Key: i=konrad.dybcio@oss.qualcomm.com; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= From: Konrad Dybcio There is no need to reinvent the wheel. There are no users yet, and the dt-bindings were never updated to accommodate for this, so fix it while we still easily can. Fixes: c263b4ef737e ("scsi: ufs: core: mcq: Configure resource regions") Signed-off-by: Konrad Dybcio --- drivers/ufs/host/ufs-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 318dca7fe3d735431e252e8a2a699ec1b7a36618..8dd9709cbdeef6ede5faa434fcb= 853e11950721f 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1899,7 +1899,7 @@ static void ufs_qcom_config_scaling_param(struct ufs_= hba *hba, =20 /* Resources */ static const struct ufshcd_res_info ufs_res_info[RES_MAX] =3D { - {.name =3D "ufs_mem",}, + {.name =3D "std",}, {.name =3D "mcq",}, /* Submission Queue DAO */ {.name =3D "mcq_sqd",}, --=20 2.50.0 From nobody Tue Oct 7 22:43:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AC0C930E851; Fri, 4 Jul 2025 17:36:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751650584; cv=none; b=CTWkzGz/CxHJLD8QFF8Y1njQdkGjH+ejp8bjgMp698hGj7bbrTzVvBHsNu54ffsTI15K0Sh2dRX8BIQTO5isS57Z+tZCvUTgvwjRbWFgC5vaRYesQ94TGmCyNMhEHhraGyS0Q49mJuLwRO/6yYTfMUpsaKOXLKpAlKbJUuhsWiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751650584; c=relaxed/simple; bh=SqIcK5tiI9BsQIocGMrC6tHDWcCPy6wP3MqXNLQUxAQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GccsHsSqcqn/9w7X2Td+mbNQWcSnDRr2yk9PNiBv9Kaj8enspSJDeGF3zarTIa0GECjaSSlE+kIClxMHrBGW9zJ9gXS2iaN0o7ANqBr4XWjx/e70XVibHj0iEhpGdqUxfdZyuTKEqJ7wl38b9wTuhIb1EWl048gbjptZSraGmmU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rXoFUieu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rXoFUieu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A6B7C4CEED; Fri, 4 Jul 2025 17:36:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751650584; bh=SqIcK5tiI9BsQIocGMrC6tHDWcCPy6wP3MqXNLQUxAQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=rXoFUieu8qo2tLehvc9SwDdBrHQwOL9wd2yZ3qNV596amF2PC4TAV727YzpLziJ/K W/7UvGDwB0tnGVc5COVBBtqa6aTxJGnRYLRI/OJuJTIMv+BnvOdfVMky+QRi/DkgBe UQFiZQyFbVOtDZ7PYo21C6A0/y9ui+loq4bIOegueokTsmva4EBM41UyKL7N+25Dc7 rQuxBgaszNlA8QsqEUH5RKb8TTONLnyuuYiyxq37+DakDg1RwCvRHlK1IALrOAu8jS Bv1mCBapR3mq3e4GG9KpP7paKy3nrcLaO+oN5F6Hy02q3sOQYOA6fynhQPIE7wgwln sCaQvnG1ZyFEA== From: Konrad Dybcio Date: Fri, 04 Jul 2025 19:36:10 +0200 Subject: [PATCH RFC/RFT 2/5] ufs: ufs-qcom: Remove inferred MCQ mappings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250704-topic-qcom_ufs_mcq_cleanup-v1-2-c70d01b3d334@oss.qualcomm.com> References: <20250704-topic-qcom_ufs_mcq_cleanup-v1-0-c70d01b3d334@oss.qualcomm.com> In-Reply-To: <20250704-topic-qcom_ufs_mcq_cleanup-v1-0-c70d01b3d334@oss.qualcomm.com> To: Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Asutosh Das , Bart Van Assche , Stanley Chu Cc: Marijn Suijten , Can Guo , Nitin Rawat , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751650573; l=5489; i=konrad.dybcio@oss.qualcomm.com; s=20230215; h=from:subject:message-id; bh=V1RnhDYSDg5d0w96zzk8uSI/I1kvAKiz2LQterElCOc=; b=ys98ZGYtiU3RgLBBpq7958MSgjOXKDHMSCo8DOZl/idG6NekseQgXkdl/DBTQrUjs1Vpbzkam 8Cz71x5tjm6D56AQk1nhACLjpSwPA/Yr6heMLRtGkST0+Gvnhy2Ay9k X-Developer-Key: i=konrad.dybcio@oss.qualcomm.com; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= From: Konrad Dybcio Stop acquiring the base HCI memory region twice. Instead, because of the need of getting the offset of MCQ regions from the controller base, get the resource for the main region and store it separately. Demand all the regions are provided in DT and don't try to make guesses, circumventing the memory map provided in FDT. There are currently no platforms with MCQ enabled, so there is no functional change. Signed-off-by: Konrad Dybcio --- drivers/ufs/host/ufs-qcom.c | 58 ++++--------------------------------= ---- drivers/ufs/host/ufshcd-pltfrm.c | 4 ++- include/ufs/ufshcd.h | 2 +- 3 files changed, 9 insertions(+), 55 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 8dd9709cbdeef6ede5faa434fcb853e11950721f..67929a3e6e6242a93ed4c84cb2d= 2f7f10de4aa5e 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -28,12 +28,6 @@ #include "ufshcd-pltfrm.h" #include "ufs-qcom.h" =20 -#define MCQ_QCFGPTR_MASK GENMASK(7, 0) -#define MCQ_QCFGPTR_UNIT 0x200 -#define MCQ_SQATTR_OFFSET(c) \ - ((((c) >> 16) & MCQ_QCFGPTR_MASK) * MCQ_QCFGPTR_UNIT) -#define MCQ_QCFG_SIZE 0x40 - /* De-emphasis for gear-5 */ #define DEEMPHASIS_3_5_dB 0x04 #define NO_DEEMPHASIS 0x0 @@ -1899,7 +1893,6 @@ static void ufs_qcom_config_scaling_param(struct ufs_= hba *hba, =20 /* Resources */ static const struct ufshcd_res_info ufs_res_info[RES_MAX] =3D { - {.name =3D "std",}, {.name =3D "mcq",}, /* Submission Queue DAO */ {.name =3D "mcq_sqd",}, @@ -1917,7 +1910,6 @@ static int ufs_qcom_mcq_config_resource(struct ufs_hb= a *hba) { struct platform_device *pdev =3D to_platform_device(hba->dev); struct ufshcd_res_info *res; - struct resource *res_mem, *res_mcq; int i, ret; =20 memcpy(hba->res, ufs_res_info, sizeof(ufs_res_info)); @@ -1929,12 +1921,6 @@ static int ufs_qcom_mcq_config_resource(struct ufs_h= ba *hba) res->name); if (!res->resource) { dev_info(hba->dev, "Resource %s not provided\n", res->name); - if (i =3D=3D RES_UFS) - return -ENODEV; - continue; - } else if (i =3D=3D RES_UFS) { - res_mem =3D res->resource; - res->base =3D hba->mmio_base; continue; } =20 @@ -1948,63 +1934,29 @@ static int ufs_qcom_mcq_config_resource(struct ufs_= hba *hba) } } =20 - /* MCQ resource provided in DT */ res =3D &hba->res[RES_MCQ]; - /* Bail if MCQ resource is provided */ if (res->base) - goto out; + return -EINVAL; =20 - /* Explicitly allocate MCQ resource from ufs_mem */ - res_mcq =3D devm_kzalloc(hba->dev, sizeof(*res_mcq), GFP_KERNEL); - if (!res_mcq) - return -ENOMEM; - - res_mcq->start =3D res_mem->start + - MCQ_SQATTR_OFFSET(hba->mcq_capabilities); - res_mcq->end =3D res_mcq->start + hba->nr_hw_queues * MCQ_QCFG_SIZE - 1; - res_mcq->flags =3D res_mem->flags; - res_mcq->name =3D "mcq"; - - ret =3D insert_resource(&iomem_resource, res_mcq); - if (ret) { - dev_err(hba->dev, "Failed to insert MCQ resource, err=3D%d\n", - ret); - return ret; - } - - res->base =3D devm_ioremap_resource(hba->dev, res_mcq); - if (IS_ERR(res->base)) { - dev_err(hba->dev, "MCQ registers mapping failed, err=3D%d\n", - (int)PTR_ERR(res->base)); - ret =3D PTR_ERR(res->base); - goto ioremap_err; - } - -out: hba->mcq_base =3D res->base; + return 0; -ioremap_err: - res->base =3D NULL; - remove_resource(res_mcq); - return ret; } =20 static int ufs_qcom_op_runtime_config(struct ufs_hba *hba) { - struct ufshcd_res_info *mem_res, *sqdao_res; + struct ufshcd_res_info *sqdao_res; struct ufshcd_mcq_opr_info_t *opr; int i; =20 - mem_res =3D &hba->res[RES_UFS]; sqdao_res =3D &hba->res[RES_MCQ_SQD]; - - if (!mem_res->base || !sqdao_res->base) + if (!sqdao_res->base) return -EINVAL; =20 for (i =3D 0; i < OPR_MAX; i++) { opr =3D &hba->mcq_opr[i]; opr->offset =3D sqdao_res->resource->start - - mem_res->resource->start + 0x40 * i; + hba->hci_res->start + 0x40 * i; opr->stride =3D 0x100; opr->base =3D sqdao_res->base + 0x40 * i; } diff --git a/drivers/ufs/host/ufshcd-pltfrm.c b/drivers/ufs/host/ufshcd-plt= frm.c index ffe5d1d2b2158882d369e4d3c902633b81378dba..0ba13ab59eafe6e5c4f8db61691= 628a4905eb52f 100644 --- a/drivers/ufs/host/ufshcd-pltfrm.c +++ b/drivers/ufs/host/ufshcd-pltfrm.c @@ -463,8 +463,9 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, void __iomem *mmio_base; int irq, err; struct device *dev =3D &pdev->dev; + struct resource *hci_res; =20 - mmio_base =3D devm_platform_ioremap_resource(pdev, 0); + mmio_base =3D devm_platform_get_and_ioremap_resource(pdev, 0, &hci_res); if (IS_ERR(mmio_base)) return PTR_ERR(mmio_base); =20 @@ -479,6 +480,7 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, } =20 hba->vops =3D vops; + hba->hci_res =3D hci_res; =20 err =3D ufshcd_parse_clock_info(hba); if (err) { diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 9b3515cee71178c96f42f757a01d975606f64c9e..28132ff759afbd3bf8977bc481d= a225d95fd461c 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -808,7 +808,6 @@ struct ufshcd_res_info { }; =20 enum ufshcd_res { - RES_UFS, RES_MCQ, RES_MCQ_SQD, RES_MCQ_SQIS, @@ -970,6 +969,7 @@ enum ufshcd_mcq_opr { */ struct ufs_hba { void __iomem *mmio_base; + struct resource *hci_res; =20 /* Virtual memory reference */ struct utp_transfer_cmd_desc *ucdl_base_addr; --=20 2.50.0 From nobody Tue Oct 7 22:43:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5D55A3196DA; Fri, 4 Jul 2025 17:36:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751650587; cv=none; b=W9crWKb1Us/6j8W3Def4VeGAlTXbptVDW63ZXJkaI0J2BMi9er3iWJg0HJ7S88wmVT5Pn7j682zvXyuj6Ql3SHseE/DDeEuRoNiNe6qcTWu9JifX1sIPnKvalK3HUxyZY23Jdtj2M0TCZzVaaBBS4BIpHkSw4baBjxrs2RHYyAo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751650587; c=relaxed/simple; bh=qbOr0CUqiIJcAM/bRqbNIazzER6BJEWViUbA8ztMfaY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lnTBSBdG7eeB25Lv4PhdMVAxS/G1qDBsdi+d20M2G30omUt7VnGPy3qBTAXm6463QpFt/OnWBZcpGbwIN60v+pY+UHd+F0XHkBYIuokBQYUTPOteWydmsvlHCR5pfm4vNqMIpr3t7PX7ZYsOabNu6T4Nn/DtfWXz1gW8x3FTiic= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eCFn7mTP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eCFn7mTP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9F42C4CEE3; Fri, 4 Jul 2025 17:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751650587; bh=qbOr0CUqiIJcAM/bRqbNIazzER6BJEWViUbA8ztMfaY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=eCFn7mTPgobDbEOPdKMqI8g1ZjUR/xkelO+YMjIi4CrrnliFdq5Am/jjQci/Raan6 m52h+7owl2snbxUq+VKhnq+MRO7hiRDguTVGpX2ouFhRl12w/T3p/jrOe9bxr5wmX0 5kUpYQegOu/uyeRV93x1bqXL5r/gx3K4jxWGxt0pgK+EqcYRnRwuAb+MuMF6Yyb1w1 ywItFBHMpT2ExuC8Baeci/R2VdjbKdzVSKyzo+cBnmVKZ+9C4SDaOMVL0j+g8sv/UY YoAx2ZjjU/9vpFzojY8/Op3V21rWutj4AstJBoHAVgpi/QYPT4uw03QbzRdwzsHIO7 GmTL5EvtTvJbA== From: Konrad Dybcio Date: Fri, 04 Jul 2025 19:36:11 +0200 Subject: [PATCH RFC/RFT 3/5] ufs: ufs-qcom: Don't try to map inexistent regions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250704-topic-qcom_ufs_mcq_cleanup-v1-3-c70d01b3d334@oss.qualcomm.com> References: <20250704-topic-qcom_ufs_mcq_cleanup-v1-0-c70d01b3d334@oss.qualcomm.com> In-Reply-To: <20250704-topic-qcom_ufs_mcq_cleanup-v1-0-c70d01b3d334@oss.qualcomm.com> To: Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Asutosh Das , Bart Van Assche , Stanley Chu Cc: Marijn Suijten , Can Guo , Nitin Rawat , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751650573; l=6857; i=konrad.dybcio@oss.qualcomm.com; s=20230215; h=from:subject:message-id; bh=ZEgdzYx+3tElY3LFFpAjG3ai4YoFjeOlp4I3Wy7XHJI=; b=9Yh++BDf7RsYHuQ5w7zoCrA+Cd+NgK6p/YZaN4gfAjJHUXuwLf7NPevY7po4TvTo+NCWVyJeE mgINw34lEMuB8tXKAiNuHeX5zuaYGEpCfIEbGglR9bRobsROL9Hurq4 X-Developer-Key: i=konrad.dybcio@oss.qualcomm.com; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= From: Konrad Dybcio [CS]Q[DI] regions are intertwined within each op region (of which there are many) and aren't actually separate register block. Remove the confusing logic that suggests otherwise and simplify the code a lot. Signed-off-by: Konrad Dybcio --- drivers/ufs/host/ufs-qcom.c | 107 ++++++++++++++++------------------------= ---- drivers/ufs/host/ufs-qcom.h | 4 ++ 2 files changed, 43 insertions(+), 68 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 67929a3e6e6242a93ed4c84cb2d2f7f10de4aa5e..52dc0da042cb62a6c28b40e4297= 73808299e102f 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1715,7 +1715,7 @@ static void ufs_qcom_dump_testbus(struct ufs_hba *hba) } =20 static int ufs_qcom_dump_regs(struct ufs_hba *hba, size_t offset, size_t l= en, - const char *prefix, enum ufshcd_res id) + const char *prefix, void __iomem *base) { u32 *regs __free(kfree) =3D NULL; size_t pos; @@ -1728,7 +1728,7 @@ static int ufs_qcom_dump_regs(struct ufs_hba *hba, si= ze_t offset, size_t len, return -ENOMEM; =20 for (pos =3D 0; pos < len; pos +=3D 4) - regs[pos / 4] =3D readl(hba->res[id].base + offset + pos); + regs[pos / 4] =3D readl(base + offset + pos); =20 print_hex_dump(KERN_ERR, prefix, len > 4 ? DUMP_PREFIX_OFFSET : DUMP_PREFIX_NONE, @@ -1739,30 +1739,31 @@ static int ufs_qcom_dump_regs(struct ufs_hba *hba, = size_t offset, size_t len, =20 static void ufs_qcom_dump_mcq_hci_regs(struct ufs_hba *hba) { + struct ufs_qcom_host *host =3D ufshcd_get_variant(hba); struct dump_info { + void __iomem *base; size_t offset; size_t len; const char *prefix; - enum ufshcd_res id; }; =20 struct dump_info mcq_dumps[] =3D { - {0x0, 256 * 4, "MCQ HCI-0 ", RES_MCQ}, - {0x400, 256 * 4, "MCQ HCI-1 ", RES_MCQ}, - {0x0, 5 * 4, "MCQ VS-0 ", RES_MCQ_VS}, - {0x0, 256 * 4, "MCQ SQD-0 ", RES_MCQ_SQD}, - {0x400, 256 * 4, "MCQ SQD-1 ", RES_MCQ_SQD}, - {0x800, 256 * 4, "MCQ SQD-2 ", RES_MCQ_SQD}, - {0xc00, 256 * 4, "MCQ SQD-3 ", RES_MCQ_SQD}, - {0x1000, 256 * 4, "MCQ SQD-4 ", RES_MCQ_SQD}, - {0x1400, 256 * 4, "MCQ SQD-5 ", RES_MCQ_SQD}, - {0x1800, 256 * 4, "MCQ SQD-6 ", RES_MCQ_SQD}, - {0x1c00, 256 * 4, "MCQ SQD-7 ", RES_MCQ_SQD}, + {hba->mcq_base, 0x0, 256 * 4, "MCQ HCI-0 "}, + {hba->mcq_base, 0x400, 256 * 4, "MCQ HCI-1 "}, + {host->mcq_vs_base, 0x0, 5 * 4, "MCQ VS-0 "}, + {host->opr_start_base, 0x0, 256 * 4, "MCQ SQD-0 "}, + {host->opr_start_base, 0x400, 256 * 4, "MCQ SQD-1 "}, + {host->opr_start_base, 0x800, 256 * 4, "MCQ SQD-2 "}, + {host->opr_start_base, 0xc00, 256 * 4, "MCQ SQD-3 "}, + {host->opr_start_base, 0x1000, 256 * 4, "MCQ SQD-4 "}, + {host->opr_start_base, 0x1400, 256 * 4, "MCQ SQD-5 "}, + {host->opr_start_base, 0x1800, 256 * 4, "MCQ SQD-6 "}, + {host->opr_start_base, 0x1c00, 256 * 4, "MCQ SQD-7 "}, }; =20 for (int i =3D 0; i < ARRAY_SIZE(mcq_dumps); i++) { ufs_qcom_dump_regs(hba, mcq_dumps[i].offset, mcq_dumps[i].len, - mcq_dumps[i].prefix, mcq_dumps[i].id); + mcq_dumps[i].prefix, mcq_dumps[i].base); cond_resched(); } } @@ -1891,74 +1892,44 @@ static void ufs_qcom_config_scaling_param(struct uf= s_hba *hba, } #endif =20 -/* Resources */ -static const struct ufshcd_res_info ufs_res_info[RES_MAX] =3D { - {.name =3D "mcq",}, - /* Submission Queue DAO */ - {.name =3D "mcq_sqd",}, - /* Submission Queue Interrupt Status */ - {.name =3D "mcq_sqis",}, - /* Completion Queue DAO */ - {.name =3D "mcq_cqd",}, - /* Completion Queue Interrupt Status */ - {.name =3D "mcq_cqis",}, - /* MCQ vendor specific */ - {.name =3D "mcq_vs",}, -}; - static int ufs_qcom_mcq_config_resource(struct ufs_hba *hba) { struct platform_device *pdev =3D to_platform_device(hba->dev); - struct ufshcd_res_info *res; - int i, ret; + struct ufs_qcom_host *host =3D ufshcd_get_variant(hba); + struct resource *sqd_res; =20 - memcpy(hba->res, ufs_res_info, sizeof(ufs_res_info)); - - for (i =3D 0; i < RES_MAX; i++) { - res =3D &hba->res[i]; - res->resource =3D platform_get_resource_byname(pdev, - IORESOURCE_MEM, - res->name); - if (!res->resource) { - dev_info(hba->dev, "Resource %s not provided\n", res->name); - continue; - } - - res->base =3D devm_ioremap_resource(hba->dev, res->resource); - if (IS_ERR(res->base)) { - dev_err(hba->dev, "Failed to map res %s, err=3D%d\n", - res->name, (int)PTR_ERR(res->base)); - ret =3D PTR_ERR(res->base); - res->base =3D NULL; - return ret; - } - } - - res =3D &hba->res[RES_MCQ]; - if (res->base) + hba->mcq_base =3D devm_platform_ioremap_resource_byname(pdev, "mcq"); + if (!hba->mcq_base) return -EINVAL; =20 - hba->mcq_base =3D res->base; + sqd_res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "mcq_sqd"); + if (!sqd_res) + return -EINVAL; + + host->opr_start_base =3D devm_ioremap_resource(hba->dev, sqd_res); + if (!host->opr_start_base) + return -EINVAL; + + host->opr_start_off =3D sqd_res->start - hba->hci_res->start; + + host->mcq_vs_base =3D devm_platform_ioremap_resource_byname(pdev, "mcq_vs= "); + if (!host->mcq_vs_base) + return -EINVAL; =20 return 0; } =20 static int ufs_qcom_op_runtime_config(struct ufs_hba *hba) { - struct ufshcd_res_info *sqdao_res; + struct ufs_qcom_host *host =3D ufshcd_get_variant(hba); struct ufshcd_mcq_opr_info_t *opr; int i; =20 - sqdao_res =3D &hba->res[RES_MCQ_SQD]; - if (!sqdao_res->base) - return -EINVAL; - for (i =3D 0; i < OPR_MAX; i++) { opr =3D &hba->mcq_opr[i]; - opr->offset =3D sqdao_res->resource->start - - hba->hci_res->start + 0x40 * i; + opr->offset =3D host->opr_start_off + 0x40 * i; opr->stride =3D 0x100; - opr->base =3D sqdao_res->base + 0x40 * i; + opr->base =3D host->opr_start_base + 0x40 * i; } =20 return 0; @@ -1973,12 +1944,12 @@ static int ufs_qcom_get_hba_mac(struct ufs_hba *hba) static int ufs_qcom_get_outstanding_cqs(struct ufs_hba *hba, unsigned long *ocqs) { - struct ufshcd_res_info *mcq_vs_res =3D &hba->res[RES_MCQ_VS]; + struct ufs_qcom_host *host =3D ufshcd_get_variant(hba); =20 - if (!mcq_vs_res->base) + if (!host->mcq_vs_base) return -EINVAL; =20 - *ocqs =3D readl(mcq_vs_res->base + UFS_MEM_CQIS_VS); + *ocqs =3D readl(host->mcq_vs_base + UFS_MEM_CQIS_VS); =20 return 0; } diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h index 0a5cfc2dd4f7d999dac9cbd671a078a65f877b68..7300e91a435607a2cef1a4f12a8= c5c1201586783 100644 --- a/drivers/ufs/host/ufs-qcom.h +++ b/drivers/ufs/host/ufs-qcom.h @@ -281,6 +281,10 @@ struct ufs_qcom_host { u32 phy_gear; =20 bool esi_enabled; + + void __iomem *opr_start_base; + resource_size_t opr_start_off; + void __iomem *mcq_vs_base; }; =20 struct ufs_qcom_drvdata { --=20 2.50.0 From nobody Tue Oct 7 22:43:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0350432624C; Fri, 4 Jul 2025 17:36:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751650591; cv=none; b=OXSTPDlUhfLfoXWKrSw6BRT6WIwDGB6sx8gkEi3e8JBLF34yIEdTCUUCYSY4ysMqbO3tfi0UuqtC8sJP0vKJZRBgRCkX5pwi/VR+yJpX7qRB5VxON7pfkJUcuSTWRBEgizp3xevWLRzxKpNkmX0oBugTelRyFQAJ7QW+IQnX9h4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751650591; c=relaxed/simple; bh=z/ePAyDgV+JrevKmvRY2qbMBnHnrNMuxv9BxUeLOU/8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PZSx+yaqmNkk4+gWruSBKPvvLGRerQf8e0WLuaXhs+ApPepbRndZluv0+psCjYkoWXTBQc2KxI/L6cuaCVckubPKaeN33A+V7DS+fsFoTKqck94NfLLy9rWKGS4jKL4tBcaBEyTddIKkFcdyaJCwzZYY4RM6b1/qpqMKrPMPjKY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sdAEb2TI; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sdAEb2TI" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1B88C4CEE3; Fri, 4 Jul 2025 17:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751650590; bh=z/ePAyDgV+JrevKmvRY2qbMBnHnrNMuxv9BxUeLOU/8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=sdAEb2TI8bcB6UqeIRvHrwoVIYFfDP4Ypqq/VLNgJTqQESxsxVHyMicuB2wZCzR9Q vH9iTzTch5iKracBadBQewiZCTsCElxOHZ3Z4ioe44JGcIaiAw+FbNAawZFGH7Fv1y Pasibw9X5kObGKy9HDVQH3SQs309zUATKhF4f5kWqGiAJnHVKIrLy7d7HRbGwECvJB GUHQf6EI3ZYUt9n2JSlOeFwbZ2i3eWxLq8UxCxcuqNL04gU8Wkf/b7eCOlC9D87A0Q /sb5jyUbI/59k+gvFkH2xpC8YNH8JP9K0pdLVLpNhCNMALV92KSp8zd6ZvQH9A9Qt0 +IC4V7jCOLk4Q== From: Konrad Dybcio Date: Fri, 04 Jul 2025 19:36:12 +0200 Subject: [PATCH RFC/RFT 4/5] ufs: ufs-qcom: Rename "mcq_sqd" to "mcq_opr" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250704-topic-qcom_ufs_mcq_cleanup-v1-4-c70d01b3d334@oss.qualcomm.com> References: <20250704-topic-qcom_ufs_mcq_cleanup-v1-0-c70d01b3d334@oss.qualcomm.com> In-Reply-To: <20250704-topic-qcom_ufs_mcq_cleanup-v1-0-c70d01b3d334@oss.qualcomm.com> To: Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Asutosh Das , Bart Van Assche , Stanley Chu Cc: Marijn Suijten , Can Guo , Nitin Rawat , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751650573; l=1660; i=konrad.dybcio@oss.qualcomm.com; s=20230215; h=from:subject:message-id; bh=qHZj5e2FXakjKwnr1HyGKlEMV85hPgCXxGadgTWBQZQ=; b=/bIxTkzHhef+/mDC3R0nLPMlb22ChAauHwsgqbkfRAStv8JKwOJWZIa2rUyHIR46w3sea6Mh+ wndgKe+ths3D87nbUJvwOcFkIECdWjuG1dLVUB+biQLkGj9JT5ICYlr X-Developer-Key: i=konrad.dybcio@oss.qualcomm.com; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= From: Konrad Dybcio SQD is a confusing name for the register block that hosts all the opregions, each one of which contains SQD/CQD/SQI/CQI subregions. Rename it since there are not even dt-bindings for this and therefore no users Signed-off-by: Konrad Dybcio --- drivers/ufs/host/ufs-qcom.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 52dc0da042cb62a6c28b40e429773808299e102f..2953b86029cfa1e5fdaa75e2917= cad79576947e2 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1896,21 +1896,21 @@ static int ufs_qcom_mcq_config_resource(struct ufs_= hba *hba) { struct platform_device *pdev =3D to_platform_device(hba->dev); struct ufs_qcom_host *host =3D ufshcd_get_variant(hba); - struct resource *sqd_res; + struct resource *opr_res; =20 hba->mcq_base =3D devm_platform_ioremap_resource_byname(pdev, "mcq"); if (!hba->mcq_base) return -EINVAL; =20 - sqd_res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "mcq_sqd"); - if (!sqd_res) + opr_res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "mcq_opr"); + if (!opr_res) return -EINVAL; =20 - host->opr_start_base =3D devm_ioremap_resource(hba->dev, sqd_res); + host->opr_start_base =3D devm_ioremap_resource(hba->dev, opr_res); if (!host->opr_start_base) return -EINVAL; =20 - host->opr_start_off =3D sqd_res->start - hba->hci_res->start; + host->opr_start_off =3D opr_res->start - hba->hci_res->start; =20 host->mcq_vs_base =3D devm_platform_ioremap_resource_byname(pdev, "mcq_vs= "); if (!host->mcq_vs_base) --=20 2.50.0 From nobody Tue Oct 7 22:43:48 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 09D6B326A68; Fri, 4 Jul 2025 17:36:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751650594; cv=none; b=RC3PM0sYF8PKcK7k//bCZynflLZ7tTU2b+YQAmUim8KerjxV3yHMFvA/8vP7iKFokrfaX/sUrggAvKgLxt6d8u36ZI1o1jdLLjQXMpgUN9wvNWfPrOWW6FeCkUe9NpL8CmGIZs2FgB320KTYmGnvxbybxs039lddNa3XpkjCq28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1751650594; c=relaxed/simple; bh=iUgw6SdLRmSY+TxjZGHq9wfHyZUGByUgELpbSlwhZh4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=APnPBUCrpZoLHDa54LL9Enn0gxCfPqqjOxHkkflZFC6UcgsDv2yQyfxWSLq9F/am+Ht4ekkRTWDdBXJrLh/NmbOKiPsgywzSSm/Pb3WrM9G0XWvFrL3La0M4tUFWICteNeJaIprrpcl+6BC5wgREey4VAJB/DNrCHF5arnXw0yQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PF4hQLWU; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PF4hQLWU" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0594BC4CEED; Fri, 4 Jul 2025 17:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1751650593; bh=iUgw6SdLRmSY+TxjZGHq9wfHyZUGByUgELpbSlwhZh4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PF4hQLWUZUFny28qzzSp6+DyN5jEtKu6ueVS13Y5+eQ3AuWNACbGc0vZOomr2SFLm tEPYUl+UY8W9Bpv+5HfQch/P5UPlk7qmJO//qeSKY2NfMFW5q2O7z1fPGBcmr85CXa 0uvpd3IUXjPOcjNXsmHyMhz/tjE5qKcGogP/k0pxQtsuFzb09ADoWh6gJprdYYaXnT 9JkUwCvWk/iu+xWLMVrQx91Fnv+Lw3Mn7UEbaSlMoX7lKazN5JzbyHeFTCapzD+6Q4 DqaeNqopLp7buSIrFkNeSGM3jXJdCtul7v2ZQWO1Acut/H0htyjnmspRuoyK/lVV1u 6YuU1vDFPWKBw== From: Konrad Dybcio Date: Fri, 04 Jul 2025 19:36:13 +0200 Subject: [PATCH RFC/RFT 5/5] ufs: ufs-qcom: Kill ufshcd_res_info Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250704-topic-qcom_ufs_mcq_cleanup-v1-5-c70d01b3d334@oss.qualcomm.com> References: <20250704-topic-qcom_ufs_mcq_cleanup-v1-0-c70d01b3d334@oss.qualcomm.com> In-Reply-To: <20250704-topic-qcom_ufs_mcq_cleanup-v1-0-c70d01b3d334@oss.qualcomm.com> To: Manivannan Sadhasivam , "James E.J. Bottomley" , "Martin K. Petersen" , Asutosh Das , Bart Van Assche , Stanley Chu Cc: Marijn Suijten , Can Guo , Nitin Rawat , linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1751650573; l=1282; i=konrad.dybcio@oss.qualcomm.com; s=20230215; h=from:subject:message-id; bh=5nEGDwR2LBYGdzzGzrzI3+xVf3CXHgIU3+o0zBEgJ/A=; b=LIvygMW9Oogay8z6+5Uv/Y2zljxt4EikyUxi8v3B+2ZKdMVIMMbqwjsPmLWuU+J6QD1idYsls YDMu7CikclmCxGi1LzVXV3buDpSq1fNjjYXP+5toSQdolgqdP46IvLh X-Developer-Key: i=konrad.dybcio@oss.qualcomm.com; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= From: Konrad Dybcio This is not used by any driver and doesn't seem like it's going to be. Remove it. Signed-off-by: Konrad Dybcio --- include/ufs/ufshcd.h | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 28132ff759afbd3bf8977bc481da225d95fd461c..e99df617ac31e983d452f8983ea= 0a5498ed64962 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -794,29 +794,6 @@ struct ufs_hba_monitor { bool enabled; }; =20 -/** - * struct ufshcd_res_info_t - MCQ related resource regions - * - * @name: resource name - * @resource: pointer to resource region - * @base: register base address - */ -struct ufshcd_res_info { - const char *name; - struct resource *resource; - void __iomem *base; -}; - -enum ufshcd_res { - RES_MCQ, - RES_MCQ_SQD, - RES_MCQ_SQIS, - RES_MCQ_CQD, - RES_MCQ_CQIS, - RES_MCQ_VS, - RES_MAX, -}; - /** * struct ufshcd_mcq_opr_info_t - Operation and Runtime registers * @@ -1127,7 +1104,6 @@ struct ufs_hba { bool lsdb_sup; bool mcq_enabled; bool mcq_esi_enabled; - struct ufshcd_res_info res[RES_MAX]; void __iomem *mcq_base; struct ufs_hw_queue *uhq; struct ufs_hw_queue *dev_cmd_queue; --=20 2.50.0