Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2698708ybd; Thu, 27 Jun 2019 17:51:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqzyV5dmlAsZsUiit7dtRUxAqEPFQu7/Ca38mYKU6Xw/eYnkQ5qLEDQeOfq0v3s/inF7gA6W X-Received: by 2002:a17:90a:b00b:: with SMTP id x11mr9665750pjq.120.1561683080785; Thu, 27 Jun 2019 17:51:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561683080; cv=none; d=google.com; s=arc-20160816; b=Blsn7nRnozjaAONqVtXAp1Mie2qNrA935zeDFWQHiKQwe4LAR0r6LXNcQtYa5zF2EU 329hW1SvcJRZdY1bTmGL5Vl5tHhvtuXBkSMGOB+3/V0Fw2xOvvC6mFUcGdk6D4t/1OP6 tqjJnMmLcSbwf7/wA7Jh4EYAkrDS/B4N2Sx8uLZ7wCvSsdMB+4KC3iBhAYiKuY5vW0x3 XXsUkS7NtNOeJ/LWYYzEQVyafnhbjjuGytAEw67kCy/cb198T0p4BvDwDVkPHILlNO6I V2gLnyCAYPNj2jlqAs+lRs68mGck1wKQnDb86geUq7rfiWU9P0Rp10+/6fXqTNSW5RB+ sSvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nkaaEzcIJYAZk41zsKaeC42Zrk9r0yReMvWJ9xWRCd8=; b=Cta7LI3qJWu7EC07HBkc60og22tis3B3H/nGgAV7x0VBvV/QKI/Bj3uLaR4qIyZocQ ezE77MCB1sFAADGJVZG/mvSn+t6RPLVzcpTKYQznHYUlUb/m2PxE2EWbW0/0AWhaixWO I3QGlrpzTGcAfeD37SZ6IqX3J8vP2QHMnRcouuMvb6zYwTNfD6R/5gwcgjwSv02JfSxf c7k9zIZUydg2uFvTejjpuZqzsQ0oljuUmB3arQ4FOcBL26D6k9wqWFaff8NkMi/vDrre oWlNEF/SRWvwh04MC5N9I8JCOamj7z+fkOgvQyZR7GEkF+4BvCn2+h62wqbyUODXUp3y GOjA== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m15si688485pff.267.2019.06.27.17.51.03; Thu, 27 Jun 2019 17:51:20 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726940AbfF1Aum (ORCPT + 99 others); Thu, 27 Jun 2019 20:50:42 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:42891 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726926AbfF1Auk (ORCPT ); Thu, 27 Jun 2019 20:50:40 -0400 Received: by mail-pl1-f194.google.com with SMTP id ay6so2191321plb.9 for ; Thu, 27 Jun 2019 17:50:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nkaaEzcIJYAZk41zsKaeC42Zrk9r0yReMvWJ9xWRCd8=; b=cIoiOWBkD4QX41slmxn3ZUM1gMm91ZlrDmGcYFHwISO3lpPh1gGcaIxKP31mCjyxAV OfnLZWqn46iAxZYQYc6MdaGpZfG2lJLpycfUGh1zpGd97jIn6evgJ5531NdkcckgsHF6 Tg0gTFVPrclnrl9k8S/SXsWdWCGwr8QvUI1wmVG9hffuLmx/FnBAmw1cAgVctglpsyeH 8NlMh8Guff5mDzAZ4iyCi4ol/hTvBElDrOZMme+9Jnm+AU8Ezsly+dJ/G55AwAEhA8Gt exAIh3ZvZxZBGHnmry+3jOGLz5ghi0+oJMGWQ7zI2+7V09K3sqGgbwQTJPVZjrIt2k0a PxTA== X-Gm-Message-State: APjAAAW3LPDy2yZrKFWcKVGw5s5/HnUUYYkmHsLULe9yi/V5sLHomu0/ 1F8yySEB/X4NU99wWN/UEfbfZ57zu8g= X-Received: by 2002:a17:902:54d:: with SMTP id 71mr7963274plf.140.1561683039698; Thu, 27 Jun 2019 17:50:39 -0700 (PDT) Received: from localhost (c-76-21-109-208.hsd1.ca.comcast.net. [76.21.109.208]) by smtp.gmail.com with ESMTPSA id j16sm339453pjz.31.2019.06.27.17.50.38 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 27 Jun 2019 17:50:38 -0700 (PDT) From: Moritz Fischer To: linux-fpga@vger.kernel.org, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Wu Hao , Xu Yilun , Moritz Fischer , Alan Tull Subject: [PATCH 11/15] fpga: dfl: afu: export __port_enable/disable function. Date: Thu, 27 Jun 2019 17:49:47 -0700 Message-Id: <20190628004951.6202-12-mdf@kernel.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190628004951.6202-1-mdf@kernel.org> References: <20190628004951.6202-1-mdf@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wu Hao 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 --- 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 65b3e895e364..c8bc0b5d9c16 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 0c7630ae3cda..35e60c5859a4 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.22.0