From patchwork Thu Aug 15 05:16:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam via B4 Relay X-Patchwork-Id: 13764404 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 E590218EAD; Thu, 15 Aug 2024 05:17:00 +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=1723699021; cv=none; b=sPES6tUR+VaNaCjNPPaZE1JYe0IYSln53qsAuHFRm1uR6h/w1p/xT//3UgO7kYgb6mXAu4fmrCoSdZWSSuiWHhrI/RlxWlk4AkoDmr7ldDFTycC6kaVeUxA6PCtUM2p1XUjpKOrDpsMeTn8nlTfU6TKAtZiCZiC7AbVoIW2Fovc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723699021; c=relaxed/simple; bh=k94wmKOy8i+80qlRCCU1S29tyDjDgvtK6PBHmgZYVZQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NmwrjW7zM8evn0mZh5b77aWqczOsbfdjWEqnLxERUQSd2k81Rt0AmcCZXkO+DCma7oRzFxOGTMazOXkJoSPKOefuhZgUF85qwhLdjhjLIuGx0NBvukLNXzKFUdzJzdldkr6iYPYhZxxHuRYY8+b9Kf0QUaajGYRtMaJ6obxWsIk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nROLPqBP; 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="nROLPqBP" Received: by smtp.kernel.org (Postfix) with ESMTPS id AD1DDC4AF09; Thu, 15 Aug 2024 05:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723699020; bh=k94wmKOy8i+80qlRCCU1S29tyDjDgvtK6PBHmgZYVZQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=nROLPqBPTmsXeHAgAYcm4VPjGqIVeGxNzqu26w76ag22JCJdjBjWVKk5ayGzJFhog 2WswWTYwUtPv+M7L4b/uZJAUPWJRzdpvp6WrSGCwLKBEnixpUAvSa6/y6IoL3lFyJi QUMbgq5Fop0N83dmydhjAhrDvbQiukKwrm1mTzqJnsGZ6BRkUCBm/T6jGxYqgVxVfO wq9Roye6ks78M1Kp4AdmpJu+BiRrVmj2u0S1s/fMDy0DR0r1kgh4Solqu0aW9Jx5hj PpEBoDQ1kdIExxk71zGm3QHaHbyQFtP6sV5ID9yOtbeODtyZwux1y/kAms+g9V1r9c 2JtjsWM1MuGzw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CB9DC531DD; Thu, 15 Aug 2024 05:17:00 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Thu, 15 Aug 2024 10:46:56 +0530 Subject: [PATCH v2 1/3] ufs: core: Rename LSDB to LSDBS to reflect the UFSHCI 4.0 spec Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240815-ufs-bug-fix-v2-1-b373afae888f@linaro.org> References: <20240815-ufs-bug-fix-v2-0-b373afae888f@linaro.org> In-Reply-To: <20240815-ufs-bug-fix-v2-0-b373afae888f@linaro.org> To: Alim Akhtar , Avri Altman , Bart Van Assche , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Kyoungrul Kim , Amit Pundir , Manivannan Sadhasivam X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2678; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=ug56jraL0N0ozijA5VnULZ3EejWihFXWmVlZhCYNgqI=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBmvY9KI9x6yyxcGEydOeOFk3MoomjFsm2pATgiw W0b/mTYaSiJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZr2PSgAKCRBVnxHm/pHO 9QkiB/943z89vSe87RUYHlGS0PIUdlG0yVOGrc4l8lnbusRoLbyBLueKIX0gw5Yd7Wzedk8BoBn 1GjjPsBFolEPp2ltgHzHaODC6ppoaIjI7ad1lxn0n4TvKpxtDh96PQRUmka1e9ziRwHCIObo6+p hJ8WtwDOUvuLS6eqdtD09rC440aHQDUQld7lafi/EIKI1fcjSupsnQ+0xy8JoSoXTawMnMfkn7S vvuMhhcPRzhSI0zQyS6AkD+oQQywQBLGMwiIYX9IaGdWJ8+VMe2iHh9Flo66nRbBq02F78MJXBM 3kpQBDO2txAzC4xi8LVxHgeAMOW004UyiK4vANKuarhuA/vE X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@linaro.org/default with auth_id=185 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@linaro.org From: Manivannan Sadhasivam UFSHCI 4.0 spec names the 'Legacy Queue & Single Doorbell Support' field in Controller Capabilities register as 'LSDBS'. So let's use the same terminology in the driver to align with the spec. Tested-by: Amit Pundir Signed-off-by: Manivannan Sadhasivam --- drivers/ufs/core/ufshcd.c | 6 +++--- include/ufs/ufshcd.h | 2 +- include/ufs/ufshci.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 0b3d0c8e0dda..0b1787074215 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2418,7 +2418,7 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) /* * The UFSHCI 3.0 specification does not define MCQ_SUPPORT and - * LSDB_SUPPORT, but [31:29] as reserved bits with reset value 0s, which + * LSDBS_SUPPORT, but [31:29] as reserved bits with reset value 0s, which * means we can simply read values regardless of version. */ hba->mcq_sup = FIELD_GET(MASK_MCQ_SUPPORT, hba->capabilities); @@ -2426,7 +2426,7 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) * 0h: legacy single doorbell support is available * 1h: indicate that legacy single doorbell support has been removed */ - hba->lsdb_sup = !FIELD_GET(MASK_LSDB_SUPPORT, hba->capabilities); + hba->lsdbs_sup = !FIELD_GET(MASK_LSDBS_SUPPORT, hba->capabilities); if (!hba->mcq_sup) return 0; @@ -10512,7 +10512,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) } if (!is_mcq_supported(hba)) { - if (!hba->lsdb_sup) { + if (!hba->lsdbs_sup) { dev_err(hba->dev, "%s: failed to initialize (legacy doorbell mode not supported)\n", __func__); err = -EINVAL; diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index cac0cdb9a916..c6ab1c671ad7 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -1109,7 +1109,7 @@ struct ufs_hba { bool ext_iid_sup; bool scsi_host_added; bool mcq_sup; - bool lsdb_sup; + bool lsdbs_sup; bool mcq_enabled; struct ufshcd_res_info res[RES_MAX]; void __iomem *mcq_base; diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h index 9917c7743d80..35013ba71b75 100644 --- a/include/ufs/ufshci.h +++ b/include/ufs/ufshci.h @@ -77,7 +77,7 @@ enum { MASK_OUT_OF_ORDER_DATA_DELIVERY_SUPPORT = 0x02000000, MASK_UIC_DME_TEST_MODE_SUPPORT = 0x04000000, MASK_CRYPTO_SUPPORT = 0x10000000, - MASK_LSDB_SUPPORT = 0x20000000, + MASK_LSDBS_SUPPORT = 0x20000000, MASK_MCQ_SUPPORT = 0x40000000, }; From patchwork Thu Aug 15 05:16:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam via B4 Relay X-Patchwork-Id: 13764406 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 364561448EB; Thu, 15 Aug 2024 05:17:00 +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=1723699021; cv=none; b=gpKG2z6UUvM2jj8RTj2EJXz2vGcYtmJ3KcpYF3dmaxynAGGMapK0f2zsnbjSo3dxUuXL+3TOX2K5UIZSfkqArtN/oC3xjCwb7MN8fcC81Yi+oL/Vjxija26lA6/QdoIzfm/S02Fjz89t4s7KOA74IYiSxp83tZjx03AU5Rypx1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723699021; c=relaxed/simple; bh=M0ZalJaR2cqaYtu21nRymj3MSV1IRF0NUOW7L0tD/OQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kKso1CVgYcNuMCmXaWCKGVgQWa4RwOxcCwpnHLbdGb3AmRuFOIuKfVBk2sLc1gsQ6r3QRtfplRNgpjnM+85Nvva7pmK0Jz31WlVEy3RJPxdDgV3vYUDhzDvMQM0qshe8geo7TBjxA8a+5pvP68OC0wr7fMeEhv3IYyx+cQagRc4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Y5V6fmyK; 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="Y5V6fmyK" Received: by smtp.kernel.org (Postfix) with ESMTPS id BA714C4AF0D; Thu, 15 Aug 2024 05:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723699020; bh=M0ZalJaR2cqaYtu21nRymj3MSV1IRF0NUOW7L0tD/OQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Y5V6fmyK2CE3DXYntItXgXd1y+1xieyIhg4zl47jlfIhJZoJ0cUfYUDIDV2hA1eSw 3IJhaDHYaKKNUsdvKlEhFyMXcR2RauHebbTpBvNy9La9lcrbYoWEB/78Kx4NroNWWg nl7RS0ee6diDbPw5yxjvDF1KDCxp+RE9pYE4Qb+0kqzghOiLZWKqFQADsR+vgPA+Ch EgbPs3J1OuN3/9kkJuJmmsgbCseljf4oUuUYDIywpGtCnUSjBKyTzTcqXR6gg1jPzP uhl16XacYIo7psjwZT+Rm8XlCtB8V/Xoo5Flhp8u2medXfjpyL36ubPwJqoaa5g3PH GjGnMlEQAE7tw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF30DC52D7F; Thu, 15 Aug 2024 05:17:00 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Thu, 15 Aug 2024 10:46:57 +0530 Subject: [PATCH v2 2/3] ufs: core: Add a quirk for handling broken LSDBS field in controller capabilities register Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240815-ufs-bug-fix-v2-2-b373afae888f@linaro.org> References: <20240815-ufs-bug-fix-v2-0-b373afae888f@linaro.org> In-Reply-To: <20240815-ufs-bug-fix-v2-0-b373afae888f@linaro.org> To: Alim Akhtar , Avri Altman , Bart Van Assche , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Kyoungrul Kim , Amit Pundir , Manivannan Sadhasivam X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1982; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=MCIRPdIw7ETAreNWkpU0sRIHAGg28eU3fllnElqMe2c=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBmvY9K42XDU3zXkh8FTpsrZGIqprZAcOJUKh6e5 LYBQbLGUpKJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZr2PSgAKCRBVnxHm/pHO 9d5UCACQsRMTBjEYzY25J46wBA0oF+Efi6dHqYgYJnNyd9Ed3kgAuLh0S9/FvKP4vIpLQtOmBCm SolfhpoHqvGg4/lj313fwwOoY3BlGqJBAjRO2ruTMb8QJnTSn0WeMC9eXDZJ9sLIW1ZwB3Q/cbF ILstaNVW9sRcPITMglvKi3+GQu4TbDmsQmiVME6Nq/Sc7eCxjWYSq77umg6VOBRcuwIls4xzRnk w9ePwQVYmYjuKZDWkXuoI1JXyJ+bdH239tCOBqa4qN7do/Omk2WXaJFTRIwonXEIRFJpdlz3B/p 1PcsYCGvY5R/EcUaGCbBiTD1cFdLR7wkVxyATHqkSUzUIQou X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@linaro.org/default with auth_id=185 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@linaro.org From: Manivannan Sadhasivam 'Legacy Queue & Single Doorbell Support (LSDBS)' field in the controller capabilities register is supposed to be reserved for UFSHCI 3.0 based controllers and should read as 0. But some controllers may report bogus value of 1 due to the hardware bug. So let's add a quirk to handle those controllers. If the quirk is enabled by the controller driver, then LSDBS register field will be ignored and legacy/single doorbell mode is assumed to be enabled always. Tested-by: Amit Pundir Signed-off-by: Manivannan Sadhasivam --- drivers/ufs/core/ufshcd.c | 6 +++++- include/ufs/ufshcd.h | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 0b1787074215..8c9ff8696bcd 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -2426,7 +2426,11 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba) * 0h: legacy single doorbell support is available * 1h: indicate that legacy single doorbell support has been removed */ - hba->lsdbs_sup = !FIELD_GET(MASK_LSDBS_SUPPORT, hba->capabilities); + if (!(hba->quirks & UFSHCD_QUIRK_BROKEN_LSDBS_CAP)) + hba->lsdbs_sup = !FIELD_GET(MASK_LSDBS_SUPPORT, hba->capabilities); + else + hba->lsdbs_sup = true; + if (!hba->mcq_sup) return 0; diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index c6ab1c671ad7..250adb6eddb6 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -676,6 +676,13 @@ enum ufshcd_quirks { * the standard best practice for managing keys). */ UFSHCD_QUIRK_KEYS_IN_PRDT = 1 << 24, + + /* + * This quirk needs to be enabled if the host controller has the broken + * Legacy Queue & Single Doorbell Support (LSDBS) field in Controller + * Capabilities register. + */ + UFSHCD_QUIRK_BROKEN_LSDBS_CAP = 1 << 25, }; enum ufshcd_caps { From patchwork Thu Aug 15 05:16:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam via B4 Relay X-Patchwork-Id: 13764407 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 54DF2145FE2; Thu, 15 Aug 2024 05:17:01 +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=1723699021; cv=none; b=FyT+T50nZBZsSw9iq/UrFy5vimAJ+9l7UiMYe0Q9RHX75mM0Liu21j/mRg7qul/Kk1LkIyk3krt3T+KVOiciOCILh5RxfiUahGoFeX6LSzyVZQyMNw9LET6y9qshbvVOxVLfV/9MdYIotcALsHs6kLrwLGpsxoHiVRXfs3J8iOk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723699021; c=relaxed/simple; bh=2eAqnVbEte4Ir5jVn1zGKS2bby0UbSy1ZNXKgTB0tAA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oS7OIPhJ63l57ZVcCuY4wRmkXzP27ZDzur8NfHKQ0ma/56r/ix2cS7/EgZSWckKlMe8VK5qp9GIIhT+wk72LHwqP8eADij2iwckLONqXMVZI8RwJT5nOwMnFx3mX9WSb285pFY5AobgeZt6gsiX5rKg4NZdZ5kekjXU14emyI4k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kHeyH2Cs; 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="kHeyH2Cs" Received: by smtp.kernel.org (Postfix) with ESMTPS id CE052C4AF0C; Thu, 15 Aug 2024 05:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723699020; bh=2eAqnVbEte4Ir5jVn1zGKS2bby0UbSy1ZNXKgTB0tAA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=kHeyH2CsXNRlcMoj/FnEMzuabmPtjorQArP2gwLIUGW1iw1J346skhXxuD2duFlDS j1c5Jg4y/o91asXQBM8VvUCFQZmL3H/a1M1w0Zd284cSaFRgNPTMAMBQPNXT7jbOoX QhnINms7z6rInTGwL8XIcFfRU1T8wT5M8EqC1waET8am49vyV7JaPsKbKHeBW/y0ui yod9qIW8A2kJGNVwEfAC0hAw232TO1D8JUDNi21g2UCx07JI5gX6UgGEj04uDl5rAy ghfWQ90LdeS8D+ywRibBx0sQOb5cL1rUP0+swlt+xaOvebvfjq+yXgmpQntupWgg6b rbqdiBh27dwtg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C207CC531DE; Thu, 15 Aug 2024 05:17:00 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Thu, 15 Aug 2024 10:46:58 +0530 Subject: [PATCH v2 3/3] ufs: qcom: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP for SM8550 SoC Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240815-ufs-bug-fix-v2-3-b373afae888f@linaro.org> References: <20240815-ufs-bug-fix-v2-0-b373afae888f@linaro.org> In-Reply-To: <20240815-ufs-bug-fix-v2-0-b373afae888f@linaro.org> To: Alim Akhtar , Avri Altman , Bart Van Assche , "James E.J. Bottomley" , "Martin K. Petersen" Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Kyoungrul Kim , Amit Pundir , Manivannan Sadhasivam X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1997; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=86LYSca/QxWt1ChuWxvzEFW+WUoUlJ8CGwZ6Mkg+m0I=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBmvY9KezBjEvKBHyC6JRqOSOXSyAJE3HpZf7pEI or6TZ3a8LOJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZr2PSgAKCRBVnxHm/pHO 9VvKCACBCdKo6gmM1PLI+AHofj7KYljAd050Y3VIV1/+QgIwkMGg5fG+pGI6fG8cb66sZPdA5tX /lD78a+ijyD33Om5oBfxwOT286+/DZZ4aKfTeusnHQzcRfKJ1FTC4ra/tyHwckiARE6evITcmeS +zkez/V9zEy8iZi8BZ6GB9SKMYW+RcEVL9T9TGJSlcf3qoTwFh+7tynG0XOtaYUCJSPeMKTPE0C uPdc3Yoh9jx214LyenbxJSK3Vt2YWa2bLvKCnv9K4ra8Gl2VN/A9SJ1IePShCN6NFCkRgG4i38d rjbVNRbxmJfIO4jf6SvyzCVDB7Cr2imZqitPFWCt5HaG2qJ5 X-Developer-Key: i=manivannan.sadhasivam@linaro.org; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@linaro.org/default with auth_id=185 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@linaro.org From: Manivannan Sadhasivam SM8550 SoC supports the UFSHCI 3.0 spec, but it reports a bogus value of 1 in the reserved 'Legacy Queue & Single Doorbell Support (LSDBS)' field of the Controller Capabilities register. This field is supposed to read 0 as per the spec. But starting with commit 0c60eb0cc320 ("scsi: ufs: core: Check LSDBS cap when !mcq"), ufshcd driver is now relying on the LSDBS field to decide when to use the legacy doorbell mode if MCQ is not supported. And this ends up breaking UFS on SM8550: ufshcd-qcom 1d84000.ufs: ufshcd_init: failed to initialize (legacy doorbell mode not supported) ufshcd-qcom 1d84000.ufs: error -EINVAL: Initialization failed with error -22 So use the UFSHCD_QUIRK_BROKEN_LSDBS_CAP quirk for SM8550 SoC so that the ufshcd driver could use legacy doorbell mode correctly. Fixes: 0c60eb0cc320 ("scsi: ufs: core: Check LSDBS cap when !mcq") Tested-by: Amit Pundir Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche --- drivers/ufs/host/ufs-qcom.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 810e637047d0..c87fdc849c62 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -857,6 +857,9 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba) if (host->hw_ver.major > 0x3) hba->quirks |= UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; + + if (of_device_is_compatible(hba->dev->of_node, "qcom,sm8550-ufshc")) + hba->quirks |= UFSHCD_QUIRK_BROKEN_LSDBS_CAP; } static void ufs_qcom_set_phy_gear(struct ufs_qcom_host *host) @@ -1847,7 +1850,8 @@ static void ufs_qcom_remove(struct platform_device *pdev) } static const struct of_device_id ufs_qcom_of_match[] __maybe_unused = { - { .compatible = "qcom,ufshc"}, + { .compatible = "qcom,ufshc" }, + { .compatible = "qcom,sm8550-ufshc" }, {}, }; MODULE_DEVICE_TABLE(of, ufs_qcom_of_match);