Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2709822ybi; Thu, 4 Jul 2019 17:45:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyPKXIynEWIVPkrhiL+abdCFm0kOCrHGalWqVmmwTg17iIyOhwtKdN+1SNxnJuTcmZC0IcM X-Received: by 2002:a63:f04:: with SMTP id e4mr1222724pgl.38.1562287531913; Thu, 04 Jul 2019 17:45:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562287531; cv=none; d=google.com; s=arc-20160816; b=TVHb8K+eusI1eSmOVntQwxTnjVqKXx6cVfVrKj4hzVJVZrrkzjkzwqt9A1ld9cIXIr rBFoU4CtusP48WM/DPtWGfQ0y4MD2Ty5vrb7B/MyODfJ1nh4DQxV61Sc1iqN24J0FkDM ttr2P4g4FOi6naw/lka0pcp79PwNOrqTtuZ/gmj+dNHuiGcvMiZYcsDIjBB1JkbhVfei 82kMBzIe/KxO6cOoT07imsC/4W6/SsCIyt0KJNHfBpCnZA1rf1fEKa6Fb0Ou/kV2uBPH GIjNTq/K8SEC7CiAq9NScmK/IOjuCKeqsHrVYs9cTP1H4ZIA9tjAlRTd9VhuoZZrqePg c5Pw== 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=Kt9zGqutEwp6DZ0tCkVoLhP0AbIcSvIVQ9/UfKlub1c=; b=ToWHXa9hhtua0wIrqpmkgFVMrtF5VD8mCW8HYA6L8AiRJ+d1qvp4Up1k/slInxqIBq ltqmVsR2KL0hLOW7WrsM2GVzM5G5AkBvysT2PS8jtEo5RZvHfXU8j92U2f+D/AdWH4Sc ahkbpuy0lr3EVxZASoein5SDAtD2usWAvwGGRiKDFRUjRuRePO44OveXXGiX8MEXEHWP fri/7AV3Xb/a3jn9hHjiauXocmr912WuK8jafZlJmLiT4UzPO//o79bBzyP645D/OiKQ xpS2h4k8YomjfpJc0fH4lgvH2vXvNs/8j3wkTCWePkdcDNKwZdmfvfUAmOjMN99/zZG7 UMfQ== 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 l19si6507031pgb.204.2019.07.04.17.45.17; Thu, 04 Jul 2019 17:45:31 -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 S1728009AbfGEAmm (ORCPT + 99 others); Thu, 4 Jul 2019 20:42:42 -0400 Received: from mga03.intel.com ([134.134.136.65]:40861 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727889AbfGEAmN (ORCPT ); Thu, 4 Jul 2019 20:42:13 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jul 2019 17:42:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,453,1557212400"; d="scan'208";a="185074803" Received: from hao-dev.bj.intel.com ([10.238.157.65]) by fmsmga001.fm.intel.com with ESMTP; 04 Jul 2019 17:42:10 -0700 From: Wu Hao To: gregkh@linuxfoundation.org, mdf@kernel.org, linux-fpga@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, atull@kernel.org, Wu Hao , Xu Yilun Subject: [PATCH v2 07/11] fpga: dfl: afu: export __port_enable/disable function. Date: Fri, 5 Jul 2019 08:23:54 +0800 Message-Id: <1562286238-11413-8-git-send-email-hao.wu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1562286238-11413-1-git-send-email-hao.wu@intel.com> References: <1562286238-11413-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 Signed-off-by: Moritz Fischer --- v2: rebased. --- 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 fbd9553..22d294b 100644 --- a/drivers/fpga/dfl-afu-main.c +++ b/drivers/fpga/dfl-afu-main.c @@ -22,14 +22,16 @@ #include "dfl-afu.h" /** - * 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; @@ -52,13 +54,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; @@ -104,9 +107,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; } @@ -806,9 +809,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