Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3436258yba; Mon, 29 Apr 2019 02:14:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqx1ndzfIF8gyVCo/kzNPsRa8pminK7ByUnFYQgGBkUZJnlq/z+mHn2hbK5xC2lNSkHPXWrj X-Received: by 2002:a63:330e:: with SMTP id z14mr57273345pgz.4.1556529257647; Mon, 29 Apr 2019 02:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556529257; cv=none; d=google.com; s=arc-20160816; b=W1DgLumHg/4rpKTteUcfds34aZSGZNQaoFeuZlXwR/WChIzw/2N4TMZvWe50YQAllx nsLM1TLnHYqBORD0h97bIMabvQOvlbWVXKZkZKQQQ2DykcbGMzOPQ7Y6izzT0b7WJ61u qOxNuUlOgrTkmCS16UGBLErhl1GDw0DKezs/ZQs9NcSA7h9Ryf5j70zeTRQ2dum6elpq 0Z14byPEdroEGgfj6fHvoc7Rwugr1pNWON6bHEIUGvHSR3d5+ZkkfLOx+wr8G7gJHt/g aCZK6QrHa3CgOkE6eXt+XpPvPEh38tUNPLbM1AHEUKb+RKKlEaoaWt2g4Z2TR3qB7EHk aAnQ== 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; bh=oNUmC5+6ClpYequmvKWKdFe9Pk8ZvV6Ln6Spgu6h8I0=; b=Aj6BuuBtZCqt2aZH54UEAGZsoGGjbw44MIQXzUuq2lNFPzCgVOoLXWYlxmk5EUHmug u7JOGusY43lBHwsPhyJuJZ9Nx9qXGVmH/9lZgDqpfR6nM88bryaU3h+Kk0r8LRtv/MoF VPONEWvonkUpeHKnRMki3JZr2cjzCFmAsn5Fo9TaOF2g2uaH5/DhJO8fa6xahOVxrOgA y7xTNsl32EXy/8ZmfJL5S0RFQdzU5ou0MLnVuVorLMwESrfAe5vIRtZr8aA0/sR9iEAQ FCNCDLkpcpxbvynYz60mE/c0iQew/8OO8/9/TyorwkcUT4VnJhIcGA9GoGihdqm66/mz 4qZQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v9si30356839pgr.167.2019.04.29.02.14.02; Mon, 29 Apr 2019 02:14:17 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727941AbfD2JM7 (ORCPT + 99 others); Mon, 29 Apr 2019 05:12:59 -0400 Received: from mga02.intel.com ([134.134.136.20]:32630 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727918AbfD2JM4 (ORCPT ); Mon, 29 Apr 2019 05:12:56 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Apr 2019 02:12:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,409,1549958400"; d="scan'208";a="165988274" Received: from hao-dev.bj.intel.com ([10.238.157.65]) by fmsmga004.fm.intel.com with ESMTP; 29 Apr 2019 02:12:53 -0700 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, Wu Hao , Xu Yilun Subject: [PATCH v2 11/18] fpga: dfl: afu: export __port_enable/disable function. Date: Mon, 29 Apr 2019 16:55:44 +0800 Message-Id: <1556528151-17221-12-git-send-email-hao.wu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556528151-17221-1-git-send-email-hao.wu@intel.com> References: <1556528151-17221-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 As these two functions are used by other private features. e.g. in error reporting private feature, it requires to check port status and reset port for error clearing. Signed-off-by: Xu Yilun Signed-off-by: Wu Hao Acked-by: Moritz Fischer Acked-by: Alan Tull --- drivers/fpga/dfl-afu-main.c | 25 ++++++++++++++----------- drivers/fpga/dfl-afu.h | 3 +++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/fpga/dfl-afu-main.c b/drivers/fpga/dfl-afu-main.c index 2916876..e727d9b 100644 --- a/drivers/fpga/dfl-afu-main.c +++ b/drivers/fpga/dfl-afu-main.c @@ -24,14 +24,16 @@ #define DRV_VERSION "0.8" /** - * port_enable - enable a port + * __port_enable - enable a port * @pdev: port platform device. * * Enable Port by clear the port soft reset bit, which is set by default. * The AFU is unable to respond to any MMIO access while in reset. - * port_enable function should only be used after port_disable function. + * __port_enable function should only be used after __port_disable function. + * + * The caller needs to hold lock for protection. */ -static void port_enable(struct platform_device *pdev) +void __port_enable(struct platform_device *pdev) { struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev); void __iomem *base; @@ -54,13 +56,14 @@ static void port_enable(struct platform_device *pdev) #define RST_POLL_TIMEOUT 1000 /* us */ /** - * port_disable - disable a port + * __port_disable - disable a port * @pdev: port platform device. * - * Disable Port by setting the port soft reset bit, it puts the port into - * reset. + * Disable Port by setting the port soft reset bit, it puts the port into reset. + * + * The caller needs to hold lock for protection. */ -static int port_disable(struct platform_device *pdev) +int __port_disable(struct platform_device *pdev) { struct dfl_feature_platform_data *pdata = dev_get_platdata(&pdev->dev); void __iomem *base; @@ -106,9 +109,9 @@ static int __port_reset(struct platform_device *pdev) { int ret; - ret = port_disable(pdev); + ret = __port_disable(pdev); if (!ret) - port_enable(pdev); + __port_enable(pdev); return ret; } @@ -810,9 +813,9 @@ static int port_enable_set(struct platform_device *pdev, bool enable) mutex_lock(&pdata->lock); if (enable) - port_enable(pdev); + __port_enable(pdev); else - ret = port_disable(pdev); + ret = __port_disable(pdev); mutex_unlock(&pdata->lock); return ret; diff --git a/drivers/fpga/dfl-afu.h b/drivers/fpga/dfl-afu.h index 0c7630a..35e60c5 100644 --- a/drivers/fpga/dfl-afu.h +++ b/drivers/fpga/dfl-afu.h @@ -79,6 +79,9 @@ struct dfl_afu { struct dfl_feature_platform_data *pdata; }; +void __port_enable(struct platform_device *pdev); +int __port_disable(struct platform_device *pdev); + void afu_mmio_region_init(struct dfl_feature_platform_data *pdata); int afu_mmio_region_add(struct dfl_feature_platform_data *pdata, u32 region_index, u64 region_size, u64 phys, u32 flags); -- 1.8.3.1