Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp789545lqt; Tue, 19 Mar 2024 04:07:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfvQpgoY2u0yPN5gvv4bZf5hEwQ4obh0moWadyj7M1BlBYdtwG6KGLZsMr/V+Ejfwme/kEhNXg3GLNwdx5FWcl0HolTpn8utukwrZ20A== X-Google-Smtp-Source: AGHT+IGHoTWNVf9uH0FnNNX6RFZE8VqbJpmxflIp+DEksLpNURsaAcvCzzVxNpe5suCpFbeSOYJf X-Received: by 2002:ac8:7d54:0:b0:42e:f7cf:ffa5 with SMTP id h20-20020ac87d54000000b0042ef7cfffa5mr19296541qtb.38.1710846465893; Tue, 19 Mar 2024 04:07:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710846465; cv=pass; d=google.com; s=arc-20160816; b=fEXZ0QrQxMSv9cuhAQD9VpD/4G9D2sSWm8xwr2JQXmRV+rolgmFSuadClDNrdVEP76 CiGtNiU1q9fJYmiPo9/ZOyGPrs5Brwc31ZKXsXbCbx7rzXkpAahKjwPTK1QKoGNla3GC +xTSstHe1y72Ng90KjBnrVXsNgyL1zN223kzu4St9Z6aH2zJl3y36OdIltk5XZb+EQkC u7OWS0NY+cun15MPTdnlQcNtzsHu/d4XnU36noPABmkDOcVTnKZIMAC6HircMxSLDHSf SaUFOGn2ocICxGBRS65fQNUXRnFCE/KXlkHGNcdxBmks4qmxmNGLm4/8t3c6nu4ukHXL zFGA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=s6prlzbdg7THi44K6pB0anmZEUrHlNA21RkUbYyl6f4=; fh=h2+Z2UDTwh486W/YcZgcjoxNR7LTVeBd5q3mY+AoLoY=; b=px3XY2ao6ng73ljqhyWYGgtJfnjcOFgOsnuseZoGMOMwEJFHqhcqMHyE0BvZPjZiga r4ixeFmltgm4XJ3B/Xbkh3RNBn2N6HFQqnFCpA9iqKEaTJumOZx51nYGhDd1Lu6x7bmI BbLh9BY1EmydUJKJRf7Anq8yhOSkxG2NFOPHl/q7VbeiDNJlJkm23NIcx4DjPfICICRI eiQ0GLsOOeZdcidckQ/vBUxjzXrtGkQa7wK+6R0R5eWH7Ww3cllEjK2EJG8DVOAjvZUS AJ9iBvHBl71OO8Sdx1GUujifFziBG6COwINJfkB99FiCfGCn3frH5lOgCvccfCIpbWmQ hDxg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=dmInOBrl; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-107438-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107438-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r19-20020ac85c93000000b0043095d777e8si11367200qta.325.2024.03.19.04.07.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 04:07:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107438-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=dmInOBrl; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-107438-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107438-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8ED091C2222E for ; Tue, 19 Mar 2024 11:07:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E5A757E582; Tue, 19 Mar 2024 11:07:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="dmInOBrl" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 4EC1864CE8; Tue, 19 Mar 2024 11:07:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710846454; cv=none; b=BN1NlCTeL7mYGnOL5vTeZ4Pz1lUlpTScM4130+TNMsILQ03Hd+ujqJsrZfen+t4S1qEWkV/AED2r2i6MCjrCTKAdXNspcRGAnrws65y3brqVJDbHwSRaqbdNBA5MOPFC3gHrEH4TDAiqMcJGzXkvuaSxNz+slTpR5J9esWO1QRo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710846454; c=relaxed/simple; bh=pWUlgTn6nHX3bdnZ9hOiOeopJLOgtZrnwrOe1BUeat4=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=ZahHNIC1pXmHNQe7AgSvQnbpAOOVT3LxCKct39xhKkrhFPPOA0pETbtzwX/9K7otpcoJsTgv399yplolwt2/JdOi94w3fyZDxaTJq9TNTN7v6adZuH8FfQUROoOAJGrBUq6DSqb+4tS/SEXEgGOP1FjLBI2lSVk55sj84/8bneA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=dmInOBrl; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42J3JXQf016132; Tue, 19 Mar 2024 11:07:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= qcppdkim1; bh=s6prlzbdg7THi44K6pB0anmZEUrHlNA21RkUbYyl6f4=; b=dm InOBrlljudKxx9rKF5chn5g6OXVkZKW6syeItdrC1nQPWW3NDtuv0cyUr5M8ZuLB MNAKlvmaZjG3LQ263IO/RicYLnKI0WV8wpKiQuGYb6mropYkKf3DoDl+n95sdvcy l2HYs8OpwJezEAHcbi9fG+I10I4vWr1q1VAie9r9ooPLMgfDWvKgAcqkpx+d6tAx yY9XixjPMTQhD5P56VJ5WlwrvwvSInLoZ112ThMzMN+pZ9f2sMgp2CC/Cxsgyuyb 51AE8uBvxA3WFzkt7e5gepOKyWRrqOHIsbRM3UdiY6BX8eO+qLfMUOjJ7O1HY5Uy 40E/9NyeAYlSLcFka8bg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wy2e9gyb7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Mar 2024 11:07:16 +0000 (GMT) Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42JB7E9g011442 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Mar 2024 11:07:14 GMT Received: from [10.81.25.230] (10.49.16.6) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 19 Mar 2024 04:07:14 -0700 Message-ID: <6eafdda1-76e1-49af-ae4b-ffe7b26097ca@quicinc.com> Date: Tue, 19 Mar 2024 04:07:13 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v1 2/3] PCI: dwc: add equalization settings for gen4 Content-Language: en-US To: Bjorn Helgaas CC: "agross@kernel.org" , "andersson@kernel.org" , "konrad.dybcio@linaro.org" , "mani@kernel.org" , "Mrinmay Sarkar (QUIC)" , "Aravind Ramakrishnaiah (QUIC)" , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Rob Herring , Bjorn Helgaas , "manivannan.sadhasivam@linaro.org" , "Serge Semin" , Yoshihiro Shimoda , Josh Triplett , Conor Dooley , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-arm-msm@vger.kernel.org" References: <20240301200041.GA405674@bhelgaas> From: Shashank Babu Chinta Venkata In-Reply-To: <20240301200041.GA405674@bhelgaas> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: CkVqNtX-GBpxlL74-lxp7Gfa2UQ6sN5W X-Proofpoint-ORIG-GUID: CkVqNtX-GBpxlL74-lxp7Gfa2UQ6sN5W X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-18_12,2024-03-18_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1011 mlxlogscore=999 suspectscore=0 spamscore=0 bulkscore=0 phishscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 mlxscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2403140001 definitions=main-2403190085 On 3/1/24 12:00, Bjorn Helgaas wrote: > On Thu, Feb 29, 2024 at 09:11:35PM -0800, Shashank Babu Chinta Venkata wrote: >> GEN3_RELATED_OFFSET is being used as shadow register for generation4 and >> generation5 data rates based on rate select mask settings on this register. >> Select relevant mask and equalization settings for generation4 operation. > > Please capitalize subject lines to match history ("PCI: qcom: Add ...") > > s/GEN3_RELATED_OFFSET/GEN3_RELATED_OFF/ (I think?) > > I wish these "GEN3_RELATED" things were named with the data rate > instead of "GEN3". The PCIe spec defines these things based on the > data rate (8GT/s, 16GT/s, etc), not the revision of the spec they > appeared in (gen3/gen4/etc). I have kept it consistent with nomenclature followed in pcie designware documentation for these registers. For function names and constraint to apply these, I will fall back to data rates rather than generation. > Using "GEN3" means we have to first look up the "gen -> rate" mapping > before finding the relevant spec info. > > Applies to the subject line, commit log, #defines, function names, > etc. > >> +void qcom_pcie_cmn_set_gen4_eq_settings(struct dw_pcie *pci) >> +{ >> + u32 reg; >> + >> + reg = dw_pcie_readl_dbi(pci, GEN3_RELATED_OFF); > > Warrants a one-line comment about using "GEN3_..." in a function named > "..._gen4_..." (But ideally both would be renamed based on the data > rate instead.) > >> +++ b/drivers/pci/controller/dwc/pcie-qcom-cmn.h >> @@ -9,10 +9,29 @@ >> #include "../../pci.h" >> #include "pcie-designware.h" >> >> +#define GEN3_EQ_CONTROL_OFF 0x8a8 >> +#define GEN3_EQ_CONTROL_OFF_FB_MODE_MASK GENMASK(3, 0) >> +#define GEN3_EQ_CONTROL_OFF_PHASE23_EXIT_MODE BIT(4) >> +#define GEN3_EQ_CONTROL_OFF_PSET_REQ_VEC_MASK GENMASK(23, 8) >> +#define GEN3_EQ_CONTROL_OFF_FOM_INC_INITIAL_EVAL BIT(24) > > Are these qcom-specific registers, or should they be added alongside > GEN3_RELATED_OFF in pcie-designware.h? yes, these are designware register offsets. Will move them to designware header file. However, the settings are vendor specific.I will park settings for these in QCOM specific files. > >> +#define GEN3_EQ_FB_MODE_DIR_CHANGE_OFF 0x8ac >> +#define GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_VAL 0x5 >> +#define GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_VAL 0x5 >> +#define GEN3_EQ_FMDC_N_EVALS_VAL 0xD >> +#define GEN3_EQ_FMDC_T_MIN_PHASE23_MASK GENMASK(4, 0) >> +#define GEN3_EQ_FMDC_N_EVALS_MASK GENMASK(9, 5) >> +#define GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_MASK GENMASK(13, 10) >> +#define GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_MASK GENMASK(17, 14) >> +#define GEN3_EQ_FMDC_N_EVALS_SHIFT 5 >> +#define GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_SHIFT 10 >> +#define GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_SHIFT 14 > >> +++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c >> @@ -438,6 +438,10 @@ static int qcom_pcie_perst_deassert(struct dw_pcie *pci) >> goto err_disable_resources; >> } >> >> + /* set Gen4 equalization settings */ > > Pointless comment. > >> + if (pci->link_gen == 4) >> + qcom_pcie_cmn_set_gen4_eq_settings(pci); > >> +++ b/drivers/pci/controller/dwc/pcie-qcom.c >> @@ -263,6 +263,10 @@ static int qcom_pcie_start_link(struct dw_pcie *pci) >> { >> struct qcom_pcie *pcie = to_qcom_pcie(pci); >> >> + /* set Gen4 equalization settings */ > > Pointless comment. > >> + if (pci->link_gen == 4) >> + qcom_pcie_cmn_set_gen4_eq_settings(pci);