From patchwork Fri Apr 22 13:21:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 565177 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D666EC433FE for ; Fri, 22 Apr 2022 13:22:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447910AbiDVNZB (ORCPT ); Fri, 22 Apr 2022 09:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447777AbiDVNY4 (ORCPT ); Fri, 22 Apr 2022 09:24:56 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B257D5675F for ; Fri, 22 Apr 2022 06:22:02 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id n8so10849175plh.1 for ; Fri, 22 Apr 2022 06:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4re5OWonUoWdRvSDXbNxViVwfbYtstxFeWpMXUatUMo=; b=qRTRtoPbGwWu7NbWdxinV9rTgVqPvkLpJjqKnPRc1dkhO6LBdwC8c96r5phZCRCVxq 5aeCyO7cZGFvWYg8rHuGdQS1eH6CLLQqJIv8guW7BxlqSgPLdnisheD+0zELrvzLl86d UBtd8CgC0ZwhIrrKjz5mHBT43/MtHoyo71MUVmPGMaoksVfwYCpqByYld0oMoP/uDRo6 39VcweT0yQx25pyNMKbeb6qprLfMdjfKHHBjdCiD6eje9hJoJC+84CEGQrcALgyeWw2Q 2fVPQz5HTR4BtSHR1f6dVX8rjbnvVGGgkV7atsy+lWLc0iouZcYwqQM7yevVHRfLuyn1 FHQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4re5OWonUoWdRvSDXbNxViVwfbYtstxFeWpMXUatUMo=; b=YFjpXWPeGFHafQSqtMDvXCsgdWSSvPh2DkkmUj3kx3SgKSikXn/q2Wox0pHKeuEUil pdA1gYeaBQGukM/DbiCBiNfODWjMeznIXCy7+bk2Xb6Vvk6ARrSk3N33UTTLFRPwHQFe R+uI4NeoLF3PTAXxUGX7Z9XWSBtdxvcmkWw8ipGDrNfyNUtd6z2YF3nqbt6tNK8DBgdY k2Wuaz/MVBk2x8B2O/mYlgzAB8DE3FnTPzKV9VWkHdXdiRnrd49g33hF018gaNMsnV3n dPTo7oyRHf8ILnVbtVlb1ZTZY1dQPO1yvK6aGz1HrVpkNzx93mD4U5/26MgSVXRz4hUs N9zg== X-Gm-Message-State: AOAM532IPq6zXBY292JSI36Wnpm4BIDo6MjK6hi2tZyK3GtR61Nd1y/v gW+hkIAT6yksCiQh65ZINVsP X-Google-Smtp-Source: ABdhPJwIpV2owBIVHmXS11m41XD/92aDrOQLfeuc66hnB4mj8MFIhw5X9cODI7BW/0wPMEkxnIRRUg== X-Received: by 2002:a17:90a:8418:b0:1d2:7c69:e3bf with SMTP id j24-20020a17090a841800b001d27c69e3bfmr16165389pjn.44.1650633722228; Fri, 22 Apr 2022 06:22:02 -0700 (PDT) Received: from localhost.localdomain ([117.207.28.196]) by smtp.gmail.com with ESMTPSA id g13-20020a62520d000000b0050a923a7754sm2586840pfb.119.2022.04.22.06.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:22:01 -0700 (PDT) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: avri.altman@wdc.com, alim.akhtar@samsung.com, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, quic_asutoshd@quicinc.com, quic_cang@quicinc.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 1/5] scsi: ufs: qcom: Fix acquiring the optional reset control line Date: Fri, 22 Apr 2022 18:51:36 +0530 Message-Id: <20220422132140.313390-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> References: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org On Qcom UFS platforms, the reset control line seems to be optional (for SoCs like MSM8996 and probably for others too). The current logic tries to mimic the `devm_reset_control_get_optional()` API but it also continues the probe if there is an error with the declared reset line in DT/ACPI. In an ideal case, if the reset line is not declared in DT/ACPI, the probe should continue. But if there is problem in acquiring the declared reset line (like EPROBE_DEFER) it should fail and return the appropriate error code. Signed-off-by: Manivannan Sadhasivam --- drivers/scsi/ufs/ufs-qcom.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 0d2e950d0865..5db0fd922062 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1002,13 +1002,13 @@ static int ufs_qcom_init(struct ufs_hba *hba) host->hba = hba; ufshcd_set_variant(hba, host); - /* Setup the reset control of HCI */ - host->core_reset = devm_reset_control_get(hba->dev, "rst"); + /* Setup the optional reset control of HCI */ + host->core_reset = devm_reset_control_get_optional(hba->dev, "rst"); if (IS_ERR(host->core_reset)) { err = PTR_ERR(host->core_reset); - dev_warn(dev, "Failed to get reset control %d\n", err); - host->core_reset = NULL; - err = 0; + if (err != -EPROBE_DEFER) + dev_err(dev, "Failed to get reset control %d\n", err); + goto out_variant_clear; } /* Fire up the reset controller. Failure here is non-fatal. */ From patchwork Fri Apr 22 13:21:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 565580 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35B60C433EF for ; Fri, 22 Apr 2022 13:22:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447913AbiDVNZD (ORCPT ); Fri, 22 Apr 2022 09:25:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447907AbiDVNZB (ORCPT ); Fri, 22 Apr 2022 09:25:01 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E973457B27 for ; Fri, 22 Apr 2022 06:22:07 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id b7so10824415plh.2 for ; Fri, 22 Apr 2022 06:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VJEo0X0uIfdf+jZ7SJyM0RcOsc+vZ/1fj3+IRG98uSo=; b=UuRfAQoJy7K2TBJgQEpJQdV/DyUhoMT+iHugPct0qwKEVM9OSiu64f6/0B9X+WWfiA 3+CM67PnLsbtUmdy8sW9tfWCaZ2G1SUKgdssobL5IhS0BuFrFLsZZfKLRHk4NGcXWOMX jPhSXh2ogF5zWn7nkX1otJt+OucDcCzF4IvQsl3XoZxPh3heMOlBIQDnNdSK0Ck2YdJM ifvTVRFePBfEXQS5SMY3DRDSfsU14tkKS+IFnF+FlvfzVL9GYbMYlqX34GzJA5PY0Tgk WU+iZmC8KM2rV4tuJDe5BJDPq7dskuW3kmRIuJL+oOkAPscewSavvAoXDPpvUgRkR3mq cukQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VJEo0X0uIfdf+jZ7SJyM0RcOsc+vZ/1fj3+IRG98uSo=; b=e9fxwdQM7l2Fh1ZsBqyA4EjhDy2P/8DHB6+cl/gf2V4suwU2zVa3yKn9vezCNFl9qY PmikbBT3Vvq1vQbfOMie+dncFovF8rJ4cpEr7M3EYi5tPzoT+ozO2ficgGo7Yedhh/5j 9khmnkQT5yrQJ8dqEkp2cZE3kb+YWwiXKktoSAQxllyoA8IcmpvX251HKBjUXBFtgK2t WG+fCI03+1SvlwZGzYK7IFNRV6J+nRUHh4+qCNy5Dq0QqU0eA4xTJhp0ammkTVzYJXLL qsPYVtbLvLGtH/Z8/TC7y/kdT686b4quwi7vi7+EKEngu2q6DDkNpKyaPcbt2GpZaKQN D5BA== X-Gm-Message-State: AOAM531X33ZD8RfAktapdt4UA5gSu/94MeGhx+d+2eXrNUsT4RryAHUH hwNsMjqG8yeqwzOGOeYYqTk3 X-Google-Smtp-Source: ABdhPJxJ88rBQ4fFhIg73VLAJ+s3N5JhHTKd8gfgR2ZdjfcWB/ifpsSKJMAATbIAqEfKugX7B3fOTw== X-Received: by 2002:a17:902:f792:b0:153:1566:18 with SMTP id q18-20020a170902f79200b0015315660018mr4534014pln.115.1650633727467; Fri, 22 Apr 2022 06:22:07 -0700 (PDT) Received: from localhost.localdomain ([117.207.28.196]) by smtp.gmail.com with ESMTPSA id g13-20020a62520d000000b0050a923a7754sm2586840pfb.119.2022.04.22.06.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:22:06 -0700 (PDT) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: avri.altman@wdc.com, alim.akhtar@samsung.com, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, quic_asutoshd@quicinc.com, quic_cang@quicinc.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 2/5] scsi: ufs: qcom: Simplify handling of devm_phy_get() Date: Fri, 22 Apr 2022 18:51:37 +0530 Message-Id: <20220422132140.313390-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> References: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org There is no need to call devm_phy_get() if ACPI is used, so skip it. The "host->generic_phy" pointer should already be NULL due to the kzalloc, so no need to set it NULL again. Also, don't print the error message in case of -EPROBE_DEFER and return the error code directly. While at it, also remove the comment that has no relationship with devm_phy_get(). Signed-off-by: Manivannan Sadhasivam --- drivers/scsi/ufs/ufs-qcom.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 5db0fd922062..5f0a8f646eb5 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1022,28 +1022,12 @@ static int ufs_qcom_init(struct ufs_hba *hba) err = 0; } - /* - * voting/devoting device ref_clk source is time consuming hence - * skip devoting it during aggressive clock gating. This clock - * will still be gated off during runtime suspend. - */ - host->generic_phy = devm_phy_get(dev, "ufsphy"); - - if (host->generic_phy == ERR_PTR(-EPROBE_DEFER)) { - /* - * UFS driver might be probed before the phy driver does. - * In that case we would like to return EPROBE_DEFER code. - */ - err = -EPROBE_DEFER; - dev_warn(dev, "%s: required phy device. hasn't probed yet. err = %d\n", - __func__, err); - goto out_variant_clear; - } else if (IS_ERR(host->generic_phy)) { - if (has_acpi_companion(dev)) { - host->generic_phy = NULL; - } else { + if (!has_acpi_companion(dev)) { + host->generic_phy = devm_phy_get(dev, "ufsphy"); + if (IS_ERR(host->generic_phy)) { err = PTR_ERR(host->generic_phy); - dev_err(dev, "%s: PHY get failed %d\n", __func__, err); + if (err != -EPROBE_DEFER) + dev_err(dev, "Failed to get PHY: %d\n", err); goto out_variant_clear; } } From patchwork Fri Apr 22 13:21:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 565176 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EE48C43219 for ; Fri, 22 Apr 2022 13:22:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447923AbiDVNZK (ORCPT ); Fri, 22 Apr 2022 09:25:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447917AbiDVNZH (ORCPT ); Fri, 22 Apr 2022 09:25:07 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55484580CC for ; Fri, 22 Apr 2022 06:22:14 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id g9so7315090pgc.10 for ; Fri, 22 Apr 2022 06:22:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0aTsYn+fbrLEF70DYT+XvQa13+urwQkivcKboFHg6Ao=; b=BOWeG3zHuKTf7IsyuvqRU3jzy2o2wts7viRFugf1Pq0w96/Km8O4Z+eJ2+lyhol87H +nf+ptgdCfyRAaqddYGbtV4kEO+ytbIsmQeEGqiHBne7/jNBDm67O5iYSFNFrjm7RAsw N6C3S2vmvGkMTEPHkduQOV+yLdG5nxhYV2QHDGaU3OH8ebpGH77AEutetm5R9RavxTKU KEU8uLmduxy72vCwY749LFujpiNd7YHncSrAEYOJdveIC8sDklLoyn5svJGrUBY0AVce pwjP1COoZcqz8dArUevYhB2ccY6+/LThiedXZ1zt/hMTaVEMaAGlX0OsBc2l9td7HRxX VBDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0aTsYn+fbrLEF70DYT+XvQa13+urwQkivcKboFHg6Ao=; b=obwtvtBjAYNHgTAl4zX57Hs6almp0l3T3QI3cCmTeTFRSdyss3f9Zt5YAyJ7L5/EXR BLuJhbtNdrtugsXeS4PtunVlzgP4lVVLTv93M+VLX2c2NtroSMEeGxgLJv1A1QQmrVJK nCwtUCZTpZN3GXSGwUC/cdRUi7VwJO2TiZHH5YPGf5Dc3plECLAq2NaieZHaKLikhci6 MM6Wt7ORaARm+fX5aBHitwdpBLyZXBdXmRm9WCvPWeUqL/HYfQ/kCldrTcPtAMnNHbx3 Na9/tmsOa/2TgP0jjqpxvXLAAeOmlD2MFCe0DfKz4+S3YOp/A4eF3y/oKVhlKNmFNk2u FAEg== X-Gm-Message-State: AOAM532bi0kw27fOjFtHNmQa2tc64iUz5Q7wr4wkNxjczUrvcgTAVCxQ k6jV46lrZG9zuCC5ooMvDnTL X-Google-Smtp-Source: ABdhPJzvnw8o1O07FvEJgfNvXBizaKMHbMO8qkm1OWHXlD40i9elG+wZHzzrDZiNB5lhOGu8ebUopg== X-Received: by 2002:a63:d855:0:b0:39c:e714:c79f with SMTP id k21-20020a63d855000000b0039ce714c79fmr3830235pgj.570.1650633733833; Fri, 22 Apr 2022 06:22:13 -0700 (PDT) Received: from localhost.localdomain ([117.207.28.196]) by smtp.gmail.com with ESMTPSA id g13-20020a62520d000000b0050a923a7754sm2586840pfb.119.2022.04.22.06.22.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:22:13 -0700 (PDT) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: avri.altman@wdc.com, alim.akhtar@samsung.com, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, quic_asutoshd@quicinc.com, quic_cang@quicinc.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam , stable@vger.kernel.org Subject: [PATCH 3/5] scsi: ufs: qcom: Add a readl() to make sure ref_clk gets enabled Date: Fri, 22 Apr 2022 18:51:38 +0530 Message-Id: <20220422132140.313390-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> References: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In ufs_qcom_dev_ref_clk_ctrl(), it was noted that the ref_clk needs to be stable for atleast 1us. Eventhough there is wmb() to make sure the write gets "completed", there is no guarantee that the write actually reached the UFS device. There is a good chance that the write could be stored in a Write Buffer (WB). In that case, eventhough the CPU waits for 1us, the ref_clk might not be stable for that period. So lets do a readl() to make sure that the previous write has reached the UFS device before udelay(). Cc: stable@vger.kernel.org Fixes: f06fcc7155dc ("scsi: ufs-qcom: add QUniPro hardware support and power optimizations") Signed-off-by: Manivannan Sadhasivam --- drivers/scsi/ufs/ufs-qcom.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 5f0a8f646eb5..5b9986c63eed 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -690,6 +690,12 @@ static void ufs_qcom_dev_ref_clk_ctrl(struct ufs_qcom_host *host, bool enable) /* ensure that ref_clk is enabled/disabled before we return */ wmb(); + /* + * Make sure the write to ref_clk reaches the destination and + * not stored in a Write Buffer (WB). + */ + readl(host->dev_ref_clk_ctrl_mmio); + /* * If we call hibern8 exit after this, we need to make sure that * device ref_clk is stable for at least 1us before the hibern8 From patchwork Fri Apr 22 13:21:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 565579 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E69DC433F5 for ; Fri, 22 Apr 2022 13:22:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447935AbiDVNZO (ORCPT ); Fri, 22 Apr 2022 09:25:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447924AbiDVNZM (ORCPT ); Fri, 22 Apr 2022 09:25:12 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62E6858390 for ; Fri, 22 Apr 2022 06:22:19 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d15so10806449pll.10 for ; Fri, 22 Apr 2022 06:22:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UmOApO6ixe70PdHEViIKrF0MVsQtQSBHzDTAzdr8K48=; b=RDUmUjJOVCU9Gom6PIQB7Om6auvTkQ8MtrvaaFjuQWx+PPVuYsNATY7Sju+1neEH4U zuFcEHYhQSKPIvjiLdEmRY0wLcoJFpbvpSP+g1JkKek1hjbpsbmDGVm0gDdYMIRC3g1f 1fCIld1KjTLpEtyAbXDrx6KjokXhKep17zeHKLgD27bUW1QjWt7vsEKykUWh9s7eTWdk FcTliAuQJ2Y+lX72APhDhiGKToK1D+rn0M8ipUbEhli2dcC8O5j1jKru2wIJD6GjF50D FyYVhTr+q88S6lNC2I0JyJqZb9LoQ+lsepMfJLddTgYSfS6WbrwyaputeM38AcVtYI7l 5z+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UmOApO6ixe70PdHEViIKrF0MVsQtQSBHzDTAzdr8K48=; b=gQ9Rj3rz9/73jXqMe4XhJt21DHmu5PsKHhs3oW65Ec0HpVSnCJuU/N050iZmvzzhzQ Qs9xQ8foQM1+ph2EBS/Nq9Ux2DuLI4twablpDFZz4XMbsoe5UszEg80NtMCnJJqXn5SV tpZQeuxqXFungTkPk4429umS+RGEyIdXbqSqmOS3MN/9MCHtAbpqi7L40gq0xyYjpw/9 YEwZ59AkhtR6V5Y+0/dI+Z8eS8/M00TPtTIxAr2jMbBFekuH5cuzQZAtKn+UN62sNsEH ciOu7Srf9rz0lf1MT0DkVxiPrtuQbT+tH1cGIuph64b7DNiD08SXx8mH8LcKIT7chmT2 YIDA== X-Gm-Message-State: AOAM530XS89PXqAQ64zNbuam+gVNdEO+46aAWEdLBMfw7FQRBzGegoKP QhsEvaGC59tP1N3x7P1RGSZy X-Google-Smtp-Source: ABdhPJyjSvRzPdzCjO9rxGq3kz927rM2kTVx3GjigPQ8cqLCXqTCHKS1iZuURIg4z6JcfYUsv5Hjuw== X-Received: by 2002:a17:90b:3b4b:b0:1d2:e3fe:e1a0 with SMTP id ot11-20020a17090b3b4b00b001d2e3fee1a0mr5427666pjb.78.1650633738937; Fri, 22 Apr 2022 06:22:18 -0700 (PDT) Received: from localhost.localdomain ([117.207.28.196]) by smtp.gmail.com with ESMTPSA id g13-20020a62520d000000b0050a923a7754sm2586840pfb.119.2022.04.22.06.22.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:22:18 -0700 (PDT) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: avri.altman@wdc.com, alim.akhtar@samsung.com, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, quic_asutoshd@quicinc.com, quic_cang@quicinc.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 4/5] scsi: ufs: core: Remove redundant wmb() in ufshcd_send_command() Date: Fri, 22 Apr 2022 18:51:39 +0530 Message-Id: <20220422132140.313390-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> References: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The wmb() inside ufshcd_send_command() is added to make sure that the doorbell is committed immediately. This leads to couple of expectations: 1. The doorbell write should complete before the function return. 2. The doorbell write should not cross the function boundary. 2nd expectation is fullfilled by the Linux memory model as there is a guarantee that the critical section won't cross the unlock (release) operation. 1st expectation is not really needed here as there is no following read/ write that depends on the doorbell to be complete implicitly. Even if the doorbell write is in a CPUs Write Buffer (WB), wmb() won't flush it. And there is no real need of a WB flush here as well. So let's get rid of the wmb() that seems redundant. Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche --- drivers/scsi/ufs/ufshcd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 9349557b8a01..ec514a6c5393 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2116,9 +2116,6 @@ void ufshcd_send_command(struct ufs_hba *hba, unsigned int task_tag) __set_bit(task_tag, &hba->outstanding_reqs); ufshcd_writel(hba, 1 << task_tag, REG_UTP_TRANSFER_REQ_DOOR_BELL); spin_unlock_irqrestore(&hba->outstanding_lock, flags); - - /* Make sure that doorbell is committed immediately */ - wmb(); } /** From patchwork Fri Apr 22 13:21:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 565175 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54847C433F5 for ; Fri, 22 Apr 2022 13:22:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1447939AbiDVNZV (ORCPT ); Fri, 22 Apr 2022 09:25:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1447938AbiDVNZT (ORCPT ); Fri, 22 Apr 2022 09:25:19 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3C2658394 for ; Fri, 22 Apr 2022 06:22:24 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id i24so7991642pfa.7 for ; Fri, 22 Apr 2022 06:22:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zSqkX7TcWeywMjVGkDaqt4I0CfnOOWaEQNQoX91yxGM=; b=sBqYuPt0XifDj11KJF2ArYF8kstCldmcCL7PC0qnMZN5P49dGeJEdwY9Il5Nbmigcm vXAl+JKru3xK/8jUDHbzqSn+H80jg3PMAQQdnV4OSgs29xcJ9OVKpENSjCfG8FW5m2+y SWHgrwbdOg/S7h2yLDzoYTK3n6rJGFol1s7zAfLq2BVvCleckLrksxLgFlsqPmiy4sF2 UV9J2EiGTccRVkxHKPvnRfRWBQn4iV3r6w20PkMg9+7pkiKuLrDljST+RrR+g/v8b5F9 EzPK6kBXX454I+61IhfYh3shai7uT7bWal6WUtObQR0UGnW7MRkJkARV22iYTF8Oypw0 njWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zSqkX7TcWeywMjVGkDaqt4I0CfnOOWaEQNQoX91yxGM=; b=bZa9gr+S6f7Q68HWfm45YDniOrv+AZg0ZNOqh7/4sFWflw6uZkPq4cw/WNHGq3DTKe IxeCCpIz55cyZy9YwH0wuKfmsexNoxBAHo94Y2EJVxo26zQ5WIOG1U4Xi5AqIyJaUopm metBp3snJXlLgU31yT4N/wlLvs2pR348HsA063Cd2Uw8WL2y+HO+HQvIcDJccrld4aSy Iie9cFb/qkwhxNl6NaQIIze2ck6Yin+rb3AvS/XZZlxAyaE9+1erMkfiemj1lyMlidTM D6AYzOBsseS2irVIpuEYDfe2JbDwQijHaA8/JD928Cl1T+fnVzkjlXm92lcWa+FdXnCv RHfA== X-Gm-Message-State: AOAM531BQrZl/LHw0VssuTfFatovR9K4U9GShuGVZLnfa46vtyZoSulq WI480PG4gIXeKSARsgX2JNpO8PTG5v8F X-Google-Smtp-Source: ABdhPJx6Yzon0UefzWSg/IXHpu2HKWdTxoUKSHKl6fEweWwXW51KugE7J+akdjD2lSXiqst2VNTOMQ== X-Received: by 2002:a62:fb0e:0:b0:505:fd9e:9218 with SMTP id x14-20020a62fb0e000000b00505fd9e9218mr5075359pfm.78.1650633744289; Fri, 22 Apr 2022 06:22:24 -0700 (PDT) Received: from localhost.localdomain ([117.207.28.196]) by smtp.gmail.com with ESMTPSA id g13-20020a62520d000000b0050a923a7754sm2586840pfb.119.2022.04.22.06.22.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 06:22:23 -0700 (PDT) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: avri.altman@wdc.com, alim.akhtar@samsung.com, bjorn.andersson@linaro.org, linux-arm-msm@vger.kernel.org, quic_asutoshd@quicinc.com, quic_cang@quicinc.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH 5/5] scsi: ufs: qcom: Enable RPM_AUTOSUSPEND for runtime PM Date: Fri, 22 Apr 2022 18:51:40 +0530 Message-Id: <20220422132140.313390-6-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> References: <20220422132140.313390-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org In order to allow the block devices to enter autosuspend mode during runtime, thereby allowing the ufshcd host driver to also runtime suspend, let's make use of the RPM_AUTOSUSPEND flag. Without this flag, userspace needs to enable the autosuspend feature of the block devices through sysfs. Signed-off-by: Manivannan Sadhasivam --- drivers/scsi/ufs/ufs-qcom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index 5b9986c63eed..bbcaefd44699 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -879,6 +879,7 @@ static void ufs_qcom_set_caps(struct ufs_hba *hba) hba->caps |= UFSHCD_CAP_WB_EN; hba->caps |= UFSHCD_CAP_CRYPTO; hba->caps |= UFSHCD_CAP_AGGR_POWER_COLLAPSE; + hba->caps |= UFSHCD_CAP_RPM_AUTOSUSPEND; if (host->hw_ver.major >= 0x2) { host->caps = UFS_QCOM_CAP_QUNIPRO |