Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2890505rdh; Wed, 27 Sep 2023 16:37:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6/Z5aQFQEcDL9svKMAwQJOIrI2QJ9hmLRfQmMV+PR8Ri8FU/gZzRLENiDvQrS5pkeHuct X-Received: by 2002:a17:90a:71c9:b0:276:ae8f:2456 with SMTP id m9-20020a17090a71c900b00276ae8f2456mr2931778pjs.3.1695857852722; Wed, 27 Sep 2023 16:37:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695857852; cv=none; d=google.com; s=arc-20160816; b=o9pdw+oAwQDfm41omjXE5PaaSj6i+heo9tZKmHnxP26WPD5J9NvdhXZxT+nc2YS2nn hmUIKax1QdOS5SwbPX6S3VOP1/F7aB+CU39lVyJxjgTQTCYa8+kAnnGtf0lDV7dvHGhH 4YRlf3sz8B+LJ8jRB6sIJM59yYBrxxMXVIS313c1/SeM8XEU+Tw2cfDoM6nXQgxMy0+G 7YsdbvA7+lhliw7aQc836Q97dJ3CIhsyUplTHhw0qnFYuZFG2E+ff+ZCkP8I4GYDVKx7 ybbdUUejt3ReEAizzNF+/a/o/uk+KlKvI4AEtfYWc5eX3vnKifRBiALEz2cgBOlB5V2p 2Dsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KPqilKbo3iVCZzaxWPXzKI2JGdBvQ+Njccl8+FkLp0E=; fh=3Xemy3yfaA5BSHpG+QAyL78tw3dXvHhKWWWSsMj7Jy4=; b=PjV1tCeCKFLk0zQHIDdB0/XDi6n6i/8csaIpz6iDzbeTL5dBUQa4pTGl57EF5Ilpvk BuyKFkM1/tprxYL0Ux6WDt3zcFKtqmCH9P3GP/mgrgqDgXePx81XMxjxQ/t/yLEqajTv YC8xStnxfda6WER/bLN2zMDgCnXECNlyMSrpUziI55j0bO4ni/zt0wlwj8yIquDNhOgr vccK2G0UCSGwLJTo4AQrv5jxjnD6sXd3YlEzFwpE3Ylcey+zs89yclRi2FiM873x7aFl NKdiUOLAXzV9RRGS8CVe3EtLvo8wShn4yNAbmeShvyUWTPhd6IGKet4iqCpDUEspc0Zp mLJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H0jYtSsB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l12-20020a17090a850c00b00273f1cd73b2si5765237pjn.75.2023.09.27.16.37.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 16:37:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H0jYtSsB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F046B80613BD; Wed, 27 Sep 2023 08:13:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232334AbjI0PNB (ORCPT + 99 others); Wed, 27 Sep 2023 11:13:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232289AbjI0PM7 (ORCPT ); Wed, 27 Sep 2023 11:12:59 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6692AF5 for ; Wed, 27 Sep 2023 08:12:58 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-523100882f2so13344173a12.2 for ; Wed, 27 Sep 2023 08:12:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1695827577; x=1696432377; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=KPqilKbo3iVCZzaxWPXzKI2JGdBvQ+Njccl8+FkLp0E=; b=H0jYtSsBpimfAI2xwWUKfH8Be2fqf/aHM2rHngzspoaYX92IPT2Q6BZXZbrT4Dix9z VT1knZoG3BqdjUWHNe18NFjGuuUGpX4fX8rfBA1n/EBAIbIXwpyIxv5ri0/1QJdPRrHV cKttv3nK5oBMRUpJEkahQEyl9PlR5x5FWVKOIzo72/RkO2TF44mMNdjESiC5ix6eMwFc oOwS2Yy7F8WZ5A7aXqKJE3M5yWjKTVmw1ucl0kJA+R+/PieN2sXNSTYLB2GfJebBqMw9 lYpFEBcqVBAv/6lnduV6AFMj2hl0F3GL62vIfTpVqGWP55lWYgkQh8RCgh6sveCLin5w 7yJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695827577; x=1696432377; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KPqilKbo3iVCZzaxWPXzKI2JGdBvQ+Njccl8+FkLp0E=; b=hhGYvZIAl/RsG3nqkqB1h/OSndshRugqohY5zDRCzfajbhXLadb0EpXWy/0mVQ0Bzn A0MI8oos6CJoGhG2dqrLnWHEEzmcrVhcc0pMwhvr4oAvGVgC6g8zkTNB6DPWDrtwG4Kp nRl47XGaR7/vWoNcRJm92TaRAh6P/CYaEhV8/Mpl0BHhvA0q0eLngSQu6zktO6yfvp5D HjdgcsxsFFyuKPYIMRDfen0mU/O+RQWeoTVZgSNWL8UnRM12IlTKRaDfB3BObn0cCTw9 541u/p9tuPiSl1P2f4vdh8egSFBSejFRNNw4XwBhVeugcLtUTGAz+8bGN9qs9GT1DtFC Snqg== X-Gm-Message-State: AOJu0Yx3/Lpyfg1sgboJ59uetdNa6auUSOybQmc/7CZ1ThvVmcIsRLnq p0k2IKOGev7ZzN4DJ4PrRXoy X-Received: by 2002:a05:6402:150f:b0:531:9c1:8271 with SMTP id f15-20020a056402150f00b0053109c18271mr2402992edw.14.1695827576789; Wed, 27 Sep 2023 08:12:56 -0700 (PDT) Received: from thinkpad ([2a02:2454:9d09:3f00:b024:394e:56d7:d8b4]) by smtp.gmail.com with ESMTPSA id j7-20020a50ed07000000b00527e7087d5dsm8229484eds.15.2023.09.27.08.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 08:12:56 -0700 (PDT) Date: Wed, 27 Sep 2023 17:12:55 +0200 From: Manivannan Sadhasivam To: Konrad Dybcio Cc: lpieralisi@kernel.org, kw@linux.com, andersson@kernel.org, bhelgaas@google.com, linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, abel.vesa@linaro.org Subject: Re: [PATCH v2] PCI: qcom: Make use of QCOM_PCIE_LINK_SPEED_TO_BW() macro for encoding link speed Message-ID: <20230927151255.GC19623@thinkpad> References: <20230927145738.115843-1-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 27 Sep 2023 08:13:12 -0700 (PDT) On Wed, Sep 27, 2023 at 05:06:55PM +0200, Konrad Dybcio wrote: > On 27.09.2023 16:57, Manivannan Sadhasivam wrote: > > Instead of hardcoding the link speed in MBps, let's make use of the > > existing QCOM_PCIE_LINK_SPEED_TO_BW() macro that does the encoding of the > > link speed for us. > > > > This eliminates the need for a switch case in qcom_pcie_icc_update() and > > also works for future Gen speeds without any code modifications. > > > > Suggested-by: Bjorn Helgaas > > Signed-off-by: Manivannan Sadhasivam > > --- > > > > Changes in v2: > > > > - Switched to QCOM_PCIE_LINK_SPEED_TO_BW() macro as per Bjorn's suggestion > > https://lore.kernel.org/linux-pci/20230924160713.217086-1-manivannan.sadhasivam@linaro.org/ > > > > drivers/pci/controller/dwc/pcie-qcom.c | 24 ++++++------------------ > > 1 file changed, 6 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c > > index 297442c969b6..dce80d6dc88f 100644 > > --- a/drivers/pci/controller/dwc/pcie-qcom.c > > +++ b/drivers/pci/controller/dwc/pcie-qcom.c > > @@ -148,6 +148,9 @@ > > > > #define QCOM_PCIE_CRC8_POLYNOMIAL (BIT(2) | BIT(1) | BIT(0)) > > > > +#define QCOM_PCIE_LINK_SPEED_TO_BW(speed) \ > > + MBps_to_icc(PCIE_SPEED2MBS_ENC(pcie_link_speed[speed]) / BITS_PER_BYTE) > Mbps_to_icc (lowercase b) is precisely that > lol, yeah. I missed it. Let me fix it and also add a patch for -ep driver as well. - Mani > Konrad -- மணிவண்ணன் சதாசிவம்