Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp2826917img; Sun, 24 Mar 2019 20:27:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwAKYlKVbzvF9b8Rm2Sc3IKjShpP+yKvSuYMFvEjCDWqcxjczo5Tv1wNAEdq+KC+QcPPoa X-Received: by 2002:a63:3f8b:: with SMTP id m133mr20910999pga.91.1553484425398; Sun, 24 Mar 2019 20:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553484425; cv=none; d=google.com; s=arc-20160816; b=Hnorh9nXeBMvCjKJmL0zKh3jQHMT1KsD8q7ii9y4fqtAoQmMzMESTQzUlehJTvfAXJ BBjMPdQjyRTKc4x3D5Hc3P1nnlp/ulGmTzTwGYLMnFhlY1kvV9MsQUXmK+z8tCrIaCn2 4ZCRabZyMyULYVXZap82mdV4kjSVXsBo7MwDC6HF3WwuxaiTjauBVjdKEl5jtlbhH1uQ Z9C4y5jpUAJR0CkBu/R7Y+O/DALurOGr3yMdp9xQ8WZvC/Ui3VBAP1digZ1KLCidDnxF t+Fini0KPK+41Bktqy3xPjqPqY2J5nLv7hJ5tU6TfaD6ECYT0l6tWpQyVQ2+Xnyivuuz Y2hQ== 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=wbpCJWrMJLSG9xCHeXmm5Lmz8pxXZDfw4ABAgSbHwrA=; b=MHWcRnz4qDv46EqgTHWkPZDyCYn/2Mul0K8Pzl1LnNofoqVbHXCvZBCZTxr9jQzohV tbY2IIa2+rX42OgVmT41UCYiDtfN5ElW7yi0da1yx2RyYRNtWDpPfWxYjMOgo399C7p3 I/ruramxzZVmo9mqnQ2BUBZXWisQ6W0q7IJ6JER7TO1C7NIsTd8QGngWyXwEDnFI7O1L MlUloq/dqL5S/kxZsxOO4R1ufjqqc5EhOVVBSRcaE/a2bjKY+Yff7RwClp4kjxnljzTP +pYZhl7AGz++/SF8E/JSfuUX+WvIoPrzpt8dG66EczHdwtprMd7JoBCFSB6uzVzjbd5w p14A== 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 a22si6954112pfc.217.2019.03.24.20.26.50; Sun, 24 Mar 2019 20:27:05 -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 S1729667AbfCYDYS (ORCPT + 99 others); Sun, 24 Mar 2019 23:24:18 -0400 Received: from mga18.intel.com ([134.134.136.126]:19158 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729618AbfCYDYJ (ORCPT ); Sun, 24 Mar 2019 23:24:09 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Mar 2019 20:24:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,256,1549958400"; d="scan'208";a="310109715" Received: from hao-dev.bj.intel.com ([10.238.157.65]) by orsmga005.jf.intel.com with ESMTP; 24 Mar 2019 20:24:07 -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 10/17] fpga: dfl: afu: export __port_enable/disable function. Date: Mon, 25 Mar 2019 11:07:37 +0800 Message-Id: <1553483264-5379-11-git-send-email-hao.wu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553483264-5379-1-git-send-email-hao.wu@intel.com> References: <1553483264-5379-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 --- 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); -- 2.7.4