From patchwork Tue Oct 16 13:35:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gilad Ben-Yossef X-Patchwork-Id: 148940 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp5100951lji; Tue, 16 Oct 2018 06:35:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV635f8TN++GrAm2u0b8TxqH3NJY6NMT8ljVzTw/X7mBzsqq9SswWwcr/+0mKuNAAIadtArvW X-Received: by 2002:a17:902:6907:: with SMTP id j7-v6mr21651822plk.232.1539696950472; Tue, 16 Oct 2018 06:35:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539696950; cv=none; d=google.com; s=arc-20160816; b=fW3edhiw4P4fvXwU3zROLGQKNqpc5GeTKF4IfRMgUrLIj0lyWwCo7Iz3AsRVIevpQV KWbU9ENEy/REJ34f7b/CagZxPITznnKzS2NCpYXyee64BxGSMo7BiGx64KUbS4rQdlch OCYHxompAfyaMQYt0qFyk45HDZGogmGqX330htc2ldS6PfRzQIcFxWJq8k5JmSaOZzVQ xN8VVLL01EucgZvx4N5N0nzgCpbwmqQGZ7UGBXiVUAIhepVX5sIweP/0BabqZbCWJJeE FyEusUkqZ/UuBq3KCOpJpLGQxQbMeyxilmD8n5Ulpwqdzl401nHAQgffkHDUFU8ls+sf dsNw== 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; bh=wL/ER+PR+JDO0OBk89Q5MDiEPeEYtiD5fE01m0lgufE=; b=z5VvjJ0WaDZNiP8P9ofrsFJz8g5oAe9m0hoKK+4CcJHBbj+K11SUV/8n6tpR3jSJbZ hSZ3zxIPCpSXxTlcmL+Mrulxs/C5zuTOAy7x7MeTzyYqCNf0erMqkoZY7mZ2KK5xwWLQ SnXvcL682aQ4KiRcgK5dHubhqVs6TrPS2V0a+Jm3BuxSKS2alliFh/dHGLznW+hn/sBL r7Eq5J3FvSgDkoBXBI2jM+Zvcb0LuHZidv5Pwia8Z1a9suN8aoQlInwLICKNdLhNv5M/ vwyCsoiroXU31Z6JWqi2VWvdjx0j9tu8L07q1ZGpnKexnbeTuGIr+ltCV5kZNwXH1Fyc cM6g== 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 w17-v6si13941674pgm.93.2018.10.16.06.35.46; Tue, 16 Oct 2018 06:35:50 -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 S1727223AbeJPV0P (ORCPT + 32 others); Tue, 16 Oct 2018 17:26:15 -0400 Received: from foss.arm.com ([217.140.101.70]:36424 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727003AbeJPV0O (ORCPT ); Tue, 16 Oct 2018 17:26:14 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2CF67A78; Tue, 16 Oct 2018 06:35:44 -0700 (PDT) Received: from sugar.kfn.arm.com (unknown [10.50.4.176]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BEC0A3F5D3; Tue, 16 Oct 2018 06:35:41 -0700 (PDT) From: Gilad Ben-Yossef To: Herbert Xu , "David S. Miller" , Rob Herring , Mark Rutland Cc: Ofir Drang , Yael Chemla , linux-crypto@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] crypto: ccree: add support for CryptoCell 713 Date: Tue, 16 Oct 2018 14:35:31 +0100 Message-Id: <1539696935-4433-2-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539696935-4433-1-git-send-email-gilad@benyossef.com> References: <1539696935-4433-1-git-send-email-gilad@benyossef.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support for Arm TrustZone CryptoCell 713. Note that this patch just enables using a 713 in backwards compatible mode to 712. Newer 713 specific features will follow. Signed-off-by: Gilad Ben-Yossef --- drivers/crypto/Kconfig | 2 +- drivers/crypto/ccree/cc_driver.c | 23 +++++++++++++++-------- drivers/crypto/ccree/cc_driver.h | 5 +++-- 3 files changed, 19 insertions(+), 11 deletions(-) -- 2.7.4 diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index a8c4ce0..bea4de6 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig @@ -754,7 +754,7 @@ config CRYPTO_DEV_CCREE help Say 'Y' to enable a driver for the REE interface of the Arm TrustZone CryptoCell family of processors. Currently the - CryptoCell 712, 710 and 630 are supported. + CryptoCell 713, 712, 710 and 630 are supported. Choose this if you wish to use hardware acceleration of cryptographic operations on the system REE. If unsure say Y. diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c index 1ff229c..630c598 100644 --- a/drivers/crypto/ccree/cc_driver.c +++ b/drivers/crypto/ccree/cc_driver.c @@ -43,6 +43,10 @@ struct cc_hw_data { /* Hardware revisions defs. */ +static const struct cc_hw_data cc713_hw = { + .name = "713", .rev = CC_HW_REV_713 +}; + static const struct cc_hw_data cc712_hw = { .name = "712", .rev = CC_HW_REV_712, .sig = 0xDCC71200U }; @@ -56,6 +60,7 @@ static const struct cc_hw_data cc630p_hw = { }; static const struct of_device_id arm_ccree_dev_of_match[] = { + { .compatible = "arm,cryptocell-713-ree", .data = &cc713_hw }, { .compatible = "arm,cryptocell-712-ree", .data = &cc712_hw }, { .compatible = "arm,cryptocell-710-ree", .data = &cc710_hw }, { .compatible = "arm,cryptocell-630p-ree", .data = &cc630p_hw }, @@ -297,15 +302,17 @@ static int init_cc_resources(struct platform_device *plat_dev) return rc; } - /* Verify correct mapping */ - signature_val = cc_ioread(new_drvdata, new_drvdata->sig_offset); - if (signature_val != hw_rev->sig) { - dev_err(dev, "Invalid CC signature: SIGNATURE=0x%08X != expected=0x%08X\n", - signature_val, hw_rev->sig); - rc = -EINVAL; - goto post_clk_err; + if (hw_rev->rev <= CC_HW_REV_712) { + /* Verify correct mapping */ + signature_val = cc_ioread(new_drvdata, new_drvdata->sig_offset); + if (signature_val != hw_rev->sig) { + dev_err(dev, "Invalid CC signature: SIGNATURE=0x%08X != expected=0x%08X\n", + signature_val, hw_rev->sig); + rc = -EINVAL; + goto post_clk_err; + } + dev_dbg(dev, "CC SIGNATURE=0x%08X\n", signature_val); } - dev_dbg(dev, "CC SIGNATURE=0x%08X\n", signature_val); /* Display HW versions */ dev_info(dev, "ARM CryptoCell %s Driver: HW version 0x%08X, Driver version %s\n", diff --git a/drivers/crypto/ccree/cc_driver.h b/drivers/crypto/ccree/cc_driver.h index d608a4f..a06e5c9 100644 --- a/drivers/crypto/ccree/cc_driver.h +++ b/drivers/crypto/ccree/cc_driver.h @@ -36,12 +36,13 @@ extern bool cc_dump_desc; extern bool cc_dump_bytes; -#define DRV_MODULE_VERSION "4.0" +#define DRV_MODULE_VERSION "5.0" enum cc_hw_rev { CC_HW_REV_630 = 630, CC_HW_REV_710 = 710, - CC_HW_REV_712 = 712 + CC_HW_REV_712 = 712, + CC_HW_REV_713 = 713 }; #define CC_COHERENT_CACHE_PARAMS 0xEEE