Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp992165pxk; Fri, 18 Sep 2020 00:24:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZMFyLmPNxMgESUAD+sw79AyrShbQuGQl+ORUhmC5kVAczQdXVD+IcKT/rjGnx+WHOqwce X-Received: by 2002:a05:6402:1779:: with SMTP id da25mr36197574edb.75.1600413852540; Fri, 18 Sep 2020 00:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600413852; cv=none; d=google.com; s=arc-20160816; b=pzu485g0whmZ+esNK/R8ijgMxUD65jYYEuL6eTXrQ1aup+RiZocqF95kOQ2uJHNEhM xTNTsyJfsIkKIJsHS773vi670LRvJP4z6jh1qRd8rTT3XyGuSDYWw7ir7IUSY+fbaAgE tQ+Z6OHLh9IaUqSg716fn7odVxe36Qz8E/McKSu7cKN5J4tnv+i7iJab5NYoRpoTmRFt jtnR1+wY1jJqLE9gEjVSHCZGqv0perb1vXcmah8V85RmAZE+su7ROaIfMZlo0akRSzGi mhixhG95o9uneFJ+ESjgFpn/r5YPiUxEci+IVTW0UoHOWZE9X3sKdLSHljc52VnYAj0n ZtEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=thgOsxp+Xq4BrFvbMKlBsMkOaotb5Mf5M65feuQsl1g=; b=ENdax2reLofmeAj/iftlJNoA9/y7RGMZYgdI/fgWbh+RUuNC4oA0Y3cGbsM1tsFZr7 xG4cAriK6/zxPqbGuh5TaLXgbALNbrYoDVpBaiZIqhe+rSCNgF50N7r59rHd5aMFCxS2 2PcpECqck8bgbyp30LyZx0nGnztXXIGXrDAtQCeNRSUPKFxkRiJLvcaFB7UCSsZZsrGI f2o15xs2Zv5c0VVdgqseTgnQdE86+jRygrk/R36JU1BoID16hi6RAJ9edZwvBi1kG/Hq mOjOSNBPWP7ZlQf7gLRJ5dX1D4eWXc85yxjD39A6M8tiQa2LQK5/XS04S3ohcCTLExZM zlTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="15Lw0w/D"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o2si1525636edw.285.2020.09.18.00.23.48; Fri, 18 Sep 2020 00:24:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="15Lw0w/D"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726595AbgIRHXh (ORCPT + 99 others); Fri, 18 Sep 2020 03:23:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726470AbgIRHXf (ORCPT ); Fri, 18 Sep 2020 03:23:35 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41AF1C061788 for ; Fri, 18 Sep 2020 00:23:34 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id e17so4293324wme.0 for ; Fri, 18 Sep 2020 00:23:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=thgOsxp+Xq4BrFvbMKlBsMkOaotb5Mf5M65feuQsl1g=; b=15Lw0w/Dv1oD9BPmxmyBukpkJeQWTO9fcY1tUj7eh0sOyFr8HK20/cOzmL9U9v/fAS gZdeCmUpmD6AmP/hXZSf9zElisfE7iSbWXr0MRv765Zy4EoMOzzGbwkdWnlC9Vk24KDl y9AHI2A/OGRnm/8JptKsDnJBBHQL8sinwF+qdVmr0lhIQzlLRBPCScV2AbuWbHWpnTYo mze28Rs0v0NpD6rz7WnRKSHB/nlQh99FwDeuXE8TIWf1QP/PMOH1dL+/D6qQ8uKSez0B GmU9ITp7m+KtRnoH9K1c/EizvzaS398ZFqs8IcNwIBU53pkk+fjWNejs4ESLSQCvIowG B94Q== 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; bh=thgOsxp+Xq4BrFvbMKlBsMkOaotb5Mf5M65feuQsl1g=; b=ryKr+K+rePCNmwNElIjxSmf1b+xON6w/c5ehaHYWnhrqhUdNQxEVrM+E6NZRm1SN+a ftxi9PVsSCKh0mspBlRZiZFpzWZ6DAT6j4o9BU4JXIdq+RqS9Neu+vBiZtOFD8LFvSuo StkguJikf9k3/yJ5XzHV/Q84TRqX+rfuLMbaidfPzlvcgkA3xLySVsrnDnv6YCuBQQsC 9Kxrrvrz+t2vBOlqhKG8aNXHrL3ke0nvPdegat8eK8k4OxsXa9BG32gvL9TytAKswJ71 o3oPcibrgukbkivVVftiTnMPCo827kS6AnPGfu0ejW+ynsk5IPWLrrafffiJbeYX8EUp 4cog== X-Gm-Message-State: AOAM533fOo3uGabOVhTLpyuysRbBc4hrpkSeOcZWjUxST5txIzy82WoH Jt2PJKUgDfomF/rnPLh/aaLZsw== X-Received: by 2002:a1c:3985:: with SMTP id g127mr14614813wma.32.1600413812991; Fri, 18 Sep 2020 00:23:32 -0700 (PDT) Received: from localhost.localdomain ([51.15.160.169]) by smtp.googlemail.com with ESMTPSA id z19sm3349546wmi.3.2020.09.18.00.23.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Sep 2020 00:23:32 -0700 (PDT) From: Corentin Labbe To: davem@davemloft.net, herbert@gondor.apana.org.au, mripard@kernel.org, wens@csie.org Cc: linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Corentin Labbe Subject: [PATCH v7 07/17] crypto: sun8i-ce: handle endianness of t_common_ctl Date: Fri, 18 Sep 2020 07:23:05 +0000 Message-Id: <1600413795-39256-8-git-send-email-clabbe@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600413795-39256-1-git-send-email-clabbe@baylibre.com> References: <1600413795-39256-1-git-send-email-clabbe@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org t_common_ctl is LE32 so we need to convert its value before using it. This value is only used on H6 (ignored on other SoCs) and not handling the endianness cause failure on xRNG/hashes operations on H6 when running BE. Fixes: 06f751b61329 ("crypto: allwinner - Add sun8i-ce Crypto Engine") Signed-off-by: Corentin Labbe --- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c index 138759dc8190..08ed1ca12baf 100644 --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c @@ -120,7 +120,10 @@ int sun8i_ce_run_task(struct sun8i_ce_dev *ce, int flow, const char *name) /* Be sure all data is written before enabling the task */ wmb(); - v = 1 | (ce->chanlist[flow].tl->t_common_ctl & 0x7F) << 8; + /* Only H6 needs to write a part of t_common_ctl along with "1", but since it is ignored + * on older SoCs, we have no reason to complicate things. + */ + v = 1 | ((le32_to_cpu(ce->chanlist[flow].tl->t_common_ctl) & 0x7F) << 8); writel(v, ce->base + CE_TLR); mutex_unlock(&ce->mlock); -- 2.26.2