From patchwork Thu Jul 17 09:00:40 2014 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: 33773 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3403920969 for ; Thu, 17 Jul 2014 09:02:56 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id s7sf5529401qap.2 for ; Thu, 17 Jul 2014 02:02:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=6Ci868yThoE31Zbg4MSRsLrS5FbqkYXIqMGLiNpjBv8=; b=BHXl9+w3AZh0n9ZI8yUCslVz5XSjly+c0l2IaJkqlnxB285m/fkRvoLE6YaO3F/eh8 9S+KG9jEj6+IdedPBLnr8BdSryPTGhnbD7/isDk3K8MNXL5ezUd8tCKlUsrlSo4tq2E0 QHe4STk/FM/FE65nU4J3w9YbHOC0wZ9BqsIwot3Yky16+PbWscvRFq3WsLIqzbeEG207 eXWsce6tmxq1O/a8PRKtYFmQLbc+zjlHLuKklth3lguX/FtPrqbkERBcHuLFyyRdpEtZ ZanVuzQ4dL0STX2GG/INGqKsxWGzNE8mLBtv1P/2imxKSjZ7AIAWDkVZTuWrvwseuOJG 6Crw== X-Gm-Message-State: ALoCoQnUku1WpdiaUh7ez5vOCUIIgmv/iO7YLaTQrqdCndKz3E3Q2/AgJ9bMM9qxRnH+JUx9/J9h X-Received: by 10.236.26.105 with SMTP id b69mr12311682yha.55.1405587776022; Thu, 17 Jul 2014 02:02:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.104.136 with SMTP id a8ls643321qgf.2.gmail; Thu, 17 Jul 2014 02:02:55 -0700 (PDT) X-Received: by 10.52.64.140 with SMTP id o12mr13056934vds.70.1405587775931; Thu, 17 Jul 2014 02:02:55 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id xk1si1562112vdc.56.2014.07.17.02.02.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 17 Jul 2014 02:02:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id la4so3876913vcb.5 for ; Thu, 17 Jul 2014 02:02:55 -0700 (PDT) X-Received: by 10.52.37.81 with SMTP id w17mr2277582vdj.95.1405587775827; Thu, 17 Jul 2014 02:02:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp18273vcb; Thu, 17 Jul 2014 02:02:55 -0700 (PDT) X-Received: by 10.70.38.72 with SMTP id e8mr3250129pdk.33.1405587774384; Thu, 17 Jul 2014 02:02:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xi3si1710562pab.111.2014.07.17.02.02.53; Thu, 17 Jul 2014 02:02:53 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756175AbaGQJCb (ORCPT + 27 others); Thu, 17 Jul 2014 05:02:31 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:44044 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756139AbaGQJC0 (ORCPT ); Thu, 17 Jul 2014 05:02:26 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s6H9193n002082; Thu, 17 Jul 2014 04:01:09 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6H918kR014955; Thu, 17 Jul 2014 04:01:09 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Thu, 17 Jul 2014 04:01:08 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6H9107f029985; Thu, 17 Jul 2014 04:01:04 -0500 From: Kishon Vijay Abraham I To: , , , , , , CC: , , Jason Gunthorpe , Marek Vasut , Arnd Bergmann Subject: [PATCH v3 1/4] PCI: designware: Configuration space should be specified in 'reg' Date: Thu, 17 Jul 2014 14:30:40 +0530 Message-ID: <1405587643-13808-2-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1405587643-13808-1-git-send-email-kishon@ti.com> References: <1405587643-13808-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: kishon@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The configuration address space has so far been specified in *ranges*, however it should be specified in *reg* making it a platform MEM resource. Hence used 'platform_get_resource_*' API to get configuration address space in the designware driver. Cc: Jason Gunthorpe Cc: Bjorn Helgaas Cc: Marek Vasut Cc: Arnd Bergmann Signed-off-by: Kishon Vijay Abraham I Acked-by: Mohit Kumar Acked-by: Jingoo Han --- .../devicetree/bindings/pci/designware-pcie.txt | 4 ++++ drivers/pci/host/pcie-designware.c | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/pci/designware-pcie.txt b/Documentation/devicetree/bindings/pci/designware-pcie.txt index d0d15ee..ed0d9b9 100644 --- a/Documentation/devicetree/bindings/pci/designware-pcie.txt +++ b/Documentation/devicetree/bindings/pci/designware-pcie.txt @@ -2,6 +2,10 @@ Required properties: - compatible: should contain "snps,dw-pcie" to identify the core. +- reg: Should contain the configuration address space. +- reg-names: Must be "config" for the PCIe configuration space. + (The old way of getting the configuration address space from "ranges" + is deprecated and should be avoided.) - #address-cells: set to <3> - #size-cells: set to <2> - device_type: set to "pci" diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c index 1eaf4df..0b7b455 100644 --- a/drivers/pci/host/pcie-designware.c +++ b/drivers/pci/host/pcie-designware.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "pcie-designware.h" @@ -396,11 +397,23 @@ static const struct irq_domain_ops msi_domain_ops = { int __init dw_pcie_host_init(struct pcie_port *pp) { struct device_node *np = pp->dev->of_node; + struct platform_device *pdev = to_platform_device(pp->dev); struct of_pci_range range; struct of_pci_range_parser parser; + struct resource *cfg_res; u32 val; int i; + cfg_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config"); + if (cfg_res) { + pp->config.cfg0_size = resource_size(cfg_res)/2; + pp->config.cfg1_size = resource_size(cfg_res)/2; + pp->cfg0_base = cfg_res->start; + pp->cfg1_base = cfg_res->start + pp->config.cfg0_size; + } else { + dev_err(pp->dev, "missing *config* reg space\n"); + } + if (of_pci_range_parser_init(&parser, np)) { dev_err(pp->dev, "missing ranges property\n"); return -EINVAL; @@ -433,6 +446,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp) of_pci_range_to_resource(&range, np, &pp->cfg); pp->config.cfg0_size = resource_size(&pp->cfg)/2; pp->config.cfg1_size = resource_size(&pp->cfg)/2; + pp->cfg0_base = pp->cfg.start; + pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; } } @@ -445,8 +460,6 @@ int __init dw_pcie_host_init(struct pcie_port *pp) } } - pp->cfg0_base = pp->cfg.start; - pp->cfg1_base = pp->cfg.start + pp->config.cfg0_size; pp->mem_base = pp->mem.start; pp->va_cfg0_base = devm_ioremap(pp->dev, pp->cfg0_base,