crypto: rockchip: add crypto offloader V2
Subsystems (4)
Corentin Labbe
maintainercover crypto: rockchip: add crypto offloader V2
Hello
Rockchip rk3568 and rk3588 have a common crypto offloader IP different than rk3228 one.
I started to work the driver for this IP on a rk3588 based board, but this SoC is still not upstream.
So it is why I send this serie asking for test since I own no rk3568 and I need to be sure datasheet is right.
Note: I keeped all rk3588 reference intentionaly, but probably it will need to be removed until this SoC was upstream.
Regards
Corentin Labbe (5):
crypto: rockchip: move kconfig to its dedicated directory
dt-bindings: crypto: add support for rockchip,crypto-rk3588
MAINTAINERS: add new dt-binding doc to the right entry
crypto: rockchip: support the new crypto IP for rk3568/rk3588
ARM64: dts: rk3568: add crypto node
.../crypto/rockchip,rk3588-crypto.yaml | 71 ++ MAINTAINERS | 1 + arch/arm64/boot/dts/rockchip/rk3568.dtsi | 14 + drivers/crypto/Kconfig | 32 +- drivers/crypto/Makefile | 2 +- drivers/crypto/rockchip/Kconfig | 56 ++ drivers/crypto/rockchip/Makefile | 5 + drivers/crypto/rockchip/rk3588_crypto.c | 646 ++++++++++++++++++ drivers/crypto/rockchip/rk3588_crypto.h | 221 ++++++ drivers/crypto/rockchip/rk3588_crypto_ahash.c | 346 ++++++++++ .../crypto/rockchip/rk3588_crypto_skcipher.c | 340 +++++++++ 11 files changed, 1703 insertions(+), 31 deletions(-) create mode 100644 Documentation/devicetree/bindings/crypto/rockchip,rk3588-crypto.yaml create mode 100644 drivers/crypto/rockchip/Kconfig create mode 100644 drivers/crypto/rockchip/rk3588_crypto.c create mode 100644 drivers/crypto/rockchip/rk3588_crypto.h create mode 100644 drivers/crypto/rockchip/rk3588_crypto_ahash.c create mode 100644 drivers/crypto/rockchip/rk3588_crypto_skcipher.c
Signature · 7 lines
2.35.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Corentin Labbe
maintainerPATCH 1/5 crypto: rockchip: move kconfig to its dedicated directory
Move all rockchip kconfig in its own subdirectory.
--- drivers/crypto/Kconfig | 32 ++------------------------------ drivers/crypto/Makefile | 2 +- drivers/crypto/rockchip/Kconfig | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 31 deletions(-) create mode 100644 drivers/crypto/rockchip/Kconfig
drivers/crypto/Kconfig +2 -30
@@ -646,6 +646,8 @@ config CRYPTO_DEV_QCOM_RNG To compile this driver as a module, choose M here. The module will be called qcom-rng. If unsure, say N. +source "drivers/crypto/rockchip/Kconfig" + config CRYPTO_DEV_VMX bool "Support for VMX cryptographic acceleration instructions" depends on PPC64 && VSX
@@ -666,36 +668,6 @@ config CRYPTO_DEV_IMGTEC_HASH hardware hash accelerator. Supporting MD5/SHA1/SHA224/SHA256 hashing algorithms. -config CRYPTO_DEV_ROCKCHIP - tristate "Rockchip's Cryptographic Engine driver" - depends on OF && ARCH_ROCKCHIP - depends on PM - select CRYPTO_ECB - select CRYPTO_CBC - select CRYPTO_DES - select CRYPTO_AES - select CRYPTO_ENGINE - select CRYPTO_LIB_DES - select CRYPTO_MD5 - select CRYPTO_SHA1 - select CRYPTO_SHA256 - select CRYPTO_HASH - select CRYPTO_SKCIPHER - - help - This driver interfaces with the hardware crypto accelerator. - Supporting cbc/ecb chainmode, and aes/des/des3_ede cipher mode. - -config CRYPTO_DEV_ROCKCHIP_DEBUG - bool "Enable Rockchip crypto stats" - depends on CRYPTO_DEV_ROCKCHIP - depends on DEBUG_FS - help - Say y to enable Rockchip crypto debug stats. - This will create /sys/kernel/debug/rk3288_crypto/stats for displaying - the number of requests per algorithm and other internal stats. - - config CRYPTO_DEV_ZYNQMP_AES tristate "Support for Xilinx ZynqMP AES hw accelerator" depends on ZYNQMP_FIRMWARE || COMPILE_TEST
drivers/crypto/Makefile +1 -1
@@ -36,7 +36,7 @@ obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += amcc/ obj-$(CONFIG_CRYPTO_DEV_QAT) += qat/ obj-$(CONFIG_CRYPTO_DEV_QCE) += qce/ obj-$(CONFIG_CRYPTO_DEV_QCOM_RNG) += qcom-rng.o -obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rockchip/ +obj-y += rockchip/ obj-$(CONFIG_CRYPTO_DEV_S5P) += s5p-sss.o obj-$(CONFIG_CRYPTO_DEV_SA2UL) += sa2ul.o obj-$(CONFIG_CRYPTO_DEV_SAHARA) += sahara.o
drivers/crypto/rockchip/Kconfig new file +28 -0
@@ -0,0 +1,28 @@ +config CRYPTO_DEV_ROCKCHIP + tristate "Rockchip's Cryptographic Engine driver" + depends on OF && ARCH_ROCKCHIP + depends on PM + select CRYPTO_ECB + select CRYPTO_CBC + select CRYPTO_DES + select CRYPTO_AES + select CRYPTO_ENGINE + select CRYPTO_LIB_DES + select CRYPTO_MD5 + select CRYPTO_SHA1 + select CRYPTO_SHA256 + select CRYPTO_HASH + select CRYPTO_SKCIPHER + + help + This driver interfaces with the hardware crypto accelerator. + Supporting cbc/ecb chainmode, and aes/des/des3_ede cipher mode. + +config CRYPTO_DEV_ROCKCHIP_DEBUG + bool "Enable Rockchip crypto stats" + depends on CRYPTO_DEV_ROCKCHIP + depends on DEBUG_FS + help + Say y to enable Rockchip crypto debug stats. + This will create /sys/kernel/debug/rk3288_crypto/stats for displaying + the number of requests per algorithm and other internal stats.
Signature · 1 line
2.35.1
Corentin Labbe
maintainerPATCH 2/5 dt-bindings: crypto: add support for rockchip,crypto-rk3588
In reply to Corentin LabbeAdd device tree binding documentation for the Rockchip cryptographic offloader V2.
--- .../crypto/rockchip,rk3588-crypto.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/rockchip,rk3588-crypto.yaml
Documentation/devicetree/bindings/crypto/rockchip,rk3588-crypto.yaml new file +71 -0
@@ -0,0 +1,71 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/crypto/rockchip,rk3588-crypto.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Rockchip cryptographic offloader V2 + +maintainers: + - Corentin Labbe <[email protected]> + +properties: + compatible: + enum: + - rockchip,rk3568-crypto + - rockchip,rk3588-crypto + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + minItems: 4 + + clock-names: + items: + - const: aclk + - const: hclk + - const: sclk + - const: pka + + resets: + minItems: 5 + + reset-names: + items: + - const: core + - const: a + - const: h + - const: rng + - const: pka + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + - resets + - reset-names + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/rk3568-cru.h> + crypto@fe380000 { + compatible = "rockchip,rk3588-crypto"; + reg = <0xfe380000 0x4000>; + interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru ACLK_CRYPTO_NS>, <&cru HCLK_CRYPTO_NS>, + <&cru CLK_CRYPTO_NS_CORE>, <&cru CLK_CRYPTO_NS_PKA>; + clock-names = "aclk", "hclk", "sclk", "pka"; + resets = <&cru SRST_CRYPTO_NS_CORE>, <&cru SRST_A_CRYPTO_NS>, + <&cru SRST_H_CRYPTO_NS>, <&cru SRST_CRYPTO_NS_RNG>, + <&cru SRST_CRYPTO_NS_PKA>; + reset-names = "core", "a", "h", "rng", "pka"; + };
Signature · 1 line
2.35.1
Re: [PATCH RFT 2/5] dt-bindings: crypto: add support for rockchip,crypto-rk3588
Quoted 9 lines · Corentin Labbe
Add device tree binding documentation for the Rockchip cryptographic offloader V2.
Signed-off-by Corentin Labbe <[email protected]>--- .../crypto/rockchip,rk3588-crypto.yaml | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Documentation/devicetree/bindings/crypto/rockchip,rk3588-crypto.yaml
Corentin Labbe
maintainerPATCH 3/5 MAINTAINERS: add new dt-binding doc to the right entry
In reply to Corentin LabbeRockchip crypto driver have a new file to be added.
--- MAINTAINERS | 1 + 1 file changed, 1 insertion(+)
MAINTAINERS +1 -0
@@ -17712,6 +17712,7 @@ M: Corentin Labbe <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/crypto/rockchip,rk3288-crypto.yaml +F: Documentation/devicetree/bindings/crypto/rockchip,rk3588-crypto.yaml F: drivers/crypto/rockchip/ ROCKCHIP I2S TDM DRIVER
Signature · 7 lines
2.35.1 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip
Corentin Labbe
maintainerPATCH 4/5 crypto: rockchip: support the new crypto IP for rk3568/rk3588
In reply to Corentin LabbeRockchip rk3568 and rk3588 have a common crypto offloader IP. This driver adds support for it.
--- drivers/crypto/rockchip/Kconfig | 28 + drivers/crypto/rockchip/Makefile | 5 + drivers/crypto/rockchip/rk3588_crypto.c | 646 ++++++++++++++++++ drivers/crypto/rockchip/rk3588_crypto.h | 221 ++++++ drivers/crypto/rockchip/rk3588_crypto_ahash.c | 346 ++++++++++ .../crypto/rockchip/rk3588_crypto_skcipher.c | 340 +++++++++ 6 files changed, 1586 insertions(+) create mode 100644 drivers/crypto/rockchip/rk3588_crypto.c create mode 100644 drivers/crypto/rockchip/rk3588_crypto.h create mode 100644 drivers/crypto/rockchip/rk3588_crypto_ahash.c create mode 100644 drivers/crypto/rockchip/rk3588_crypto_skcipher.c
drivers/crypto/rockchip/Kconfig +28 -0
@@ -26,3 +26,31 @@ config CRYPTO_DEV_ROCKCHIP_DEBUG Say y to enable Rockchip crypto debug stats. This will create /sys/kernel/debug/rk3288_crypto/stats for displaying the number of requests per algorithm and other internal stats. + +config CRYPTO_DEV_ROCKCHIP2 + tristate "Rockchip's cryptographic offloader V2" + depends on OF && ARCH_ROCKCHIP + depends on PM + select CRYPTO_ECB + select CRYPTO_CBC + select CRYPTO_AES + select CRYPTO_MD5 + select CRYPTO_SHA1 + select CRYPTO_SHA256 + select CRYPTO_SM3 + select CRYPTO_HASH + select CRYPTO_SKCIPHER + select CRYPTO_ENGINE + + help + This driver interfaces with the hardware crypto offloader present + on RK3568 and RK3588. + +config CRYPTO_DEV_ROCKCHIP2_DEBUG + bool "Enable Rockchip V2 crypto stats" + depends on CRYPTO_DEV_ROCKCHIP2 + depends on DEBUG_FS + help + Say y to enable Rockchip crypto debug stats. + This will create /sys/kernel/debug/rk3588_crypto/stats for displaying + the number of requests per algorithm and other internal stats.
drivers/crypto/rockchip/Makefile +5 -0
@@ -3,3 +3,8 @@ obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rk_crypto.o rk_crypto-objs := rk3288_crypto.o \ rk3288_crypto_skcipher.o \ rk3288_crypto_ahash.o + +obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP2) += rk_crypto2.o +rk_crypto2-objs := rk3588_crypto.o \ + rk3588_crypto_skcipher.o \ + rk3588_crypto_ahash.o
drivers/crypto/rockchip/rk3588_crypto.c new file +646 -0
646 lines not on this page · raw message
drivers/crypto/rockchip/rk3588_crypto.h new file +221 -0
221 lines not on this page · raw message
drivers/crypto/rockchip/rk3588_crypto_ahash.c new file +346 -0
346 lines not on this page · raw message
drivers/crypto/rockchip/rk3588_crypto_skcipher.c new file +340 -0
340 lines not on this page · raw message
Signature · 1 line
2.35.1
Re: [PATCH RFT 4/5] crypto: rockchip: support the new crypto IP for rk3568/rk3588
Quoted 27 lines · Corentin Labbe
Rockchip rk3568 and rk3588 have a common crypto offloader IP. This driver adds support for it.
Signed-off-by Corentin Labbe <[email protected]>--- drivers/crypto/rockchip/Kconfig | 28 + drivers/crypto/rockchip/Makefile | 5 + drivers/crypto/rockchip/rk3588_crypto.c | 646 ++++++++++++++++++ drivers/crypto/rockchip/rk3588_crypto.h | 221 ++++++ drivers/crypto/rockchip/rk3588_crypto_ahash.c | 346 ++++++++++ .../crypto/rockchip/rk3588_crypto_skcipher.c | 340 +++++++++ 6 files changed, 1586 insertions(+) create mode 100644 drivers/crypto/rockchip/rk3588_crypto.c create mode 100644 drivers/crypto/rockchip/rk3588_crypto.h create mode 100644 drivers/crypto/rockchip/rk3588_crypto_ahash.c create mode 100644 drivers/crypto/rockchip/rk3588_crypto_skcipher.cdrivers/crypto/rockchip/Kconfig +2
-0@@ -26,3 +26,31 @@ config CRYPTO_DEV_ROCKCHIP_DEBUG Say y to enable Rockchip crypto debug stats. This will create /sys/kernel/debug/rk3288_crypto/stats for displaying the number of requests per algorithm and other internal stats. + +config CRYPTO_DEV_ROCKCHIP2
drivers/crypto/rockchip/Kconfig config CRYPTO_DEV_ROCKCHIP_DEBUG · line 40
Quoted 10 lines
drivers/crypto/rockchip/Kconfig +10
-0+ tristate "Rockchip's cryptographic offloader V2" + depends on OF && ARCH_ROCKCHIP + depends on PM + select CRYPTO_ECB + select CRYPTO_CBC + select CRYPTO_AES + select CRYPTO_MD5 + select CRYPTO_SHA1 + select CRYPTO_SHA256 + select CRYPTO_SM3
That should be CRYPTO_SM3_GENERIC
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
LABBE Corentin
maintainerRe: [PATCH RFT 4/5] crypto: rockchip: support the new crypto IP for rk3568/rk3588
Quoted 32 lines · Aurelien Jarno
Quoted 31 lines · Corentin Labbe
Rockchip rk3568 and rk3588 have a common crypto offloader IP. This driver adds support for it.
Signed-off-by Corentin Labbe <[email protected]>--- drivers/crypto/rockchip/Kconfig | 28 + drivers/crypto/rockchip/Makefile | 5 + drivers/crypto/rockchip/rk3588_crypto.c | 646 ++++++++++++++++++ drivers/crypto/rockchip/rk3588_crypto.h | 221 ++++++ drivers/crypto/rockchip/rk3588_crypto_ahash.c | 346 ++++++++++ .../crypto/rockchip/rk3588_crypto_skcipher.c | 340 +++++++++ 6 files changed, 1586 insertions(+) create mode 100644 drivers/crypto/rockchip/rk3588_crypto.c create mode 100644 drivers/crypto/rockchip/rk3588_crypto.h create mode 100644 drivers/crypto/rockchip/rk3588_crypto_ahash.c create mode 100644 drivers/crypto/rockchip/rk3588_crypto_skcipher.cdrivers/crypto/rockchip/Kconfig +6
-0@@ -26,3 +26,31 @@ config CRYPTO_DEV_ROCKCHIP_DEBUG Say y to enable Rockchip crypto debug stats. This will create /sys/kernel/debug/rk3288_crypto/stats for displaying the number of requests per algorithm and other internal stats. + +config CRYPTO_DEV_ROCKCHIP2 + tristate "Rockchip's cryptographic offloader V2" + depends on OF && ARCH_ROCKCHIP + depends on PM + select CRYPTO_ECB
Quoted 8 lines
drivers/crypto/rockchip/Kconfig config CRYPTO_DEV_ROCKCHIP_DEBUG · line 40
Quoted 6 lines
drivers/crypto/rockchip/Kconfig +6
-0+ select CRYPTO_CBC + select CRYPTO_AES + select CRYPTO_MD5 + select CRYPTO_SHA1 + select CRYPTO_SHA256 + select CRYPTO_SM3That should be
CRYPTO_SM3_GENERIC
Thanks I will fix it.
Re: [PATCH RFT 4/5] crypto: rockchip: support the new crypto IP for rk3568/rk3588
In reply to Corentin LabbeDear Corentin,
According to official document
Seems they have just updated downstream source to support more algorithms
such as RSA. So it would be better to sync your code with downstream driver
for more feature.
Shengyu
Corentin Labbe
maintainerPATCH 5/5 ARM64: dts: rk3568: add crypto node
In reply to Corentin LabbeThe rk3568 has a crypto IP handled by the rk3588 crypto driver so adds a node for it.
--- arch/arm64/boot/dts/rockchip/rk3568.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/rockchip/rk3568.dtsi +14 -0
@@ -211,6 +211,20 @@ gmac0_mtl_tx_setup: tx-queues-config { }; }; + crypto: crypto@fe380000 { + compatible = "rockchip,rk3568-crypto"; + reg = <0x0 0xfe380000 0x0 0x2000>; + interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cru ACLK_CRYPTO_NS>, <&cru HCLK_CRYPTO_NS>, + <&cru CLK_CRYPTO_NS_CORE>, <&cru CLK_CRYPTO_NS_PKA>; + clock-names = "aclk", "hclk", "sclk", "pka"; + resets = <&cru SRST_CRYPTO_NS_CORE>, <&cru SRST_A_CRYPTO_NS>, + <&cru SRST_H_CRYPTO_NS>, <&cru SRST_CRYPTO_NS_RNG>, + <&cru SRST_CRYPTO_NS_PKA>; + reset-names = "core", "a", "h", "rng,", "pka"; + status = "okay"; + }; + combphy0: phy@fe820000 { compatible = "rockchip,rk3568-naneng-combphy"; reg = <0x0 0xfe820000 0x0 0x100>;
Signature · 1 line
2.35.1
Quoted 8 lines · Corentin Labbe
Hello
Rockchip rk3568 and rk3588 have a common crypto offloader IP different than rk3228 one.
I started to work the driver for this IP on a rk3588 based board, but this SoC is still not upstream.
So it is why I send this serie asking for test since I own no rk3568 and I need to be sure datasheet is right.
I did a quick test, and it doesn't seem to work. I get:
rk3588-crypto fe380000.crypto: DMA timeout
rk3588-crypto fe380000.crypto: DMA timeout
That's on an ODROID-M1 board, so with the set of patches I sent yesterday to support it.
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net
LABBE Corentin
maintainerQuoted 10 lines · Aurelien Jarno
Quoted 8 lines · Corentin Labbe
Hello
Rockchip rk3568 and rk3588 have a common crypto offloader IP different than rk3228 one.
I started to work the driver for this IP on a rk3588 based board, but this SoC is still not upstream.
So it is why I send this serie asking for test since I own no rk3568 and I need to be sure datasheet is right.
Quoted 7 lines
I did a quick test, and it doesn't seem to work. I get:
rk3588-crypto fe380000.crypto: DMA timeout
rk3588-crypto fe380000.crypto: DMA timeoutThat's on an ODROID-M1 board, so with the set of patches I sent yesterday to support it.
Thanks for testing it, probably I did something wrong because I got a successfull test by someone on #linux-rockchip. But I dont know on which board it is, and it was on my debug tree, so probably cleaned something wrong before sending the patchs.
If I sent you a link to my tree, could you retry ?
Regards
Quoted 16 lines · LABBE Corentin
Quoted 15 lines · Aurelien Jarno
Quoted 8 lines · Corentin Labbe
Hello
Rockchip rk3568 and rk3588 have a common crypto offloader IP different than rk3228 one.
I started to work the driver for this IP on a rk3588 based board, but this SoC is still not upstream.
So it is why I send this serie asking for test since I own no rk3568 and I need to be sure datasheet is right.I did a quick test, and it doesn't seem to work. I get:
rk3588-crypto fe380000.crypto: DMA timeout
rk3588-crypto fe380000.crypto: DMA timeout
Quoted 7 lines
Quoted 2 lines
That's on an ODROID-M1 board, so with the set of patches I sent yesterday to support it.
Thanks for testing it, probably I did something wrong because I got a successfull test by someone on #linux-rockchip. But I dont know on which board it is, and it was on my debug tree, so probably cleaned something wrong before sending the patchs.
If I sent you a link to my tree, could you retry ?
Yep, I can try that.
Regards
Aurelien
Signature · 2 lines
Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://www.aurel32.net