Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1934562ybn; Thu, 26 Sep 2019 04:33:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqzakoD5uhqr6O3zI2hv/lGyteaqvOUbW04pRgXB/gHSidxYGqdVfF5NHWswadPLRTjBE3eZ X-Received: by 2002:a50:e791:: with SMTP id b17mr2945000edn.11.1569497627642; Thu, 26 Sep 2019 04:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569497627; cv=none; d=google.com; s=arc-20160816; b=RS2TwnPz/iCYALK7G0YYrxppLqV6SoRTh0dyU1ffdPUt6MU3r6VVzckYe0V6E5ulql Ag+ZWi5ipGKPoDjAB+9KtOEWR0WtgHsaC1avShWWzoi7HktzBxA8n2qRyGCxAQ5LZS1t eWY15Pq22HuwlqD2iawgeKZlSu3raNGHJ2t0VvcmjwoLp3H6Pv2HeXjC2x3e5ki7RgQ4 F12HDHwP0GCka3u5eeEx4QnK/0AZ6vS9hpPTB3oztzHs9Y4dOE62/IX9alqG8/0I9ioo hRg0+F/H8G8WHmZVXd5gjGpMrmUFgULQ3+Mcd0ZpAlzM97HzfmP519tK9O0FtjxGTc/7 nvWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=iaR4/VPvHXdgGcChNIDAglMw0NIfiR18nZfC93JIGCk=; b=kcpdFwlTFEMNb2lSDZsNmhcKtV58PxtOw7hec2FP5Jpfg/PsdRsE8T+SLZLqSV7ias sMpL2uWxFNMPWnLO9g2M44QIH/jTQAtEwBEDYxwcLNfPSY7BSwHQl+mxj2/nkpGdxSG1 8qN3txYOnmdqZvDY5Y4C8FWQm4bJqi8ftLhic4+fH9/Ya52/GX0czMz/GvvftzBVRoU1 aoYdYr2xYgUNTDTHV0rkz65XQFiZhmxheJFPP6mZLA/Forz6EzcoXKAitzmzLzfY0/Eu EutYY/1DORRuaSbYKKVrRMtutK9G1/rmxfl0rVsleN5Fhk/q7mgGli+NBLh9Bz6lEE2U K8SQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=CH27UaMC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (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 r2si868704ejj.90.2019.09.26.04.33.23; Thu, 26 Sep 2019 04:33:47 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=CH27UaMC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726462AbfIZLbN (ORCPT + 99 others); Thu, 26 Sep 2019 07:31:13 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:50980 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbfIZLbL (ORCPT ); Thu, 26 Sep 2019 07:31:11 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id x8QBV3MU042367; Thu, 26 Sep 2019 06:31:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1569497463; bh=iaR4/VPvHXdgGcChNIDAglMw0NIfiR18nZfC93JIGCk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=CH27UaMC6h0DmkS/FvOR0OXtMzqrOiA4EgMLJdoReHAUiONQmSOzpuLtbABypp3Iw w/ESVD+sCX1JrOR7laHlkzAgYhoNJa6Zw08UycuCcMR1zJ2w4JkmUlHEaW/Fj0+KmC 5im6Y6NehNR8k3OTnupdbYv/73HI5Uox2WOn9WRI= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x8QBV3B5050162 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 26 Sep 2019 06:31:03 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 26 Sep 2019 06:31:03 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Thu, 26 Sep 2019 06:31:03 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x8QBUTk0069017; Thu, 26 Sep 2019 06:30:59 -0500 From: Kishon Vijay Abraham I To: Bjorn Helgaas , Jonathan Corbet , Rob Herring , Jon Mason , Dave Jiang , Allen Hubbe , Lorenzo Pieralisi CC: Mark Rutland , , , , , , Subject: [RFC PATCH 07/21] PCI: endpoint: Add "pci-epf-bus" driver Date: Thu, 26 Sep 2019 16:59:19 +0530 Message-ID: <20190926112933.8922-8-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190926112933.8922-1-kishon@ti.com> References: <20190926112933.8922-1-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add "pci-epf-bus" driver that helps to create EPF device from device tree. This is added in order to define an endpoint function completely from device tree. Signed-off-by: Kishon Vijay Abraham I --- drivers/pci/endpoint/Makefile | 3 +- drivers/pci/endpoint/pci-epf-bus.c | 54 ++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 drivers/pci/endpoint/pci-epf-bus.c diff --git a/drivers/pci/endpoint/Makefile b/drivers/pci/endpoint/Makefile index 95b2fe47e3b0..36cf33cf975c 100644 --- a/drivers/pci/endpoint/Makefile +++ b/drivers/pci/endpoint/Makefile @@ -5,4 +5,5 @@ obj-$(CONFIG_PCI_ENDPOINT_CONFIGFS) += pci-ep-cfs.o obj-$(CONFIG_PCI_ENDPOINT) += pci-epc-core.o pci-epf-core.o\ - pci-epc-mem.o functions/ + pci-epc-mem.o pci-epf-bus.o \ + functions/ diff --git a/drivers/pci/endpoint/pci-epf-bus.c b/drivers/pci/endpoint/pci-epf-bus.c new file mode 100644 index 000000000000..c47eeae7fe7a --- /dev/null +++ b/drivers/pci/endpoint/pci-epf-bus.c @@ -0,0 +1,54 @@ +// SPDX-License-Identifier: GPL-2.0 +/** + * PCI Endpoint *Function* Bus Driver + * + * Copyright (C) 2019 Texas Instruments + * Author: Kishon Vijay Abraham I + */ + +#include +#include +#include +#include +#include + +static int pci_epf_bus_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *node = of_node_get(dev->of_node); + struct device_node *child; + struct pci_epf *epf; + + for_each_child_of_node(node, child) { + epf = devm_pci_epf_of_create(dev, child); + if (IS_ERR(epf)) { + dev_err(dev, "Failed to create PCI EPF device %s\n", + node->full_name); + of_node_put(child); + break; + } + } + of_node_put(node); + + return 0; +} + +static const struct of_device_id pci_epf_bus_id_table[] = { + { .compatible = "pci-epf-bus" }, + {} +}; +MODULE_DEVICE_TABLE(of, pci_epf_bus_id_table); + +static struct platform_driver pci_epf_bus_driver = { + .probe = pci_epf_bus_probe, + .driver = { + .name = "pci-epf-bus", + .of_match_table = of_match_ptr(pci_epf_bus_id_table), + }, +}; + +module_platform_driver(pci_epf_bus_driver); + +MODULE_AUTHOR("Texas Instruments Inc."); +MODULE_DESCRIPTION("PCI EPF Bus Driver"); +MODULE_LICENSE("GPL v2"); -- 2.17.1