From patchwork Mon Jul 14 14:55:02 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: 33608 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B8C792061E for ; Mon, 14 Jul 2014 14:56:16 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id y10sf4036621pdj.0 for ; Mon, 14 Jul 2014 07:56:15 -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=gSbnY0imlklajg2+I0Yv/966ttt1iAMGHL5Fq4UFAKc=; b=lR89nElyY6l8AhHNydfL2IoCH9t+7bVdX8YzDBz4Gwqi6cBbFTeStBjOpLFYUwE2N6 jz5bm8/oZIcllCfO18Ogpbz07S/oPo7vD6Q3DPFky26C6c1k6n4fdo2jLz/bDJA0wmjX JJ4CbS5b0neeIp3hBBOSFr94rle0wxnUQHyIZl27C/sGRkjFGwD/KjrYHfwEFIZc5YEb NCfREhz2ibTB/lZZjGW5b2q1We4771PcPU7h4n5eGcL2hc5BftNfXM7orh4v1i83xe+C MNBfKNeL1/KjJ6v/d00j6zy2MAs2dmCdkCCBbZ6f6/pOggfOWaVm8m9FkXYxIbODcRf2 Mo9w== X-Gm-Message-State: ALoCoQmM5/eOTI8OYsFTl7ERyUQefbk+T6Phkxz44Bu8V2ZLmSAlOFF5q70upmQ3slhgJhAROl05 X-Received: by 10.66.236.136 with SMTP id uu8mr7334753pac.13.1405349775510; Mon, 14 Jul 2014 07:56:15 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.198 with SMTP id m64ls1059800qge.39.gmail; Mon, 14 Jul 2014 07:56:15 -0700 (PDT) X-Received: by 10.58.48.193 with SMTP id o1mr671999ven.68.1405349775399; Mon, 14 Jul 2014 07:56:15 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id re13si790572vcb.8.2014.07.14.07.56.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 14 Jul 2014 07:56:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id hq11so7665172vcb.27 for ; Mon, 14 Jul 2014 07:56:15 -0700 (PDT) X-Received: by 10.58.65.40 with SMTP id u8mr693365ves.53.1405349775324; Mon, 14 Jul 2014 07:56:15 -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 tc5csp141070vcb; Mon, 14 Jul 2014 07:56:14 -0700 (PDT) X-Received: by 10.68.161.101 with SMTP id xr5mr179451pbb.168.1405349773903; Mon, 14 Jul 2014 07:56:13 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ok8si9320274pbb.181.2014.07.14.07.56.12; Mon, 14 Jul 2014 07:56:12 -0700 (PDT) Received-SPF: none (google.com: devicetree-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 S932270AbaGNO4L (ORCPT + 8 others); Mon, 14 Jul 2014 10:56:11 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:42556 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932234AbaGNOzv (ORCPT ); Mon, 14 Jul 2014 10:55:51 -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 s6EEtTj9013989; Mon, 14 Jul 2014 09:55:29 -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 s6EEtTub027779; Mon, 14 Jul 2014 09:55:29 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Mon, 14 Jul 2014 09:55:29 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s6EEtLNC008433; Mon, 14 Jul 2014 09:55:26 -0500 From: Kishon Vijay Abraham I To: , , , , , , CC: , , Jason Gunthorpe , Marek Vasut , Arnd Bergmann Subject: [PATCH v2 1/4] PCI: designware: Configuration space should be specified in 'reg' Date: Mon, 14 Jul 2014 20:25:02 +0530 Message-ID: <1405349705-31400-2-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1405349705-31400-1-git-send-email-kishon@ti.com> References: <1405349705-31400-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@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.182 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,