From patchwork Mon Jan 14 13:24:06 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: 155468 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3656400jaa; Mon, 14 Jan 2019 05:26:34 -0800 (PST) X-Google-Smtp-Source: ALg8bN7QlSknIqNUtSOq7yq2QM4Cd21KDxF1pL0VWL5kZH0jBsSxKshaSwFEqRatwnF9JEPhsEd2 X-Received: by 2002:a17:902:a5ca:: with SMTP id t10mr25295310plq.139.1547472393960; Mon, 14 Jan 2019 05:26:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547472393; cv=none; d=google.com; s=arc-20160816; b=zMquwXktR45JI33wxS+Ii/QzB8u9q7n6ZCXLeLMQXKR1Q3XI7iRWJFLmmciw0gw+QE ehwredMTmI9O6aV8Xt4J/yqmqY0hCiurfIgFRrO6Ln02xdKOpATQCI6NfA7YirFE4Yq6 6b+iV6u6uTOZioMI8eYfncLUiJlvlAbVfXC3gzWCZCvwtcQwhVqNP/ObZXgXGCzxhriP 2wUunv6ckY/u+30bOWcUstlRmOJitawaYphz2hfkepRIKBoQoiGwSOq44+6SF3gDAE1W eFi08Z14cw8FWflkYUoL8ZyPxGfAVdn/58oqIOuYQIlBqinvCWuDhWdlKCX7ZKdiJR+O EZfw== 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=i/fk/tt+1LjhsntKlkuFU4S9fmttwzxDH8syQnMt+Q0=; b=hMkEvZxRjzdFzWlpmmjD+HI2BFV4A9qTUn6TIgrSHjeDot6Mdo3dOsTcSYIo1OBzRi xeVSRpSbdRcnc2PAMY+eVO7AZ1toyry55vt0AUDwXMU0nil/MR8r7wuyryPpIx4/tyZD ZPpHHzB8lEJDwkDyDJZKh34KReRVK0WQhsn1NrMVUpdPDabEA5LyXasTHZIiduCznoh9 dHTif43uDmI82zEiLBYFEUdbL3PT0kls2rEb8X1WZKr4UIxSVNvodKDmkDTKbzbfZ4Fn uWk5aECn+HJ3XwvRm2DKu7vj7VfFLfRoYIb/rnRGBUGxxqnv8/AxUvFVfchaKg0NB7hb 0HIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=kwDa8FXb; 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=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 l8si318503pgm.250.2019.01.14.05.26.33; Mon, 14 Jan 2019 05:26:33 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=kwDa8FXb; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726807AbfANN00 (ORCPT + 31 others); Mon, 14 Jan 2019 08:26:26 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:37378 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726470AbfANN0Y (ORCPT ); Mon, 14 Jan 2019 08:26:24 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x0EDPPKD098075; Mon, 14 Jan 2019 07:25:25 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547472325; bh=i/fk/tt+1LjhsntKlkuFU4S9fmttwzxDH8syQnMt+Q0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=kwDa8FXbuhQUUiErE1lls7qIheWSUrEoPhE9vxxyxA3sgQR0ynmXnP5v9DGPcwU/5 o02li3c/WCT/mEBuoEX9WG6NPUEtWv7DVQx+FO/EUlb6cHlNt7cruzIwguaBhGF+Xa m5lRS8vuu8z2+hbypSt0LPymTbtu6m7XYMvdD8lU= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x0EDPPSJ093881 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 14 Jan 2019 07:25:25 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Mon, 14 Jan 2019 07:25:25 -0600 Received: from dlep32.itg.ti.com (157.170.170.100) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Mon, 14 Jan 2019 07:25:25 -0600 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x0EDOoWS028516; Mon, 14 Jan 2019 07:25:20 -0600 From: Kishon Vijay Abraham I To: Gustavo Pimentel , Rob Herring , Lorenzo Pieralisi CC: Kishon Vijay Abraham I , Jingoo Han , Bjorn Helgaas , Mark Rutland , Arnd Bergmann , Greg Kroah-Hartman , Murali Karicheri , Jesper Nilsson , , , , , , Subject: [PATCH 06/24] PCI: keystone: Move initializations to appropriate places Date: Mon, 14 Jan 2019 18:54:06 +0530 Message-ID: <20190114132424.6445-7-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190114132424.6445-1-kishon@ti.com> References: <20190114132424.6445-1-kishon@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No functional change. Move host specific platform_get_resource to ks_add_pcie_port and the common platform_get_resource (applicable to both host and endpoint) to probe. This is in preparation for adding endpoint support to pci-keystone driver. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/controller/dwc/pci-keystone.c | 27 +++++++++++++---------- 1 file changed, 15 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index 88766d4cb50c..ce2f5c25f7a3 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -789,11 +789,6 @@ static int __init ks_pcie_add_pcie_port(struct keystone_pcie *ks_pcie, struct resource *res; int ret; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbics"); - pci->dbi_base = devm_pci_remap_cfg_resource(dev, res); - if (IS_ERR(pci->dbi_base)) - return PTR_ERR(pci->dbi_base); - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config"); pp->va_cfg0_base = devm_pci_remap_cfg_resource(dev, res); if (IS_ERR(pp->va_cfg0_base)) @@ -801,13 +796,6 @@ static int __init ks_pcie_add_pcie_port(struct keystone_pcie *ks_pcie, pp->va_cfg1_base = pp->va_cfg0_base; - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "app"); - ks_pcie->va_app_base = devm_ioremap_resource(dev, res); - if (IS_ERR(ks_pcie->va_app_base)) - return PTR_ERR(ks_pcie->va_app_base); - - ks_pcie->app = *res; - pp->ops = &ks_pcie_host_ops; ret = dw_pcie_host_init(pp); if (ret) { @@ -878,6 +866,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev) struct dw_pcie *pci; struct keystone_pcie *ks_pcie; struct device_link **link; + struct resource *res; + void __iomem *base; u32 num_viewport; struct phy **phy; u32 num_lanes; @@ -894,6 +884,19 @@ static int __init ks_pcie_probe(struct platform_device *pdev) if (!pci) return -ENOMEM; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "app"); + ks_pcie->va_app_base = devm_ioremap_resource(dev, res); + if (IS_ERR(ks_pcie->va_app_base)) + return PTR_ERR(ks_pcie->va_app_base); + + ks_pcie->app = *res; + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbics"); + base = devm_pci_remap_cfg_resource(dev, res); + if (IS_ERR(base)) + return PTR_ERR(base); + + pci->dbi_base = base; pci->dev = dev; pci->ops = &ks_pcie_dw_pcie_ops;