Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5573770ybp; Tue, 8 Oct 2019 05:12:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqw4nCFdTIGCCXb9FuPgWJtFh/JU3okqRxUlqYK0nMGNs8xvipfo6Zor0odObKZqJBS7865E X-Received: by 2002:a50:f0d4:: with SMTP id a20mr34491995edm.149.1570536741482; Tue, 08 Oct 2019 05:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570536741; cv=none; d=google.com; s=arc-20160816; b=ZmABNdCVeQXUXP6g9KiRfcHpRRYD9ItdHOcnIjl2owq5xJtdrTfs6KBrf894+ctkFA eNXLNSo5idEYiD6e/nKwizJGJyHo60AKis7a9GsxRjwS7dOOzqJ5TjOE74ydfp6TiYv+ WpdOuLi002X1xGxaW+6BjLN8JYpz6KgrC4DCYxVJZfdYcTS+7zwEt0A1uxkN7AIb7PuP Rzcn8bhg54Buq5ca8rvceuW20wFbzAORayiKHuuCW83QVL1UrydZVqKTaBVSWdd4mAmX +tmSE9sG+hD6/7PXzdgG6gQbi1707UEoBGYBDAqugZ+hlSCm8RIupdKUlP9o2kEUAlXW gLHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from; bh=be6wFiaKOnxCC5pEh16NJ+MfAuYCRSfElowjhi9scSo=; b=aF3zClMPTVd6OIXFwQh67TCPQsovNztq95jiBRuvmTi64Hhl/zALsUl8jc197I6WoY ebF35Qy8HyF8pwBCDmprbMs2G4Up6WQDd+wiEvIK3t7s2OGs5uUBD6qhnVDNns2hewEj 4kamw/HIntRh/wg8tBalOtIEuSwkQJEdYoRUE6WJPSNJa83k0ApGUro/HLMSs4RKa44Y 398IC06lxQzBaW1tTFBF59FdtpjTdDTOgnR9UNRQGTBLyoTNjGNnbfcVGx+43OD0lnqx sjv5D8fxBOalo0RmLoyQHVx4viycMDOA2M0IA6q+kdYbOM+NgIEY4utPbTYe29bozMs0 gJog== 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=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si8766137ejj.40.2019.10.08.05.11.58; Tue, 08 Oct 2019 05:12:21 -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=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731133AbfJHML1 (ORCPT + 99 others); Tue, 8 Oct 2019 08:11:27 -0400 Received: from inva020.nxp.com ([92.121.34.13]:54192 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731110AbfJHML0 (ORCPT ); Tue, 8 Oct 2019 08:11:26 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id F06481A00FC; Tue, 8 Oct 2019 14:11:24 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E35421A002E; Tue, 8 Oct 2019 14:11:24 +0200 (CEST) Received: from fsr-fed2164-101.ea.freescale.net (fsr-fed2164-101.ea.freescale.net [10.171.82.91]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id A250E205DB; Tue, 8 Oct 2019 14:11:24 +0200 (CEST) From: Madalin Bucur To: davem@davemloft.net, netdev@vger.kernel.org Cc: roy.pledge@nxp.com, laurentiu.tudor@nxp.com, linux-kernel@vger.kernel.org, Madalin Bucur Subject: [PATCH 14/20] soc: fsl: qbman: allow registering a device link for the portal user Date: Tue, 8 Oct 2019 15:10:35 +0300 Message-Id: <1570536641-25104-15-git-send-email-madalin.bucur@nxp.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1570536641-25104-1-git-send-email-madalin.bucur@nxp.com> References: <1570536641-25104-1-git-send-email-madalin.bucur@nxp.com> Reply-to: madalin.bucur@nxp.com X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce the API required to make sure that the devices that use the QMan portal are unbound when the portal is unbound. Signed-off-by: Madalin Bucur --- drivers/soc/fsl/qbman/qman.c | 13 +++++++++++++ include/soc/fsl/qman.h | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/drivers/soc/fsl/qbman/qman.c b/drivers/soc/fsl/qbman/qman.c index bf68d86d80ee..bc75a5882b9e 100644 --- a/drivers/soc/fsl/qbman/qman.c +++ b/drivers/soc/fsl/qbman/qman.c @@ -1749,6 +1749,19 @@ struct qman_portal *qman_get_affine_portal(int cpu) } EXPORT_SYMBOL(qman_get_affine_portal); +int qman_start_using_portal(struct qman_portal *p, struct device *dev) +{ + return (!device_link_add(dev, p->config->dev, + DL_FLAG_AUTOREMOVE_CONSUMER)) ? -EINVAL : 0; +} +EXPORT_SYMBOL(qman_start_using_portal); + +void qman_stop_using_portal(struct qman_portal *p, struct device *dev) +{ + device_link_remove(dev, p->config->dev); +} +EXPORT_SYMBOL(qman_stop_using_portal); + int qman_p_poll_dqrr(struct qman_portal *p, unsigned int limit) { return __poll_portal_fast(p, limit); diff --git a/include/soc/fsl/qman.h b/include/soc/fsl/qman.h index aa31c05a103a..c499c5cfa7c9 100644 --- a/include/soc/fsl/qman.h +++ b/include/soc/fsl/qman.h @@ -32,6 +32,7 @@ #define __FSL_QMAN_H #include +#include /* Hardware constants */ #define QM_CHANNEL_SWPORTAL0 0 @@ -915,6 +916,23 @@ u16 qman_affine_channel(int cpu); struct qman_portal *qman_get_affine_portal(int cpu); /** + * qman_start_using_portal - register a device link for the portal user + * @p: the portal that will be in use + * @dev: the device that will use the portal + * + * Makes sure that the devices that use the portal are unbound when the + * portal is unbound + */ +int qman_start_using_portal(struct qman_portal *p, struct device *dev); + +/** + * qman_stop_using_portal - deregister a device link for the portal user + * @p: the portal that will no longer be in use + * @dev: the device that uses the portal + */ +void qman_stop_using_portal(struct qman_portal *p, struct device *dev); + +/** * qman_p_poll_dqrr - process DQRR (fast-path) entries * @limit: the maximum number of DQRR entries to process * -- 2.1.0