From patchwork Tue Aug 12 16:25:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liviu Dudau X-Patchwork-Id: 35297 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5A3D6203C5 for ; Tue, 12 Aug 2014 16:28:50 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i7sf46519072oag.8 for ; Tue, 12 Aug 2014 09:28:49 -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:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=v/75LeFnCL5NZ+NzBXZPT3OJDQwHpgFA9AL535h9FUk=; b=PlCmpWl7WZZLMz7fb7BCrplA0b3WyIUiLPCYYr2+QuVU3VZ0X5PZ1Y5+z6xwLDJWjV 8kdHjJPTKDFukmNjtd+IdS03YN8mPOdrP7IUKAeXeSbwUZDNwI5V49rRDTT2eDMn/Yqm LwVkA1LtqZTWFw6sSqhlcv0JfWkWLYlrFL6RGE+5IGB3xR+0QePav8iebyCe2uR2qAbz ZfmCf2RaMDS0als2iRzeNZmGGtWPY6RPzDFgBsDvNLQN/PyVyN4NHLbDoLiYpE0E/Elr +AMtLjxGdax4qRHsNJ1mdOh+keISRm1lbVDsCtX8kKfsbLz82g4kFGDTkiVbDamuzBKe /3gw== X-Gm-Message-State: ALoCoQl904gahgIFZRB9sGetN/UKe8Z09grFEIXk891ajlc79HB47nWesleaglvlXbnaxm0CqgSw X-Received: by 10.50.112.68 with SMTP id io4mr2736563igb.0.1407860929741; Tue, 12 Aug 2014 09:28:49 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.176 with SMTP id t45ls198121qgt.60.gmail; Tue, 12 Aug 2014 09:28:49 -0700 (PDT) X-Received: by 10.52.121.74 with SMTP id li10mr24495629vdb.19.1407860929624; Tue, 12 Aug 2014 09:28:49 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id k11si8538539vcy.20.2014.08.12.09.28.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 12 Aug 2014 09:28:49 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf12so13369957vcb.40 for ; Tue, 12 Aug 2014 09:28:49 -0700 (PDT) X-Received: by 10.221.47.9 with SMTP id uq9mr2209292vcb.48.1407860929519; Tue, 12 Aug 2014 09:28:49 -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 tc5csp262680vcb; Tue, 12 Aug 2014 09:28:48 -0700 (PDT) X-Received: by 10.66.139.16 with SMTP id qu16mr1769869pab.153.1407860928547; Tue, 12 Aug 2014 09:28:48 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id vo5si16434851pab.26.2014.08.12.09.28.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Aug 2014 09:28:48 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XHEvL-0003k1-6W; Tue, 12 Aug 2014 16:27:47 +0000 Received: from fw-tnat.cambridge.arm.com ([217.140.96.21] helo=cam-smtp0.cambridge.arm.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XHEuK-0002ud-EH for linux-arm-kernel@lists.infradead.org; Tue, 12 Aug 2014 16:26:46 +0000 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 s7CGPPga026280; Tue, 12 Aug 2014 17:25:27 +0100 From: Liviu Dudau To: Bjorn Helgaas , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Arnd Bergmann , Russell King , Tanmay Inamdar , Grant Likely , Sinan Kaya , Jingoo Han , Kukjin Kim , Suravee Suthikulanit , linux-pci Subject: [PATCH v9 06/12] ARM: integrator: Correct usage of of_pci_range_to_resource() Date: Tue, 12 Aug 2014 17:25:19 +0100 Message-Id: <1407860725-25202-7-git-send-email-Liviu.Dudau@arm.com> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1407860725-25202-1-git-send-email-Liviu.Dudau@arm.com> References: <1407860725-25202-1-git-send-email-Liviu.Dudau@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140812_092644_926208_8D35328D X-CRM114-Status: GOOD ( 13.26 ) X-Spam-Score: -3.0 (---) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-3.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [217.140.96.21 listed in list.dnswl.org] -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: linux-arch , Device Tree ML , LKML , LAKML X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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.220.181 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 Previously, of_pci_range_to_resource() would return a resource that contained physical addresses of the IO space even if the IORESOURCE_IO flags mandate a logical port set of values. Now that the function has been fixed we need to update the drivers that were taking advantage of the old behaviour. Cc: Linus Walleij Cc: Arnd Bergmann Cc: Rob Herring Cc: Russell King Signed-off-by: Liviu Dudau Acked-by: Linus Walleij --- arch/arm/mach-integrator/pci_v3.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c index 05e1f73..193b7f8 100644 --- a/arch/arm/mach-integrator/pci_v3.c +++ b/arch/arm/mach-integrator/pci_v3.c @@ -660,6 +660,7 @@ static void __init pci_v3_preinit(void) { unsigned long flags; unsigned int temp; + phys_addr_t io_address = pci_pio_to_address(io_mem.start); pcibios_min_mem = 0x00100000; @@ -701,7 +702,7 @@ static void __init pci_v3_preinit(void) /* * Setup window 2 - PCI IO */ - v3_writel(V3_LB_BASE2, v3_addr_to_lb_base2(io_mem.start) | + v3_writel(V3_LB_BASE2, v3_addr_to_lb_base2(io_address) | V3_LB_BASE_ENABLE); v3_writew(V3_LB_MAP2, v3_addr_to_lb_map2(0)); @@ -742,6 +743,7 @@ static void __init pci_v3_preinit(void) static void __init pci_v3_postinit(void) { unsigned int pci_cmd; + phys_addr_t io_address = pci_pio_to_address(io_mem.start); pci_cmd = PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE; @@ -758,7 +760,7 @@ static void __init pci_v3_postinit(void) "interrupt: %d\n", ret); #endif - register_isa_ports(non_mem.start, io_mem.start, 0); + register_isa_ports(non_mem.start, io_address, 0); } /* @@ -867,33 +869,33 @@ static int __init pci_v3_probe(struct platform_device *pdev) for_each_of_pci_range(&parser, &range) { if (!range.flags) { - of_pci_range_to_resource(&range, np, &conf_mem); + ret = of_pci_range_to_resource(&range, np, &conf_mem); conf_mem.name = "PCIv3 config"; } if (range.flags & IORESOURCE_IO) { - of_pci_range_to_resource(&range, np, &io_mem); + ret = of_pci_range_to_resource(&range, np, &io_mem); + dev_info(&pdev->dev, "IO PCI range converted\n"); io_mem.name = "PCIv3 I/O"; } if ((range.flags & IORESOURCE_MEM) && !(range.flags & IORESOURCE_PREFETCH)) { non_mem_pci = range.pci_addr; non_mem_pci_sz = range.size; - of_pci_range_to_resource(&range, np, &non_mem); + ret = of_pci_range_to_resource(&range, np, &non_mem); non_mem.name = "PCIv3 non-prefetched mem"; } if ((range.flags & IORESOURCE_MEM) && (range.flags & IORESOURCE_PREFETCH)) { pre_mem_pci = range.pci_addr; pre_mem_pci_sz = range.size; - of_pci_range_to_resource(&range, np, &pre_mem); + ret = of_pci_range_to_resource(&range, np, &pre_mem); pre_mem.name = "PCIv3 prefetched mem"; } - } - if (!conf_mem.start || !io_mem.start || - !non_mem.start || !pre_mem.start) { - dev_err(&pdev->dev, "missing ranges in device node\n"); - return -EINVAL; + if (ret < 0) { + dev_err(&pdev->dev, "missing ranges in device node\n"); + return -EINVAL; + } } pci_v3.map_irq = of_irq_parse_and_map_pci;