Skip to contentSkip to conversation

dt-bindings: crypto: Add Mediatek EIP-93 crypto engine

RFC PATCH In review Christian Marangi 3 participants 6 messages Oct 9, 2024 – Oct 13, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/2 dt-bindings: crypto: Add Mediatek EIP-93 crypto engine

Add bindings for the Mediatek EIP-93 crypto engine. The same IP is also present on Airoha SoC.

---
 .../bindings/crypto/mediatek,mtk-eip93.yaml   | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml
Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml new file +40 -0
new file mode 100644
index 000000000000..b0173b4da42d
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/crypto/mediatek,mtk-eip93.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Mediatek EIP93 crypto engine
+
+maintainers:
+  - Christian Marangi <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - mediatek, mtk-eip93
+      - airoha,mtk-eip93
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    crypto@1e004000 {
+      compatible = "airoha,mtk-eip93";
+      reg = <0x1fb70000 0x1000>;
+
+      interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+    };
Signature · 1 line
2.45.2
#1 lore raw

RFC PATCH 2/2 crypto: Add Mediatek EIP-93 crypto engine support

Add support for the Mediatek EIP-93 crypto engine used on MT7621 and new Airoha SoC.

EIP-93 IP supports AES/DES/3DES ciphers in ECB/CBC and CTR modes as well as authenc(HMAC(x), cipher(y)) using HMAC MD5, SHA1, SHA224 and SHA256.

EIP-93 provide regs to signal support for specific chipers and the driver dynamically register only the supported one by the chip.

---
 drivers/crypto/Kconfig                  |   1 +
 drivers/crypto/Makefile                 |   1 +
 drivers/crypto/mtk-eip93/Kconfig        |  20 +
 drivers/crypto/mtk-eip93/Makefile       |   5 +
 drivers/crypto/mtk-eip93/eip93-aead.c   | 698 +++++++++++++++++++
 drivers/crypto/mtk-eip93/eip93-aead.h   |  38 ++
 drivers/crypto/mtk-eip93/eip93-aes.h    |  16 +
 drivers/crypto/mtk-eip93/eip93-cipher.c | 403 +++++++++++
 drivers/crypto/mtk-eip93/eip93-cipher.h |  60 ++
 drivers/crypto/mtk-eip93/eip93-common.c | 815 ++++++++++++++++++++++
 drivers/crypto/mtk-eip93/eip93-common.h |  25 +
 drivers/crypto/mtk-eip93/eip93-des.h    |  16 +
 drivers/crypto/mtk-eip93/eip93-hash.c   | 865 ++++++++++++++++++++++++
 drivers/crypto/mtk-eip93/eip93-hash.h   |  72 ++
 drivers/crypto/mtk-eip93/eip93-main.c   | 503 ++++++++++++++
 drivers/crypto/mtk-eip93/eip93-main.h   | 153 +++++
 drivers/crypto/mtk-eip93/eip93-regs.h   | 335 +++++++++
 17 files changed, 4026 insertions(+)
 create mode 100644 drivers/crypto/mtk-eip93/Kconfig
 create mode 100644 drivers/crypto/mtk-eip93/Makefile
 create mode 100644 drivers/crypto/mtk-eip93/eip93-aead.c
 create mode 100644 drivers/crypto/mtk-eip93/eip93-aead.h
 create mode 100644 drivers/crypto/mtk-eip93/eip93-aes.h
 create mode 100644 drivers/crypto/mtk-eip93/eip93-cipher.c
 create mode 100644 drivers/crypto/mtk-eip93/eip93-cipher.h
 create mode 100644 drivers/crypto/mtk-eip93/eip93-common.c
 create mode 100644 drivers/crypto/mtk-eip93/eip93-common.h
 create mode 100644 drivers/crypto/mtk-eip93/eip93-des.h
 create mode 100644 drivers/crypto/mtk-eip93/eip93-hash.c
 create mode 100644 drivers/crypto/mtk-eip93/eip93-hash.h
 create mode 100644 drivers/crypto/mtk-eip93/eip93-main.c
 create mode 100644 drivers/crypto/mtk-eip93/eip93-main.h
 create mode 100644 drivers/crypto/mtk-eip93/eip93-regs.h
