From patchwork Mon Mar 25 09:39:25 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: 161059 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3749903jan; Mon, 25 Mar 2019 02:42:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwMRlhAx6hZd5M/rfqciaBU0G1zrrliMplm5azl15+LXQ97By+P7IPWnDfKgXA9o3mDnX9 X-Received: by 2002:a62:4290:: with SMTP id h16mr23168635pfd.8.1553506972930; Mon, 25 Mar 2019 02:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553506972; cv=none; d=google.com; s=arc-20160816; b=vb39/9AZUpwkveSeoE1cBaGJ0y/0rK4clZdgjcT/w1aiDy943yVx4aAVjNjYt/LxlX 6h7hvyWOtDYQ89ii8pa9m88II9Kg5ICdhwOF+s8SlSZS/6v6cKzJRDf7ORBAs/XgkgFv YJB45MKbFwdeM5IuyaHHNWJTFX19/Hi7vLr0uabgfyV6YuUGsupiCPiRU6j4sI+xSrH/ s4tXbFzg7Fgki9TUMwiqPc1qfAnuAivRrQ+fOlLFlGrqT1xJnwVi9P7fBIa1hWFHx4tc wVATWOIGbGhMGGduMlZE9EfvcMbAlidv2Y3AkWZ+f+NneRfkciNwDSKScl6fh8GZeoyM L7Fg== 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=eZWnPPDbFVKunrhBYSdXwEOnltBVdXDnI/Xd180x+sM=; b=n2oEaJU+Cb6eWqFxuPtRHp3s4pPL337eT2GcryC7MlhISGI+/W2H5FZOOzKCepy8n2 pNWj257QDP4AWuyBacWTAd7KWrFkD08eo0kkojL1S6xJ91P+3SHtzPpLduUHN0ae2lSZ EKYwuQLr9kmDAbKTepItJJk0qbPvkXqP8mxvyRXJ4clkv+kwDWu7hazUlTZy5Ztp/V0j yBzm+tMyWtWR68nAHGQG7o+dbp4HELF6NGx9asVGr8nWSVYpdcd8NvyTDQ+nrieF7HcQ xnhxEMEwFeQ1G28jKXImXtfSDu2AJDaNJ1sAdLCx0rl26GrUCjKm/H48BMMGNdOX4jT2 wplQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="yc/ujBid"; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 u20si13061123pga.71.2019.03.25.02.42.52; Mon, 25 Mar 2019 02:42:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-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="yc/ujBid"; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-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 S1730547AbfCYJmv (ORCPT + 7 others); Mon, 25 Mar 2019 05:42:51 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:33368 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730538AbfCYJmt (ORCPT ); Mon, 25 Mar 2019 05:42:49 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2P9g8TM010414; Mon, 25 Mar 2019 04:42:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1553506928; bh=eZWnPPDbFVKunrhBYSdXwEOnltBVdXDnI/Xd180x+sM=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=yc/ujBidK5yCsSyHttwMv+mXbScWQYJn4SdYvM6O7tiepCgKvTxu9mWOTVIisudxL tBC/5YTf9jqEPV+t9j1cQpxtUHXMXrTLJgmDBEuh9n7nZ7dGqKBQPftSs0VX5TSOJs EqE2+tjaMN0Ap9t8cjjAnHUKKHmJTrObkAI7oJqo= Received: from DLEE103.ent.ti.com (dlee103.ent.ti.com [157.170.170.33]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2P9g8tW014234 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 25 Mar 2019 04:42:08 -0500 Received: from DLEE110.ent.ti.com (157.170.170.21) by DLEE103.ent.ti.com (157.170.170.33) 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:08 -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:07 -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 x2P9feaJ028077; Mon, 25 Mar 2019 04:42:02 -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 04/26] PCI: keystone: Perform host initialization in a single function Date: Mon, 25 Mar 2019 15:09:25 +0530 Message-ID: <20190325093947.32633-5-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: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org No functional change. Instead of having two functions ks_pcie_add_pcie_port and ks_pcie_dw_host_init for initializing host, have a single function to perform all the host initialization. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/controller/dwc/pci-keystone.c | 63 +++++++++-------------- 1 file changed, 23 insertions(+), 40 deletions(-) -- 2.17.1 diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index e50f8773e768..566718ea7ebf 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -487,45 +487,6 @@ static int ks_pcie_start_link(struct dw_pcie *pci) return 0; } -/** - * ks_pcie_dw_host_init() - initialize host for v3_65 dw hardware - * - * Ioremap the register resources, initialize legacy irq domain - * and call dw_pcie_v3_65_host_init() API to initialize the Keystone - * PCI host controller. - */ -static int __init ks_pcie_dw_host_init(struct keystone_pcie *ks_pcie) -{ - struct dw_pcie *pci = ks_pcie->pci; - struct pcie_port *pp = &pci->pp; - struct device *dev = pci->dev; - struct platform_device *pdev = to_platform_device(dev); - struct resource *res; - - /* Index 0 is the config reg. space address */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - pci->dbi_base = devm_pci_remap_cfg_resource(dev, res); - if (IS_ERR(pci->dbi_base)) - return PTR_ERR(pci->dbi_base); - - /* - * We set these same and is used in pcie rd/wr_other_conf - * functions - */ - pp->va_cfg0_base = pci->dbi_base + SPACE0_REMOTE_CFG_OFFSET; - pp->va_cfg1_base = pp->va_cfg0_base; - - /* Index 1 is the application reg. space address */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); - 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; - - return dw_pcie_host_init(pp); -} - static void ks_pcie_quirk(struct pci_dev *dev) { struct pci_bus *bus = dev->bus; @@ -843,10 +804,32 @@ static int __init ks_pcie_add_pcie_port(struct keystone_pcie *ks_pcie, struct dw_pcie *pci = ks_pcie->pci; struct pcie_port *pp = &pci->pp; struct device *dev = &pdev->dev; + struct resource *res; int ret; + /* Index 0 is the config reg. space address */ + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + pci->dbi_base = devm_pci_remap_cfg_resource(dev, res); + if (IS_ERR(pci->dbi_base)) + return PTR_ERR(pci->dbi_base); + + /* + * We set these same and is used in pcie rd/wr_other_conf + * functions + */ + pp->va_cfg0_base = pci->dbi_base + SPACE0_REMOTE_CFG_OFFSET; + pp->va_cfg1_base = pp->va_cfg0_base; + + /* Index 1 is the application reg. space address */ + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + 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 = ks_pcie_dw_host_init(ks_pcie); + ret = dw_pcie_host_init(pp); if (ret) { dev_err(dev, "failed to initialize host\n"); return ret;