From patchwork Mon Mar 25 09:39:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 161063 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3750262jan; Mon, 25 Mar 2019 02:43:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/H9CeOreLaAumv3NuqNutrww5FFQk5mhjMYpPC+UUN+7JuLG+2/l4SlT+jY9e9LfgGzPe X-Received: by 2002:a17:902:7786:: with SMTP id o6mr24075666pll.206.1553506996698; Mon, 25 Mar 2019 02:43:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553506996; cv=none; d=google.com; s=arc-20160816; b=mk5qzat6EtpbjXuXWccsRRwMQ/fzhV2zMKcIrtBfG34FB+uXqs1VC89PIk9IV9vPjw ETID91OvzwwWYNLRKyyCIy+JHuXUHquhciveA4EjavKvnj0Ogt+VJFjgBKjcskF/A2Ve 0GwzWBvnipSLCf9B5kPPKkK3GuTXytc1b850HN5OyKsLwuM2pGlEj9WjHY/1nFEA6HW9 CK+K1rA4tM+L3dTIte1Lq0smdIpubOn+F3gv9rTUi6U5crF3QR5Qsna/bC1nf0RoKIYC 08bODIusvz6yQmNGQVjBYTHxF5CJGDo1CSt3z23Xn/jLaTUTLHXlOvz5XQW8tzMOStzv T3QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Z5FsYHz2+eCaWuP/Fr5+/R+9oCvd7mzmcItqNVxbMQU=; b=rBAlrKYkMh92ixWXnlUwJI4+Zdlr/VarWqEP9ynIhA7XLbjmdhB1p+gR9DQt6yXomR Fgw4K/b3PdrXp0cyuiM0gAovaD4jD+QwJBbUaTpVyEYQKLIuzzU0oCO7iUMqb38dvT53 +VBRn7T16aTk0jQw9K2O580nKpK/oY4jzTfSqrpuJuTd+WRF2oU4qMMo0VZ0maFbCO0g wXWYZ+yyPWkkNYCAQx9o8xgh9nzeIrloWXPquwakaKcIm23BlD3wKzrtt+D2EF8yMeJ8 exiTmYyFibHrxgY2YnR/rfcWZfUoUM+dlqRK8maDwRYvDW1/yZPqurOv6Jn9ctjnRwyo 8v+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=EsuxLzUm; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 193si13081900pgc.365.2019.03.25.02.43.16; Mon, 25 Mar 2019 02:43:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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=@ti.com header.s=ti-com-17Q1 header.b=EsuxLzUm; spf=pass (google.com: best guess record for domain of linux-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730597AbfCYJnO (ORCPT + 5 others); Mon, 25 Mar 2019 05:43:14 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:44982 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730593AbfCYJnN (ORCPT ); Mon, 25 Mar 2019 05:43:13 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2P9gkkm067924; Mon, 25 Mar 2019 04:42:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1553506966; bh=Z5FsYHz2+eCaWuP/Fr5+/R+9oCvd7mzmcItqNVxbMQU=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=EsuxLzUmb3c+iIHmKZxkVrXL7iwFXghWiPWvextA9NH0F/wxiYKWGApgH90rG7faD oZGrREqi86ksXdQqhCUXCiqc4zB4nsiNd5maXdX9tU4KXndvsxZgdQYEUYMoBZo+b7 k/b6d6JbuouqMFu1ZctJ7FlCEDsp5xgjxWwBxiFU= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2P9gk5E109867 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Mar 2019 04:42:46 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 25 Mar 2019 04:42:45 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE110.ent.ti.com (157.170.170.21) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1713.5 via Frontend Transport; Mon, 25 Mar 2019 04:42:45 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x2P9feaQ028077; Mon, 25 Mar 2019 04:42:40 -0500 From: Kishon Vijay Abraham I To: Gustavo Pimentel , Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , Arnd Bergmann , Murali Karicheri CC: Kishon Vijay Abraham I , Jingoo Han , Greg Kroah-Hartman , , , , , , , Minghuan Lian , Mingkai Hu , Roy Zang , Jesper Nilsson Subject: [PATCH v3 11/26] PCI: dwc: Fix ATU identification for designware version >= 4.80 Date: Mon, 25 Mar 2019 15:09:32 +0530 Message-ID: <20190325093947.32633-12-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190325093947.32633-1-kishon@ti.com> References: <20190325093947.32633-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Synopsys designware version >= 4.80 uses a separate register space for programming ATU. The current code identifies if there exists a separate register space by accessing the register address of ATUs in designware version < 4.80. Accessing this address results in abort in the case of K2G. Fix it here by adding "version" member to struct dw_pcie. This should be set by platform specific drivers and designware core will use it to identify if the platform has a separate ATU space. For platforms which hasn't populated the version member, the old method of identification will still be used. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/controller/dwc/pcie-designware.c | 14 ++++++++------ drivers/pci/controller/dwc/pcie-designware.h | 1 + 2 files changed, 9 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index a14ca00f72aa..4e2f7946da89 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -358,13 +358,15 @@ void dw_pcie_setup(struct dw_pcie *pci) struct device *dev = pci->dev; struct device_node *np = dev->of_node; - /* Get iATU unroll support */ - pci->iatu_unroll_enabled = dw_pcie_iatu_unroll_enabled(pci); - dev_dbg(pci->dev, "iATU unroll: %s\n", - pci->iatu_unroll_enabled ? "enabled" : "disabled"); + if (pci->version >= 0x480A || (!pci->version && + dw_pcie_iatu_unroll_enabled(pci))) { + pci->iatu_unroll_enabled = true; + if (!pci->atu_base) + pci->atu_base = pci->dbi_base + DEFAULT_DBI_ATU_OFFSET; + } + dev_dbg(pci->dev, "iATU unroll: %s\n", pci->iatu_unroll_enabled ? + "enabled" : "disabled"); - if (pci->iatu_unroll_enabled && !pci->atu_base) - pci->atu_base = pci->dbi_base + DEFAULT_DBI_ATU_OFFSET; ret = of_property_read_u32(np, "num-lanes", &lanes); if (ret) diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index ca3a3190a6f5..90a5b1215344 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -234,6 +234,7 @@ struct dw_pcie { struct pcie_port pp; struct dw_pcie_ep ep; const struct dw_pcie_ops *ops; + unsigned int version; }; #define to_dw_pcie_from_pp(port) container_of((port), struct dw_pcie, pp)