drivers/crypto/Kconfig +1 -0
index 94f23c6fc93b..a23d7ef004c8 100644
@@ -790,5 +790,6 @@ config CRYPTO_DEV_SA2UL
 
 source "drivers/crypto/aspeed/Kconfig"
 source "drivers/crypto/starfive/Kconfig"
+source "drivers/crypto/mtk-eip93/Kconfig"
 
 endif # CRYPTO_HW
drivers/crypto/Makefile +1 -0
index ad4ccef67d12..3fbe5b528ca9 100644
@@ -52,3 +52,4 @@ obj-y += hisilicon/
 obj-$(CONFIG_CRYPTO_DEV_AMLOGIC_GXL) += amlogic/
 obj-y += intel/
 obj-y += starfive/
+obj-y += mtk-eip93/
drivers/crypto/mtk-eip93/Kconfig new file +20 -0
new file mode 100644
index 000000000000..8353d3d7ec9b
@@ -0,0 +1,20 @@
+# SPDX-License-Identifier: GPL-2.0
+config CRYPTO_DEV_EIP93
+	tristate "Support for EIP93 crypto HW accelerators"
+	depends on SOC_MT7621 || ARCH_AIROHA ||COMPILE_TEST
+	select CRYPTO_LIB_AES
+	select CRYPTO_LIB_DES
+	select CRYPTO_SKCIPHER
+	select CRYPTO_AEAD
+	select CRYPTO_AUTHENC
+	select CRYPTO_MD5
+	select CRYPTO_SHA1
+	select CRYPTO_SHA256
+	help
+	  EIP93 have various crypto HW accelerators. Select this if
+	  you want to use the EIP93 modules for any of the crypto algorithms.
+
+	  If the IP supports it, this provide offload for AES - ECB, CBC and
+	  CTR crypto. Also provide DES and 3DES ECB and CBC.
+
+	  Also provide AEAD authenc(hmac(x), cipher(y)) for supported algo.
drivers/crypto/mtk-eip93/Makefile new file +5 -0
new file mode 100644
index 000000000000..a3d3d3677cdc
@@ -0,0 +1,5 @@
+obj-$(CONFIG_CRYPTO_DEV_EIP93) += crypto-hw-eip93.o
+
+crypto-hw-eip93-y += eip93-main.o eip93-common.o
+crypto-hw-eip93-y += eip93-cipher.o eip93-aead.o
+crypto-hw-eip93-y += eip93-hash.o
drivers/crypto/mtk-eip93/eip93-aead.c new file +698 -0

698 lines not on this page · raw message

drivers/crypto/mtk-eip93/eip93-aead.h new file +38 -0
new file mode 100644
index 000000000000..2d30efb6eef4
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2019 - 2021
+ *
+ * Richard van Schagen <[email protected]>
+ * Christian Marangi <[email protected]
+ */
+#ifndef _EIP93_AEAD_H_
+#define _EIP93_AEAD_H_
+
+extern struct mtk_alg_template mtk_alg_authenc_hmac_md5_cbc_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha1_cbc_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha224_cbc_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha256_cbc_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_md5_ctr_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha1_ctr_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha224_ctr_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha256_ctr_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_md5_rfc3686_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha1_rfc3686_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha224_rfc3686_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha256_rfc3686_aes;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_md5_cbc_des;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha1_cbc_des;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha224_cbc_des;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha256_cbc_des;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_md5_cbc_des3_ede;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha1_cbc_des3_ede;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha224_cbc_des3_ede;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha256_cbc_des3_ede;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_md5_ecb_null;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha1_ecb_null;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha224_ecb_null;
+extern struct mtk_alg_template mtk_alg_authenc_hmac_sha256_ecb_null;
+
+void mtk_aead_handle_result(struct crypto_async_request *async, int err);
+
+#endif /* _EIP93_AEAD_H_ */
drivers/crypto/mtk-eip93/eip93-aes.h new file +16 -0
new file mode 100644
index 000000000000..b8270277a13f
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2019 - 2021
+ *
+ * Richard van Schagen <[email protected]>
+ * Christian Marangi <[email protected]
+ */
+#ifndef _EIP93_AES_H_
+#define _EIP93_AES_H_
+
+extern struct mtk_alg_template mtk_alg_ecb_aes;
+extern struct mtk_alg_template mtk_alg_cbc_aes;
+extern struct mtk_alg_template mtk_alg_ctr_aes;
+extern struct mtk_alg_template mtk_alg_rfc3686_aes;
+
+#endif /* _EIP93_AES_H_ */
drivers/crypto/mtk-eip93/eip93-cipher.c new file +403 -0

