Received: by 10.223.185.116 with SMTP id b49csp3392353wrg; Tue, 13 Feb 2018 01:42:17 -0800 (PST) X-Google-Smtp-Source: AH8x224GeLkaZSJwscL1iguOUErnqxZ8ru9Am3SBcnrn6iWfdCYs0FjlyxV5nUkAWu/65uWrUrE0 X-Received: by 10.99.126.24 with SMTP id z24mr499860pgc.343.1518514937410; Tue, 13 Feb 2018 01:42:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518514937; cv=none; d=google.com; s=arc-20160816; b=Bf9ZM4b2F5Lfu0j4sq34hfgyGZU7v+ijjprBm1y2SkP4X/VnLyMQdhV7rpPr1mT1N8 ThDejRvdyWiaiQ1SoBVa2EjmP2WIUnSuooehS+5mjGoEB0E+nlPNN4U5Gz3LCRkA84Cn WtrNRTtD8hc2TzD9pqNC5M3eEBpgd/eCAKVpEDrBKNw4XUsoD8FlfFW8GNBS0kLI5ZQg 40gHaLOcGoIISfMQitJ1eElR92WYWba2rt/PEd8/O4cdBf2R4fl5NBDbqjEG01IWAepi Uyb3qKngbry92JBB03w/zTsIT7lse5UILKO9gXTNLlGGluI7NISQLMhIU3WCzKEygq2A fecg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=+ZPQZY/HbN1GP4E+mAlsb+0FZxIakhdpSg0uV1AC1n0=; b=xytPBcEotkmkbp2kmLOvWvSuBx0BMxalocWWzfsbkUygosemHtoafdyDiOdLCsjOe3 9XHFtBENeNOMaVUu1P6g7iLrbUl45R3K/sDmtYg/J7ElKsYdeqF+7Mw7r7lWDzUPUeM2 PbS7XEcfuyIg5phg1uNmnUFjeLdhfavRKcPwp20mijpguVr+oY6JtK8JXAdFEs9cG5vm IH15Su1vYLDZABhcfOwhH1INwc0OQgSZzdGiCu530Lk0z1kBHzhVNIXgQI67gfEY78mg WlHC4ubTh3WpOVAGqpa1uWG7KNPECZtEcBXGcsJvxyiWQdfzYWMQ5t/N/RspaVNL0ytM /xhw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11-v6si1121062plr.8.2018.02.13.01.41.59; Tue, 13 Feb 2018 01:42:17 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934324AbeBMJkI (ORCPT + 99 others); Tue, 13 Feb 2018 04:40:08 -0500 Received: from mga03.intel.com ([134.134.136.65]:27128 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934420AbeBMJfy (ORCPT ); Tue, 13 Feb 2018 04:35:54 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Feb 2018 01:35:54 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,507,1511856000"; d="scan'208";a="26889611" Received: from hao-dev.bj.intel.com ([10.238.157.61]) by FMSMGA003.fm.intel.com with ESMTP; 13 Feb 2018 01:35:52 -0800 From: Wu Hao To: atull@kernel.org, mdf@kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linux-api@vger.kernel.org, luwei.kang@intel.com, yi.z.zhang@intel.com, hao.wu@intel.com, Tim Whisonant , Enno Luebbers , Shiva Rao , Christopher Rauer Subject: [PATCH v4 17/24] fpga: dfl: add fpga bridge platform driver for FME Date: Tue, 13 Feb 2018 17:24:46 +0800 Message-Id: <1518513893-4719-18-git-send-email-hao.wu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518513893-4719-1-git-send-email-hao.wu@intel.com> References: <1518513893-4719-1-git-send-email-hao.wu@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds fpga bridge platform driver for FPGA Management Engine. It implements the enable_set call back for fpga bridge. Signed-off-by: Tim Whisonant Signed-off-by: Enno Luebbers Signed-off-by: Shiva Rao Signed-off-by: Christopher Rauer Signed-off-by: Wu Hao Acked-by: Alan Tull Acked-by: Moritz Fischer --- v3: rename driver to fpga-dfl-fme-br remove useless dev_dbg in probe function. rebased due to fpga api change. v4: rename to dfl-fme-br and fix SPDX license issue include dfl-fme-pr.h instead of dfl-fme.h add Acked-by from Alan and Moritz --- drivers/fpga/Kconfig | 6 ++++ drivers/fpga/Makefile | 1 + drivers/fpga/dfl-fme-br.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 drivers/fpga/dfl-fme-br.c diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig index 89f76e8..a8f939a 100644 --- a/drivers/fpga/Kconfig +++ b/drivers/fpga/Kconfig @@ -156,6 +156,12 @@ config FPGA_DFL_FME_MGR help Say Y to enable FPGA Manager driver for FPGA Management Engine. +config FPGA_DFL_FME_BRIDGE + tristate "FPGA DFL FME Bridge Driver" + depends on FPGA_DFL_FME + help + Say Y to enable FPGA Bridge driver for FPGA Management Engine. + config FPGA_DFL_PCI tristate "FPGA Device Feature List (DFL) PCIe Device Driver" depends on PCI && FPGA_DFL diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile index f82814a..75096e9 100644 --- a/drivers/fpga/Makefile +++ b/drivers/fpga/Makefile @@ -32,6 +32,7 @@ obj-$(CONFIG_OF_FPGA_REGION) += of-fpga-region.o obj-$(CONFIG_FPGA_DFL) += dfl.o obj-$(CONFIG_FPGA_DFL_FME) += dfl-fme.o obj-$(CONFIG_FPGA_DFL_FME_MGR) += dfl-fme-mgr.o +obj-$(CONFIG_FPGA_DFL_FME_BRIDGE) += dfl-fme-br.o dfl-fme-objs := dfl-fme-main.o dfl-fme-pr.o diff --git a/drivers/fpga/dfl-fme-br.c b/drivers/fpga/dfl-fme-br.c new file mode 100644 index 0000000..46cee30 --- /dev/null +++ b/drivers/fpga/dfl-fme-br.c @@ -0,0 +1,85 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * FPGA Bridge Driver for FPGA Management Engine (FME) + * + * Copyright (C) 2017 Intel Corporation, Inc. + * + * Authors: + * Wu Hao + * Joseph Grecco + * Enno Luebbers + * Tim Whisonant + * Ananda Ravuri + * Henry Mitchel + */ + +#include +#include + +#include "dfl.h" +#include "dfl-fme-pr.h" + +static int fme_bridge_enable_set(struct fpga_bridge *bridge, bool enable) +{ + struct fme_br_pdata *pdata = bridge->priv; + int ret = 0; + + if (enable) + fpga_port_enable(pdata->port); + else + ret = fpga_port_disable(pdata->port); + + return ret; +} + +static const struct fpga_bridge_ops fme_bridge_ops = { + .enable_set = fme_bridge_enable_set, +}; + +static int fme_br_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct fme_br_pdata *pdata = dev_get_platdata(dev); + struct fpga_bridge *br; + int ret; + + br = devm_kzalloc(dev, sizeof(*br), GFP_KERNEL); + if (!br) + return -ENOMEM; + + br->name = "FPGA FME Bridge"; + br->br_ops = &fme_bridge_ops; + br->priv = pdata; + br->parent = dev; + platform_set_drvdata(pdev, br); + + ret = fpga_bridge_register(br); + if (ret) + dev_err(dev, "unable to register FPGA Bridge\n"); + + return ret; +} + +static int fme_br_remove(struct platform_device *pdev) +{ + struct fpga_bridge *br = platform_get_drvdata(pdev); + + fpga_bridge_unregister(br); + + return 0; +} + +static struct platform_driver fme_br_driver = { + .driver = { + .name = FPGA_DFL_FME_BRIDGE, + }, + .probe = fme_br_probe, + .remove = fme_br_remove, +}; + +module_platform_driver(fme_br_driver); + +MODULE_DESCRIPTION("FPGA Bridge for DFL FPGA Management Engine"); +MODULE_AUTHOR("Intel Corporation"); +MODULE_LICENSE("GPL v2"); +MODULE_ALIAS("platform:dfl-fme-bridge"); -- 2.7.4