From patchwork Mon Oct 29 09:50:12 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: 149650 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3911893ljp; Mon, 29 Oct 2018 02:50:29 -0700 (PDT) X-Google-Smtp-Source: AJdET5cTG3vEmwhFV+kApiF0blrQ/FyD1bnDgXEKzxyrEODHMrU0BmLWHky4m5o/o5s9A7l7/JJb X-Received: by 2002:a17:902:8a4:: with SMTP id 33-v6mr13723495pll.304.1540806629573; Mon, 29 Oct 2018 02:50:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540806629; cv=none; d=google.com; s=arc-20160816; b=OG/VeJr8UuiUclMVgQqRatCm8HHD9MP7Imd19fiugCnYi6JJHKjroOG1vSVIewVAo3 GSFHTvwLKygRSZoYm3eVg+V8c+H6BeVMHIAiJ2c+yfYLQuuvM28aCFsRcvK0txZG4BZJ 81reSkvoMDIpBQu0GUXyXr+dOiCBGQYbr1bFjgzWuCEsl8/lr7Z1CR3bjXmz4Jo9qTlK PdgZ6YEEH0NoIV57aYh95OrHnI6L56Rqh1eQicNtgGjbGGcqj5jGL1hZXwuAnFJq53cX MBJ2Z709nosDlUe7y4HzPz1KCVjy4VDPiuiji8HDjIJVP/ka0ILqpOLY73CuGpztytC9 21Mw== 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=XwW41SgrU4lVKQdWE3KPrVSt0bSyLhynCcYpOVSUHrGGDeLudLSQJBa4HhNHqb54YX uRfO1wGC+sjc1YG3M5vKyO76oJGuv++NLVfd4byDGR/x4n4mtH0AMNnsKh96g16LcV5N idfL7aVbYaviLpSwbfh+DqSwqlrGW0mzHFEZ1tKxgwFaHFEnAZsU9x6KA3Pmb8PZjkgI rYzKZza6FiYEJPG7x338HHuAMLLqw7sIPGjExhUDDcN42rPgdjQmvX97bInco1v8Ob9X bgW1JNBDraUUzApH3YBcAadDhTWWsoFtIH7ApEkwpgRS3xYHBGl+mDc39HxtsibiI15h V6ag== 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 d8-v6si3550136pls.164.2018.10.29.02.50.28; Mon, 29 Oct 2018 02:50:29 -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 S1729746AbeJ2SiW (ORCPT + 32 others); Mon, 29 Oct 2018 14:38:22 -0400 Received: from foss.arm.com ([217.140.101.70]:37772 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729343AbeJ2SiV (ORCPT ); Mon, 29 Oct 2018 14:38:21 -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 0DAF7341; Mon, 29 Oct 2018 02:50:26 -0700 (PDT) Received: from sugar.kfn.arm.com (E110176.Arm.com [10.50.4.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5A233F557; Mon, 29 Oct 2018 02:50:23 -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 v2 1/3] crypto: ccree: add support for CryptoCell 713 Date: Mon, 29 Oct 2018 09:50:12 +0000 Message-Id: <1540806616-5483-2-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1540806616-5483-1-git-send-email-gilad@benyossef.com> References: <1540806616-5483-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 From patchwork Mon Oct 29 09:50:13 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: 149651 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp3911949ljp; Mon, 29 Oct 2018 02:50:33 -0700 (PDT) X-Google-Smtp-Source: AJdET5d1MJUEjifHS1KYOkNG/BioDQgiixEUNOwf/8i95Yul96dUJHsrg9DrLr/DI+QvRul9oQWy X-Received: by 2002:a63:24f:: with SMTP id 76-v6mr12940384pgc.67.1540806633156; Mon, 29 Oct 2018 02:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540806633; cv=none; d=google.com; s=arc-20160816; b=wvc4al+b1hqsO+0/27SJnvlQUzHAHe1gqPDbBa44+UwwBzSk3k/cF1zV4QL6K/45rh rpnSJYWMgj+j8mtMsdiAuJj+4dfH1/LexhtwGxkt42xzefbFRm3yB/53GqDfuBSGocOI u31YpUaAqaBs473fOb8cJaLOgQaJvIUkeVG8ZlbE2oA+80feUPTi1PikZmmQCd2LTr8F 3xHA7AHpousEmtIsQzUKU8SzXO8GC4PiUuadNvuWAZF3kOHnEIWiWpG5EfJkegiESBMZ uz2Dn2LiaXZty0Gdoo6LfTYq1FSTUJPgb8P8aRhFq1TaG2OeMgwAv38S5K4cbujaXYx6 d+rA== 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=1zS1ja25Cs0UVkqQPyILRBo2JsQ3GL7ega7akNxY4fM=; b=K+r658J6fxdaxwE+ORzG/TZaMMRg3NRlTr8EvwxpEtsujEXuW8T72LAR2nHLd4FVFV WtQBEDEt/SHRd9QoACofOEiy+hJ7gr//zmD9MiIg81oaVNTvBJ5048Lm6SJgNtev4Ank sbE75TNledJa4qmUtCxp7qJdFkMijpeCf2bI/AbAaNYTFtZI2xdVUx1kDv9QpDkLN1j3 jtl9XsgjbB5LMUqNHd6huOEGKMcOfke87q3+zKWgVT0jS42UM1YsiGtrXBfa/+HKk2Gu 1YkoKmo1+jYN+IvTy9SESNodppnW3i7kTvkBuMU0FVP3AysGu2Vjym+EQv5Jw4Q81u+D wmSQ== 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 d8-v6si3550136pls.164.2018.10.29.02.50.32; Mon, 29 Oct 2018 02:50:33 -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 S1729770AbeJ2Si0 (ORCPT + 32 others); Mon, 29 Oct 2018 14:38:26 -0400 Received: from foss.arm.com ([217.140.101.70]:37784 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729343AbeJ2SiZ (ORCPT ); Mon, 29 Oct 2018 14:38:25 -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 8DA98341; Mon, 29 Oct 2018 02:50:30 -0700 (PDT) Received: from sugar.kfn.arm.com (E110176.Arm.com [10.50.4.178]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 216FD3F557; Mon, 29 Oct 2018 02:50:27 -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 v2 2/3] dt-bindings: crypto: ccree: add ccree 713 Date: Mon, 29 Oct 2018 09:50:13 +0000 Message-Id: <1540806616-5483-3-git-send-email-gilad@benyossef.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1540806616-5483-1-git-send-email-gilad@benyossef.com> References: <1540806616-5483-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 device tree bindings associating Arm TrustZone CryptoCell 713 with the ccree driver. Signed-off-by: Gilad Ben-Yossef --- Documentation/devicetree/bindings/crypto/arm-cryptocell.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.7.4 diff --git a/Documentation/devicetree/bindings/crypto/arm-cryptocell.txt b/Documentation/devicetree/bindings/crypto/arm-cryptocell.txt index 999fb2a..0ac06ec 100644 --- a/Documentation/devicetree/bindings/crypto/arm-cryptocell.txt +++ b/Documentation/devicetree/bindings/crypto/arm-cryptocell.txt @@ -1,8 +1,11 @@ Arm TrustZone CryptoCell cryptographic engine Required properties: -- compatible: Should be one of: "arm,cryptocell-712-ree", - "arm,cryptocell-710-ree" or "arm,cryptocell-630p-ree". +- compatible: Should be one of - + "arm,cryptocell-713-ree" + "arm,cryptocell-712-ree" + "arm,cryptocell-710-ree" + "arm,cryptocell-630p-ree" - reg: Base physical address of the engine and length of memory mapped region. - interrupts: Interrupt number for the device.