]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: sun8i-ce - add Allwinner H616 support
authorAndre Przywara <andre.przywara@arm.com>
Mon, 24 Jun 2024 23:21:09 +0000 (00:21 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 6 Jul 2024 00:20:00 +0000 (10:20 +1000)
The crypto engine in the Allwinner H616 is very similar to the H6, but
needs the base address for the task descriptor and the addresses within
it to be expressed in words, not in bytes.

Add a new variant struct entry for the H616, and set the new flag to
mark the use of 34 bit addresses. Also the internal 32K oscillator is
required for TRNG operation, so specify all four clocks.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Tested-by: Ryan Walklin <ryan@testtoast.com>
Tested-by: Philippe Simons <simons.philippe@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c

index 6d45c1e559f7d3c787c3b83fe118b7e2b47fb842..e55e58e164db32b4b1ae04d6ef9069f5783a4cef 100644 (file)
@@ -92,6 +92,30 @@ static const struct ce_variant ce_h6_variant = {
        .trng = CE_ALG_TRNG_V2,
 };
 
+static const struct ce_variant ce_h616_variant = {
+       .alg_cipher = { CE_ALG_AES, CE_ALG_DES, CE_ALG_3DES,
+       },
+       .alg_hash = { CE_ALG_MD5, CE_ALG_SHA1, CE_ALG_SHA224, CE_ALG_SHA256,
+               CE_ALG_SHA384, CE_ALG_SHA512
+       },
+       .op_mode = { CE_OP_ECB, CE_OP_CBC
+       },
+       .cipher_t_dlen_in_bytes = true,
+       .hash_t_dlen_in_bits = true,
+       .prng_t_dlen_in_bytes = true,
+       .trng_t_dlen_in_bytes = true,
+       .needs_word_addresses = true,
+       .ce_clks = {
+               { "bus", 0, 200000000 },
+               { "mod", 300000000, 0 },
+               { "ram", 0, 400000000 },
+               { "trng", 0, 0 },
+               },
+       .esr = ESR_H6,
+       .prng = CE_ALG_PRNG_V2,
+       .trng = CE_ALG_TRNG_V2,
+};
+
 static const struct ce_variant ce_a64_variant = {
        .alg_cipher = { CE_ALG_AES, CE_ALG_DES, CE_ALG_3DES,
        },
@@ -1097,6 +1121,8 @@ static const struct of_device_id sun8i_ce_crypto_of_match_table[] = {
          .data = &ce_h5_variant },
        { .compatible = "allwinner,sun50i-h6-crypto",
          .data = &ce_h6_variant },
+       { .compatible = "allwinner,sun50i-h616-crypto",
+         .data = &ce_h616_variant },
        {}
 };
 MODULE_DEVICE_TABLE(of, sun8i_ce_crypto_of_match_table);