403 lines not on this page · raw message

drivers/crypto/mtk-eip93/eip93-cipher.h new file +60 -0

60 lines not on this page · raw message

drivers/crypto/mtk-eip93/eip93-common.c new file +815 -0

815 lines not on this page · raw message

drivers/crypto/mtk-eip93/eip93-common.h new file +25 -0
new file mode 100644
index 000000000000..87ba1718825e
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2019 - 2021
+ *
+ * Richard van Schagen <[email protected]>
+ * Christian Marangi <[email protected]
+ */
+
+#ifndef _EIP93_COMMON_H_
+#define _EIP93_COMMON_H_
+
+#include "eip93-main.h"
+
+void *mtk_get_descriptor(struct mtk_device *mtk);
+int mtk_put_descriptor(struct mtk_device *mtk, struct eip93_descriptor *desc);
+
+void mtk_set_sa_record(struct sa_record *sa_record, const unsigned int keylen,
+		       const u32 flags);
+
+int mtk_parse_ctrl_stat_err(struct mtk_device *mtk, int err);
+
+int mtk_authenc_setkey(struct crypto_aead *aead, struct sa_record *sa,
+		       const u8 *authkey, unsigned int authkeylen);
+
+#endif /* _EIP93_COMMON_H_ */
drivers/crypto/mtk-eip93/eip93-des.h new file +16 -0
new file mode 100644
index 000000000000..34f54ab2817e
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0
+ *
+ * Copyright (C) 2019 - 2021
+ *
+ * Richard van Schagen <[email protected]>
+ * Christian Marangi <[email protected]
+ */
+#ifndef _EIP93_DES_H_
+#define _EIP93_DES_H_
+
+extern struct mtk_alg_template mtk_alg_ecb_des;
+extern struct mtk_alg_template mtk_alg_cbc_des;
+extern struct mtk_alg_template mtk_alg_ecb_des3_ede;
+extern struct mtk_alg_template mtk_alg_cbc_des3_ede;
+
+#endif /* _EIP93_DES_H_ */
drivers/crypto/mtk-eip93/eip93-hash.c new file +865 -0

865 lines not on this page · raw message

drivers/crypto/mtk-eip93/eip93-hash.h new file +72 -0

29 lines not on this page · raw message

drivers/crypto/mtk-eip93/eip93-main.c new file +503 -0

503 lines not on this page · raw message

drivers/crypto/mtk-eip93/eip93-main.h new file +153 -0

153 lines not on this page · raw message

drivers/crypto/mtk-eip93/eip93-regs.h new file +335 -0

335 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.45.2

Part of the diff is not shown here. View the raw message.

#2 lore raw

Re: [RFC PATCH 2/2] crypto: Add Mediatek EIP-93 crypto engine support

kernel test robot noticed the following build errors:

Hi Christian,

[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:

[auto build test ERROR on herbert-cryptodev-2.6/master]
[also build test ERROR on herbert-crypto-2.6/master robh/for-next linus/master v6.12-rc2 next-20241011] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/crypto-Add-Mediatek-EIP-93-crypto-engine-support/20241010-011532
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20241009171223.12695-2-ansuelsmth%40gmail.com
patch subject: [RFC PATCH 2/2] crypto: Add Mediatek EIP-93 crypto engine support
config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20241014/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241014/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All error/warnings (new ones prefixed by >>):

>> drivers/crypto/mtk-eip93/eip93-main.c:483:34: error: array type has incomplete element type 'struct of_device_id'
     483 | static const struct of_device_id mtk_crypto_of_match[] = {
         |                                  ^~~~~~~~~~~~~~~~~~~
>> drivers/crypto/mtk-eip93/eip93-main.c:492:19: error: initialization of 'void (*)(struct platform_device *)' from incompatible pointer type 'int (*)(struct platform_device *)' [-Werror=incompatible-pointer-types]

492 | .remove = mtk_crypto_remove,
| ^~~~~~~~~~~~~~~~~
drivers/crypto/mtk-eip93/eip93-main.c:492:19: note: (near initialization for 'mtk_crypto_driver.<anonymous>.remove')
cc1: some warnings being treated as errors
--
drivers/crypto/mtk-eip93/eip93-common.c: In function 'mtk_send_req':

>> drivers/crypto/mtk-eip93/eip93-common.c:637:1: warning: label 'send_err' defined but not used [-Wunused-label]
     637 | send_err:
         | ^~~~~~~~
--
   drivers/crypto/mtk-eip93/eip93-hash.c: In function 'mtk_send_hash_req':
>> drivers/crypto/mtk-eip93/eip93-hash.c:231:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
     231 |         int ret;
         |             ^~~

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for MODVERSIONS
Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
Selected by [y]:
- RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=n] || GCC_PLUGINS [=y]) && MODULES [=y]
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]

vim +483 drivers/crypto/mtk-eip93/eip93-main.c

482

 > 483	static const struct of_device_id mtk_crypto_of_match[] = {
   484		{ .compatible = "mediatek,mtk-eip93", },
   485		{ .compatible = "airoha,mtk-eip93", },
   486		{}
   487	};
   488	MODULE_DEVICE_TABLE(of, mtk_crypto_of_match);
   489	
   490	static struct platform_driver mtk_crypto_driver = {
   491		.probe = mtk_crypto_probe,
 > 492		.remove = mtk_crypto_remove,

493 .driver = {
494 .name = "mtk-eip93",
495 .of_match_table = mtk_crypto_of_match,
496 },
497 };
498 module_platform_driver(mtk_crypto_driver);
499

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#3 lore raw

Re: [RFC PATCH 2/2] crypto: Add Mediatek EIP-93 crypto engine support

In reply to Christian Marangi
kernel test robot noticed the following build warnings:

Hi Christian,

[This is a private test report for your RFC patch.] kernel test robot noticed the following build warnings:

