From patchwork Wed Aug 14 17:15:34 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: 819668 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 73E8E16BE14; Wed, 14 Aug 2024 17:15:38 +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=1723655738; cv=none; b=gD+Z7t+gji8uhk+bjNUw6dQb3Gm70Q8xDUxkpSF6x7HzvjCcxkyRjN8qJNTnQDg1MfJCSmMf5DGCYvocy8fpvEhHbp/V08aHZlfmooSCMHsAmXr6IYlf/tvGJI+855efg+Rx/aJIBs9GsVuYtwg18UWhh5v3aqW+XpUiznOx1r8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723655738; c=relaxed/simple; bh=4G+1rYVbP64RHUW4ZvLPjIXbtsIri1hPAIz9g7DS1lU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uHaaH3l0t98f61ZyqKQQlz/NATSHUYuR52rMuQ2ELf8kXMvKO0RpfYvTXHnu7Oqmm8aqO3uOz7wE4FRvs11pAxSmYA2T0T9IzrtVkPRIkODP6SOzEkRjiHdAQ+oNRq8kNOQmLd9Yqfw4a7dPywf8FxZo3DTgQORg1YTWirpZrAQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GjJXJwzM; 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="GjJXJwzM" Received: by smtp.kernel.org (Postfix) with ESMTPS id 03DF6C4AF0A; Wed, 14 Aug 2024 17:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723655738; bh=4G+1rYVbP64RHUW4ZvLPjIXbtsIri1hPAIz9g7DS1lU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=GjJXJwzMdc4f43DnG6pfNIMYhmaFKspCtEP5BBESqNRhmNJg4gEJZuqL5NPJfwg61 cOxpPWVltFiK3WyvmS0k+eMETqholnwVDUH3lj+ZgXWG5/lCbP4lkJ5JX3s8IRfpT1 IApeyCI0mGq9RVIcwlhEL8KaywVOHj1cSaykWHUli4wgMepOaJtNC7pGMIDwMRh1np EYNXPD8O4LnuFrxgWL+Hsm3eN707OZCE+WfQDLd+TSgS++pwHELpvLQgQqH3E2I4+t veiAXgF9aMvzNUSAmKVyLXw9S1bUDFkuQ6am8zN1pRW5Kty5GJ2mLpni8nWNPFWfTJ k7Np8BwMlyoXA== 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 E74F1C531DD; Wed, 14 Aug 2024 17:15:37 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 14 Aug 2024 22:45:34 +0530 Subject: [PATCH 1/3] ufs: core: Rename LSDB to SDBS to reflect the UFSHCI 4.0 spec Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240814-ufs-bug-fix-v1-1-5eb49d5f7571@linaro.org> References: <20240814-ufs-bug-fix-v1-0-5eb49d5f7571@linaro.org> In-Reply-To: <20240814-ufs-bug-fix-v1-0-5eb49d5f7571@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 , Manivannan Sadhasivam X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=2622; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=YW06jWkKjEWiplubl7FzAc5Mu1aZMxORon0NWYdZPK8=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBmvOY3WdNs13h5ZEVwiZkwRSCloR1bfX4X7ZrHy AIyYgHK9emJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZrzmNwAKCRBVnxHm/pHO 9c+bB/9CjuTsZyKd9CqBKToyshFHSvU4ZD/FxkvmwXU8WGRlMYrs+Bw40cB06Yut3OOUHUuFbY7 6LkOTkKh7kClYmSekCKyXlbc8WXZ9yreqvNB3rO8oMaW1jKSAVjIkJ+ZCXSL3shTPYny1g8KNN6 YzcwhW8nEOPSnZEPwy3tV6/QzdcGaNCX+4SO6p+DS99BE3NjdJNE1DTMPAvAhLxmE6FPNWWKe52 LlMF/0N9PwqpG4Q6nW5BVqVtJp9u/iqY01hrjy8Kli+X3Qt3B8r+ga3e8inbHrMMPvrzckCZoa0 AVBYklWNJfdqHTAkx57oG2SXwAhgzaXpbTlYmcmcD5uciV6m 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 'SDBS'. So let's use the same terminology in the driver to align with the spec. 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..168b9dbc3ada 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 + * SDBS_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->sdbs_sup = !FIELD_GET(MASK_SDBS_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->sdbs_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..d44b19cf9f82 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 sdbs_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..b60212865e90 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_SDBS_SUPPORT = 0x20000000, MASK_MCQ_SUPPORT = 0x40000000, }; From patchwork Wed Aug 14 17:15:35 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: 819370 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 73EDB1B4C3C; Wed, 14 Aug 2024 17:15:38 +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=1723655738; cv=none; b=ZHnZGOl23jj1gleyndPJlQVJXH2kt4CRo59Ts0Z0xuw+jsk8qBR9EipLMwSW65XKn5i0jQ/fLfGVyNwT9R0pWI5RPlMHS3bz3GJuYDAM04ZEhvj0G/iabBRGt/68prR1TBCw/zukr5ouVJKypI6E5Iq165+rWlU2nvwk9E4W23M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723655738; c=relaxed/simple; bh=uhB5tp9HxI7AQHzj3j+STWwEQWpW8iHWMwuvU5vQ/+c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=q4dzpYYgBdnw3bChTzwX38Bnp6R0EXeAJtRVCOYWlyKXOZcLF9NCX6dmudY8D+iWvSrNkhdY0b522giz3nM7HL+jE9TFmEHICvecG1ZCha7TuZnA7KOwTDfXPFo0TAy7zKvBf8IYgdrvfG/ANll0I10f1eQZXLh8K2I8f7jWo6g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SSbSEyPN; 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="SSbSEyPN" Received: by smtp.kernel.org (Postfix) with ESMTPS id 18C4BC4AF0B; Wed, 14 Aug 2024 17:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723655738; bh=uhB5tp9HxI7AQHzj3j+STWwEQWpW8iHWMwuvU5vQ/+c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=SSbSEyPNADtTn40pj0Q0jFKJN9c/LZMCYrtvw8aV/CjnusIR0gj0sEP3RxHmcE9cM DlPJqz6SpICOJkZkQY30fwDBs/EumNj60+/md6kp5aNBP01vZ6ICpB0iVJj8lR1ISm mEvPkAXMahsE86O9Je4UrvSwURxIqnyrQXoFQ6ouQZIODbZhMP6ZUt42cnZnBVnMtm p55PlGHV4UQCNZS4ep7/sHeyMov87PIbTPxftU/ExI4/5BFpK/dCi52Jmwsy26i8To S84jzP/qzsm1uvNoAZnp/uSvgIxKZRiUIFTAE9qo1unMxJmdb7utItJqxoJnre5Tbc DntxJkSrkA2Qw== 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 0A2B0C531DC; Wed, 14 Aug 2024 17:15:38 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 14 Aug 2024 22:45:35 +0530 Subject: [PATCH 2/3] ufs: core: Add a quirk for handling broken SDBS field in controller capabilities register Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240814-ufs-bug-fix-v1-2-5eb49d5f7571@linaro.org> References: <20240814-ufs-bug-fix-v1-0-5eb49d5f7571@linaro.org> In-Reply-To: <20240814-ufs-bug-fix-v1-0-5eb49d5f7571@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 , Manivannan Sadhasivam X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1955; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=b/cuuxILW/Nn5o+nE4aellu+itmsZwg73HSlbrIKfVs=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBmvOY3lBK7tzrEC7WXwsQVgnENFIxae751N7f5D TgEOJSS2GmJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZrzmNwAKCRBVnxHm/pHO 9cO4B/9PMf0FjxvFCxyoHFRSPjyHN18MiXSQ+tF0M1WFQxJu4PpPJXaHonmx1YLq7X3naUyB1IP s9mWrfcQt0saHVbW2B8dQ2J85iIYgIQp1+LSatEUvZKVd0/9csAQAl5r698pHEJZL9lmzBr8jJ8 Sx8nW+GxxNfPca166Tlabp5p9lI2yUXZwo3Vl2Vrlad7ocnsez9yY2E528vD747w/BwRRfcGYPE 57eRq80wMINMtBViFvvAMdfzuBE9Ci9m0BNvvKKFCWOL6JAcRAh0eo7WrZPudw28j6Me+MBBmSS UHmC3OubIS+a4r71H2ZoYpmJOB0uYEN1m2CjgeisuCUZSu7R 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 (SDBS)' 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 and MCQ is not supported, then 'hba->sdbs_sup' field will be ignored and the SCSI device will be added in legacy/single doorbell mode. Signed-off-by: Manivannan Sadhasivam --- drivers/ufs/core/ufshcd.c | 5 +++-- include/ufs/ufshcd.h | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 168b9dbc3ada..acb6f261ecc2 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -10512,8 +10512,9 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) } if (!is_mcq_supported(hba)) { - if (!hba->sdbs_sup) { - dev_err(hba->dev, "%s: failed to initialize (legacy doorbell mode not supported)\n", + if (!(hba->quirks & UFSHCD_QUIRK_BROKEN_SDBS_CAP) && !hba->sdbs_sup) { + dev_err(hba->dev, + "%s: failed to initialize (legacy doorbell mode not supported)\n", __func__); err = -EINVAL; goto out_disable; diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index d44b19cf9f82..85c6ea28d45d 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 (SDBS) field in Controller + * Capabilities register. + */ + UFSHCD_QUIRK_BROKEN_SDBS_CAP = 1 << 25, }; enum ufshcd_caps { From patchwork Wed Aug 14 17:15:36 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: 819369 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 81FAB1B9B3E; Wed, 14 Aug 2024 17:15:38 +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=1723655738; cv=none; b=k0WsmNJTwpLRNlwO+mayX8Qk4vFxCxAQARWeGVQbAFlNpHIfflTcomT45MRsh4N4GWzQ2trf2sOhdG6YuL4eNRQ7/ZQcd1SyM75NNZsOMROCYZrg6SScDN5165v7UdU0g58/U22Wjoxa/y48G5hNrWz9LwKEq7iLdsqHgeUNfJ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723655738; c=relaxed/simple; bh=21hMRAcosiv6UlvSwLZ77NGpT9rAb7GgO23AOPjl6vM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=q+6P3QTtrv9n6ngzr/rZqiCAxK3u1rBQGIRMn9zFifhmoOhCErlG3vAfewBsVlDeGLizBCf1hpTBIuyk89tzzjNgsPVk+w5H9I+bZ8n2gLmh2tatv/bQGsnZR7MGr1tpEHyifhaIWwY7dEbXJQbIBu1/rjYIBo/0FAw7VNuRDrI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ExQuJv/y; 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="ExQuJv/y" Received: by smtp.kernel.org (Postfix) with ESMTPS id 2C746C4AF09; Wed, 14 Aug 2024 17:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723655738; bh=21hMRAcosiv6UlvSwLZ77NGpT9rAb7GgO23AOPjl6vM=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=ExQuJv/ynGMi4Li+TPoRhEzxKx70dUYHap+vA53rkC4yyhsn91wl15uEGQD6oijSr 17730j/yGcm5NNRj3E2lctGjjkkqh+68lgUxYN2iWwC/J5HDOJufszG8QbFQcckleb CAUqWcBlO8+j9M3tuxLlvSp0zA2oMp70fyNSMWhknV9Hl9oS/zrQFuJtnE3f13URFN 0HK/JHRGdn4qckaVhOCK/06WymZIC1XIkkrfIc3r6tExT8w3wDrNaljNizzCiumt3I UReIz9MG+snrSluN/LwLljyZZ8ioiawiV2Bpxrn6mosAvYKoyPS+NhH0dCf7iN/Cmi ydopWBfEb6dsg== 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 214A0C531DD; Wed, 14 Aug 2024 17:15:38 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Wed, 14 Aug 2024 22:45:36 +0530 Subject: [PATCH 3/3] ufs: qcom: Add UFSHCD_QUIRK_BROKEN_SDBS_CAP for SM8550 SoC Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240814-ufs-bug-fix-v1-3-5eb49d5f7571@linaro.org> References: <20240814-ufs-bug-fix-v1-0-5eb49d5f7571@linaro.org> In-Reply-To: <20240814-ufs-bug-fix-v1-0-5eb49d5f7571@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 , Manivannan Sadhasivam X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=openpgp-sha256; l=1960; i=manivannan.sadhasivam@linaro.org; h=from:subject:message-id; bh=tifq6GOjcopPL6cLTuL63f6pon2nnqW5vXlh4Zf80OY=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBmvOY3a7gkLi2VXbeUSPBQzUF/mhbLHVjzPz/dL G5CfvIi/dmJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCZrzmNwAKCRBVnxHm/pHO 9TGXB/9FfmWLoUKrlGEkbnbfPTE0oIH5VWXQrjhKPLgfEbLIXFnoPnIlzWy7xRg5fmNWXw59vUG x6cJh/XE29qcDlD1nik03+T4BP3rvailoHF6KiZhz6RdLgjyM/Zvrm5v4lX6Hd1+fX/sXo9yF+p XOCUDZQQq91QzS85LvEFRwyih9uDlX1tb22HvbGQkZfM61388t5f/Zcbh3dgO4e2mzzT0dWBnL2 idV8CjLdhIz36ukGFbuARXLdAGsecnNG4Db6gbaPcrqSZ0Vau4udPnAaOWg1vbfU72wrtsDodo4 OooygvFfvdYywZTZrvygzxbKtTbXtHUfSPT7ZyNTSdnZTdZS 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 (SDBS)' 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 SDBS 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_SDBS_CAP quirk for SM8550 SoC so that the ufshcd driver could use legacy doorbell mode correctly. Fixes: 674f8bfb1848 ("ufs: qcom: Add UFSHCD_QUIRK_BROKEN_SDBS_CAP for SM8550 SoC") Signed-off-by: Manivannan Sadhasivam --- 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..391b814c318e 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_SDBS_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);