Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1626560ybd; Wed, 26 Jun 2019 22:03:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwN46BL8awONkInMx4dLNhEJhT0H3yGB3Ff1K/AU64MMZkkZE+rPCCbEpaQvZw+s71pzLNY X-Received: by 2002:a63:4404:: with SMTP id r4mr1779513pga.245.1561611815081; Wed, 26 Jun 2019 22:03:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561611815; cv=none; d=google.com; s=arc-20160816; b=JwETUjdK1Pub6O6BeiL9avbfPrBCzhgOBTf449W1p6qWgd49aeDyVYakntyoIKyBVp I/QpYOjpcrfYNFIT6oNJiL4ablt/OiIGX1rktRnxEIdVui4t7c2euOj5llC6Dos759SJ m4lRFKPThqXeRfcOhniwx+0c0vbPlgpXMxiByZYMB6GgABllPdms9hINLnIIKIAWzRL2 peXjn04a4ojRL2TruHx9bIY995mfgCkWIKGKbV371ttdbgvoQ7EXT/SFna79SSo1ICd3 8A5Ebr/SGjk/Kfl8NU8laIMYwE6z4PJg2lpjH58RvQt6Qol6lQJW3NfH8zWCFisFY8Q0 1fHA== 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=C94PlmY+PF/JBUl5f/qGEv5tFn484bva38fjH6fyWiA=; b=CudcfCjdUfMyG35ufqGadyHv6dVr9lhBE72mzJk4Z7xdXwIzVKcp9oniWI0v7kK2T+ PJoRpmVFRBRA32XMi3JQhTYprLSjRxwYSj2lulDp3Kot8CdJIT5rGWgSbstWcxWNtST7 D7gN2euBmZHZXWdkGAdVltbAwunLGjm1SOjuga00W/B6hTyOV3QpYjgcjMj4Gdx/rcEx UfNj4ArbPQgIT0KFn+iF3T7BkEDh88nsbltg6AttYwNNBgm0H051d4chSf9YGJQLFIBx HV6FQ+IcMLlXHyejBh5COH5vFihemnYXmTcKKLhJSGn3KDeqnEozfGgSeLsXobJ/Q37p E24Q== 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 h1si1126128pgs.290.2019.06.26.22.03.17; Wed, 26 Jun 2019 22:03:35 -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 S1727505AbfF0FCe (ORCPT + 99 others); Thu, 27 Jun 2019 01:02:34 -0400 Received: from mga11.intel.com ([192.55.52.93]:22936 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727394AbfF0FCM (ORCPT ); Thu, 27 Jun 2019 01:02:12 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jun 2019 22:02:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,422,1557212400"; d="scan'208";a="173005117" Received: from hao-dev.bj.intel.com ([10.238.157.65]) by orsmga002.jf.intel.com with ESMTP; 26 Jun 2019 22:02:10 -0700 From: Wu Hao To: mdf@kernel.org, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linux-api@vger.kernel.org, yilun.xu@intel.com, hao.wu@intel.com, gregkh@linuxfoundation.org, atull@kernel.org Subject: [PATCH v4 11/15] fpga: dfl: afu: export __port_enable/disable function. Date: Thu, 27 Jun 2019 12:44:51 +0800 Message-Id: <1561610695-5414-12-git-send-email-hao.wu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1561610695-5414-1-git-send-email-hao.wu@intel.com> References: <1561610695-5414-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 65b3e89..c8bc0b5 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; } @@ -805,9 +808,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