From patchwork Wed Oct 21 15:52:10 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 55390 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lf0-f69.google.com (mail-lf0-f69.google.com [209.85.215.69]) by patches.linaro.org (Postfix) with ESMTPS id 153A123024 for ; Wed, 21 Oct 2015 15:54:40 +0000 (UTC) Received: by lffz202 with SMTP id z202sf19602045lff.3 for ; Wed, 21 Oct 2015 08:54:38 -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:cc:subject:date:message-id :in-reply-to:references:mime-version:content-type :spamdiagnosticoutput:spamdiagnosticmetadata:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe; bh=m8+sQGi2DWnPAOl9R3XZ/GoLFG9SwXUXgw1o3HWTwXA=; b=dkEl+Z/lslzQLsjfe5IrSL5483J083ge/tC71NzKwJZ5LwSk20b8EVjfUvsiruaAdd Is4+C9UjLj1E2qstusZTzE5vVYP7UXHA4Pkr66GK4ehwlfWcu8iNsVrh7UyQHBf/P4is LLOyw5lZcm72G9kgnCMCjqpEu5x/M3I/qj0mzd8NPI24G+D2e6z0ipw25JDpunl68NL+ Mj3s6xPrKvmr0UiRavMYYztIvuL6IuShNiwgMS48fg0KhtKsNtMq6GGRHVhTVz0zPzem Vh72zSsM+b9lgGOOBuqQwjbdu3wb5vjHoJgs2HmOJIrUGQegts051aIWQR2TTjA2cnb0 3CCA== X-Gm-Message-State: ALoCoQngMNbrr91tNy2cc2VjUQVzjWD4ljzxflUrtxjaVyz5NAI0lGhyKKc5CqIwsoJnE5fS+JJo X-Received: by 10.180.99.71 with SMTP id eo7mr1491475wib.3.1445442878578; Wed, 21 Oct 2015 08:54:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.209.145 with SMTP id i139ls56521lfg.0.gmail; Wed, 21 Oct 2015 08:54:38 -0700 (PDT) X-Received: by 10.25.143.73 with SMTP id r70mr3853004lfd.108.1445442878376; Wed, 21 Oct 2015 08:54:38 -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 m16si4996247lbl.155.2015.10.21.08.54.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2015 08:54:38 -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 lbcao8 with SMTP id ao8so41694708lbc.3 for ; Wed, 21 Oct 2015 08:54:38 -0700 (PDT) X-Received: by 10.112.202.35 with SMTP id kf3mr5890060lbc.19.1445442878120; Wed, 21 Oct 2015 08:54:38 -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.59.35 with SMTP id w3csp66899lbq; Wed, 21 Oct 2015 08:54:37 -0700 (PDT) X-Received: by 10.68.251.33 with SMTP id zh1mr2620654pbc.64.1445442874197; Wed, 21 Oct 2015 08:54:34 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nr10si14150356pbc.219.2015.10.21.08.54.33; Wed, 21 Oct 2015 08:54:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755776AbbJUPyc (ORCPT + 28 others); Wed, 21 Oct 2015 11:54:32 -0400 Received: from mail-bl2on0096.outbound.protection.outlook.com ([65.55.169.96]:57056 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755529AbbJUPxK (ORCPT ); Wed, 21 Oct 2015 11:53:10 -0400 Received: from CY1PR12CA0050.namprd12.prod.outlook.com (10.163.230.18) by SN1PR12MB0862.namprd12.prod.outlook.com (10.164.27.12) with Microsoft SMTP Server (TLS) id 15.1.300.14; Wed, 21 Oct 2015 15:53:07 +0000 Received: from BY2NAM03FT029.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::202) by CY1PR12CA0050.outlook.office365.com (2a01:111:e400:c42b::18) with Microsoft SMTP Server (TLS) id 15.1.306.13 via Frontend Transport; Wed, 21 Oct 2015 15:53:07 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp02.amd.com (165.204.84.222) by BY2NAM03FT029.mail.protection.outlook.com (10.152.84.213) with Microsoft SMTP Server id 15.1.306.8 via Frontend Transport; Wed, 21 Oct 2015 15:53:06 +0000 X-WSS-ID: 0NWKUSE-08-0A2-02 X-M-MSG: Received: from satlvexedge01.amd.com (satlvexedge01.amd.com [10.177.96.28]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp02.amd.com (Axway MailGate 5.3.1) with ESMTPS id 258BDBD8902; Wed, 21 Oct 2015 11:53:02 -0400 (EDT) Received: from SATLEXDAG04.amd.com (10.181.40.9) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Wed, 21 Oct 2015 10:53:12 -0500 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by satlexdag04.amd.com (10.181.40.9) with Microsoft SMTP Server id 14.3.266.1; Wed, 21 Oct 2015 11:53:04 -0400 From: Suravee Suthikulpanit To: , , , , CC: , , , , , , , , Suravee Suthikulpanit , Murali Karicheri Subject: [PATCH V4 7/8] PCI: OF: Move of_pci_dma_configure() to pci_dma_configure() Date: Wed, 21 Oct 2015 08:52:10 -0700 Message-ID: <1445442731-28819-8-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1445442731-28819-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1445442731-28819-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.222; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(189002)(199003)(77096005)(2201001)(87936001)(92566002)(50986999)(53416004)(76176999)(46102003)(2950100001)(101416001)(19580395003)(189998001)(5003600100002)(575784001)(36756003)(86362001)(5003940100001)(64706001)(19580405001)(47776003)(48376002)(50466002)(97736004)(5001770100001)(106466001)(105586002)(5008740100001)(5007970100001)(11100500001)(229853001)(5001920100001)(50226001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0862; H:atltwp02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0862; 2:L/n6ijz9zaK+iDE2wShT+yROvCU8Dt8CjyB7gT5OEu7KqR9OXmKzeQuvNvGWFPH1xIWprgMZ2bQ7Bpk2Z9b0mQEzQkF1L8okTdfk768DoiowzcS9k60lgyaVjoQFkLjUQlGyox7v13zNBtea5M7yS8hY1Wie6bUUmAdu+S4sLro=; 3:HhZ9qZn6g/O447UTHn0TTmDXXzpgpO4XX+HsCOLrxg79TkMyUloIJ36YyOXwSdn+e3XkQyNNTu4dXDqejvU8x/EVwV97G6EKipzxzO89t/zZkVVh7SZ0L6qmlilyc/GoaJZagt7F235yreVtAaMbJpBqe/VND2DgMdwwJLMufkNZLxyBiH0iKw4KR4Pq+jHpS/eCXR+6iOP/GeiqVVvEO2aWmAcUzj2O7chgTau9mIWrDDmvD88OfrFtLw5OJVWm; 25:UTHsNk0Hl+/JBm6rGDQYSEFm5B09TLcIFWGrjfW1y3e8wR9jp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deN8yPQvb7H4Jl/cD0aIyTmauPwhetqblatzL+JXsVJ/XoWCUduu+DwFvaAAIrl4aHlzW6QrjiWAJgcArYDtONDDwVDkSEcbIh/1pxuOgY7Ay+U+EIUB0BQKQ0anMMKKbYo81yQ0vZ102g7MwLRIYq/G X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(102115026); SRVR:SN1PR12MB0862; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0862; X-Forefront-PRVS: 073631BD3D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0862; 23:b+HkRvd0z/wtcFfSrgFgMFcW5V0Lp/EPfs2zqRprZ?= =?us-ascii?Q?2uKirGAZ1quS7/VPFno/8zByeIGJLDzjgzx1a45bs4/Tgsve9MBMRVpfTlHt?= =?us-ascii?Q?QsCm6fyvAmy04iUytq+M+CArhh1Uq1rt/2XZdB+x1VfaRZXT2pmANYTJrm5Y?= =?us-ascii?Q?LxKx7LnWZj6Vd5Sp+GlJlrf7Nmhl7OEQ/GP+Kn88RCEpzWvV00bFoVIKgoyI?= =?us-ascii?Q?odcF+21mdV6ft6ifTXcRq+YC8Mu0akGEZSUgRE24ru6ztL5NC06WbuYN5JNF?= =?us-ascii?Q?P+nawB0xNxEMP2KMguGUpdq305tavkUTNcP30D9qMHf/2m1Hgb1JpNCXFZM+?= =?us-ascii?Q?6w34gfRExVFj3Zui86hiKNH0J5sxVv8Imp7mUtJP3ESpXcXuyP4cEr41h8u6?= =?us-ascii?Q?CXpsg8CfrOLeVeFUcvcFrPvEjJDPdgPObFjwdOUsYGOFnwg3D1ekWG15v6y9?= =?us-ascii?Q?uwxm+KOFrziLE7xuEVC3CJQOYZTk1R9VMurUpqCMWLQEyoyhRx3BhSvWaIKM?= =?us-ascii?Q?w1WVGdXSYZiZAqgo9FJYCI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N7MMOv5w+pncSup8e+Q3rLWzmjmk5jRX+TLEkKPqwmdU03JkFde9fqZwz4K1wZSdYD0TYQXiIQjnp/nkKys434YVJ91yNtR59ah+n80Ik2IS3yWG SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2015 15:53:06.3878 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.222]; Helo=[atltwp02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0862 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: suravee.suthikulpanit@amd.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.mailfrom=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: , This patch move of_pci_dma_configure() to a more generic pci_dma_configure(), which can be extended by non-OF code (e.g. ACPI). This has no functional change. Signed-off-by: Suravee Suthikulpanit Acked-by: Rob Herring CC: Bjorn Helgaas CC: Catalin Marinas CC: Will Deacon CC: Rafael J. Wysocki CC: Murali Karicheri --- drivers/of/of_pci.c | 20 -------------------- drivers/pci/probe.c | 27 +++++++++++++++++++++++++-- include/linux/of_pci.h | 3 --- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c index 5751dc5..b66ee4e 100644 --- a/drivers/of/of_pci.c +++ b/drivers/of/of_pci.c @@ -117,26 +117,6 @@ int of_get_pci_domain_nr(struct device_node *node) } EXPORT_SYMBOL_GPL(of_get_pci_domain_nr); -/** - * of_pci_dma_configure - Setup DMA configuration - * @dev: ptr to pci_dev struct of the PCI device - * - * Function to update PCI devices's DMA configuration using the same - * info from the OF node of host bridge's parent (if any). - */ -void of_pci_dma_configure(struct pci_dev *pci_dev) -{ - struct device *dev = &pci_dev->dev; - struct device *bridge = pci_get_host_bridge_device(pci_dev); - - if (!bridge->parent) - return; - - of_dma_configure(dev, bridge->parent->of_node); - pci_put_host_bridge_device(bridge); -} -EXPORT_SYMBOL_GPL(of_pci_dma_configure); - #if defined(CONFIG_OF_ADDRESS) /** * of_pci_get_host_bridge_resources - Parse PCI host bridge resources from DT diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index eea8b42..09264f8 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -6,12 +6,14 @@ #include #include #include -#include +#include #include #include #include #include #include +#include +#include #include #include "pci.h" @@ -1635,6 +1637,27 @@ static void pci_set_msi_domain(struct pci_dev *dev) dev_get_msi_domain(&dev->bus->dev)); } +/** + * pci_dma_configure - Setup DMA configuration + * @dev: ptr to pci_dev struct of the PCI device + * + * Function to update PCI devices's DMA configuration using the same + * info from the OF node of host bridge's parent (if any). + */ +static void pci_dma_configure(struct pci_dev *dev) +{ + struct device *bridge = pci_get_host_bridge_device(dev); + + if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) { + if (!bridge->parent) + return; + + of_dma_configure(&dev->dev, bridge->parent->of_node); + } + + pci_put_host_bridge_device(bridge); +} + void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) { int ret; @@ -1648,7 +1671,7 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) dev->dev.dma_mask = &dev->dma_mask; dev->dev.dma_parms = &dev->dma_parms; dev->dev.coherent_dma_mask = 0xffffffffull; - of_pci_dma_configure(dev); + pci_dma_configure(dev); pci_set_dma_max_seg_size(dev, 65536); pci_set_dma_seg_boundary(dev, 0xffffffff); diff --git a/include/linux/of_pci.h b/include/linux/of_pci.h index 29fd3fe..ce0e5ab 100644 --- a/include/linux/of_pci.h +++ b/include/linux/of_pci.h @@ -16,7 +16,6 @@ int of_pci_get_devfn(struct device_node *np); int of_irq_parse_and_map_pci(const struct pci_dev *dev, u8 slot, u8 pin); int of_pci_parse_bus_range(struct device_node *node, struct resource *res); int of_get_pci_domain_nr(struct device_node *node); -void of_pci_dma_configure(struct pci_dev *pci_dev); #else static inline int of_irq_parse_pci(const struct pci_dev *pdev, struct of_phandle_args *out_irq) { @@ -51,8 +50,6 @@ of_get_pci_domain_nr(struct device_node *node) { return -1; } - -static inline void of_pci_dma_configure(struct pci_dev *pci_dev) { } #endif #if defined(CONFIG_OF_ADDRESS)