Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3404444ybi; Sun, 26 May 2019 22:41:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqweYxp7BWs7XRgmP9g4nnTOvLkBZ0F3ElSwFQHkr8yia1ccJOWgQY2mS1Pq6+a9cIdiXn5q X-Received: by 2002:a17:902:2907:: with SMTP id g7mr99359366plb.114.1558935708290; Sun, 26 May 2019 22:41:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558935708; cv=none; d=google.com; s=arc-20160816; b=rpIevBxnz0BH6aaSA7Gydt4LgIm/lrkKtzTv02FXikJ5MX1T6Q6hWT+BpWSl+cE4RY 34F07mo4+ozwe6uuSDfEb6s/Tl8HlYgG8mrOH46Vq7ms6/5iJfSGg9P8mM+teUKO3xPe KRLxI8r4gEaOJJx7/czEk5gdwSih0OiTONw/NSs5jRl0BpfqOysQA5byylOv2nY62Adv BAgnRljzl4Z7FIPc6fCBOEaJKligkJ5Qf/jH9O3/yebBy+00e+Ov9RAM/6RUZvXMHisR WHxXDCdWvADJc1s3HSa0nGX3pKdfZIChUJjIIqZl29e8TVhAVm16o3CtRpILQwPUeeUc jA5w== 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=mbzenhWjvFgXccEa3FFBLu5PZ3oFOJ/eVFBvRz5QzHjDJLbiXvEqOvxxolAfwG/KQr Vy7Hw7WPfuSFkwBrOE5tc/Az43b0ByuWPAFSWMAJ382H5V1AfAWXzvf/0W6EIM0ZJikj 9mb8dJwO8I6KX5S8MjWOVodjSqz9HQFed+9/ei+zteMnGHFLWdvs+NQ2C8GueiNoCPD9 1iVqkQYqsvF9+wxRYPtEY48msukxVhnkgJtm2ddrVva4WBDX+1ClwQEzxZ9tQGSOrVz3 yNNWyAIovo1n3lVhku49wtOTvTkD71lHr7kp/D6kHcQTJuWjYdpCFm+SuJs2gp+xHXlC O96g== 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 e9si15579320pjs.108.2019.05.26.22.41.33; Sun, 26 May 2019 22:41:48 -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 S1726652AbfE0Fjs (ORCPT + 99 others); Mon, 27 May 2019 01:39:48 -0400 Received: from mga04.intel.com ([192.55.52.120]:7420 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbfE0FjQ (ORCPT ); Mon, 27 May 2019 01:39:16 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 May 2019 22:39:16 -0700 X-ExtLoop1: 1 Received: from hao-dev.bj.intel.com ([10.238.157.65]) by orsmga001.jf.intel.com with ESMTP; 26 May 2019 22:39:15 -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 v3 11/16] fpga: dfl: afu: export __port_enable/disable function. Date: Mon, 27 May 2019 13:22:21 +0800 Message-Id: <1558934546-12171-12-git-send-email-hao.wu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1558934546-12171-1-git-send-email-hao.wu@intel.com> References: <1558934546-12171-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