Add MediaTek crypto accelerator driver
Subsystems (3)
v3 cover Add MediaTek crypto accelerator driver
Hello,
This adds support for the MediaTek hardware accelerator on some SoCs.
This driver currently implement:
- SHA1 and SHA2 family(HMAC) hash algorithms.
- AES block cipher in CBC/ECB mode with 128/196/256 bits keys.
Chances since v3:
-remove unused structure member
-drop interrupt-parent from DT bindings documentation
Changes since v2:
- use byteorder conversion macros and type identifiers for descriptors
- revise register definition macros to make it more clear
- revise DT compatiable string
Changes since v1:
- remove EXPORT_SYMBOL
- remove unused PRNG setting
- sort headers in alphabetical order
- add a definition for IRQ unmber
- replace ambiguous definition
- add more annotation and function comment
- add COMPILE_TEST in Kconfig
Ryder Lee (2):
Add crypto driver support for some MediaTek chips
crypto: mediatek - add DT bindings documentation
.../devicetree/bindings/crypto/mediatek-crypto.txt | 27 + drivers/crypto/Kconfig | 17 + drivers/crypto/Makefile | 1 + drivers/crypto/mediatek/Makefile | 2 + drivers/crypto/mediatek/mtk-aes.c | 765 +++++++++++ drivers/crypto/mediatek/mtk-platform.c | 604 ++++++++ drivers/crypto/mediatek/mtk-platform.h | 238 ++++ drivers/crypto/mediatek/mtk-regs.h | 194 +++ drivers/crypto/mediatek/mtk-sha.c | 1437 ++++++++++++++++++++ 9 files changed, 3285 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/mediatek-crypto.txt create mode 100644 drivers/crypto/mediatek/Makefile create mode 100644 drivers/crypto/mediatek/mtk-aes.c create mode 100644 drivers/crypto/mediatek/mtk-platform.c create mode 100644 drivers/crypto/mediatek/mtk-platform.h create mode 100644 drivers/crypto/mediatek/mtk-regs.h create mode 100644 drivers/crypto/mediatek/mtk-sha.c
Signature · 1 line
1.9.1
PATCH v3 1/2 Add crypto driver support for some MediaTek chips
This adds support for the MediaTek hardware accelerator on mt7623/mt2701/mt8521p SoC.
This driver currently implement:
- SHA1 and SHA2 family(HMAC) hash algorithms.
- AES block cipher in CBC/ECB mode with 128/196/256 bits keys.
--- drivers/crypto/Kconfig | 17 + drivers/crypto/Makefile | 1 + drivers/crypto/mediatek/Makefile | 2 + drivers/crypto/mediatek/mtk-aes.c | 765 +++++++++++++++++ drivers/crypto/mediatek/mtk-platform.c | 604 ++++++++++++++ drivers/crypto/mediatek/mtk-platform.h | 238 ++++++ drivers/crypto/mediatek/mtk-regs.h | 194 +++++ drivers/crypto/mediatek/mtk-sha.c | 1437 ++++++++++++++++++++++++++++++++ 8 files changed, 3258 insertions(+) create mode 100644 drivers/crypto/mediatek/Makefile create mode 100644 drivers/crypto/mediatek/mtk-aes.c create mode 100644 drivers/crypto/mediatek/mtk-platform.c create mode 100644 drivers/crypto/mediatek/mtk-platform.h create mode 100644 drivers/crypto/mediatek/mtk-regs.h create mode 100644 drivers/crypto/mediatek/mtk-sha.c
drivers/crypto/Kconfig +17 -0
@@ -553,6 +553,23 @@ config CRYPTO_DEV_ROCKCHIP This driver interfaces with the hardware crypto accelerator. Supporting cbc/ecb chainmode, and aes/des/des3_ede cipher mode. +config CRYPTO_DEV_MEDIATEK + tristate "MediaTek's EIP97 Cryptographic Engine driver" + depends on ARM && (ARCH_MEDIATEK || COMPILE_TEST) + select NEON + select KERNEL_MODE_NEON + select ARM_CRYPTO + select CRYPTO_AES + select CRYPTO_BLKCIPHER + select CRYPTO_SHA1_ARM_NEON + select CRYPTO_SHA256_ARM + select CRYPTO_SHA512_ARM + select CRYPTO_HMAC + help + This driver allows you to utilize the hardware crypto accelerator + EIP97 which can be found on the MT7623 MT2701, MT8521p, etc .... + Select this if you want to use it for AES/SHA1/SHA2 algorithms. + source "drivers/crypto/chelsio/Kconfig" endif # CRYPTO_HW
drivers/crypto/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_CRYPTO_DEV_IMGTEC_HASH) += img-hash.o obj-$(CONFIG_CRYPTO_DEV_IXP4XX) += ixp4xx_crypto.o obj-$(CONFIG_CRYPTO_DEV_MV_CESA) += mv_cesa.o obj-$(CONFIG_CRYPTO_DEV_MARVELL_CESA) += marvell/ +obj-$(CONFIG_CRYPTO_DEV_MEDIATEK) += mediatek/ obj-$(CONFIG_CRYPTO_DEV_MXS_DCP) += mxs-dcp.o obj-$(CONFIG_CRYPTO_DEV_NIAGARA2) += n2_crypto.o n2_crypto-y := n2_core.o n2_asm.o
drivers/crypto/mediatek/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_CRYPTO_DEV_MEDIATEK) += mtk-crypto.o +mtk-crypto-objs:= mtk-platform.o mtk-aes.o mtk-sha.o
drivers/crypto/mediatek/mtk-aes.c new file +765 -0
765 lines not on this page · raw message
drivers/crypto/mediatek/mtk-platform.c new file +604 -0
604 lines not on this page · raw message
drivers/crypto/mediatek/mtk-platform.h new file +238 -0
238 lines not on this page · raw message
drivers/crypto/mediatek/mtk-regs.h new file +194 -0
194 lines not on this page · raw message
drivers/crypto/mediatek/mtk-sha.c new file +1437 -0
1,167 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.9.1
Part of the diff is not shown here. View the raw message.
PATCH v3 2/2 crypto: mediatek - add DT bindings documentation
In reply to Ryder LeeAdd DT bindings documentation for the crypto driver
--- .../devicetree/bindings/crypto/mediatek-crypto.txt | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/mediatek-crypto.txt
Documentation/devicetree/bindings/crypto/mediatek-crypto.txt new file +27 -0
@@ -0,0 +1,27 @@ +MediaTek cryptographic accelerators + +Required properties: +- compatible: Should be "mediatek,eip97-crypto" +- reg: Address and length of the register set for the device +- interrupts: Should contain the five crypto engines interrupts in numeric + order. These are global system and four descriptor rings. +- clocks: the clock used by the core +- clock-names: the names of the clock listed in the clocks property. These are + "ethif", "cryp" +- power-domains: Must contain a reference to the PM domain. + + +Example: + crypto: crypto at 1b240000 { + compatible = "mediatek,eip97-crypto"; + reg = <0 0x1b240000 0 0x20000>; + interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_LOW>, + <GIC_SPI 83 IRQ_TYPE_LEVEL_LOW>, + <GIC_SPI 84 IRQ_TYPE_LEVEL_LOW>, + <GIC_SPI 91 IRQ_TYPE_LEVEL_LOW>, + <GIC_SPI 97 IRQ_TYPE_LEVEL_LOW>; + clocks = <&topckgen CLK_TOP_ETHIF_SEL>, + <ðsys CLK_ETHSYS_CRYPTO>; + clock-names = "ethif","cryp"; + power-domains = <&scpsys MT2701_POWER_DOMAIN_ETH>; + };
Signature · 1 line
1.9.1
Re: [PATCH v3 2/2] crypto: mediatek - add DT bindings documentation
Quoted 7 lines · Ryder Lee
Add DT bindings documentation for the crypto driver
Signed-off-by Ryder Lee <[email protected]>--- .../devicetree/bindings/crypto/mediatek-crypto.txt | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/mediatek-crypto.txt
Herbert Xu
maintainerQuoted 27 lines · Ryder Lee
Hello,
This adds support for the MediaTek hardware accelerator on some SoCs.
This driver currently implement:
- SHA1 and SHA2 family(HMAC) hash algorithms.
- AES block cipher in CBC/ECB mode with 128/196/256 bits keys.Chances since v3:
(quoted diff) +0
-2-remove unused structure member -drop interrupt-parent from DT bindings documentationChanges since v2:
- use byteorder conversion macros and type identifiers for descriptors
- revise register definition macros to make it more clear
- revise DT compatiable stringChanges since v1:
- removeEXPORT_SYMBOL
- remove unused PRNG setting
- sort headers in alphabetical order
- add a definition for IRQ unmber
- replace ambiguous definition
- add more annotation and function comment
- addCOMPILE_TESTinKconfig
Quoted 3 lines
Ryder Lee (2):
Add crypto driver support for some MediaTek chips
crypto: mediatek - add DT bindings documentation
All applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt