From patchwork Fri Sep 21 10:21:29 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: 147228 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp633194ljw; Fri, 21 Sep 2018 03:29:00 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda+RQcD1jQWAc2AVmLZrY0/V4M5zOe2dHZ0ABnGo9i3e7UR7izNhwFuUq/eutZ8nsae7Mn5 X-Received: by 2002:a62:9402:: with SMTP id m2-v6mr45267054pfe.3.1537525740503; Fri, 21 Sep 2018 03:29:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537525740; cv=none; d=google.com; s=arc-20160816; b=yh2EE2/8dCJ9YE6Dk+U3oWxuGgOFLUImp42RWHKOcnE70x9ApYAohjC6YSbUADluyv kIL++7V/WIfMA1EuWY6x7kFY2+87TMufB1L51gwWXplZbs4i7nEXvVWvX2yE0dAFBF3d yteP8cKLRbUUCXICl6u93vtAqahEMHWuH9Xzt2ygu2t51DqfV6VkwflAIBbU5aO+AgTQ +wh+WtM4mB67pOdtJ52Ifids9mcq9D7Hzw4ej31LB5r/GjDjkubJn4zKfh+ouVsAOcof V5eszY8YhepthB/xTwa+zPdw6a77f0pVuYMa2eNL4hXqbockDASygdQSpTa0rZd4YU48 qj5w== 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 31-v6si28838737pla.129.2018.09.21.03.29.00; Fri, 21 Sep 2018 03:29:00 -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 S2389837AbeIUQMJ (ORCPT + 32 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 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(-) -- 2.17.1 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);