Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1001407ybb; Fri, 20 Mar 2020 11:36:30 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvsSPoUPW/qaqtg3CAL+tCovdYZrAnNuNK7LzvkvolHHBz1eE3B0ujQ9D6qKeBZC8phM5qh X-Received: by 2002:aca:aa0a:: with SMTP id t10mr1781845oie.38.1584729389938; Fri, 20 Mar 2020 11:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584729389; cv=none; d=google.com; s=arc-20160816; b=vd1NVxw3WY2KwEZr4CejSwk3Zrs2O7kHzx7EYbB8kTwbTD2HOkFs2y/bq+d7bnS3a9 64ZUahmWes6ASpIFXEcqSNdCj3M0VegRam6WZLwx35MI++RNgkGOPDv4C3atVCDc7VeQ eFTGWW8JAnlpFQBUneaVEp7LAS5qAyrUee9LeARWrsJ0zlgC+v5nfyJ328dFz7YAuntF qcl2CVfHurJmtMPccdF4ODV6DRrZ/uT/rw4t+t9757Fej+BUfezr8LNxlF6z9SSCbIMu s+RzEp2fc2OpFvN9noXDzyBkqaINO8D1vN00f3RFdsJgGnDTXFzeQ0hJ/NjDkwVy6ubV Y4Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=R1yA09A2jj2GJ7mf6EWjnGj5car0+pFadneU5DRW1E0=; b=BexX2ZfHDeEqKzmAROQ8lEUBYYVrpJ02FKqfyK6kQS8J6fg2Wmy3TM99X9WlwBFyRZ upIFtGAPs2vXwvWRzATxtvp9fWGUA+OyK74vKBiUSd4bR17YcyD7QCFvFXjwNy+Cl+We iKA9ZWti0zHFh7kodRQz512zt2D18dhVHNIngyd/cQMZAdjRw8NSjti9M7wCWqyOzRhc 2nDQzpB1Dcm4drM1S4BbJk2O9QtM2J2zizRF+XrXivFeDHePFdZzILXrtgva39P7LhcF 2IxuLbD/FOUKdVuC63CIvL28YXyyReiFL+NnnAhXGC0TiHL6TNK+DcOCQr/dqW+f0kAW ZpUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=A91sMfRk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6si3634005otf.147.2020.03.20.11.36.16; Fri, 20 Mar 2020 11:36:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=A91sMfRk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727587AbgCTSfj (ORCPT + 99 others); Fri, 20 Mar 2020 14:35:39 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:44498 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725446AbgCTSfh (ORCPT ); Fri, 20 Mar 2020 14:35:37 -0400 Received: by mail-ed1-f67.google.com with SMTP id z3so8266993edq.11; Fri, 20 Mar 2020 11:35:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=R1yA09A2jj2GJ7mf6EWjnGj5car0+pFadneU5DRW1E0=; b=A91sMfRkl42TkFSWs9Q9IhP6ewbRQpGP3zvAHs4ixj8O0VAlwGf2XdqjxNkda42p+F rE1DdJYbgM+bE/7PhlMb0i8QNf6tNtciczvIyl6A7MvXq2tplBeeOIREacm5BF8C0Fw7 y9sLTfP6+k64lr6KcJIL291+2IO2htWpdYT/FRFBPULP7rUPSY7Xs/lPWCzsVEW5Mlsj yowqy//ObW7xPUz+y9oVin5RzgtlFn/PydNjEYt5Z8Em8x0mS+PiZ8NOY0CpQQH9Cr+W z4WnBLD8zAVDMWGGwLcnVIUyI8ISCr4mR0xjG5JGN4/hmdWAYWZWBu4vEvL2hovawwHJ akjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=R1yA09A2jj2GJ7mf6EWjnGj5car0+pFadneU5DRW1E0=; b=U9kpaTOT0dc+MqPSsaRRcXngU1pgfjRXjlPnaOpCFyJ6HrvN+RZ004oNvipAZsFZk8 REIluxWus3h7k+hPtYUwyB2BXUlCTvfmBlNefd/+OUP9XaH0NagLhoeDPG8bGXrF5nh0 KYyHVzKUe8iYbhLAeLo5rEICQ6CR56WEjScZpHYILavL3sY/6FkOnXJeFRbgzZPawmJJ 6+e5TkANcd9QPWvYtVdHoU4DsbmyNMHY/hNfMV0FjKGw4HxVUNGieTBuEwdQCO6on3/0 /wvNFZbFaaNjEky5F6tKdfFOpid1o9cTLbpIOyfBw7EqRscBbXGPHYNiv/cPk+TkMmsm QXfg== X-Gm-Message-State: ANhLgQ3S0AIrlaJi6aF6H29dbzdW/yxNYJmVrVhgu0hoRYsQRtB6B1A3 hc+n2XcJzDi20biyTqbkhYo= X-Received: by 2002:aa7:d9d8:: with SMTP id v24mr3531315eds.386.1584729334422; Fri, 20 Mar 2020 11:35:34 -0700 (PDT) Received: from Ansuel-XPS.localdomain (host203-232-dynamic.53-79-r.retail.telecomitalia.it. [79.53.232.203]) by smtp.googlemail.com with ESMTPSA id y13sm172916eje.3.2020.03.20.11.35.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Mar 2020 11:35:33 -0700 (PDT) From: Ansuel Smith To: Stanimir Varbanov Cc: Sriram Palanisamy , Ansuel Smith , Andy Gross , Bjorn Andersson , Bjorn Helgaas , Rob Herring , Mark Rutland , Lorenzo Pieralisi , Andrew Murray , Philipp Zabel , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/12] pcie: qcom: Set PCIE MRRS and MPS to 256B Date: Fri, 20 Mar 2020 19:34:54 +0100 Message-Id: <20200320183455.21311-12-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200320183455.21311-1-ansuelsmth@gmail.com> References: <20200320183455.21311-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sriram Palanisamy Set Max Read Request Size and Max Payload Size to 256 bytes, per chip team recommendation. Signed-off-by: Gokul Sriram Palanisamy Signed-off-by: Ansuel Smith --- drivers/pci/controller/dwc/pcie-qcom.c | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 03130a3206b4..ad437c6f49a0 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -125,6 +125,14 @@ #define PCIE20_LNK_CONTROL2_LINK_STATUS2 0xA0 +#define __set(v, a, b) (((v) << (b)) & GENMASK(a, b)) +#define __mask(a, b) (((1 << ((a) + 1)) - 1) & ~((1 << (b)) - 1)) +#define PCIE20_DEV_CAS 0x78 +#define PCIE20_MRRS_MASK __mask(14, 12) +#define PCIE20_MRRS(x) __set(x, 14, 12) +#define PCIE20_MPS_MASK __mask(7, 5) +#define PCIE20_MPS(x) __set(x, 7, 5) + #define DEVICE_TYPE_RC 0x4 #define QCOM_PCIE_2_1_0_MAX_SUPPLY 3 @@ -1595,6 +1603,35 @@ static int qcom_pcie_probe(struct platform_device *pdev) return ret; } +static void qcom_pcie_fixup_final(struct pci_dev *pcidev) +{ + int cap, err; + u16 ctl, reg_val; + + cap = pci_pcie_cap(pcidev); + if (!cap) + return; + + err = pci_read_config_word(pcidev, cap + PCI_EXP_DEVCTL, &ctl); + + if (err) + return; + + reg_val = ctl; + + if (((reg_val & PCIE20_MRRS_MASK) >> 12) > 1) + reg_val = (reg_val & ~(PCIE20_MRRS_MASK)) | PCIE20_MRRS(0x1); + + if (((ctl & PCIE20_MPS_MASK) >> 5) > 1) + reg_val = (reg_val & ~(PCIE20_MPS_MASK)) | PCIE20_MPS(0x1); + + err = pci_write_config_word(pcidev, cap + PCI_EXP_DEVCTL, reg_val); + + if (err) + dev_err(&pcidev->dev, "pcie config write failed %d\n", err); +} +DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, qcom_pcie_fixup_final); + static const struct of_device_id qcom_pcie_match[] = { { .compatible = "qcom,pcie-apq8084", .data = &ops_1_0_0 }, { .compatible = "qcom,pcie-ipq8064", .data = &ops_2_1_0 }, -- 2.25.1