Received: by 2002:ab2:855:0:b0:1ef:b27b:cc29 with SMTP id 21csp1722134lqy; Fri, 29 Mar 2024 06:49:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXyTkBF/CRo46w737h7aydPeJQc1PTi7JHLi2YJTphWrZhWHfcpFkL9rjpCkxyykoXl/SbId7y5dPaPJmoOVMHghYu6cVZpo40rZkV4Dw== X-Google-Smtp-Source: AGHT+IEswvp6vkadRgxYLs3VSiTfNdxqZVd4RqlHU8n5QiRAvpAGeMtlEOrfsCmM+2c2kfbX2Nrh X-Received: by 2002:a17:903:2442:b0:1e0:e35e:abc3 with SMTP id l2-20020a170903244200b001e0e35eabc3mr2818308pls.0.1711720195618; Fri, 29 Mar 2024 06:49:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711720195; cv=pass; d=google.com; s=arc-20160816; b=XZUOL+WkjRGxWK4wXYpSFqRd3HFlxHnE2tImZSnio7yWkj+1nbNLheCOB4TglQumLL vrnoFoUToUHPlzWSO6qD48DZGjQEjyVC8JXRdakv1RVhADYivLteLPyG7yxjP1n0mn4o rjRAcZOmrVGGJMk47/TqhWa98c89k9SuPmld/re+mBjN2YbX7mGtd5J7voulj5m7+DCT j3vF8pCo+pxybgridxYaHqHzGnVj+69K8/1n28zo5mDPjGz4gbs2p9eaEMyrrus86mpj +Rh+N4Zi3RwPsFD+DTl0IL/7J1Nfx8asdjmxKDdfGtthq6Ua25OkAKPYjhlb+CFTjE5u KiUw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=TEsLfeKBEkSvcnrPNbTyVnKH4CfxcDt+MC4AAKjJDCY=; fh=FdKuXFNmqwj1OQ3MJS3WhDw+gFxA6bFBJNEVcHajBK0=; b=aPzT9en2Ls4G6jr+FnXsfkENpN9bXhbaUa9gfhU6SoQo15UTHLn0FYOJGtTLsivZo4 1MyAV+K7GfAxzbRxDjBQgOc56VnffFe39H2jVMKICKISXL2XRpYEBGt/Kgai3G46IYPH U5WYfJIkeHT1hNl/vWjDsfl2UD/kFPEZe+p89C6MqlUMDFDEkVuPyADu18H3gQz0LXAK ltr/MhLgZ6pCt7gu5fBD3y7X59c9eTJu/xcnIPeJmh/kYql0Z7WYT//WPp69ubrOSGqg NXR+SFcYWg2wlEi0UbAJiV/56lOc0bSkx/jlxZd3YdunpQUG0AoGGuRbIT+BOoElGAM4 HkBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gxNPQxE3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124717-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124717-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id cp6-20020a170902e78600b001e0af9981a1si3483480plb.108.2024.03.29.06.49.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 06:49:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-124717-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gxNPQxE3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-124717-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-124717-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AEEA8B24F83 for ; Fri, 29 Mar 2024 13:32:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3F28145FFF; Fri, 29 Mar 2024 12:39:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gxNPQxE3" 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 CB0CB145B3B; Fri, 29 Mar 2024 12:39:36 +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=1711715976; cv=none; b=BnveuIl1UFwQkyzUXguRmSBrD3XC4FlUhfrY0srEeomhSkDG6HFkX/taAuLQVnAFRHL2OueISdntrYhmHek1u3vIWvBsDA21YduTanZ/XKaIQyCpoaASn6ptU11yFzKZ5DPCofB8gMmt99rhiKz/xqcHWpV+PTapqW+nqtmNa3s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711715976; c=relaxed/simple; bh=DL9ydJy4+MkNqRrWlZjVU5Jee/u9kzyIN7uk54AxvzA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kQ9TcatsQOSDo2aY95+LiBf5jixXFsdrdnZCnlUE0j3RJgA9ASiJofO3eOqV8xKv/qelimn7TTmlL/shsAbxRNPIboR3VRzVDG11mz79G/s0sOoL1axgvrPgYzTnZRlFpYnFMglC5eBX6T+t8p+F3oMHY4Dse4WTT8ORSNf/k7Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gxNPQxE3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EBF9C433A6; Fri, 29 Mar 2024 12:39:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711715976; bh=DL9ydJy4+MkNqRrWlZjVU5Jee/u9kzyIN7uk54AxvzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gxNPQxE3WPZFxGcBYxJehh6SdHsRctFLDB5fmmEHfayAd1FTDpZJ6pYAoqHxVHeWF gshvJzud6ViWykQ3wHznT6kJSPL9GZ5PGLw9Qimyf9dN4ePK20b6SzkguKiAP4VUsZ dpnjuzc4rUqajoXDEck89oiyEXfltjvgk+Vl67lIAgG2dvlULrYNXbS5pSwwhMBjyG WphDMTNAub8qTihcY5FlZSaxkAthgCSNAd1bq69yeMzVRiRZ05IpM1rsHTCDjTjGsV ZIaabMeaRP7L5M7cxAirV6egvjCTKtgMCeS55q+kc8ONZ2N4NBCU3L8lXadJ4QZe9U sVPFlVFLucyYg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Eric Chanudet , Manivannan Sadhasivam , Andrew Halaney , "Martin K . Petersen" , Sasha Levin , andersson@kernel.org, konrad.dybcio@linaro.org, jejb@linux.ibm.com, linux-arm-msm@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 6.8 08/98] scsi: ufs: qcom: Avoid re-init quirk when gears match Date: Fri, 29 Mar 2024 08:36:39 -0400 Message-ID: <20240329123919.3087149-8-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240329123919.3087149-1-sashal@kernel.org> References: <20240329123919.3087149-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.2 Content-Transfer-Encoding: 8bit From: Eric Chanudet [ Upstream commit 10a39667a117daf0c1baaebcbe589715ee79178b ] On sa8775p-ride, probing the HBA will go through the UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH path although the power info is the same during the second init. The REINIT quirk only applies starting with controller v4. For these, ufs_qcom_get_hs_gear() reads the highest supported gear when setting the host_params. After the negotiation, if the host and device are on the same gear, it is the highest gear supported between the two. Skip REINIT to save some time. Signed-off-by: Eric Chanudet Link: https://lore.kernel.org/r/20240123192854.1724905-4-echanude@redhat.com Reviewed-by: Manivannan Sadhasivam Tested-by: Andrew Halaney # sa8775p-ride Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/ufs/host/ufs-qcom.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 39eef470f8fa5..f7dba7236c6e5 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -738,8 +738,17 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, * the second init can program the optimal PHY settings. This allows one to start * the first init with either the minimum or the maximum support gear. */ - if (hba->ufshcd_state == UFSHCD_STATE_RESET) - host->phy_gear = dev_req_params->gear_tx; + if (hba->ufshcd_state == UFSHCD_STATE_RESET) { + /* + * Skip REINIT if the negotiated gear matches with the + * initial phy_gear. Otherwise, update the phy_gear to + * program the optimal gear setting during REINIT. + */ + if (host->phy_gear == dev_req_params->gear_tx) + hba->quirks &= ~UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; + else + host->phy_gear = dev_req_params->gear_tx; + } /* enable the device ref clock before changing to HS mode */ if (!ufshcd_is_hs_mode(&hba->pwr_info) && -- 2.43.0