Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1398117ybk; Thu, 14 May 2020 08:03:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7Pp9fxFpimmuMEQxF92NMh438N6yub0L8SOs3z0UX9JdtpDzAWiI8UHZIREC46Euf/h38 X-Received: by 2002:aa7:d3d6:: with SMTP id o22mr4453509edr.359.1589468619591; Thu, 14 May 2020 08:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589468619; cv=none; d=google.com; s=arc-20160816; b=Ihla8lIihfnIaRlbYbkEDVMBSIoJqPIIhDbxg5mgqfMfFUwlTAgANW7f3wpzRS1Lfs wMjcikofW52KiWxq7gosd0tUDWCMeI/4w6A57Elb9Izmmz8rIpjvqPm2JEDHsXpLKtEx SdyTOReej2CBfUcJnC/qozlcITZfbCk5hL3uYhHJyUUBLh6GuR/WHJl83WNOI4sQyIHb m0PZUNsP4s1d8LTfA2iSU9bx1M4JXbIgr56IpGCgSIvWepSL5ZHRjyYGgmnOtV9hnP2n KZdMhW96Fcugzwtrx5iF3IOtgy0hV29f/VWdDpIRGA9qBvuNTLgjfgQ6mcIiLtiw3YXN Pb6g== 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=hFv2iOUC9MFGbvA/KZkyn+UkE86d8RSkbhbbEwZ8rmI=; b=uhNKQzPKt8QUy1v3n7sY7O91fQiV3+3uwq6ML3luJw9s8HHR0t2GXrWsabKyou9SuK /bmp96HB4ogx49c+WcWYpwnRNkWfBnYAqhyxhgNYAylDjhdA//SekCUpXKki1+DKxvei 7O4c/jjXYyVW6bc60GafrjN5yq6KGdNFswWsJ9bgQ3nDw7htIZZDYzyGQGX824adoare KWyMEonOirwvJxTT8JbGzUxkT33WeBc7dsMSKbzyp8G1SUo035FKwqPuY9PKLgPMj7Mu vbM2Ek0LLKfAOVOqtnq5FQStf9nPY4UywaiZY9/pLx38Ea+nTBBzMGOUs/jP47iKmgdG xa4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=yUS70p4V; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g24si1958349ejx.432.2020.05.14.08.03.16; Thu, 14 May 2020 08:03:39 -0700 (PDT) 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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=yUS70p4V; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728095AbgENPAi (ORCPT + 99 others); Thu, 14 May 2020 11:00:38 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:42190 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728060AbgENPAf (ORCPT ); Thu, 14 May 2020 11:00:35 -0400 Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04EF0BBj029167; Thu, 14 May 2020 10:00:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1589468411; bh=hFv2iOUC9MFGbvA/KZkyn+UkE86d8RSkbhbbEwZ8rmI=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=yUS70p4Ved7qpx5ntRAwginbYDjg3v9OI1PXLTi1XyU7QMO9Zbhw9ODxHqmZh/P6w z2UCoz11W1QPSULfMZE7Xw3m0EQ/PaMQf7sbvjii0TAB4pwKOA0Om/J+Ucv2WGdaEI TiLv27mjLMfFK+zH50ozkj4b0GkqGMx2SrrTXmmE= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 04EF0BNg103053 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 14 May 2020 10:00:11 -0500 Received: from DFLE110.ent.ti.com (10.64.6.31) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Thu, 14 May 2020 10:00:10 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE110.ent.ti.com (10.64.6.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Thu, 14 May 2020 10:00:10 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04EExgAn019279; Thu, 14 May 2020 10:00:06 -0500 From: Kishon Vijay Abraham I To: Lorenzo Pieralisi , Arnd Bergmann , Jon Mason , Dave Jiang , Allen Hubbe , Tom Joseph , Bjorn Helgaas , Rob Herring CC: Greg Kroah-Hartman , Jonathan Corbet , , , , , , Kishon Vijay Abraham I Subject: [PATCH 05/19] PCI: endpoint: Add "pci-epf-bus" driver Date: Thu, 14 May 2020 20:29:13 +0530 Message-ID: <20200514145927.17555-6-kishon@ti.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200514145927.17555-1-kishon@ti.com> References: <20200514145927.17555-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 device 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..b6ab1479b79e --- /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) 2020 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