Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp477107imm; Fri, 21 Sep 2018 03:30:05 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYYzYrFP01wxpo/FwDQt7FN3Q8hsz5Ohb7ppLP+5tXXYMGC/lc8vq0yDMMx6574Y5N0ztG9 X-Received: by 2002:a17:902:848d:: with SMTP id c13-v6mr37659279plo.194.1537525805810; Fri, 21 Sep 2018 03:30:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537525805; cv=none; d=google.com; s=arc-20160816; b=yaXoT6Z40H2cPDkaiN/N3mfB9chGIP/CJTY5NXPM5BLAJKQiv4hwfuCXNIe6bkYh6R snZMnp/Nlyw6EgHX/4Y75pv1BMRv9tYUG/pnVdexDsd6eONJYGvCoglRf3G3bpQgggMR 7gbyipSIXDGOjzlKxJM2evCFqX9ab7FXC/MYZkeVPEHlG6TaLkZdJEb0P4/BMEH4lFPE Y6cO/F6eEsYc/eNlKOU8xjdGjzfOxHFNB1ERu+QrKJfftpisKJiEhKPbLLuH0bLH0vDq N6reK/91bG96XAbFnOc68BqXk3RTjl+ciGM8Rt/92GpC1bng2Bsf4n9e9l5EDvagiM5w coRA== 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=KRjdjQ5hcy7QKZ5B8r6m0BycFYn2BHKtUqCgGLjIzAI=; b=Uei2f6tTpi8+ms6hIXIvYaU/Fn0PdXIVNMRJhMI7pSKMnm4ITA9rjC2vMjWpwuDmVk fiPzYfJcoIXy33b4ggyBBPjPUq4f3bilvcxF6RUw89sH/jdxweJQamzlbtHKzEIfZedo a0RCykolOqH8v2MXshPs595pbD2VwmcvP6+DiFIw4OtSWEO/fQGXbtTuXJAM7iTdFIRP Hxju7JC79I+/lXxwVgpq3EKjYnvr65h6EaVRjDtutwt57qakwV0qQunS4+f25BBMKH3M x879FmONovpZSbbLm9qEY47n+tIGrRXlH7HxPdR3d7zJSYe0Gq7j4S8lwuPjuQjdQft4 F5+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=TATuFq3P; 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 1-v6si25975004plk.379.2018.09.21.03.29.50; Fri, 21 Sep 2018 03:30:05 -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=TATuFq3P; 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 S2389832AbeIUQMJ (ORCPT + 99 others); Fri, 21 Sep 2018 12:12:09 -0400 Received: from lelv0143.ext.ti.com ([198.47.23.248]:54548 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727554AbeIUQMI (ORCPT ); Fri, 21 Sep 2018 12:12:08 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id w8LANP2l032903; Fri, 21 Sep 2018 05:23:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1537525405; bh=KRjdjQ5hcy7QKZ5B8r6m0BycFYn2BHKtUqCgGLjIzAI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=TATuFq3PCJdQaawgDQLViVQv0o9wUcp9YQzm45Mk6CHFQIDYlyPCww3fUVPNh8xsT OZlsI4ngDgpR7YMmhmObSGvZT9aPmznXWMU2WsVKtAcJPXneH1qTLhv+jQo3tZ4gQt XwkIPVe3CuyHTQFfw95jUJ8h36E174thq65TC7mI= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w8LANPAa029983; Fri, 21 Sep 2018 05:23:25 -0500 Received: from DFLE107.ent.ti.com (10.64.6.28) 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.1466.3; Fri, 21 Sep 2018 05:23:25 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE107.ent.ti.com (10.64.6.28) 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:23:25 -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 w8LAMEtI032280; Fri, 21 Sep 2018 05:23:20 -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 14/40] PCI: keystone: Use platform_get_resource_byname to get memory resources Date: Fri, 21 Sep 2018 15:51:29 +0530 Message-ID: <20180921102155.22839-15-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 Content-Type: text/plain 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 Use platform_get_resource_byname() instead of platform_get_resource() which uses index to get memory resources. While at that get the memory resource defined specifically for configuration space instead of deriving the configuration space address from dbics address space. Since pci-keystone driver has never worked out of the box in mainline kernel, dt backward compatibility is ignored. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/controller/dwc/pci-keystone.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c index 505e13b1197d..fe522b8c981f 100644 --- a/drivers/pci/controller/dwc/pci-keystone.c +++ b/drivers/pci/controller/dwc/pci-keystone.c @@ -49,7 +49,6 @@ #define OB_SIZE 0x030 #define CFG_PCIM_WIN_SZ_IDX 3 #define CFG_PCIM_WIN_CNT 32 -#define SPACE0_REMOTE_CFG_OFFSET 0x1000 #define OB_OFFSET_INDEX(n) (0x200 + (8 * n)) #define OB_OFFSET_HI(n) (0x204 + (8 * n)) @@ -677,21 +676,19 @@ static int __init ks_pcie_add_pcie_port(struct keystone_pcie *ks_pcie, struct resource *res; int ret; - /* Index 0 is the config reg. space address */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + 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); - /* - * 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; + 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)) + return PTR_ERR(pp->va_cfg0_base); + pp->va_cfg1_base = pp->va_cfg0_base; - /* Index 1 is the application reg. space address */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); + 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); -- 2.17.1