From: Chris Spencer <christopher.spencer@xxxxxxxxx> This patch series adds support for the i.MX8MQ to the CAAM driver. This is mostly adapted from corresponding changes in the NXP repo. The patches are based on v5.0-rc7. RFC for now because I do not have any other boards to test it on. Hopefully people can verify this change on other boards. The only thing that I think is potentially problematic is that the RNG is now initialised via the job ring instead of interfacing directly with the DECO. In principle, support for the i.MX8MM can be added by just checking for fsl,imx8mm everywhere we are checking for fsl,imx8mq. I left this out because there is currently no upstream support for the i.MX8MM, and I wouldn't be able to test it anyway. The i.MX8QM and i.MX8QXP will take more work to support because the driver needs to be updated to handle the SECO. I have copied the DT nodes for imx8mq.dtsi below. I will submit these separately to the imx tree if/when these changes are accepted. crypto: caam@30900000 { compatible = "fsl,sec-v4.0"; #address-cells = <0x1>; #size-cells = <0x1>; reg = <0x30900000 0x40000>; ranges = <0 0x30900000 0x40000>; interrupts = <GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>; sec_jr0: jr0@1000 { compatible = "fsl,sec-v4.0-job-ring"; reg = <0x1000 0x1000>; interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>; }; sec_jr1: jr1@2000 { compatible = "fsl,sec-v4.0-job-ring"; reg = <0x2000 0x1000>; interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>; }; sec_jr2: jr2@3000 { compatible = "fsl,sec-v4.0-job-ring"; reg = <0x3000 0x1000>; interrupts = <GIC_SPI 114 IRQ_TYPE_LEVEL_HIGH>; }; }; Sample boot log: [ 2.691119] caam 30900000.caam: device ID = 0x0a16040100000000 (Era 9) [ 2.697950] caam 30900000.caam: job rings = 3, qi = 0 [ 2.703645] caam_jr 30901000.jr0: Entropy delay = 3200 [ 2.709126] caam_jr 30901000.jr0: Entropy delay = 3600 [ 2.784991] caam_jr 30901000.jr0: Instantiated RNG4 SH0. [ 2.855464] caam_jr 30901000.jr0: Instantiated RNG4 SH1. [ 2.881181] alg: No test for authenc(hmac(sha224),ecb(cipher_null)) (authenc-hmac-sha224-ecb-cipher_null-caam) [ 2.891777] alg: No test for authenc(hmac(sha256),ecb(cipher_null)) (authenc-hmac-sha256-ecb-cipher_null-caam) [ 2.902371] alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-caam) [ 2.910989] alg: No test for echainiv(authenc(hmac(md5),cbc(aes))) (echainiv-authenc-hmac-md5-cbc-aes-caam) [ 2.933251] alg: No test for echainiv(authenc(hmac(sha1),cbc(aes))) (echainiv-authenc-hmac-sha1-cbc-aes-caam) [ 2.946711] alg: No test for authenc(hmac(sha224),cbc(aes)) (authenc-hmac-sha224-cbc-aes-caam) [ 2.956107] alg: No test for echainiv(authenc(hmac(sha224),cbc(aes))) (echainiv-authenc-hmac-sha224-cbc-aes-caam) [ 2.967791] alg: No test for echainiv(authenc(hmac(sha256),cbc(aes))) (echainiv-authenc-hmac-sha256-cbc-aes-caam) [ 2.978680] alg: No test for authenc(hmac(md5),cbc(des3_ede)) (authenc-hmac-md5-cbc-des3_ede-caam) [ 2.988204] alg: No test for echainiv(authenc(hmac(md5),cbc(des3_ede))) (echainiv-authenc-hmac-md5-cbc-des3_ede-caam) [ 2.999764] alg: No test for echainiv(authenc(hmac(sha1),cbc(des3_ede))) (echainiv-authenc-hmac-sha1-cbc-des3_ede-caam) [ 3.011477] alg: No test for echainiv(authenc(hmac(sha224),cbc(des3_ede))) (echainiv-authenc-hmac-sha224-cbc-des3_ede-caam) [ 3.023583] alg: No test for echainiv(authenc(hmac(sha256),cbc(des3_ede))) (echainiv-authenc-hmac-sha256-cbc-des3_ede-caam) [ 3.035376] alg: No test for authenc(hmac(md5),cbc(des)) (authenc-hmac-md5-cbc-des-caam) [ 3.044013] alg: No test for echainiv(authenc(hmac(md5),cbc(des))) (echainiv-authenc-hmac-md5-cbc-des-caam) [ 3.054668] alg: No test for echainiv(authenc(hmac(sha1),cbc(des))) (echainiv-authenc-hmac-sha1-cbc-des-caam) [ 3.065489] alg: No test for echainiv(authenc(hmac(sha224),cbc(des))) (echainiv-authenc-hmac-sha224-cbc-des-caam) [ 3.076658] alg: No test for echainiv(authenc(hmac(sha256),cbc(des))) (echainiv-authenc-hmac-sha256-cbc-des-caam) [ 3.087528] alg: No test for authenc(hmac(md5),rfc3686(ctr(aes))) (authenc-hmac-md5-rfc3686-ctr-aes-caam) [ 3.097680] alg: No test for seqiv(authenc(hmac(md5),rfc3686(ctr(aes)))) (seqiv-authenc-hmac-md5-rfc3686-ctr-aes-caam) [ 3.109169] alg: No test for seqiv(authenc(hmac(sha1),rfc3686(ctr(aes)))) (seqiv-authenc-hmac-sha1-rfc3686-ctr-aes-caam) [ 3.120670] alg: No test for authenc(hmac(sha224),rfc3686(ctr(aes))) (authenc-hmac-sha224-rfc3686-ctr-aes-caam) [ 3.131358] alg: No test for seqiv(authenc(hmac(sha224),rfc3686(ctr(aes)))) (seqiv-authenc-hmac-sha224-rfc3686-ctr-aes-caam) [ 3.143393] alg: No test for seqiv(authenc(hmac(sha256),rfc3686(ctr(aes)))) (seqiv-authenc-hmac-sha256-rfc3686-ctr-aes-caam) [ 3.155198] caam algorithms registered in /proc/crypto [ 3.171662] caam_jr 30901000.jr0: registering rng-caam [ 3.616749] caam 30900000.caam: caam pkc algorithms registered in /proc/crypto Chris Spencer (4): crypto: caam - fix detection of i.MX8 SoC crypto: caam - do not initialise clocks on the i.MX8 crypto: caam - correct DMA address size for the i.MX8 crypto: caam - use job ring for RNG instantiation instead of DECO drivers/crypto/caam/Makefile | 2 +- drivers/crypto/caam/ctrl.c | 587 ++++++------------------------ drivers/crypto/caam/desc_constr.h | 27 +- drivers/crypto/caam/inst_rng.c | 374 +++++++++++++++++++ drivers/crypto/caam/inst_rng.h | 18 + drivers/crypto/caam/intern.h | 5 +- drivers/crypto/caam/jr.c | 19 +- drivers/crypto/caam/pdb.h | 49 +-- drivers/crypto/caam/regs.h | 21 +- 9 files changed, 575 insertions(+), 527 deletions(-) create mode 100644 drivers/crypto/caam/inst_rng.c create mode 100644 drivers/crypto/caam/inst_rng.h -- 2.17.1