Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp1519536ybh; Sun, 4 Aug 2019 03:40:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUo5axm2saGavgR6Y11GRNuxRHIknkxCKYnz8q0qY7x2NixTyalpAhDKb8kla8LG8jUIAU X-Received: by 2002:a17:90a:ac0e:: with SMTP id o14mr13209835pjq.142.1564915228490; Sun, 04 Aug 2019 03:40:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564915228; cv=none; d=google.com; s=arc-20160816; b=Vz6xlKd7wvlE/NR1v0ZlzE616/pfEGlUWntNUvW2ROEynPVW7YweqIVg2PPeVNo9RA 0L0Hf5g/V8BZcA2dH9+NPkjwltkNUY+LsBNkBZ8x99t74PVKqLNse0oz/6Vado0CzBJd wJWc9HSgU/aOUteP7Ht9KuUY22EXTs/644+uGQbuxYEGQNX0VYsgd+w/N6+P3HLpuPCK UCz4Ka7rqbS7w9FODxWCxl+vkheNmFAisaAlK8q6S1uiN/H6frtzXpQ6qeZ95bzPsJCN OAlMfxfCWL/jUMP9dgkjksQur0IJeC424vsvF3nzzOymqMjJQKU6UvdE0xlYIbK7h9Zt 5rNA== 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=6ajgRJ/p8a8E67XyONF2lgPILXR+iW/jyIKQTRz9ukM=; b=RhH8ZAaiOa2ms0WbEhP7VcUIWteICZRdqkxxyWa1ENQaB2K+OTc9YDkbAp4wAK+ISl fdCVuqvVJAEP6rKufhm/RqW3sxHpK6maaCYs2oPVbHa2j8JGX68kLc5H5HchDofWkmOJ gUP+7ztYXXspJ0VOfM2T13ZuG9O3sCZd5SDNZ61BxbChTQ1wiJt5ab16fKnkufswtplL QgQ6EJQjZiDhis3PLLY/6Q85lvykgys9gJyWJ4sePHWvR1JWeUbLviACLuMSKMHKh6gx kFTqmpBcnlN+l2PzlYBIwW2YMAKLB78aJ+OASI4HxwOmA0tbS8x/sa7NPTUIdPReLAPC J9Ow== 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 v10si42161973pgq.17.2019.08.04.03.40.13; Sun, 04 Aug 2019 03:40:28 -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 S1726440AbfHDKiB (ORCPT + 99 others); Sun, 4 Aug 2019 06:38:01 -0400 Received: from mga01.intel.com ([192.55.52.88]:31912 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726419AbfHDKh7 (ORCPT ); Sun, 4 Aug 2019 06:37:59 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Aug 2019 03:37:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,345,1559545200"; d="scan'208";a="167678962" Received: from hao-dev.bj.intel.com ([10.238.157.65]) by orsmga008.jf.intel.com with ESMTP; 04 Aug 2019 03:37:57 -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, linux-doc@vger.kernel.org, atull@kernel.org, Wu Hao , Xu Yilun Subject: [PATCH v4 06/12] fpga: dfl: afu: export __port_enable/disable function. Date: Sun, 4 Aug 2019 18:20:16 +0800 Message-Id: <1564914022-3710-7-git-send-email-hao.wu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564914022-3710-1-git-send-email-hao.wu@intel.com> References: <1564914022-3710-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 e013afb..e312179 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