Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1237831pxb; Fri, 26 Feb 2021 06:11:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJx76b7lsgoBzS5DgrPxsr4AVdg7lbGUOEuZD2rOqHv4BPSJ/lCZDngrydorXtBCRfeo0quG X-Received: by 2002:a05:6402:4311:: with SMTP id m17mr3570232edc.123.1614348667311; Fri, 26 Feb 2021 06:11:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614348667; cv=none; d=google.com; s=arc-20160816; b=X+im6BqZ/dE7ALRxqCsf4EVhjUozAHX3Tq8QrP0xtL0UI2VVZzjkC/CB+ATvyDpCBi yuaijgdMi3JmnV186uZutdRon2pjrXeyrQ6hJ5+x3uBYTACsJMrgp7ITGFWjV/Rx3N6G fQ1CSbdOI/v8SEC7M0qxXSq61dR2vNUccLQmvBizEYD6PmJbSd/99Tq5iIU2Nx1vAmuG NA4KepMiz2ZIbhEvSDYGUkLAnzyBaILZkPJz6OI125QZ8ExjM4mdwtATG/B+kk2tVxG7 qyMLtZkkWZd/Bf8MZzXInvlJxwpekGai7aEX5h5SAZlKPRhUShYYpHk7qGJ5xmJOVmIG My6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=RqUuiLJY+wyHMm1rvN45eSNlHniZZCtrJDBlMg/23sc=; b=mqtgGY6tMIiVKujudaypKkvkuz129fgK2AhBYHv0HlKIldfSz9gfxRZaFJquBkQ8u7 ykes6MgTsrqW3xL9GLo9pjHFQ0U3PF2GU0Okranie3V9Z8F8NhwMs7fu8D29uDLTy0W8 Yu1FlnHxDDiTzEsX7xkIFYVEG3V8HhjzXrVMlKhYOWiCtRy8zxJiJEAJlD2UEAe6s/aW mUFzUCVYBWxH5qwx6XBJy0HhFvhADj3IPyr2VAXKGtwA5lc1u8pwT2qvn5UBIBNVAWpI CIOuE6KBoJiFp7PBQLYr1j7fPuE7mdiNcZgfez9fkgX0RRA425zhfHxQMDWVmmv/sOUX w83A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ar9si6201159ejc.373.2021.02.26.06.10.41; Fri, 26 Feb 2021 06:11:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229449AbhBZOGm (ORCPT + 99 others); Fri, 26 Feb 2021 09:06:42 -0500 Received: from mx2.suse.de ([195.135.220.15]:54870 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230063AbhBZOEo (ORCPT ); Fri, 26 Feb 2021 09:04:44 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 24D19AF4F; Fri, 26 Feb 2021 14:03:19 +0000 (UTC) From: Nicolas Saenz Julienne To: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: f.fainelli@gmail.com, robh+dt@kernel.org, robin.murphy@arm.com, ardb@kernel.org, hch@infradead.org, narmstrong@baylibre.com, dwmw2@infradead.org, linux@armlinux.org.uk, catalin.marinas@arm.com, arnd@arndb.de, will@kernel.org, Nicolas Saenz Julienne Subject: [RFC 05/13] pci: Introduce pci_mmio_configure() Date: Fri, 26 Feb 2021 15:02:57 +0100 Message-Id: <20210226140305.26356-6-nsaenzjulienne@suse.de> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210226140305.26356-1-nsaenzjulienne@suse.de> References: <20210226140305.26356-1-nsaenzjulienne@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function will traverse the pci device's bus hierarchy and set the relevant MMIO access flags. Signed-off-by: Nicolas Saenz Julienne --- drivers/pci/pci-driver.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index ec44a79e951a..554d91e7ec52 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1596,6 +1596,31 @@ static int pci_dma_configure(struct device *dev) return ret; } +/** + * pci_mmio_configure - Setup MMIO configuration + * @dev: ptr to dev structure + * + * Function to update PCI devices's MMIO configuration using the same + * info from the OF node of host bridge's parent (if any). + */ +static int pci_mmio_configure(struct device *dev) +{ + struct device *bridge; + int ret = 0; + + bridge = pci_get_host_bridge_device(to_pci_dev(dev)); + + dev_info(dev, "MMIO CONFIGURATION\n"); + if (IS_ENABLED(CONFIG_OF) && bridge->parent && + bridge->parent->of_node) { + dev_info(dev, "MMIO CONFIGURATION, %pOF\n", bridge->parent->of_node); + ret = of_mmio_configure(dev, bridge->parent->of_node); + } + + pci_put_host_bridge_device(bridge); + return ret; +} + struct bus_type pci_bus_type = { .name = "pci", .match = pci_bus_match, @@ -1609,6 +1634,7 @@ struct bus_type pci_bus_type = { .pm = PCI_PM_OPS_PTR, .num_vf = pci_bus_num_vf, .dma_configure = pci_dma_configure, + .mmio_configure = pci_mmio_configure, }; EXPORT_SYMBOL(pci_bus_type); -- 2.30.1