From patchwork Wed Oct 11 08:00:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 115520 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp464916qgn; Wed, 11 Oct 2017 01:01:23 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDvS/3QeDD1+caaT3D+eAlfeOfvz3B6o37FMfPmBkSFiO4YDflsdIY89Z9Zt+b8/WMSq112 X-Received: by 10.98.53.196 with SMTP id c187mr16178578pfa.38.1507708883447; Wed, 11 Oct 2017 01:01:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507708883; cv=none; d=google.com; s=arc-20160816; b=bZcCNWDYzUnQ1j0WtUpg+QeCWwzXis6RtQcyvyELl0QXXBHx/Bn0523h9Q4T0maXAo 2WVONLRTSVuduRc8ixDUj55ACcnTYLsCok/lxhikMBZWxJQVjLeKLrp/4k7XtHpsPTL4 hcHNSHqdRNQO6ar3xftpWvU4SrUdd8I4U0UIJGHw1bUXsxfxc7p2IzQxU6aYG3OlBjle rLnj9/1OYPhuA0ud8XSaD05y4lbYUqACtbyWqHq31EpVFj2BSfdo/kfHhDvEvsF4PeTY 4gN4mJd5L23bXK814aeu3XeZV/44wplzBd067JpI8iVjz6L3SneqOhKwBjljwXC205DT xTfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature:arc-authentication-results; bh=q15kBkZg2s43c4Ff6LXTIwa0w+QtI1vf4+Wjq+c0ut8=; b=LBlYm90aU1xAI2EKOzZNPwL07FZbRs8dqrq/+HYMauaM+wPw21uXAcRxXjD45i5IAq l5BbHDy3cLCrNhUjc001AOHjdz1SOQ19UYfXkOsOs9Qm6oDJT7oMHDyCtGnPLDCp6j35 g8glBIv8e1fhEOoVnw0McpJ0kcwMucOTyudWTDgEUL/dFIFSO4WbOjigLJfkNDvWTTZ1 35Ehr6xMYd9xESztxwkLvVJdK7m1gyVycED+NwjU9kqqJc9L/kPSOdtHSMEc6h965xoD dhwijLgr9KllDHTW5BxUEAi2pRv1llK8KpvuKmx/HzxyZtcOaxDWnPAc6IjfxQejPc6a qByg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=WLnABALC; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x4si10054250plw.392.2017.10.11.01.01.23; Wed, 11 Oct 2017 01:01:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@ti.com header.s=ti-com-17Q1 header.b=WLnABALC; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756656AbdJKIBV (ORCPT + 6 others); Wed, 11 Oct 2017 04:01:21 -0400 Received: from lelnx194.ext.ti.com ([198.47.27.80]:33200 "EHLO lelnx194.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756206AbdJKIA5 (ORCPT ); Wed, 11 Oct 2017 04:00:57 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id v9B80nQN002145; Wed, 11 Oct 2017 03:00:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1507708849; bh=73sA19+nivvphZ6NX6OYSWPopB/IrfkSDWEIWv4Lcd4=; h=From:To:CC:Subject:Date; b=WLnABALC1QBI6Ae5jBOAbTz8UpXONbXSmVEWHf8kgE2VCOrcFwki8WHPWRYt2ujxO ITDnWmb3yj3s5PHz1yab8CYULBCqjQiqqV6UM3vwerGLbw8pqU9ljtv44gZzOx0Poc lzAW5OGfSlGiquKvKxQ9C0UWwjMVH266Rrtuc6Rg= Received: from DLEE108.ent.ti.com (dlee108.ent.ti.com [157.170.170.38]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v9B80n46003128; Wed, 11 Oct 2017 03:00:49 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE108.ent.ti.com (157.170.170.38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.845.34; Wed, 11 Oct 2017 03:00:48 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.845.34 via Frontend Transport; Wed, 11 Oct 2017 03:00:48 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v9B80iFw006731; Wed, 11 Oct 2017 03:00:45 -0500 From: Kishon Vijay Abraham I To: Robin Murphy , Christoph Hellwig , Rob Herring , Mark Rutland CC: Kishon Vijay Abraham I , Bjorn Helgaas , , , , , Subject: [PATCH] of: Devices with pci_epf_bus_type require DMA configuration Date: Wed, 11 Oct 2017 13:30:41 +0530 Message-ID: <20171011080041.12918-1-kishon@ti.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org pci-epc-core.c invokes of_dma_configure in order to configure the coherent_dma_mask/dma_mask of endpoint function device. This is required for dma_alloc_coherent to succeed in pci function driver (pci-epf-test.c). However after commit 723288836628bc1c08 ("of: restrict DMA configuration"), of_dma_configure doesn't configure the coherent_dma_mask/dma_mask of endpoint function device (since it doesn't have dma-ranges property), resulting in dma_alloc_coherent in pci endpoint function driver to to fail. Fix it by making sure of_dma_configure configures coherent_dma_mask/dma_mask irrespective of whether the node has dma-ranges property or not. Fixes: 723288836628bc1c08 ("of: restrict DMA configuration") Signed-off-by: Kishon Vijay Abraham I --- drivers/of/device.c | 4 +++- drivers/pci/endpoint/pci-epf-core.c | 3 +-- include/linux/pci-epf.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/of/device.c b/drivers/of/device.c index 64b710265d39..881cf80a3d69 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -105,7 +106,8 @@ int of_dma_configure(struct device *dev, struct device_node *np) #ifdef CONFIG_ARM_AMBA dev->bus != &amba_bustype && #endif - dev->bus != &platform_bus_type) + dev->bus != &platform_bus_type && + dev->bus != &pci_epf_bus_type) return ret == -ENODEV ? 0 : ret; dma_addr = offset = 0; diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c index ae1611a62808..6f354ec6be71 100644 --- a/drivers/pci/endpoint/pci-epf-core.c +++ b/drivers/pci/endpoint/pci-epf-core.c @@ -26,7 +26,6 @@ #include #include -static struct bus_type pci_epf_bus_type; static const struct device_type pci_epf_type; /** @@ -344,7 +343,7 @@ static int pci_epf_device_remove(struct device *dev) return ret; } -static struct bus_type pci_epf_bus_type = { +struct bus_type pci_epf_bus_type = { .name = "pci-epf", .match = pci_epf_device_match, .probe = pci_epf_device_probe, diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index 60d551a9a1ba..83a3fb7e6ac1 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h @@ -16,6 +16,7 @@ #include #include +extern struct bus_type pci_epf_bus_type; struct pci_epf; enum pci_barno {