Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3554889rwb; Tue, 20 Sep 2022 01:04:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5RIkRD80SCYCOXBNX5coEGXOSBi54j2JgfBTKy3VrNd7zydnr0KuHGbRU5vAqLzkanKX+R X-Received: by 2002:a17:90b:3504:b0:202:7253:9b53 with SMTP id ls4-20020a17090b350400b0020272539b53mr2608000pjb.155.1663661080768; Tue, 20 Sep 2022 01:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663661080; cv=none; d=google.com; s=arc-20160816; b=Ek/F/OpKhWjYU+6ckrMZh/slcjAQlewfnPRSeXxyh6H3eDWMpLWcwbbuA3UT6QCEBp u9Cr6OABn+AEnxo5HXkid85hPKy3n/aTOlMc7zWDaWz1+SXqVU//EqJwEvUjcJYN+Oyt ns7XMKbyM1MA9iY91T0dSBU+HIaw642CD4hQszAaLFNaf8D8nSkOKWy5XrQ/pN1VbQOq 0iTFKRS2vc5SAovD0KMYJOBXImKl7B7tsuDL54gp3HEBraPw7nVN+vTFReTLFpAXqmDd WZi/B25K4+TEY1tZghJ/32H6m24NgU9aZGwP6HaoO8KFHNjRSaHo+x/khNySJdU7egYI ZwnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UBElztSxJ1rdBS50z2Hh+xljndSP253b3OPRrTnscxQ=; b=a5pJJatW9sLNzf6WsePAWFFy1EMk3E7qGrSnLMeNK3/f4kd/R68ZmQT3K4QJxErsml eNqW05rVShW5PxH+6Tox7oRum0sQodWXlNTR6uVojgxgNOVljktaXPa6Uurlal9VV7JQ i9oxatPY59g+8shODWbh1u/Xx5XLzCUV9xzSKfrmDRtjmCoW0nmODHppEH39hG7uKB/M 6aK1oAnPDe2r+Q1cObuFfhNvp7e+cH+TRuQz+lmPk5OJvKMcqwfAKyv5zkY1e55eKOhC ht3IdGr5qeVBQaZPTQR3sVWOx9nlQdu+RKX8wotHo7GUVrKsTLtiUzzP9BDlrKFl1cIZ XwGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@maxlinear.com header.s=selector header.b=ByzcBrxR; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=maxlinear.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a63f651000000b00408dc9c0b98si1149814pgj.32.2022.09.20.01.04.20; Tue, 20 Sep 2022 01:04:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@maxlinear.com header.s=selector header.b=ByzcBrxR; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=maxlinear.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230490AbiITIDQ (ORCPT + 99 others); Tue, 20 Sep 2022 04:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbiITIBv (ORCPT ); Tue, 20 Sep 2022 04:01:51 -0400 Received: from us-smtp-delivery-115.mimecast.com (us-smtp-delivery-115.mimecast.com [170.10.129.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7146642C2 for ; Tue, 20 Sep 2022 01:01:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maxlinear.com; s=selector; t=1663660909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UBElztSxJ1rdBS50z2Hh+xljndSP253b3OPRrTnscxQ=; b=ByzcBrxRaf8bYEPI7zE7VITvzf/7AzLipeLGJfeP8P56neBdKN3xd38PtTRGqm6I/lBOuA GHNvkGmgmm11Yc2gvvYDskTs1m+J2f0/FxgWt4EutXOznSD/XcN9vC95cMj8cO2u1r6vKD bf5akZXfPfmksV0VFimHSiYQNHrXvthbcFnooEc/eGsPKW1AOWzKcJTFo3IVWyw0gg/NnD 9lMkdpLkJgvMglYCeG+PhIohgg0FTNZ4aWMf+nUk0453Hh1BSbWun4Dg3j+f4+n8X3x5o6 FcLfk+/J4Qpung2wifqhe3xBcaU69OUeqvnVI7FWx3T2kT4ovKI4BgtxBa987w== Received: from mail.maxlinear.com (174-47-1-84.static.ctl.one [174.47.1.84]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id us-mta-235-nEWdcjjDOR-NiH6cM9J8hQ-3; Tue, 20 Sep 2022 04:01:48 -0400 X-MC-Unique: nEWdcjjDOR-NiH6cM9J8hQ-3 Received: from sgsxdev002.isng.phoenix.local (10.226.81.112) by mail.maxlinear.com (10.23.38.119) with Microsoft SMTP Server id 15.1.2375.24; Tue, 20 Sep 2022 01:01:44 -0700 From: Peter Harliman Liem To: , CC: , , "Peter Harliman Liem" Subject: [PATCH 2/3] crypto: inside-secure - Add fw_little_endian option Date: Tue, 20 Sep 2022 16:01:38 +0800 Message-ID: <29cf210c9adce088bc50248ad46255d883bd5edc.1663660578.git.pliem@maxlinear.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: maxlinear.com Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org This is to add fw_little_endian option, which can be used for platform which firmware is using little-endian (instead of big-endian). Signed-off-by: Peter Harliman Liem --- drivers/crypto/inside-secure/safexcel.c | 15 +++++++++++---- drivers/crypto/inside-secure/safexcel.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/insid= e-secure/safexcel.c index 02c103da09a9..955170d2dd7c 100644 --- a/drivers/crypto/inside-secure/safexcel.c +++ b/drivers/crypto/inside-secure/safexcel.c @@ -316,14 +316,21 @@ static void eip197_init_firmware(struct safexcel_cryp= to_priv *priv) static int eip197_write_firmware(struct safexcel_crypto_priv *priv, =09=09=09=09 const struct firmware *fw) { -=09const __be32 *data =3D (const __be32 *)fw->data; +=09const u32 *data =3D (const u32 *)fw->data; +=09u32 val; =09int i; =20 =09/* Write the firmware */ -=09for (i =3D 0; i < fw->size / sizeof(u32); i++) -=09=09writel(be32_to_cpu(data[i]), +=09for (i =3D 0; i < fw->size / sizeof(u32); i++) { +=09=09if (priv->data->fw_little_endian) +=09=09=09val =3D le32_to_cpu(data[i]); +=09=09else +=09=09=09val =3D be32_to_cpu(data[i]); + +=09=09writel(val, =09=09 priv->base + EIP197_CLASSIFICATION_RAMS + -=09=09 i * sizeof(__be32)); +=09=09 i * sizeof(*data)); +=09} =20 =09/* Exclude final 2 NOPs from size */ =09return i - EIP197_FW_TERMINAL_NOPS; diff --git a/drivers/crypto/inside-secure/safexcel.h b/drivers/crypto/insid= e-secure/safexcel.h index 1b8ccb33202b..a89dd8dc1ddd 100644 --- a/drivers/crypto/inside-secure/safexcel.h +++ b/drivers/crypto/inside-secure/safexcel.h @@ -735,6 +735,7 @@ enum safexcel_eip_version { =20 struct safexcel_of_data { =09enum safexcel_eip_version version; +=09bool fw_little_endian; }; =20 /* Priority we use for advertising our algorithms */ --=20 2.17.1