From patchwork Thu Mar 5 16:46:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 5947961 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6AD3DBF440 for ; Thu, 5 Mar 2015 16:53:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8DC222038E for ; Thu, 5 Mar 2015 16:53:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AADC820390 for ; Thu, 5 Mar 2015 16:53:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751220AbbCEQqP (ORCPT ); Thu, 5 Mar 2015 11:46:15 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:48151 "EHLO mailhub1.si.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752853AbbCEQqO (ORCPT ); Thu, 5 Mar 2015 11:46:14 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id A63861C8330; Thu, 5 Mar 2015 17:46:12 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from mailhub1.si.c-s.fr ([192.168.12.234]) by localhost (mailhub1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M8Wxe6qH5pFh; Thu, 5 Mar 2015 17:46:12 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 8A4011C8301; Thu, 5 Mar 2015 17:46:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D0170C73CD; Thu, 5 Mar 2015 17:46:10 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id bK7oL3ZK_VA1; Thu, 5 Mar 2015 17:46:10 +0100 (CET) Received: from PO10863.localdomain (unknown [172.25.231.75]) by messagerie.si.c-s.fr (Postfix) with ESMTP id DD66AC73C5; Thu, 5 Mar 2015 17:46:07 +0100 (CET) Received: by localhost.localdomain (Postfix, from userid 0) id 637E61A241D; Thu, 5 Mar 2015 17:46:05 +0100 (CET) From: Christophe Leroy To: Kim Phillips , Herbert Xu , "David S. Miller" CC: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-crypto@vger.kernel.org Subject: [PATCH 02/17] crypto: talitos - Externalise specific SEC2 reset actions Message-Id: <20150305164606.637E61A241D@localhost.localdomain> Date: Thu, 5 Mar 2015 17:46:05 +0100 (CET) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP During init and reset, some actions are different between SEC1 and SEC2 This patch isolates them in small helper functions that we will be able to redefine for SEC1 Signed-off-by: Christophe Leroy --- drivers/crypto/talitos.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index ebbae8d..e3a2d75 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -88,9 +88,8 @@ static void unmap_single_talitos_ptr(struct device *dev, be16_to_cpu(talitos_ptr->len), dir); } -static int reset_channel(struct device *dev, int ch) +static unsigned int do_reset_channel(struct talitos_private *priv, int ch) { - struct talitos_private *priv = dev_get_drvdata(dev); unsigned int timeout = TALITOS_TIMEOUT; setbits32(priv->chan[ch].reg + TALITOS_CCCR, TALITOS_CCCR_RESET); @@ -99,6 +98,14 @@ static int reset_channel(struct device *dev, int ch) && --timeout) cpu_relax(); + return timeout; +} + +static int reset_channel(struct device *dev, int ch) +{ + struct talitos_private *priv = dev_get_drvdata(dev); + unsigned int timeout = do_reset_channel(priv, ch); + if (timeout == 0) { dev_err(dev, "failed to reset channel %d\n", ch); return -EIO; @@ -144,6 +151,12 @@ static int reset_device(struct device *dev) /* * Reset and initialize the device */ +static void do_init_device(struct talitos_private *priv) +{ + setbits32(priv->reg + TALITOS_IMR, TALITOS_IMR_INIT); + setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); +} + static int init_device(struct device *dev) { struct talitos_private *priv = dev_get_drvdata(dev); @@ -171,8 +184,7 @@ static int init_device(struct device *dev) } /* enable channel done and error interrupts */ - setbits32(priv->reg + TALITOS_IMR, TALITOS_IMR_INIT); - setbits32(priv->reg + TALITOS_IMR_LO, TALITOS_IMR_LO_INIT); + do_init_device(priv); /* disable integrity check error interrupts (use writeback instead) */ if (priv->features & TALITOS_FTR_HW_AUTH_CHECK)