[auto build test WARNING on herbert-cryptodev-2.6/master]
[also build test WARNING on herbert-crypto-2.6/master robh/for-next linus/master v6.12-rc2 next-20241011] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/crypto-Add-Mediatek-EIP-93-crypto-engine-support/20241010-011532
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
patch link:    https://lore.kernel.org/r/20241009171223.12695-2-ansuelsmth%40gmail.com
patch subject: [RFC PATCH 2/2] crypto: Add Mediatek EIP-93 crypto engine support
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20241014/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241014/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/crypto/mtk-eip93/eip93-main.c:483:34: error: array type has incomplete element type 'struct of_device_id'

     483 | static const struct of_device_id mtk_crypto_of_match[] = {
         |                                  ^~~~~~~~~~~~~~~~~~~
   drivers/crypto/mtk-eip93/eip93-main.c:492:19: error: initialization of 'void (*)(struct platform_device *)' from incompatible pointer type 'int (*)(struct platform_device *)' [-Werror=incompatible-pointer-types]
     492 |         .remove = mtk_crypto_remove,
         |                   ^~~~~~~~~~~~~~~~~
   drivers/crypto/mtk-eip93/eip93-main.c:492:19: note: (near initialization for 'mtk_crypto_driver.<anonymous>.remove')
>> drivers/crypto/mtk-eip93/eip93-main.c:483:34: warning: 'mtk_crypto_of_match' defined but not used [-Wunused-variable]
     483 | static const struct of_device_id mtk_crypto_of_match[] = {
         |                                  ^~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for MODVERSIONS
Depends on [n]: MODULES [=y] && !COMPILE_TEST [=y]
Selected by [y]:
- RANDSTRUCT_FULL [=y] && (CC_HAS_RANDSTRUCT [=n] || GCC_PLUGINS [=y]) && MODULES [=y]
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [y]:
- RESOURCE_KUNIT_TEST [=y] && RUNTIME_TESTING_MENU [=y] && KUNIT [=y]

vim +/mtk_crypto_of_match +483 drivers/crypto/mtk-eip93/eip93-main.c

482

 > 483	static const struct of_device_id mtk_crypto_of_match[] = {

484 { .compatible = "mediatek,mtk-eip93", },
485 { .compatible = "airoha,mtk-eip93", },
486 {}
487 };
488 MODULE_DEVICE_TABLE(of, mtk_crypto_of_match);
489

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#4 lore raw
In reply to Christian Marangi
Quoted 20 lines · Christian Marangi

Add bindings for the Mediatek EIP-93 crypto engine. The same IP is also present on Airoha SoC.

---
 .../bindings/crypto/mediatek,mtk-eip93.yaml   | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml
Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml new file +5 -0
new file mode 100644
index 000000000000..b0173b4da42d
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/crypto/mediatek,mtk-eip93.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml line 15

Quoted 10 lines
Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml new file +10 -0
+
+title: Mediatek EIP93 crypto engine
+
+maintainers:
+  - Christian Marangi <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - mediatek, mtk-eip93

space?

Why mediatek and mtk? Is eip93 an SoC?

Quoted 28 lines
Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml new file +25 -0
+      - airoha,mtk-eip93
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    crypto@1e004000 {
+      compatible = "airoha,mtk-eip93";
+      reg = <0x1fb70000 0x1000>;
+
+      interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+    };
Signature · 1 line
2.45.2
#5 lore raw
Quoted 34 lines · Rob Herring
Quoted 20 lines · Christian Marangi

Add bindings for the Mediatek EIP-93 crypto engine. The same IP is also present on Airoha SoC.

---
 .../bindings/crypto/mediatek,mtk-eip93.yaml   | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml
Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml new file +5 -0
new file mode 100644
index 000000000000..b0173b4da42d
@@ -0,0 +1,40 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/crypto/mediatek,mtk-eip93.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml line 15

Quoted 10 lines
Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml new file +10 -0
+
+title: Mediatek EIP93 crypto engine
+
+maintainers:
+  - Christian Marangi <[email protected]>
+
+properties:
+  compatible:
+    enum:
+      - mediatek, mtk-eip93

space?

Quoted 2 lines

Why mediatek and mtk? Is eip93 an SoC?

Hi Rob,

totally blind for not noticing this (and not even dt_binding_check notice it wow)

Anyway the naming of this thing is a bit strange and hope you can give some hint about what to use.

This is a crypto block included in various product like Mediatek SoC (mt7621), DSP (ADSP-BF70x Blackfin) and in more recent stuff Airoha SoC EN7581.

In documentation and in GPL source is called in various name... PKTE, EIP93, geneirc "Crypto". One common name in drivers is tho EIP93.

Currently upstream it's supported the more recent version of this kind of HW Crypto block, EIP197.

There the compatible is

"inside-secure,safexcel-eip197"

So from these info IN THEORY, the real produced of all this stuff is inside-secure and the product is safexcel (confirmed also in other product)

NOW the real problem.

From what I notice EIP93 HW Crytpo present on the old Mediatek SoC (mt7621) have some small difference in some registry so maybe a specific compatible will be needed.

Given this situation would it be acceptable to have

- inside-secure,safexcel-eip93
- inside-secure,safexcel-eip93-mt7621 (or maybe risky but more generic -mediatek ?)

The current driver doesn't fully account for the mediatek variant so it would require some later changes. Maybe a better strategy is to just not declare mediatek compatible for now? I know it sound stupid to ask a question for something not entirely supported now but it's really to understand how to move in the future. (just to prevent case where the generic compatible is misused and we get mad on handling it in the driver)

Quoted 28 lines
Quoted 28 lines
Documentation/devicetree/bindings/crypto/mediatek,mtk-eip93.yaml new file +25 -0
+      - airoha,mtk-eip93
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    crypto@1e004000 {
+      compatible = "airoha,mtk-eip93";
+      reg = <0x1fb70000 0x1000>;
+
+      interrupts = <GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+    };
Signature · 1 line
2.45.2
Signature · 1 line
	Ansuel