From patchwork Tue Sep 23 19:01:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 37763 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id ED78720792 for ; Tue, 23 Sep 2014 20:12:04 +0000 (UTC) Received: by mail-wg0-f72.google.com with SMTP id k14sf1124810wgh.3 for ; Tue, 23 Sep 2014 13:12:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=DvHZgvEGPPlvnczfRliWylkFuTMj69rNZxzZZty4gOs=; b=Q5/wuFUyfZZOlnlRfIVnJCSFtrxD6Wu22bXKbwJ1CeqiLsqOWIcsVOccutrLhtb6xj qXwwA5dJKxGGogMsl+x3Bwjif1AYEJiw3VF1n2Ed1Hkg6hKgQr+85V8XdVUivrP+vHef 6RuLZ3ggN/rXoG6S1ipAgCrOzQ8iAFyWsV35SIoJdbBPZB9dnNBymSBaQV223HYD2G/s ZWBkc4oj1bsZ8wylS/d3zOUzdu8KxEZeyjIJZ2a12+qQqXcNkq8H85Jn5SO2OS4eqJib d8yNRvEpocvSz50rwr0pADYon8CT77PaqfGpyRfL35Mwls+i1OfIQdt3XyvoBJR68cZD 2k8A== X-Gm-Message-State: ALoCoQml0nJUqZKG86cyF6/BQOR3S3Mw2t3Fj3uWvog5M4dyMTtUJDfE52GgBxsxaG4HCfYZM/Oe X-Received: by 10.194.205.34 with SMTP id ld2mr18145wjc.5.1411503124221; Tue, 23 Sep 2014 13:12:04 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.37.99 with SMTP id x3ls87126laj.90.gmail; Tue, 23 Sep 2014 13:12:04 -0700 (PDT) X-Received: by 10.152.28.199 with SMTP id d7mr1771907lah.55.1411503124027; Tue, 23 Sep 2014 13:12:04 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com [209.85.217.178]) by mx.google.com with ESMTPS id qs2si9803841lbb.47.2014.09.23.13.12.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Sep 2014 13:12:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id z12so6791412lbi.37 for ; Tue, 23 Sep 2014 13:12:03 -0700 (PDT) X-Received: by 10.112.163.103 with SMTP id yh7mr1657975lbb.73.1411503123914; Tue, 23 Sep 2014 13:12:03 -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.112.130.169 with SMTP id of9csp478304lbb; Tue, 23 Sep 2014 13:12:03 -0700 (PDT) X-Received: by 10.68.132.65 with SMTP id os1mr2798347pbb.82.1411503122414; Tue, 23 Sep 2014 13:12:02 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ac5si12768996pbc.18.2014.09.23.13.12.01 for ; Tue, 23 Sep 2014 13:12:02 -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 S1756680AbaIWUL6 (ORCPT + 27 others); Tue, 23 Sep 2014 16:11:58 -0400 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21]:51667 "EHLO cam-smtp0.cambridge.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756582AbaIWULz (ORCPT ); Tue, 23 Sep 2014 16:11:55 -0400 Received: from e106497-lin.cambridge.arm.com (e106497-lin.cambridge.arm.com [10.1.195.53]) by cam-smtp0.cambridge.arm.com (8.13.8/8.13.8) with ESMTP id s8NJ1Eh1027659; Tue, 23 Sep 2014 20:01:22 +0100 From: Liviu Dudau To: Bjorn Helgaas , Arnd Bergmann , Rob Herring , Jason Gunthorpe , Benjamin Herrenschmidt , Catalin Marinas , Will Deacon , Russell King , linux-pci , Linus Walleij Cc: Tanmay Inamdar , Grant Likely , Sinan Kaya , Jingoo Han , Kukjin Kim , Suravee Suthikulanit , linux-arch , LKML , Device Tree ML , LAKML , Grant Likely Subject: [PATCH v12 04/12] PCI: OF: Move of_pci_range_to_resources() into address.c Date: Tue, 23 Sep 2014 20:01:06 +0100 Message-Id: <1411498874-9864-5-git-send-email-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1411498874-9864-1-git-send-email-Liviu.Dudau@arm.com> References: <1411498874-9864-1-git-send-email-Liviu.Dudau@arm.com> 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: liviu.dudau@arm.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.217.178 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 ranges property for a host bridge controller in DT describes the mapping between the PCI bus address and the CPU physical address. The resources framework however expects that the IO resources start at a pseudo "port" address 0 (zero) and have a maximum size of IO_SPACE_LIMIT. The conversion from pci ranges to resources failed to take that into account. In preparation for fixing this of_pci_range_to_resources(), move it into drivers/of/address.c. Cc: Grant Likely Cc: Rob Herring Cc: Arnd Bergmann Cc: Catalin Marinas Signed-off-by: Liviu Dudau --- drivers/of/address.c | 10 ++++++++++ include/linux/of_address.h | 19 ++++++++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/drivers/of/address.c b/drivers/of/address.c index 758d4f0..86c1055 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -956,3 +956,13 @@ bool of_dma_is_coherent(struct device_node *np) return false; } EXPORT_SYMBOL_GPL(of_dma_is_coherent); + +void of_pci_range_to_resource(struct of_pci_range *range, + struct device_node *np, struct resource *res) +{ + res->flags = range->flags; + res->start = range->cpu_addr; + res->end = range->cpu_addr + range->size - 1; + res->parent = res->child = res->sibling = NULL; + res->name = np->full_name; +} diff --git a/include/linux/of_address.h b/include/linux/of_address.h index f8cc7da..ac28338 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h @@ -23,17 +23,6 @@ struct of_pci_range { #define for_each_of_pci_range(parser, range) \ for (; of_pci_range_parser_one(parser, range);) -static inline void of_pci_range_to_resource(struct of_pci_range *range, - struct device_node *np, - struct resource *res) -{ - res->flags = range->flags; - res->start = range->cpu_addr; - res->end = range->cpu_addr + range->size - 1; - res->parent = res->child = res->sibling = NULL; - res->name = np->full_name; -} - /* Translate a DMA address from device space to CPU space */ extern u64 of_translate_dma_address(struct device_node *dev, const __be32 *in_addr); @@ -42,6 +31,9 @@ extern u64 of_translate_dma_address(struct device_node *dev, extern u64 of_translate_address(struct device_node *np, const __be32 *addr); extern int of_address_to_resource(struct device_node *dev, int index, struct resource *r); +extern void of_pci_range_to_resource(struct of_pci_range *range, + struct device_node *np, struct resource *res); + extern struct device_node *of_find_matching_node_by_address( struct device_node *from, const struct of_device_id *matches, @@ -68,6 +60,11 @@ extern int of_dma_get_range(struct device_node *np, u64 *dma_addr, u64 *paddr, u64 *size); extern bool of_dma_is_coherent(struct device_node *np); #else /* CONFIG_OF_ADDRESS */ +static inline void of_pci_range_to_resource(struct of_pci_range *range, + struct device_node *np, struct resource *res) +{ +} + static inline struct device_node *of_find_matching_node_by_address( struct device_node *from, const struct of_device_id *matches,