Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7954761imm; Thu, 28 Jun 2018 12:01:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdIidxaA/z2ZsVw+ZJqsd/abhpJOtbYOrJB6WYHwVAlaXc2stuJYusmCwquDK9OnaIFSUuB X-Received: by 2002:a62:90d4:: with SMTP id q81-v6mr2385478pfk.37.1530212478543; Thu, 28 Jun 2018 12:01:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530212478; cv=none; d=google.com; s=arc-20160816; b=GFYcI8q0gi0hn6LjTuJpiyOAovBiSwQhRTkf6igS9bz4ufcFy7Xb0fxpv6LsyK/dEk bsZXkujOFqIt/o+JuayPbYgnE8kc3//2TR932o5kEPfEXbpH+pc2ywN3vKDv4iXdUlxu J0xi4kbK0NDmU+iS+91ig9EaUMGlxHQkqzjM6f/UrbZ00jJ/R2mAsNqNvcZqNFiO4lnv +1u/JGI3DYgQ5Su79ibLgY8pLy7vlxGI+XLIp3wBsFRJRslHzMFaoR9Vry0MOq3WqYbP TLDz+mBgGN2Rs/8MheRXHfFORuHGGsDSEqlrmZGhkVz36+NlEqSkaZJkTIKBzH6fP0QD V96A== 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:arc-authentication-results; bh=fAut9VP0IzByLjJ60C+VZwOFLAVsWNTvCPpmnD4jG0U=; b=zS7SII0Nfdne3nAJkbFmgFfiEpUwU2RytAzlVGRyCehBHvGkALsXdq36iDXcwqUlPl 0S+f0Hy/oewDJTg9tSNTpylG2LMfVfKH2HNP8eOx8ojFp3zxnTdOgwgM4EzsK2wcIT0L a8amyz5etWJS0R9Z/dNt5Zbkhs3pB0tvxl2G04USU/ADLpSQ46RMRNnrXuhX08lI9roi MprdzFLv4bTAu5ivqvwIqhryKxXTBBavAZUPFBe6b0RnT062InxnH7paPsjiJOTtUHeD o/H0KPcs/afHR/s4yIK+rqsNSKaQc/1/7u8yGlYjnxNTTrW5CJzJFi+hel2mFmC1CwGI zBDA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l190-v6si6768400pgl.198.2018.06.28.12.01.03; Thu, 28 Jun 2018 12:01:18 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967164AbeF1PVS (ORCPT + 99 others); Thu, 28 Jun 2018 11:21:18 -0400 Received: from mail.bootlin.com ([62.4.15.54]:53356 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967059AbeF1PUH (ORCPT ); Thu, 28 Jun 2018 11:20:07 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id D482120DD2; Thu, 28 Jun 2018 17:20:04 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (nat.foo.tf [163.172.35.26]) by mail.bootlin.com (Postfix) with ESMTPSA id A223E203EC; Thu, 28 Jun 2018 17:20:04 +0200 (CEST) From: Antoine Tenart To: herbert@gondor.apana.org.au, davem@davemloft.net, gregory.clement@bootlin.com, andrew@lunn.ch, jason@lakedaemon.net, sebastian.hesselbarth@gmail.com Cc: Ofer Heifetz , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, maxime.chevallier@bootlin.com, miquel.raynal@bootlin.com, nadavh@marvell.com, igall@marvell.com, Antoine Tenart Subject: [PATCH 11/14] crypto: inside-secure - reset CDR and RDR rings on module removal Date: Thu, 28 Jun 2018 17:15:41 +0200 Message-Id: <20180628151544.22134-12-antoine.tenart@bootlin.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180628151544.22134-1-antoine.tenart@bootlin.com> References: <20180628151544.22134-1-antoine.tenart@bootlin.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ofer Heifetz This patch adds extra steps in the module removal path, to reset the command and result rings. The corresponding interrupts are cleared, and the ring address configuration is reset. Signed-off-by: Ofer Heifetz [Antoine: small reworks, commit message] Signed-off-by: Antoine Tenart --- drivers/crypto/inside-secure/safexcel.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/inside-secure/safexcel.c index b70694090353..5feb83c6238b 100644 --- a/drivers/crypto/inside-secure/safexcel.c +++ b/drivers/crypto/inside-secure/safexcel.c @@ -1125,6 +1125,24 @@ static int safexcel_probe(struct platform_device *pdev) return ret; } +static void safexcel_hw_reset_rings(struct safexcel_crypto_priv *priv) +{ + int i; + + for (i = 0; i < priv->config.rings; i++) { + /* clear any pending interrupt */ + writel(GENMASK(5, 0), EIP197_HIA_CDR(priv, i) + EIP197_HIA_xDR_STAT); + writel(GENMASK(7, 0), EIP197_HIA_RDR(priv, i) + EIP197_HIA_xDR_STAT); + + /* Reset the CDR base address */ + writel(0, EIP197_HIA_CDR(priv, i) + EIP197_HIA_xDR_RING_BASE_ADDR_LO); + writel(0, EIP197_HIA_CDR(priv, i) + EIP197_HIA_xDR_RING_BASE_ADDR_HI); + + /* Reset the RDR base address */ + writel(0, EIP197_HIA_RDR(priv, i) + EIP197_HIA_xDR_RING_BASE_ADDR_LO); + writel(0, EIP197_HIA_RDR(priv, i) + EIP197_HIA_xDR_RING_BASE_ADDR_HI); + } +} static int safexcel_remove(struct platform_device *pdev) { @@ -1132,6 +1150,8 @@ static int safexcel_remove(struct platform_device *pdev) int i; safexcel_unregister_algorithms(priv); + safexcel_hw_reset_rings(priv); + clk_disable_unprepare(priv->clk); for (i = 0; i < priv->config.rings; i++) -- 2.17.1