From patchwork Fri Sep 21 10:21:39 2018 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: 147204 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp629137ljw; Fri, 21 Sep 2018 03:24:40 -0700 (PDT) X-Google-Smtp-Source: ACcGV634h2J4MqELIDoQt8vJ5stKtBvdn8h4F3dnM9nmj9yTW1Rkn5J5MARREm4AQ7nJLtWwPran X-Received: by 2002:a17:902:b7c2:: with SMTP id v2-v6mr865474plz.238.1537525479996; Fri, 21 Sep 2018 03:24:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537525479; cv=none; d=google.com; s=arc-20160816; b=V9OFNuwsae4W0XK/1ZPdf57++FE2Jkzk3WYSH82f6Re5Lhz5be/jimOkW54l7eOwAM eJJpQqD8wwRw4nMvE7ffsNmifA6etZF+xkYmE7BlXhG+hk2O6eqSOYJ2v8Htxf+bSU+s AvB1JAmsepp+1+1TCET82kZFsEr51q08GuojImi3jiv0FKFz38CY1qyOdH/qXFaUr9Vw UJuoibelg9AifgaJPUFGcMo+PbfwZU28tO0Ao0/wMHyQClQ34nOoz7j2wxBgAucnGaJ+ U2QD08HcwIs2VACeoUBLpSHBRpaifA9EBijuDDPJLNyrfwb42hoEKClDzQENA0Ot2hmL SAuQ== 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=eN2QjYF7XPN5wdQWDOgORmztfTZi1+IN0RnaI/q47uM=; b=dBsKjuOr4Nxv7R/xUA+U1+QpUn3a/HYmf/tjK4nOrS0XemHxjo/7k3PtBGDIdlgJWp nDx9W+VsLTNhEpI+usED6JqrVicAE/mjejMBLfYvOXmAQgmfGQEjZFxlmgn/Nvo9H8P+ pYsGnrfF4tqI81KBCdrUCnVh9RyybFoEJAu14wb4wtX0k+j602RtfjNcOW7mlkZW5M7d hpL09M1ZzF4k37mxZ8RDdNK5ojBYiU7T7ya9wAEdym3aZe+ci3J//+pFG2DfBDWZTDkd pvegSK2CHbSjRcBt1d9f/XFi5N6xDWJ3CR70c7RzFFBYpp2vfDITXomI71T44TlkWcSC 1vCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=mUYoOwvO; 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 v12-v6si25919894pfm.341.2018.09.21.03.24.39; Fri, 21 Sep 2018 03:24:39 -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=@ti.com header.s=ti-com-17Q1 header.b=mUYoOwvO; 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 S2390100AbeIUQMu (ORCPT + 32 others); Fri, 21 Sep 2018 12:12:50 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:35152 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727776AbeIUQMt (ORCPT ); Fri, 21 Sep 2018 12:12:49 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id w8LAOCEU030588; Fri, 21 Sep 2018 05:24:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1537525452; bh=eN2QjYF7XPN5wdQWDOgORmztfTZi1+IN0RnaI/q47uM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=mUYoOwvOuF4LdCFoLhYliXtHs9zuYOSfzR388fCluI4435BPzRQms35ZdS4cjG+/b 87Dlt47vHmJvxbyQdB5ByAWBdHRbWwAQ3aIeWnc6m/rLID4rrbTFEctCDN5a5K8QMC ST2WiPaQ9LMlAmjn9JMYShQGvhYFS1+F5oH4oTsg= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8LAOCdB019982; Fri, 21 Sep 2018 05:24:12 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 21 Sep 2018 05:24:12 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Fri, 21 Sep 2018 05:24:12 -0500 Received: from a0393678ub.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8LAMEtS032280; Fri, 21 Sep 2018 05:24:07 -0500 From: Kishon Vijay Abraham I To: Jingoo Han , Joao Pinto , Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , Murali Karicheri , Kishon Vijay Abraham I , CC: Mark Rutland , Santosh Shilimkar , Tero Kristo , Nishanth Menon , , , , Subject: [RFC PATCH 24/40] PCI: keystone: Move initializations to appropriate places Date: Fri, 21 Sep 2018 15:51:39 +0530 Message-ID: <20180921102155.22839-25-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921102155.22839-1-kishon@ti.com> References: <20180921102155.22839-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 75d007148804..13e865f82f96 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -646,11 +646,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)) @@ -658,13 +653,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) { @@ -768,6 +756,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; @@ -784,6 +774,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;