From patchwork Wed Oct 16 20:06:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 11194213 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A76A31575 for ; Wed, 16 Oct 2019 20:07:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 882B420663 for ; Wed, 16 Oct 2019 20:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571256434; bh=Q1L8hdcU5OBIJdjzms17KC+99XyVIs5qHzieOnvJfg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=YweJQXLUtLtfkcFwG81LLma2WE8H+DmfblvhUGLZCWVPZ4QVLpVa6go7yu7XNXyRM T7hcGtnvHzyzpDOG08230yGZ35qWMf34YWj6QW9unqUPbiWtYUOWPgVNHL07YcQ9SP ZSTflUQs3YMucfZZqFo+wlF6dQ1iLWXQFihv527Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732452AbfJPUHO (ORCPT ); Wed, 16 Oct 2019 16:07:14 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:37414 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732214AbfJPUHO (ORCPT ); Wed, 16 Oct 2019 16:07:14 -0400 Received: by mail-oi1-f195.google.com with SMTP id i16so130910oie.4; Wed, 16 Oct 2019 13:07:13 -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=Ka1OUTRrdwoRIdpfE6TTScylmdfPZp0ZecCE90F9O7Y=; b=nyh4Eh0JOBP5S1RS7lCkZ6Iyx6sICrzN46rbk+LKhCCvlg9MgLKzw8l2AIavYxeNir dKCMTQ4b9PuEOWDhtxMkpDbfxuUwbFbPVW72wqQ1vq+kwoPhrDP0eJnLG8KrboQZENjE Pw1HvTf9mYNpiyHQIUHJG1y2bO16KM8gwdXlMD2ACYmt+ZXDzQ6OvnvxezlluedNdzPp NdCPb87OR/GCZVfnyV7gZOFoBRI1oPouBQGmth1SNdWS1mPXr4doCPM72qUTD/gH8EEy Vgfx6bH/spQOry7xkJGP/O24Mk06gZTjhMjLtYGJSJ842qqrGH9rX5cRiGzJTIdtN5sY +kyA== X-Gm-Message-State: APjAAAV3ZHImjPPP9cQOMeQekl25+9zTPshT6PJWF2P8TvQALjhcEMoF rAF3KsseKqw49E1xMIf2kA== X-Google-Smtp-Source: APXvYqxF2w729h5ozTnGpbZgI910+LMJWdeJ1bDzhRRDmJlMoOehKl2opT2euDfK8hJsmlbq0GqAKA== X-Received: by 2002:aca:b8d6:: with SMTP id i205mr112805oif.116.1571256432630; Wed, 16 Oct 2019 13:07:12 -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 a9sm7412463oie.7.2019.10.16.13.07.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 13:07:12 -0700 (PDT) From: Rob Herring To: Andrew Murray , Bjorn Helgaas , Lorenzo Pieralisi Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, Gustavo Pimentel , Heiko Stuebner , Hou Zhiqiang , Jingoo Han , Karthikeyan Mitran , Ley Foon Tan , Linus Walleij , linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, Matthias Brugger , Michal Simek , Ray Jui , rfi@lists.rocketboards.org, Ryder Lee , Scott Branden , Shawn Lin , Simon Horman , Srinath Mannam , Thomas Petazzoni , Toan Le , Tom Joseph , Will Deacon Subject: [PATCH v2 12/25] PCI: v3-semi: Use pci_parse_request_of_pci_ranges() Date: Wed, 16 Oct 2019 15:06:34 -0500 Message-Id: <20191016200647.32050-13-robh@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191016200647.32050-1-robh@kernel.org> References: <20191016200647.32050-1-robh@kernel.org> MIME-Version: 1.0 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Convert V3 host bridge to use the common pci_parse_request_of_pci_ranges(). Cc: Linus Walleij Cc: Lorenzo Pieralisi Cc: Andrew Murray Cc: Bjorn Helgaas Signed-off-by: Rob Herring Acked-by: Linus Walleij --- v2: - New patch drivers/pci/controller/pci-v3-semi.c | 35 +++++----------------------- 1 file changed, 6 insertions(+), 29 deletions(-) -- 2.20.1 diff --git a/drivers/pci/controller/pci-v3-semi.c b/drivers/pci/controller/pci-v3-semi.c index d219404bad92..96677520f6c1 100644 --- a/drivers/pci/controller/pci-v3-semi.c +++ b/drivers/pci/controller/pci-v3-semi.c @@ -241,10 +241,8 @@ struct v3_pci { void __iomem *config_base; struct pci_bus *bus; u32 config_mem; - u32 io_mem; u32 non_pre_mem; u32 pre_mem; - phys_addr_t io_bus_addr; phys_addr_t non_pre_bus_addr; phys_addr_t pre_bus_addr; struct regmap *map; @@ -520,35 +518,22 @@ static int v3_integrator_init(struct v3_pci *v3) } static int v3_pci_setup_resource(struct v3_pci *v3, - resource_size_t io_base, struct pci_host_bridge *host, struct resource_entry *win) { struct device *dev = v3->dev; struct resource *mem; struct resource *io; - int ret; switch (resource_type(win->res)) { case IORESOURCE_IO: io = win->res; - io->name = "V3 PCI I/O"; - v3->io_mem = io_base; - v3->io_bus_addr = io->start - win->offset; - dev_dbg(dev, "I/O window %pR, bus addr %pap\n", - io, &v3->io_bus_addr); - ret = devm_pci_remap_iospace(dev, io, io_base); - if (ret) { - dev_warn(dev, - "error %d: failed to map resource %pR\n", - ret, io); - return ret; - } + /* Setup window 2 - PCI I/O */ - writel(v3_addr_to_lb_base2(v3->io_mem) | + writel(v3_addr_to_lb_base2(pci_pio_to_address(io->start)) | V3_LB_BASE2_ENABLE, v3->base + V3_LB_BASE2); - writew(v3_addr_to_lb_map2(v3->io_bus_addr), + writew(v3_addr_to_lb_map2(io->start - win->offset), v3->base + V3_LB_MAP2); break; case IORESOURCE_MEM: @@ -732,7 +717,6 @@ static int v3_pci_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; - resource_size_t io_base; struct resource *regs; struct resource_entry *win; struct v3_pci *v3; @@ -741,7 +725,6 @@ static int v3_pci_probe(struct platform_device *pdev) u16 val; int irq; int ret; - LIST_HEAD(res); host = pci_alloc_host_bridge(sizeof(*v3)); if (!host) @@ -793,12 +776,7 @@ static int v3_pci_probe(struct platform_device *pdev) if (IS_ERR(v3->config_base)) return PTR_ERR(v3->config_base); - ret = devm_of_pci_get_host_bridge_resources(dev, 0, 0xff, &res, - &io_base); - if (ret) - return ret; - - ret = devm_request_pci_bus_resources(dev, &res); + ret = pci_parse_request_of_pci_ranges(dev, &host->windows, NULL); if (ret) return ret; @@ -852,8 +830,8 @@ static int v3_pci_probe(struct platform_device *pdev) writew(val, v3->base + V3_PCI_CMD); /* Get the I/O and memory ranges from DT */ - resource_list_for_each_entry(win, &res) { - ret = v3_pci_setup_resource(v3, io_base, host, win); + resource_list_for_each_entry(win, &host->windows) { + ret = v3_pci_setup_resource(v3, host, win); if (ret) { dev_err(dev, "error setting up resources\n"); return ret; @@ -931,7 +909,6 @@ static int v3_pci_probe(struct platform_device *pdev) val |= V3_SYSTEM_M_LOCK; writew(val, v3->base + V3_SYSTEM); - list_splice_init(&res, &host->windows); ret = pci_scan_root_bus_bridge(host); if (ret) { dev_err(dev, "failed to register host: %d\n", ret);