From patchwork Fri Dec 1 15:14:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13475994 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="M/72Xi7L" Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DEA4E9 for ; Fri, 1 Dec 2023 07:14:32 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6cdd4aab5f5so2211275b3a.3 for ; Fri, 01 Dec 2023 07:14:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443671; x=1702048471; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jvLkGXNQshvzZU680OmMrA5c7oAf7WIO0uWnCsVQkig=; b=M/72Xi7LtlcaLyxOdtc4W175e5smNQovEC4vDu2GqlgfWJWMjdUOx6hntqSCeQpnUq Xo65QX9+aNbQuQQCJRcXzv34xSD/vPTGtAPRs+9mKtGARv/XUlqPEC6J1HuepwjYD49k sXGv9g1kb/XoYQh1s9yv89vJnCW8XSfWiWtXtjOMWfCyyKnOxASVaVyBu9NCNB80pyk8 mzcTxH3ic9hGqOehjaww7qhc5kuemW/bph53cg+RmEIos6BtV56jwVKWW+HyJsK5Vw44 NQS5VgwFRFoqz7w6FrHjF0+XieN3EDCWvn4Y5H1AOWCy5P7KEa5sVpBzY5zXmAdxiHRc E/XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443671; x=1702048471; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jvLkGXNQshvzZU680OmMrA5c7oAf7WIO0uWnCsVQkig=; b=a8ksDkid6ChEyh5j7X+tYkTbISPn8JvECdK8Ws8wAHqleo2gOxUx4pTLP6E8ynzTVU /Em1bu5cJ8UegZpssDRU1a/VrZ9wxDJvgbo4U4a+VtEViEzRJpKp+V/8KNpmRLUhpsa2 rnNni+0e9MMCovQsY9foaWFyBinqo5lA3tZXUIi4LrcaU/s/fvIJnTDM7hPxACsBVmVd zjhMg2omZfiWRg1w5t8n43eGGW8bRfmC34fdY4vgwAMjCFy2TU5D9x1gIm3PX7lZ09z1 DxasbGgTpQ5L4ubZcyF6wT9wWozLXR3WwbsA78K3q7YK/QaWfw3MIQvWij1Ue5MKVBCW T8RA== X-Gm-Message-State: AOJu0YztMrcwNDwQm1OYVfCGICTuB+ImR1m0XXcvTofaDxZ6jiYV39tz SOHBW5nBD1E+Cbs85O+beQRj X-Google-Smtp-Source: AGHT+IHfg55fjDOeogk5wYiCzOSIR5XBMDXPS6dtqYKnYjDL4+dYx/9pbpMpF4BYl4nFFNl2hYsOGA== X-Received: by 2002:a05:6a20:8e26:b0:18c:abeb:b0db with SMTP id y38-20020a056a208e2600b0018cabebb0dbmr18760847pzj.49.1701443671549; Fri, 01 Dec 2023 07:14:31 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:14:31 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 01/13] scsi: ufs: qcom: Use clk_bulk APIs for managing lane clocks Date: Fri, 1 Dec 2023 20:44:05 +0530 Message-Id: <20231201151417.65500-2-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Lane clock handling can be simplified by using the clk_bulk APIs. So let's make use of them. This also get's rid of the clock validation in the driver as kernel should just rely on the firmware (DT/ACPI) to provide the clocks required for proper functioning. Signed-off-by: Manivannan Sadhasivam Reviewed-by: Andrew Halaney --- drivers/ufs/host/ufs-qcom.c | 94 ++----------------------------------- drivers/ufs/host/ufs-qcom.h | 6 +-- 2 files changed, 7 insertions(+), 93 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 96cb8b5b4e66..cbb6a696cd97 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -194,52 +194,12 @@ static inline int ufs_qcom_ice_suspend(struct ufs_qcom_host *host) } #endif -static int ufs_qcom_host_clk_get(struct device *dev, - const char *name, struct clk **clk_out, bool optional) -{ - struct clk *clk; - int err = 0; - - clk = devm_clk_get(dev, name); - if (!IS_ERR(clk)) { - *clk_out = clk; - return 0; - } - - err = PTR_ERR(clk); - - if (optional && err == -ENOENT) { - *clk_out = NULL; - return 0; - } - - if (err != -EPROBE_DEFER) - dev_err(dev, "failed to get %s err %d\n", name, err); - - return err; -} - -static int ufs_qcom_host_clk_enable(struct device *dev, - const char *name, struct clk *clk) -{ - int err = 0; - - err = clk_prepare_enable(clk); - if (err) - dev_err(dev, "%s: %s enable failed %d\n", __func__, name, err); - - return err; -} - static void ufs_qcom_disable_lane_clks(struct ufs_qcom_host *host) { if (!host->is_lane_clks_enabled) return; - clk_disable_unprepare(host->tx_l1_sync_clk); - clk_disable_unprepare(host->tx_l0_sync_clk); - clk_disable_unprepare(host->rx_l1_sync_clk); - clk_disable_unprepare(host->rx_l0_sync_clk); + clk_bulk_disable_unprepare(host->num_clks, host->clks); host->is_lane_clks_enabled = false; } @@ -247,43 +207,14 @@ static void ufs_qcom_disable_lane_clks(struct ufs_qcom_host *host) static int ufs_qcom_enable_lane_clks(struct ufs_qcom_host *host) { int err; - struct device *dev = host->hba->dev; - - if (host->is_lane_clks_enabled) - return 0; - err = ufs_qcom_host_clk_enable(dev, "rx_lane0_sync_clk", - host->rx_l0_sync_clk); + err = clk_bulk_prepare_enable(host->num_clks, host->clks); if (err) return err; - err = ufs_qcom_host_clk_enable(dev, "tx_lane0_sync_clk", - host->tx_l0_sync_clk); - if (err) - goto disable_rx_l0; - - err = ufs_qcom_host_clk_enable(dev, "rx_lane1_sync_clk", - host->rx_l1_sync_clk); - if (err) - goto disable_tx_l0; - - err = ufs_qcom_host_clk_enable(dev, "tx_lane1_sync_clk", - host->tx_l1_sync_clk); - if (err) - goto disable_rx_l1; - host->is_lane_clks_enabled = true; return 0; - -disable_rx_l1: - clk_disable_unprepare(host->rx_l1_sync_clk); -disable_tx_l0: - clk_disable_unprepare(host->tx_l0_sync_clk); -disable_rx_l0: - clk_disable_unprepare(host->rx_l0_sync_clk); - - return err; } static int ufs_qcom_init_lane_clks(struct ufs_qcom_host *host) @@ -294,26 +225,11 @@ static int ufs_qcom_init_lane_clks(struct ufs_qcom_host *host) if (has_acpi_companion(dev)) return 0; - err = ufs_qcom_host_clk_get(dev, "rx_lane0_sync_clk", - &host->rx_l0_sync_clk, false); - if (err) - return err; - - err = ufs_qcom_host_clk_get(dev, "tx_lane0_sync_clk", - &host->tx_l0_sync_clk, false); - if (err) + err = devm_clk_bulk_get_all(dev, &host->clks); + if (err <= 0) return err; - /* In case of single lane per direction, don't read lane1 clocks */ - if (host->hba->lanes_per_direction > 1) { - err = ufs_qcom_host_clk_get(dev, "rx_lane1_sync_clk", - &host->rx_l1_sync_clk, false); - if (err) - return err; - - err = ufs_qcom_host_clk_get(dev, "tx_lane1_sync_clk", - &host->tx_l1_sync_clk, true); - } + host->num_clks = err; return 0; } diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h index 9950a0089475..e2df4c528a2a 100644 --- a/drivers/ufs/host/ufs-qcom.h +++ b/drivers/ufs/host/ufs-qcom.h @@ -213,10 +213,8 @@ struct ufs_qcom_host { struct phy *generic_phy; struct ufs_hba *hba; struct ufs_pa_layer_attr dev_req_params; - struct clk *rx_l0_sync_clk; - struct clk *tx_l0_sync_clk; - struct clk *rx_l1_sync_clk; - struct clk *tx_l1_sync_clk; + struct clk_bulk_data *clks; + u32 num_clks; bool is_lane_clks_enabled; struct icc_path *icc_ddr; From patchwork Fri Dec 1 15:14:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13475995 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nogZAFzQ" Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ED9310DF for ; Fri, 1 Dec 2023 07:14:35 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6cdd28aa7f8so2127582b3a.3 for ; Fri, 01 Dec 2023 07:14:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443675; x=1702048475; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c+jx8HoyhzxiydFyXHE2frQBCbCouzHNLsW3Lqd+5ss=; b=nogZAFzQ1gFJA34X/nOWTr5HvcbRNPOp0XtpUZ6RllfyTCHMXaKwDGvQbDFghgE1II hzC5auAy1Y9XNvNt7lt+8NaZDh8NEvqdZ52jrSQC/wyfBvRRT3c3eK4Wxp9vtFCywqzx 0Ol/V4mOt+9JSl4uahzEFX7zZscbU/eE7s44larreDSdxi3Ap1FPnsSneuaMbgxPY6BO 6Cv2GXKf4nMoupm4rCGqwbdNnvVj/+MNQdWZh5ADgoo5xTBmwOja1KL4THGoq3wb7/1B TM15Z4CPuiTY8inOSQedHD0ZWB8Nj0QnrL1sXDif4wGRldoSX93pIYz7dVeoPIJU+XuF mmeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443675; x=1702048475; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c+jx8HoyhzxiydFyXHE2frQBCbCouzHNLsW3Lqd+5ss=; b=GU5e5Gw1Nq1syxBFg8B5LUrLMYocKQ2ac24GjwlcipknJGdZilPLWfSpERZDOhKEKC CQ0l+lDOC16G04JRgkJGd07bvaOWMJyTFmSjm05x7dymSUM8WNBRlIoWdMnK4Zv6iOwX ul7F60ueSpNU9CMZrP5fg5x7nQCW0GtjUiaH3s9BiYQpC21/x9wlZfSn35R4sTaj3fTx FNUspness/XJfdq5vvlCltDLYYxczVnh1i3+ZcIj0Eouj+y+7SlQfyGlUTb48QoN84vC teF9cBiu8/NXnMSs06QyolYxtS0htgo45R0WibiloAMrvlZoh7lzgEAGPwaOo2a+u8c9 7K7w== X-Gm-Message-State: AOJu0YxZCWz84ZC1dr1t9EIUtmESWImFEUFA4ZJJxomAET8A15zsA4dq j2Aags7/u1/QzCVWYSIaMOlE X-Google-Smtp-Source: AGHT+IEXcgzY0pBiF4IvEOSKrihXMHf6vn7vSvLxter42ILSy0vyLHU/Ml2svphdhbvyMnc1NER0vQ== X-Received: by 2002:a05:6a20:1614:b0:18b:f108:1595 with SMTP id l20-20020a056a20161400b0018bf1081595mr26409897pzj.53.1701443675056; Fri, 01 Dec 2023 07:14:35 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:14:34 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam , Abel Vesa Subject: [PATCH 02/13] scsi: ufs: qcom: Fix the return value of ufs_qcom_ice_program_key() Date: Fri, 1 Dec 2023 20:44:06 +0530 Message-Id: <20231201151417.65500-3-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Currently, the function returns -EINVAL if algorithm other than AES-256-XTS is requested. But the correct error code is -EOPNOTSUPP. Fix it! Cc: Abel Vesa Fixes: 56541c7c4468 ("scsi: ufs: ufs-qcom: Switch to the new ICE API") Signed-off-by: Manivannan Sadhasivam Reviewed-by: Abel Vesa --- 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 cbb6a696cd97..852179e456f2 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -158,7 +158,7 @@ static int ufs_qcom_ice_program_key(struct ufs_hba *hba, cap = hba->crypto_cap_array[cfg->crypto_cap_idx]; if (cap.algorithm_id != UFS_CRYPTO_ALG_AES_XTS || cap.key_size != UFS_CRYPTO_KEY_SIZE_256) - return -EINVAL; + return -EOPNOTSUPP; if (config_enable) return qcom_ice_program_key(host->ice, From patchwork Fri Dec 1 15:14:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13475996 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HM4mQeTz" Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE78CE9 for ; Fri, 1 Dec 2023 07:14:38 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1cfc2bcffc7so5448775ad.1 for ; Fri, 01 Dec 2023 07:14:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443678; x=1702048478; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f3kfHr+zbu/uneZ4lD4JhbFPgELgLtJ8NZ2za38JuAE=; b=HM4mQeTztByqk/kg5XN28mV8G7VAhhkric9HJh6Dyv0nETOl5yw6qJA8bj2rRWZYyQ BehEv8BjjJX90L8tGlHmUO9kIfveNPevPzuGkSCMTAb8sLktkJA1mfv4NattT/F+YCec iPL8fWZO/nZ0XdGtBtrJDV2xfJ1C8iX+2krU82IIu01NcVNa8O5CG0HBLhbbtMa2ECVl GrAqzw0UniZ3LhkN5rdKsvncsbI1tVbI1C70ALTMVXDp3V6sYy/VYxBC5dbrj4FKaSAY 7Z9AHPwNTIpVQ9oAPZwwOeD/TvGInAGY/kgWtPKA12jm3LHrksUYAVSQFLc9GItHzDQH 6yqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443678; x=1702048478; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f3kfHr+zbu/uneZ4lD4JhbFPgELgLtJ8NZ2za38JuAE=; b=tlHKSS7/e7YRAu3XnU7ygx3kYBFQ6poTVjGySG9WJHWZl9g4zVxidD7faN4VS4iPiF X31HTRu9FL6NwhpPMw5JSturBThTzT6voFp3up2QGZk/jJHknoz89Qg5FYAmTjVYZeQI jJ+aLsQ8orky+gFdEseocV7ZwPfIlbxA9l30tCetg8kdBfBHk3mrGWtLMW+QvWO3mHv1 tHlmEOWHgtLckTI4AHkd5rVwXjcK8jLeH6muxo37NOTGbya5YQeBEjBMp+Sk8w2LS/t0 P3UQ+OJ5XXbseGP3c83P9WM00ACp9SLqMz34Iv3/NB8YWOs95JZ/ANdLSJjuV/Oc9c+u EA7A== X-Gm-Message-State: AOJu0YxokluNAFNBno/6p4KMkOSvQLZV4cifbkcYXRJJamEJC5+Nsd+D e+dMXDqCdfY9PdIOmpQ1PBdo X-Google-Smtp-Source: AGHT+IGQbMODfad0onWH3yp27ryxYqlJOk59OxMJBwWdXR8mhA24qEpLLbVa+5KmJHWVuz333O747g== X-Received: by 2002:a17:902:d4cd:b0:1cf:e113:7932 with SMTP id o13-20020a170902d4cd00b001cfe1137932mr15787296plg.17.1701443678293; Fri, 01 Dec 2023 07:14:38 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.14.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:14:37 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 03/13] scsi: ufs: qcom: Fix the return value when platform_get_resource_byname() fails Date: Fri, 1 Dec 2023 20:44:07 +0530 Message-Id: <20231201151417.65500-4-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The return value should be -ENODEV indicating that the resource is not provided in DT, not -ENOMEM. Fix it! Fixes: c263b4ef737e ("scsi: ufs: core: mcq: Configure resource regions") Signed-off-by: Manivannan Sadhasivam Reviewed-by: Andrew Halaney --- 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 852179e456f2..778df0a9c65e 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1701,7 +1701,7 @@ static int ufs_qcom_mcq_config_resource(struct ufs_hba *hba) if (!res->resource) { dev_info(hba->dev, "Resource %s not provided\n", res->name); if (i == RES_UFS) - return -ENOMEM; + return -ENODEV; continue; } else if (i == RES_UFS) { res_mem = res->resource; From patchwork Fri Dec 1 15:14:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13475997 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GsWDNJ7h" Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAD3310DE for ; Fri, 1 Dec 2023 07:14:46 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-6cdd584591eso2181326b3a.2 for ; Fri, 01 Dec 2023 07:14:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443686; x=1702048486; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=beKD8U42oVG/LPkYMpuiHwtdIQIz07SaBd5mVxpojp4=; b=GsWDNJ7hcVWO7R7fS8kXZDkRU2GrEiO8pQAEWP2PXr3Rt4UdOhlW6LDNwy6zg/1uu3 w9Ty/ny+sn9lQKWroXzOJi5eqAUP2ZfVQNWql/Rb5mHejSMIdCUC1mSmgGODT1DVnRFk pnhuTLXsyNXcRxt5/4dJ3PYZtu4zgo1U+DJpmz3NL5navh0bAxkxUEGWBBpuqlgN8AF5 DPCcILbCCojk+mDxDBv+bUQaUk6pTuRL1ImtnS5C4kwexq6o8uz4R9kxuf134WZKhXGj sbm73cOkgsE2fuFoFg8vk/o57wWBfgeAdKC4t8s8mQ4f/MwwaCMIGWLnoboOCB9Xt/If l2kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443686; x=1702048486; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=beKD8U42oVG/LPkYMpuiHwtdIQIz07SaBd5mVxpojp4=; b=Fv/5riviknYCQJcx0WYuWlTgxhUOrVKQyiPerqsicQNoxf8XC/x/mJGjdaCRwxBJou QUYCz2yj2KlXTXSy2OjPRprGI6BlLk8YWk1iF0kJuAtUYbsqnuyAMSUbbJIE4oNkn3VB xwNz+Um46AxT75tqH+3arnu59pFIf6/ZEfIUBShIzup53fWJWqwckDwuv4nTK0pjzLRG GQ/K4mHAuX+V/U5nHQQ9yQQ+tZx7OK7ka68PdXSevVlgQwbGfDYCLH6tF3e7h6sRz7rn tCHIxfNoHKBM28M+DX2L/5wi3fDlf1R7+9avxG6H/rWTD2y41afNK4ikzK+jxY6E+WX+ G+Ww== X-Gm-Message-State: AOJu0YzvbDGdGEBgZsnGDW3IHj/RCm254BRN1d/pqe3qrOo6RtQ0Su5p VzSAv6o8j3WPU2q6uwUJ3m9e X-Google-Smtp-Source: AGHT+IEI1gQxHgxIVFSXBW3Lr4VkCQKmvityUZ3YN6dTPUUdQJ6TYB6K3ddDoLazcxETDunDTEe2MA== X-Received: by 2002:a05:6a20:9712:b0:187:9f15:bfc7 with SMTP id hr18-20020a056a20971200b001879f15bfc7mr22594590pzc.27.1701443681635; Fri, 01 Dec 2023 07:14:41 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.14.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:14:41 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 04/13] scsi: ufs: qcom: Remove superfluous variable assignments Date: Fri, 1 Dec 2023 20:44:08 +0530 Message-Id: <20231201151417.65500-5-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 There are many instances where the variable assignments are not needed. Remove them. Signed-off-by: Manivannan Sadhasivam Reviewed-by: Andrew Halaney --- drivers/ufs/host/ufs-qcom.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 778df0a9c65e..dc93b1c5ca74 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -219,7 +219,7 @@ static int ufs_qcom_enable_lane_clks(struct ufs_qcom_host *host) static int ufs_qcom_init_lane_clks(struct ufs_qcom_host *host) { - int err = 0; + int err; struct device *dev = host->hba->dev; if (has_acpi_companion(dev)) @@ -237,7 +237,7 @@ static int ufs_qcom_init_lane_clks(struct ufs_qcom_host *host) static int ufs_qcom_check_hibern8(struct ufs_hba *hba) { int err; - u32 tx_fsm_val = 0; + u32 tx_fsm_val; unsigned long timeout = jiffies + msecs_to_jiffies(HBRN8_POLL_TOUT_MS); do { @@ -292,9 +292,9 @@ static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host) */ static int ufs_qcom_host_reset(struct ufs_hba *hba) { - int ret = 0; + int ret; struct ufs_qcom_host *host = ufshcd_get_variant(hba); - bool reenable_intr = false; + bool reenable_intr; if (!host->core_reset) { dev_warn(hba->dev, "%s: reset control not set\n", __func__); @@ -417,7 +417,7 @@ static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba, enum ufs_notify_change_status status) { struct ufs_qcom_host *host = ufshcd_get_variant(hba); - int err = 0; + int err; switch (status) { case PRE_CHANGE: @@ -463,7 +463,7 @@ static int ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear, u32 core_clk_period_in_ns; u32 tx_clk_cycles_per_us = 0; unsigned long core_clk_rate = 0; - u32 core_clk_cycles_per_us = 0; + u32 core_clk_cycles_per_us; static u32 pwm_fr_table[][2] = { {UFS_PWM_G1, 0x1}, @@ -1418,7 +1418,7 @@ static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba, bool scale_up, enum ufs_notify_change_status status) { struct ufs_qcom_host *host = ufshcd_get_variant(hba); - int err = 0; + int err; /* check the host controller state before sending hibern8 cmd */ if (!ufshcd_is_hba_active(hba)) @@ -1689,7 +1689,7 @@ static int ufs_qcom_mcq_config_resource(struct ufs_hba *hba) struct platform_device *pdev = to_platform_device(hba->dev); struct ufshcd_res_info *res; struct resource *res_mem, *res_mcq; - int i, ret = 0; + int i, ret; memcpy(hba->res, ufs_res_info, sizeof(ufs_res_info)); From patchwork Fri Dec 1 15:14:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13475998 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="piBUBkG9" Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA228D4A for ; Fri, 1 Dec 2023 07:14:49 -0800 (PST) Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-6cdd214bce1so2208568b3a.3 for ; Fri, 01 Dec 2023 07:14:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443689; x=1702048489; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XnOqh3tKVGxzLKVliMslkL85vI3TlFUJ6BYDSjXWVCM=; b=piBUBkG9uHOi7mSVIxeCLVNiNuoR5BzdVQJJ7IgkhhSgJjpokyXpjW2euko5Ymd/SB jK5xDHPEq5Mn56qcprjXt28xqoT5HfhEzxXE9NC5Js/i9wbU66PPB2kjie0Wxwu2zhkn k7UoEqaUPYReoaMozX1s4wB5Gp4iNk3bKnaN3KnaHyP0MEimdy9iYl+i1Fyhwyry6SaZ 0ybrqzZEfpe1kV1H/h0rjb+9gScTZcPDb48biWNU3fyPC+OBL6KSpYYC3or3JY8Dtma0 8hI0e0Vkkcw6gmtBP9RPUoidPKMNckytaBj2QySybHla8YZ2i0xPPxHnml5lOnyYGSuO QmAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443689; x=1702048489; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XnOqh3tKVGxzLKVliMslkL85vI3TlFUJ6BYDSjXWVCM=; b=PLHKlVJeDHG3I4BhxOLhk45od92xTT8aJloQM3grK7a5VUJK72QaxeJoM01++H0Njn ub3Xqap6H9VOxriPzqRDw5+X0T3SjUqNBmsh7tj60yh5/1MT2x0mszHXkq6aY5WPs6tK oAxdY1i2BPkRqHkbrOd8YyPAqZZlrGgXeZafRN7UHGattoMnLC5sZM26Vn7NYfKPYvYw MTqL2nhPz2mW0UB2aiM3yjBPZDSpH5ICUau8zrAmno753b+89yfZ6uZkbs7ut7F1309h 4+G9fnRIJEhZuq1AcarQIW+Ja6hTdL07VYNl6zC19ipC+rnLHBOt4IImplJSaeTtHJh/ pgNg== X-Gm-Message-State: AOJu0Yw+SXh16iyrOwQa5n1A+E4/sxk3R7KFGqYhgBTW48BOcZt4dmsv NkEnu/8/ICcg762YogyGI5P0 X-Google-Smtp-Source: AGHT+IFRok/PPbeYz1jt5sDzaQAYKwisws8ppClXIyJSzhqJBqHMFReTc4GN3X4WZgb17WbfSDMXFw== X-Received: by 2002:a05:6a21:150a:b0:18a:f462:5d3c with SMTP id nq10-20020a056a21150a00b0018af4625d3cmr30375005pzb.12.1701443689407; Fri, 01 Dec 2023 07:14:49 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.14.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:14:48 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 05/13] scsi: ufs: qcom: Remove the warning message when core_reset is not available Date: Fri, 1 Dec 2023 20:44:09 +0530 Message-Id: <20231201151417.65500-6-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 core_reset is optional, so there is no need to warn the user if it is not available (that too not while doing host reset each time). Signed-off-by: Manivannan Sadhasivam Reviewed-by: Andrew Halaney --- drivers/ufs/host/ufs-qcom.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index dc93b1c5ca74..d474de0739e4 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -296,10 +296,8 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) struct ufs_qcom_host *host = ufshcd_get_variant(hba); bool reenable_intr; - if (!host->core_reset) { - dev_warn(hba->dev, "%s: reset control not set\n", __func__); + if (!host->core_reset) return 0; - } reenable_intr = hba->is_irq_enabled; disable_irq(hba->irq); From patchwork Fri Dec 1 15:14:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13475999 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="S5v2iuq0" Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25DCFD4A for ; Fri, 1 Dec 2023 07:14:55 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1cc9b626a96so5658465ad.2 for ; Fri, 01 Dec 2023 07:14:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443694; x=1702048494; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4tM3mSD6N99toh6Lxpzp3nqitrKgi3AWBJMN4NKcxwY=; b=S5v2iuq0paRROYnATkxyszRbyl0qI37bsf/seHcLz5zg9lO+DWKzcwdqldmYuc71wQ BOv5x9pwng6/+OsY3Cp+a5HBJj0FjQC8GsPq0kTZ8mPPKrfm/BkZl5B1BxCM/4etf67d u4qR+Ae0hnVqWT13DQN8Ryb3YbN3j4F+xv5hF5357iFOOIXf3K7g+87B6lc+RY+4wXAv BSQGLin7IZuA3LHk81ya2zJFOTtG1yk2LIYu0yQe+QICCkwAEWQ9qCzJwczl+D1bZafP H6hulE1eHrQV01DouYNqqXNG8mQoYwIHaZ2l+0yIf6SGOaWXBzf3R3To05P9PCeWeDYb oHtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443694; x=1702048494; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4tM3mSD6N99toh6Lxpzp3nqitrKgi3AWBJMN4NKcxwY=; b=mHBaGzDd7kTbsTHALEwRrILdRzpYST5e5u39jccv5bTOnRISycM18U7OIEl9P4cI/J ZeAzyMXL4CZ2dhq4Q8VR1ikHBoIPIteMp3hkIrp9gbLyLWIcmADSJq+G4SWJT8wbapNa U3NDiLmcpRq/pa6dsi3QO6FheWfSzFpQHD9p1WeEqfDVKIGZ9+Lch6ZK3xD/F+c349qq 5sNEX/M4UJxF05nlbyAWUgwkIfs+3MOtGEEslDXJx5Tix+C+FhOxSHXuhq6OO2rrXJ5d DYIV+IaVT32hgBtb2WI6X9rmQNF97RQPBFZpzkk3bRWdgmtJHDSnhv1vEKISb/g9OFqj dm4Q== X-Gm-Message-State: AOJu0YxHdPM8Ch72BIXQngqNiiL458NXDN5vpIHOck2LrKDbCI8i4A5S Vfb1PbZmUY8ALDaUfNTtDIEd X-Google-Smtp-Source: AGHT+IEvcSupiS55i7LRMCM1TM6DpAdYYQdvO+GsxJKs6TfD6+W1c+TV0iEwXWd6korXj6X6YAwZkQ== X-Received: by 2002:a17:903:11c4:b0:1cc:4072:22c6 with SMTP id q4-20020a17090311c400b001cc407222c6mr29718775plh.24.1701443694468; Fri, 01 Dec 2023 07:14:54 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:14:52 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 06/13] scsi: ufs: qcom: Export ufshcd_{enable/disable}_irq helpers and make use of them Date: Fri, 1 Dec 2023 20:44:10 +0530 Message-Id: <20231201151417.65500-7-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Instead of duplicating the enable/disable IRQ part, let's export the helpers available in ufshcd driver and make use of them. This also fixes the possible redundant IRQ disable before asserting reset (when IRQ was already disabled). Fixes: 4a791574a0cc ("scsi: ufs: ufs-qcom: Disable interrupt in reset path") Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bart Van Assche --- drivers/ufs/core/ufshcd.c | 6 ++++-- drivers/ufs/host/ufs-qcom.c | 9 +++------ include/ufs/ufshcd.h | 2 ++ 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index 8b1031fb0a44..671facc73921 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -289,21 +289,23 @@ static void ufshcd_wb_toggle_buf_flush_during_h8(struct ufs_hba *hba, static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba); static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba); -static inline void ufshcd_enable_irq(struct ufs_hba *hba) +void ufshcd_enable_irq(struct ufs_hba *hba) { if (!hba->is_irq_enabled) { enable_irq(hba->irq); hba->is_irq_enabled = true; } } +EXPORT_SYMBOL_GPL(ufshcd_enable_irq); -static inline void ufshcd_disable_irq(struct ufs_hba *hba) +void ufshcd_disable_irq(struct ufs_hba *hba) { if (hba->is_irq_enabled) { disable_irq(hba->irq); hba->is_irq_enabled = false; } } +EXPORT_SYMBOL_GPL(ufshcd_disable_irq); static void ufshcd_configure_wb(struct ufs_hba *hba) { diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index d474de0739e4..604273a22afd 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -300,8 +300,7 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) return 0; reenable_intr = hba->is_irq_enabled; - disable_irq(hba->irq); - hba->is_irq_enabled = false; + ufshcd_disable_irq(hba); ret = reset_control_assert(host->core_reset); if (ret) { @@ -324,10 +323,8 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba) usleep_range(1000, 1100); - if (reenable_intr) { - enable_irq(hba->irq); - hba->is_irq_enabled = true; - } + if (reenable_intr) + ufshcd_enable_irq(hba); return 0; } diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index 7f0b2c5599cd..f1fc16ac6af2 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -1231,6 +1231,8 @@ static inline void ufshcd_rmwl(struct ufs_hba *hba, u32 mask, u32 val, u32 reg) ufshcd_writel(hba, tmp, reg); } +void ufshcd_enable_irq(struct ufs_hba *hba); +void ufshcd_disable_irq(struct ufs_hba *hba); int ufshcd_alloc_host(struct device *, struct ufs_hba **); void ufshcd_dealloc_host(struct ufs_hba *); int ufshcd_hba_enable(struct ufs_hba *hba); From patchwork Fri Dec 1 15:14:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13476000 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OqYs0GmF" Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28456171C for ; Fri, 1 Dec 2023 07:14:59 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6cde4aeea29so1897299b3a.2 for ; Fri, 01 Dec 2023 07:14:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443698; x=1702048498; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S5u5mj8ueK+oc2yv8mZg26TvQm1X83rBh8cXq05A5b8=; b=OqYs0GmF8HFxp5IsgzqAulfJFTwog24rf3mni9vKI2/sxOm9JPq3BaymnyA3lIYbDq lGSX+JeE8BOmoWcJ/af2/C8Z+yk8j73ivOFvKMKt3z7hSLpuZBIN2rheDuC1e24em4Hu eNpbL5BMEQjQQjMX5piE943Zp5ANR/GLCN2tG1JtzFsrpDZtQ2cLI9EoNr/QiQVAtCf3 Q5i7E6PPHlYSfWrNvjBgtCYiSeCGGs9H4Kz412qih8tCbREub2ythCx2gF1NU65jOOKh GW78sJammyY7wBmDChniak6rErGEUS+maCY9+Pzuo4QwbzbFoy6qqG1nfNpQCAR/9fWz DMig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443698; x=1702048498; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S5u5mj8ueK+oc2yv8mZg26TvQm1X83rBh8cXq05A5b8=; b=ROc9+1N7Lvp1KUZ2Wpvz0kPTRmuJb+6PXfV4/pLRapn48yVghq1wDNYCB34Q762/ME qoTDuIaJ7d2HoVetv7QUXfQDf/rpQWAebthNL7N44dx+SAaXw+FuAdCIXtuhjokzGtYc w9IY4zRSKG5wXsMI4ZNtp6DrYG/FlnySmBCR1pZ9AdlqPmc3jbQZtxf4sfgtCBig3gvj lkGD3JulmS2JZIjWKLUe8E/6PaqKKlGMcBK8/6ssdJE8IDL/TXbiKs/eFcBq2Dj0oTJV 5ZrAsuMjeQMQfYCtLG2O5lTORPoLa7evmEIN4VnbS0+OYgb9D1/wK9/w0z6eYPsX0020 8JSQ== X-Gm-Message-State: AOJu0Yy8fQ9B9I2w5WiNMUqBbpURwT7OjWOAgo+6Bye7jXX1pDLP/zYZ XXIeBPfFNKkgIMbU9g/SA721 X-Google-Smtp-Source: AGHT+IEjBAHxDNnswReyTsQ/wgyRVee0zz+RTPON/r87o5NDp9vCjrHC67XAbwc0Yi+6bHfU1R4nag== X-Received: by 2002:a05:6a20:548e:b0:18c:8d0f:a794 with SMTP id i14-20020a056a20548e00b0018c8d0fa794mr19592802pzk.19.1701443698551; Fri, 01 Dec 2023 07:14:58 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:14:58 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 07/13] scsi: ufs: qcom: Fail ufs_qcom_power_up_sequence() when core_reset fails Date: Fri, 1 Dec 2023 20:44:11 +0530 Message-Id: <20231201151417.65500-8-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Even though core_reset is optional, a failure during assert/deassert should be considered fatal, if core_reset is available. So fail ufs_qcom_power_up_sequence() if an error happens during reset and also get rid of the redundant warning as the ufs_qcom_host_reset() function itself prints error messages. Signed-off-by: Manivannan Sadhasivam Reviewed-by: Andrew Halaney --- drivers/ufs/host/ufs-qcom.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 604273a22afd..4948dd732aae 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -359,8 +359,7 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba) /* Reset UFS Host Controller and PHY */ ret = ufs_qcom_host_reset(hba); if (ret) - dev_warn(hba->dev, "%s: host reset returned %d\n", - __func__, ret); + return ret; /* phy initialization - calibrate the phy */ ret = phy_init(phy); From patchwork Fri Dec 1 15:14:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13476001 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Fjo9L6Jc" Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B35A81725 for ; Fri, 1 Dec 2023 07:15:02 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-6cdd9c53270so1923393b3a.1 for ; Fri, 01 Dec 2023 07:15:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443702; x=1702048502; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=63N0jK5ZcBeJuBTrtXzoyRGZDNopQVJCv+vFWIRCiEI=; b=Fjo9L6Jc+XW3mkryMOXpBapHySvMEDBSGGCVBO8lKPjx7PdZLuWUaLsxYvzM/zTFbn 4ELY1d/1mbI2mv6Fc2GfQZ+WiWX6jtLmyhZJIze7wkAIcN+3BQQr+tHhd9n+DP048NB4 XseAf8A8MyPaH/SxxUxVuJ/OxSGM7FTYwaafsbEoIwBG8tVzOem6LWxZhepU8ru5LFQo JxAF4oWgM8154LI6XfpShBUPEntXLajZRlDIjE/MSLb1kIV/UDEkau5s/8tyzykTtvL3 IpskeAyOYgH7I6YtD2v9Pg15b9C3SNioexQinroYbUk1vXzbPtjfyrbHZN05WXqmBBHU LZ+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443702; x=1702048502; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=63N0jK5ZcBeJuBTrtXzoyRGZDNopQVJCv+vFWIRCiEI=; b=CYupNpQxnFZh85zKpfGe/cpsJISuFJLsxHGfHEpNno3rkynOhE/pjId1fLmrDDkm7S VYxhaLhtk/8o8Epm+A74zZDF7cEqJRaIq91mIn9VwUE1drd+qORuUNgZ/oFE921jngQz 6LKZL62N22UFTrOdBJVWEeD5qRZAeq85gD+5mgSZVtHTwQ8LDLFJIhF1qLdpAs+5BKPv +SV9tv9NyFFpKT0+hn5AHCokAn99uiTsxCN6jF3NfzFjwAhmUj0MGqdDH5K/m19LTyNR 1v/19n2rJD306O42qhQjETGcNA+ozweN8pJ+S1I313Td2jkARgHbSMTdCwDcua7eGZKN AKOg== X-Gm-Message-State: AOJu0YzIPOuqdmw55abE2WcXKuKHs0EtQN7ikLVFHunexXBPUElWpA15 A3SpyiUZRdvAk3EXi6frpvju X-Google-Smtp-Source: AGHT+IETQ1stSQmwhPIzf25NLke8Nu64YavF9AVB6RzSBdjnw47xK9+jZxC9s0vLs8BKJXMe1U27ug== X-Received: by 2002:a05:6a20:9150:b0:18b:9682:59e9 with SMTP id x16-20020a056a20915000b0018b968259e9mr26138765pzc.21.1701443701963; Fri, 01 Dec 2023 07:15:01 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.14.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:15:01 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 08/13] scsi: ufs: qcom: Check the return value of ufs_qcom_power_up_sequence() Date: Fri, 1 Dec 2023 20:44:12 +0530 Message-Id: <20231201151417.65500-9-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If ufs_qcom_power_up_sequence() fails, then it makes no sense to enable the lane clocks and continue ufshcd_hba_enable(). So let's check the return value of ufs_qcom_power_up_sequence(). Signed-off-by: Manivannan Sadhasivam Reviewed-by: Andrew Halaney Reviewed-by: Nitin Rawat --- drivers/ufs/host/ufs-qcom.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 4948dd732aae..e4dd3777a4d4 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -415,7 +415,10 @@ static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba, switch (status) { case PRE_CHANGE: - ufs_qcom_power_up_sequence(hba); + err = ufs_qcom_power_up_sequence(hba); + if (err) + return err; + /* * The PHY PLL output is the source of tx/rx lane symbol * clocks, hence, enable the lane clocks only after PHY From patchwork Fri Dec 1 15:14:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13476002 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="a/WAEUWw" Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DEDD1730 for ; Fri, 1 Dec 2023 07:15:06 -0800 (PST) Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-5c1f8b0c149so472177a12.3 for ; Fri, 01 Dec 2023 07:15:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443705; x=1702048505; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7s+dxOARPtmuDtxtrPmYWXFcx5QSwMABsj/xuwm0cfM=; b=a/WAEUWwXBU2IwTd/1lnStFpgCNRsM5snta4eqSqhLzBSBwpsjhVCyYVYV2lD/WBVS mbK/kKi8hhafFgki7Qke4VWPLBaLVImDjo6NBPn1bm3a1GvCkZ0+dXjGVHMVK+yz+ULe oYrdGfOX5MjAeEeT4kdwQP9lF1ejE8xyN2lHRc6ITB5fuWqYJepJip1GcRZ6r3sphNuX Qtzf+A6M6VkKAP2DtPIU5aln+GiDMb3JrCAeXSJU6d9i+kCdsm1ElijHkwoTVlLBuS/r FeoRBICXTsomzzFwdEpmQnGC+jZXB6VG2ejEmh3/xzob3O/wH+KPR86ty7Nt/YJjAb41 cXAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443705; x=1702048505; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7s+dxOARPtmuDtxtrPmYWXFcx5QSwMABsj/xuwm0cfM=; b=XpooqOFwG5AwjFIXVNw8E7oTC5JqrhjPFCm5JR5itiv1UpxBXuqkRFbac8qwgPKxzX rqaKNDiNwNN2jCZy0P9qkudZ9/xC1tVqWOqLL0M8FzEyMeDEIZskkdi8o4Wqhjd3hPaT al/TlcK57L8sbHd7FhcIuW/newu/f/71XxkLBDTdq9Gu5GjSNwV0uOaKVyj8Z9mmtyHM hsiEL9CWXWYzHQXR7jLIUpanok2j+dMGMJ691bAMo8s0gfmohM6mSORPCT9eNpCpB8Jz W69zNk93pKdjGzNgb8tq2LOjI/ASpdiL37KttY/llyN6iHi/e/5xWtAHl7BBgtNEJEDu UOew== X-Gm-Message-State: AOJu0YzPRL8W0Z5utE7PlZrlHogV08x/EbwD8ING/bcQM4xA6q9xN6+t j+JqsvYrwWc8Oj7kMunmJqaa X-Google-Smtp-Source: AGHT+IFvJZzkDlY46j20YHiJ2dxic5gDp8k5OB44MAkItevykW7t58SjWek1DweEF2vi9nrFLvLUYg== X-Received: by 2002:a17:90b:1a8d:b0:285:81aa:aec0 with SMTP id ng13-20020a17090b1a8d00b0028581aaaec0mr26173302pjb.12.1701443705444; Fri, 01 Dec 2023 07:15:05 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.15.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:15:04 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 09/13] scsi: ufs: qcom: Remove redundant error print for devm_kzalloc() failure Date: Fri, 1 Dec 2023 20:44:13 +0530 Message-Id: <20231201151417.65500-10-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 devm_kzalloc() will itself print the error message on failure. So let's get rid of the redundant error message in ufs_qcom_init(). Signed-off-by: Manivannan Sadhasivam Reviewed-by: Nitin Rawat --- drivers/ufs/host/ufs-qcom.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index e4dd3777a4d4..218d22e1efce 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1107,10 +1107,8 @@ static int ufs_qcom_init(struct ufs_hba *hba) struct ufs_clk_info *clki; host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL); - if (!host) { - dev_err(dev, "%s: no memory for qcom ufs host\n", __func__); + if (!host) return -ENOMEM; - } /* Make a two way bind between the qcom host and the hba */ host->hba = hba; From patchwork Fri Dec 1 15:14:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13476003 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NqcaiHbD" Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC6C1173E for ; Fri, 1 Dec 2023 07:15:09 -0800 (PST) Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6cde14ff73bso1831339b3a.0 for ; Fri, 01 Dec 2023 07:15:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443709; x=1702048509; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=64ppbjLuXnC3sRRee6xAp4YeL9+LAF3VOykBfQp43DQ=; b=NqcaiHbD9GEc1QdsywbH+1UAg6UVzN8fpEYFb9BqCPy8/OjnHyfEE/WF58C8a4gTkx wLcbXFvyQTq9BWcDY7/nuEgaV5OuKl9+L4xbhxUdFNU/KhlDvbNpcvpbgDzXl9NW6C8I 3Zwg72HTkUQJgwNRYUnnNrzwsBgj3KJUeyzy5JU/ikEYk1kseUj4TkcngNmSa7+VAHHE 4CD7wcv4fmktMwc/aWiqdm5UWfvfeTQnQ7laJkyUugKJTAQXxT7gK5Jikk23GhffpnZp 5hMuCRI94o1tvBCms84+ZqzCn5nR3TXnc8TwyNHp6p1ztZV6XB8dSSwraKG+b+Hf7xSv sK7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443709; x=1702048509; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=64ppbjLuXnC3sRRee6xAp4YeL9+LAF3VOykBfQp43DQ=; b=VOD6UwRK6cTRaBhZWhLfHGNJkBDXYeT6n9etb3fVtP8NQb6SJB8l9F9aALvTotUSu8 gDGqDFMMblC4t7n7vrIxQhKefl8y9BZHFT7Wz7QRlcScQsBKIqnNhNWi7EhkC+P/7T5G lymWuUfCR0ayG1K90s6FHS+N0i+xYJJ9Mf4LrcmfI0GMOlFhaHmVQK/2w9hnMXwF333r DyBcC5xUHAPWpXYxEwgCix6YqMrZ8+V7aN7q+fxh4xEUcDVlSulDVmXLx2dwWgR6WtoG QnZh0xfMqtTwiBH9ZGoxOrhosJd+odCERy5asdkXeGzM6OgCCDal9hJLXBkN7Bz7RW/7 CQFA== X-Gm-Message-State: AOJu0YzXV5+LVDHuMeknmXu6o+TnoAUZ4zteTHemYALYO++SfX22DvaT u2215pssMUIwucVJLpeEwGid X-Google-Smtp-Source: AGHT+IGFEwYFndW1mgX6h47/MbvGBKo00XuXVuSHUaCz6PgUzV+fkCdc8GeBdLKLTyRZDfjr7WGuGA== X-Received: by 2002:a05:6a20:918b:b0:15d:4cf1:212e with SMTP id v11-20020a056a20918b00b0015d4cf1212emr38989386pzd.4.1701443708902; Fri, 01 Dec 2023 07:15:08 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.15.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:15:08 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 10/13] scsi: ufs: qcom: Use dev_err_probe() to simplify error handling of devm_gpiod_get_optional() Date: Fri, 1 Dec 2023 20:44:14 +0530 Message-Id: <20231201151417.65500-11-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As done in other places, let's use dev_err_probe() to simplify the error handling while acquiring the device reset gpio using devm_gpiod_get_optional(). While at it, let's reword the error message to make it clear that the failure is due to acquiring "device reset gpio". Signed-off-by: Manivannan Sadhasivam Reviewed-by: Andrew Halaney --- drivers/ufs/host/ufs-qcom.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 218d22e1efce..a86f6620abc8 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1146,9 +1146,8 @@ static int ufs_qcom_init(struct ufs_hba *hba) host->device_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(host->device_reset)) { - err = PTR_ERR(host->device_reset); - if (err != -EPROBE_DEFER) - dev_err(dev, "failed to acquire reset gpio: %d\n", err); + err = dev_err_probe(dev, PTR_ERR(host->device_reset), + "Failed to acquire device reset gpio\n"); goto out_variant_clear; } From patchwork Fri Dec 1 15:14:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13476004 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="civyD6qH" Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E244619A1 for ; Fri, 1 Dec 2023 07:15:12 -0800 (PST) Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6cdfb721824so888015b3a.3 for ; Fri, 01 Dec 2023 07:15:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443712; x=1702048512; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=RbyUrAaftLH0a6pAoGx1Rl9IDQRbi9vKE/mvsuJjc8A=; b=civyD6qH10xgCdwlR5Oza3I6Aj2gy3qnQUJ9hL/6XcV5kOwyBNzfgfkEe/rH07/1m6 MFcwdNVNHLk8GTXrR/4xLPULHMnQlHp1kWfHlq1iKNUCHkNtMdPIavZOogvaFJ9PsFG7 8EXiO143NHCzdEGEnsH8vxnl88bSdQhErJfpvEwhOL60Nb9hqLmDatULZEqCgLRI4dtm qspGlc3059J9XcGhduZ8xcX3onfKyElk8R+n1pweNJ8U74OjRXJTzRLVNxaBLKYKgeqf aOrJSMo9NjbduC87IZkZp6OMwen+cdtU8PuaVZ1uQjAiPd/sIls0yz7RFI9ewPux/TZI ZjGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443712; x=1702048512; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RbyUrAaftLH0a6pAoGx1Rl9IDQRbi9vKE/mvsuJjc8A=; b=vq90dHNYea/gCUWYZ0kOBMG1dz9sD0lsEEHQ2iQ6FO+t0r9hQMTGfm9zx9SHr9rBS2 X+9xu7OO2BkjRQ2ONz6NK4LeiYPnwOBhDOmQV3n9d12nhbtgqNoTGmWGjkRTM5CM9PrG k+KhNmJKVNNz6pcGKxdN3eVwxnnUMMLAamP7spAW9StNsi+7fdovDxojZYMvwZZfcIZn eNdEGouP7ytVCqU63LnoH0j/mW431l8uZpyzBySqlg5N+fbMy3u8mLCqRA5n4F+y4+cS qAIlAYo2I1XBmegE1puYsitgtPDpnx1/8wouohPPiOpqejd88wOGl3mhDCLjpE4GAEqU c/Ww== X-Gm-Message-State: AOJu0YxpUlCb0o2x3A27Q/pTYTcoNjWkL0bZeTJLQvFURxhfiAqMcTtv liqtJRFH7FNMoK5s+L0tTNMi X-Google-Smtp-Source: AGHT+IFuCo2HXUNTDZ89i3ZUB/xN8N1lk9JFjN5kV2JC6maA9HXjbyuOLP1pqtskP+HahJYnCrsHJw== X-Received: by 2002:a05:6a21:7891:b0:18b:950d:de3b with SMTP id bf17-20020a056a21789100b0018b950dde3bmr31394907pzc.38.1701443712159; Fri, 01 Dec 2023 07:15:12 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:15:11 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 11/13] scsi: ufs: qcom: Remove unused ufs_qcom_hosts struct array Date: Fri, 1 Dec 2023 20:44:15 +0530 Message-Id: <20231201151417.65500-12-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 ufs_qcom_hosts array is assigned, but not used anywhere. So let's remove it. Signed-off-by: Manivannan Sadhasivam Reviewed-by: Nitin Rawat --- drivers/ufs/host/ufs-qcom.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index a86f6620abc8..824c006be093 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -90,8 +90,6 @@ static const struct __ufs_qcom_bw_table { [MODE_MAX][0][0] = { 7643136, 307200 }, }; -static struct ufs_qcom_host *ufs_qcom_hosts[MAX_UFS_QCOM_HOSTS]; - static void ufs_qcom_get_default_testbus_cfg(struct ufs_qcom_host *host); static int ufs_qcom_set_core_clk_ctrl(struct ufs_hba *hba, bool is_scale_up); @@ -1192,9 +1190,6 @@ static int ufs_qcom_init(struct ufs_hba *hba) ufs_qcom_setup_clocks(hba, true, POST_CHANGE); - if (hba->dev->id < MAX_UFS_QCOM_HOSTS) - ufs_qcom_hosts[hba->dev->id] = host; - ufs_qcom_get_default_testbus_cfg(host); err = ufs_qcom_testbus_config(host); if (err) From patchwork Fri Dec 1 15:14:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13476005 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="GtWJ/wzc" Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45D7B1BD3 for ; Fri, 1 Dec 2023 07:15:16 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6cde11fb647so2217998b3a.1 for ; Fri, 01 Dec 2023 07:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443715; x=1702048515; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HRvflStZ/vTcP5B8zVnsU2ULybvGH2B1eMnhOvB9jfI=; b=GtWJ/wzcoOW5Jc3UDjFMV81ANMdOg5e0pedMcEQBThMVaiJvZeoMKfs8uaoECnZFNx orK42lnrM+sIthwFggaw6nUl7gpytq02A5vlbNO/t13babiolophin53U7p4xwymiWfm GRbi0RbNy3Z6WeFd4UL9nN6YjqzSNE92cxJ/hcXdRHTifM7L/oYTE/qs8JhEGvv4INbi F/XiVrm7fcCwWr2+HkEpY4FdYE0IZKzQAdna0U5OTkSCrbAxdBbhi3Llq42NvstM1JXj MgSYEbSGzSpj3RGkBuH4jqSqc7m4ZCie7zJfamt2BQU5JiB0EU0JnYgCXXNtqL0vFxZZ CNDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443715; x=1702048515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HRvflStZ/vTcP5B8zVnsU2ULybvGH2B1eMnhOvB9jfI=; b=G84tPegDdXW0co9lwhYtfSNQr6QdC7qWuYbqQU4WydsGMYiuTV+g9bgV36n0EONwVq 9yr7PQpuIJ5QfuNAxsSARvRxXeJZtYStS1tZOkcUlrv4YJSbusyGsRL4C/eymQtAJ/5x IPcFMHLShWALME8GtxqujW+/Dq8/UzJemq+diNjiEcr4kf0X1pUvk2+laX1EEHpMfod7 ZIkL+EeNLBaPvirK+ASd20DZ5NIGvOVTcyjMA9qfBtwNajxraiTfbMDN9MeETGa9EGOj OyAIW3Woh43EUSOEKs7qG2KOuagcW/rHJ9wRrjQpCQtz8KNuPJqjlExNj8rQmNDYF/Eg darg== X-Gm-Message-State: AOJu0YwGtNfqYOT3Kd3vva83ou1VwFdxtVOhNp/tJmhTr7A/v5VNWNxv GhT+PoELYgCVaO1+oUqkV1k6 X-Google-Smtp-Source: AGHT+IFL+VdkT8Jx4gdpedUqkKxN/i8MfrhTGRszx2lMQkD1Yq8i2V0FL16deBTMgMSjHw0oq7LBQQ== X-Received: by 2002:a05:6a00:1401:b0:68a:5cf8:dac5 with SMTP id l1-20020a056a00140100b0068a5cf8dac5mr29042906pfu.22.1701443715471; Fri, 01 Dec 2023 07:15:15 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:15:15 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 12/13] scsi: ufs: qcom: Sort includes alphabetically Date: Fri, 1 Dec 2023 20:44:16 +0530 Message-Id: <20231201151417.65500-13-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sort includes alphabetically. Signed-off-by: Manivannan Sadhasivam Reviewed-by: Nitin Rawat --- drivers/ufs/host/ufs-qcom.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 824c006be093..590a2c67cf7d 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -4,26 +4,26 @@ */ #include -#include #include #include +#include +#include #include #include #include -#include #include -#include +#include #include -#include +#include #include #include -#include "ufshcd-pltfrm.h" -#include -#include "ufs-qcom.h" #include #include +#include +#include "ufshcd-pltfrm.h" +#include "ufs-qcom.h" #define MCQ_QCFGPTR_MASK GENMASK(7, 0) #define MCQ_QCFGPTR_UNIT 0x200 From patchwork Fri Dec 1 15:14:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 13476006 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dqpTXmDo" Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C5A81BF4 for ; Fri, 1 Dec 2023 07:15:19 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6cdfb72172aso913201b3a.1 for ; Fri, 01 Dec 2023 07:15:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701443719; x=1702048519; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=99jwCtueYKuqHSnO06pq+vanF2UHvfzCABwBvmt41SY=; b=dqpTXmDoXE6wytJPhm2PCBQfp/5HV7AtqtFuSibrn7aUkYe89B32Er6GSctfWsodS3 5adNy7vLCG/+vARD/4JbpdWTFJb8JGike3Oa9YjC3A18kQ5paNKCktHOGIWb5SY8rFdx hYwMu2edywVkLpgNa1FYcalgADmyGnWCieRxbjpkzNO96Q+qqi7AxLB3HcbyhJup1WKe 9nAw/W4/BGMt8cMwavX5YXBQo2jeXN1wMH7Jxa/8X88R7KKhsq0gpmNI97pOpt2IC8lo ZdXDc5tnZxdwXd1Aekcl8X9VjzPKXRjDe60PRrzGBVhNdZUMd4PmmlSipE1Tu7p1+FCc po+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701443719; x=1702048519; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=99jwCtueYKuqHSnO06pq+vanF2UHvfzCABwBvmt41SY=; b=dCpjAFM6J1aaBVF3tCGsj/Somkt43NHRjmSbuIaK58MK3cTUOKcqOxOke8YTpPR8PQ COz0dj3N119aTmiNUQH8uAw0MV3ssvpeBC7oWjx25EMHbY9bgu9fgMmSa9afGl4cpJrV pizYxgn7TUqy0c+S034pm2D/L4Hs25Tze2Bt3TJQLjKe4qc8Uty7pIiPb4RDVjsNl9r8 AJ+xOJ1nxG1YR3KRfMXDUChnEpYqnI2EaLqQ06aYWkruL/eURy3+r/sGd3CsJR/6UiNr NuH1OjUyTLBLZHcaQZ2WPi2qA8R8iwHA4CW008mhf3PtRVwQFsz1sSxQlZ9KRK5A/Eoa eiwg== X-Gm-Message-State: AOJu0Yzxy5DyMfnHw53kym1Rgcp+MKEtMZDlcDXJSCEvgsIzG8AZXPbj 9EriBOF//n35LNHm9GVfOCdc X-Google-Smtp-Source: AGHT+IG0lDGObraHLt0PSday0c1vddh/0X4DzkGcDUEtJFQ4rieNhf2pWlFV1r7BSDu6rIgWhh5OOA== X-Received: by 2002:a05:6a00:938d:b0:6cd:faa6:fc36 with SMTP id ka13-20020a056a00938d00b006cdfaa6fc36mr3968638pfb.30.1701443718764; Fri, 01 Dec 2023 07:15:18 -0800 (PST) Received: from localhost.localdomain ([117.213.98.226]) by smtp.gmail.com with ESMTPSA id s14-20020a65644e000000b00578afd8e012sm2765824pgv.92.2023.12.01.07.15.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Dec 2023 07:15:18 -0800 (PST) From: Manivannan Sadhasivam To: martin.petersen@oracle.com, jejb@linux.ibm.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, quic_cang@quicinc.com, Manivannan Sadhasivam Subject: [PATCH 13/13] scsi: ufs: qcom: Initialize cycles_in_1us variable in ufs_qcom_set_core_clk_ctrl() Date: Fri, 1 Dec 2023 20:44:17 +0530 Message-Id: <20231201151417.65500-14-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> References: <20231201151417.65500-1-manivannan.sadhasivam@linaro.org> Precedence: bulk X-Mailing-List: linux-scsi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In case the "core_clk_unipro" clock is not provided, "cycles_in_1us" variable will be used as uninitialized. So initialize it with 0. Issue reported by Smatch tool: drivers/ufs/host/ufs-qcom.c:1336 ufs_qcom_set_core_clk_ctrl() error: uninitialized symbol 'cycles_in_1us'. drivers/ufs/host/ufs-qcom.c:1341 ufs_qcom_set_core_clk_ctrl() error: uninitialized symbol 'cycles_in_1us'. Signed-off-by: Manivannan Sadhasivam Reviewed-by: Nitin Rawat --- 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 590a2c67cf7d..208543a62d43 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1296,7 +1296,7 @@ static int ufs_qcom_set_core_clk_ctrl(struct ufs_hba *hba, bool is_scale_up) struct ufs_qcom_host *host = ufshcd_get_variant(hba); struct list_head *head = &hba->clk_list_head; struct ufs_clk_info *clki; - u32 cycles_in_1us; + u32 cycles_in_1us = 0; u32 core_clk_ctrl_reg; int err;