From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9F4BC432C1 for ; Tue, 24 Sep 2019 21:48:57 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7896020872 for ; Tue, 24 Sep 2019 21:48:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="q2PAVkyQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7896020872 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=K8JErJ8DPqMtPjfz4uWNTtCPRXeD6nmqaWhPTF+2Trs=; b=q2PAVkyQzWWeoY 3HYaKZqss1+s0xi32g2dz20nfhRXu9OAxVE2HSRu7KguKdwbFj3B0XJho5l8eCiDFSqCB1S2fyE+G zNMH6etEIuCBdpXqhatIQ6xgvnxFWZyN5nISksVwshD9TYlI6w2+dPUsz3vIrvWy11P9MVmXy1Lgo bvi9Rfc6KOe9HjkjvrgN96KQ71lP8BgO777n3Kw04bk5HB5RLIOV2GdVMrOQltSOEUq7XjYXW6umQ tmwd57sWEJq5WM5SyivdbGUgfJX5PLMADDiRkA54pgDtKVaQdf27l7xLvlEflv9Bpd5QMWjsp63Oo PQ1ZAB/NqeKYvEb3CLYw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iCsfz-000737-0K; Tue, 24 Sep 2019 21:48:51 +0000 Received: from mail-oi1-f193.google.com ([209.85.167.193]) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iCsdt-0005Td-Ux for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2019 21:46:43 +0000 Received: by mail-oi1-f193.google.com with SMTP id 83so3068020oii.1 for ; Tue, 24 Sep 2019 14:46:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q6NzmoyzjZeLo4J8UGvzKGgfTn+zvwBNbZJNczmh+D4=; b=NIa0o12a9f9K9L7DdnkAiC/cRBzJ3GNthHwrdx6iGVAJpAkcIdVD0YiyAWFwEXEbZG txecNoAz560O1IfjPbrWffJUWUpjr6Jb+sYCeh0/Aa/Vnwlc8Lra+wgjSgJCJrUqOZZq 6k9KL4lEiGqvR1+P8P7ir3GBDhz6AWynFtujVe//XFRp1OK0CHN5d7TiGzzLCT+dhSSO hp/m5XmvV8zOdXh6uDpbO+zxco+eUdOAs1s5aW8Yc2ADmstxplWr5zsj+hapREVow12G ajqc8k/oOuphWUz1Ow7TxShIUg27r5Hi1JFU7If8hbx2l1gJcPaHmLCPh5YlBG3cw+/2 PuYA== X-Gm-Message-State: APjAAAXyHx8CA9EYCF+J45uwtaXqvl8pjvD3S0tqIYps+w/wZccY/Ibh ObHE60bpUyrIWOLr8dB04A== X-Google-Smtp-Source: APXvYqxm493Rq9Q/JW6/m50nT3yGQOwZBnFUFyrFNDpiyWem3q6ykJqiXpDHGYmF2uopiFy/5olkYQ== X-Received: by 2002:aca:a9c3:: with SMTP id s186mr2088694oie.60.1569361601218; Tue, 24 Sep 2019 14:46:41 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id s66sm976787otb.65.2019.09.24.14.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Sep 2019 14:46:40 -0700 (PDT) From: Rob Herring To: linux-pci@vger.kernel.org, Bjorn Helgaas , Lorenzo Pieralisi Subject: [PATCH 07/11] PCI: ftpci100: Use inbound resources for setup Date: Tue, 24 Sep 2019 16:46:26 -0500 Message-Id: <20190924214630.12817-8-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190924214630.12817-1-robh@kernel.org> References: <20190924214630.12817-1-robh@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190924_144642_199989_0E746BB4 X-CRM114-Status: GOOD ( 12.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that the helpers provide the inbound resources in the host bridge 'dma_ranges' resource list, convert Faraday ftpci100 host bridge to use the resource list to setup the inbound addresses. Cc: Lorenzo Pieralisi Cc: Bjorn Helgaas Signed-off-by: Rob Herring --- drivers/pci/controller/pci-ftpci100.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/pci/controller/pci-ftpci100.c b/drivers/pci/controller/pci-ftpci100.c index 3e07a8203736..e37a33ad77d9 100644 --- a/drivers/pci/controller/pci-ftpci100.c +++ b/drivers/pci/controller/pci-ftpci100.c @@ -375,12 +375,11 @@ static int faraday_pci_setup_cascaded_irq(struct faraday_pci *p) return 0; } -static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p, - struct device_node *np) +static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p) { - struct of_pci_range range; - struct of_pci_range_parser parser; struct device *dev = p->dev; + struct pci_host_bridge *bridge = pci_host_bridge_from_priv(p); + struct resource_entry *entry; u32 confreg[3] = { FARADAY_PCI_MEM1_BASE_SIZE, FARADAY_PCI_MEM2_BASE_SIZE, @@ -389,19 +388,12 @@ static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p, int i = 0; u32 val; - if (of_pci_dma_range_parser_init(&parser, np)) { - dev_err(dev, "missing dma-ranges property\n"); - return -EINVAL; - } - - /* - * Get the dma-ranges from the device tree - */ - for_each_of_pci_range(&parser, &range) { - u64 end = range.pci_addr + range.size - 1; + resource_list_for_each_entry(entry, &bridge->dma_ranges) { + u64 pci_addr = entry->res->start - entry->offset; + u64 end = entry->res->end - entry->offset; int ret; - ret = faraday_res_to_memcfg(range.pci_addr, range.size, &val); + ret = faraday_res_to_memcfg(pci_addr, resource_size(entry->res), &val); if (ret) { dev_err(dev, "DMA range %d: illegal MEM resource size\n", i); @@ -409,7 +401,7 @@ static int faraday_pci_parse_map_dma_ranges(struct faraday_pci *p, } dev_info(dev, "DMA MEM%d BASE: 0x%016llx -> 0x%016llx config %08x\n", - i + 1, range.pci_addr, end, val); + i + 1, pci_addr, end, val); if (i <= 2) { faraday_raw_pci_write_config(p, 0, 0, confreg[i], 4, val); @@ -566,7 +558,7 @@ static int faraday_pci_probe(struct platform_device *pdev) cur_bus_speed = PCI_SPEED_66MHz; } - ret = faraday_pci_parse_map_dma_ranges(p, dev->of_node); + ret = faraday_pci_parse_map_dma_ranges(p); if (ret) return ret; -- 2.20.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel