Skip to content

Commit 8e8ec59

Browse files
kimphillherbertx
authored andcommitted
crypto: caam - Add support for the Freescale SEC4/CAAM
The SEC4 supercedes the SEC2.x/3.x as Freescale's Integrated Security Engine. Its programming model is incompatible with all prior versions of the SEC (talitos). The SEC4 is also known as the Cryptographic Accelerator and Assurance Module (CAAM); this driver is named caam. This initial submission does not include support for Data Path mode operation - AEAD descriptors are submitted via the job ring interface, while the Queue Interface (QI) is enabled for use by others. Only AEAD algorithms are implemented at this time, for use with IPsec. Many thanks to the Freescale STC team for their contributions to this driver. Signed-off-by: Steve Cornelius <sec@pobox.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 60af520 commit 8e8ec59

17 files changed

Lines changed: 5441 additions & 1 deletion

File tree

‎Documentation/devicetree/bindings/crypto/fsl-sec4.txt‎

Lines changed: 409 additions & 0 deletions
Large diffs are not rendered by default.

‎arch/powerpc/boot/dts/p4080ds.dts‎

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* P4080DS Device Tree Source
33
*
4-
* Copyright 2009 Freescale Semiconductor Inc.
4+
* Copyright 2009-2011 Freescale Semiconductor Inc.
55
*
66
* This program is free software; you can redistribute it and/or modify it
77
* under the terms of the GNU General Public License as published by the
@@ -33,6 +33,17 @@
3333
dma1 = &dma1;
3434
sdhc = &sdhc;
3535

36+
crypto = &crypto;
37+
sec_jr0 = &sec_jr0;
38+
sec_jr1 = &sec_jr1;
39+
sec_jr2 = &sec_jr2;
40+
sec_jr3 = &sec_jr3;
41+
rtic_a = &rtic_a;
42+
rtic_b = &rtic_b;
43+
rtic_c = &rtic_c;
44+
rtic_d = &rtic_d;
45+
sec_mon = &sec_mon;
46+
3647
rio0 = &rapidio0;
3748
};
3849

@@ -410,6 +421,88 @@
410421
dr_mode = "host";
411422
phy_type = "ulpi";
412423
};
424+
425+
crypto: crypto@300000 {
426+
compatible = "fsl,p4080-sec4.0", "fsl,sec4.0";
427+
#address-cells = <1>;
428+
#size-cells = <1>;
429+
reg = <0x300000 0x10000>;
430+
ranges = <0 0x300000 0x10000>;
431+
interrupt-parent = <&mpic>;
432+
interrupts = <92 2>;
433+
434+
sec_jr0: jr@1000 {
435+
compatible = "fsl,p4080-sec4.0-job-ring",
436+
"fsl,sec4.0-job-ring";
437+
reg = <0x1000 0x1000>;
438+
interrupt-parent = <&mpic>;
439+
interrupts = <88 2>;
440+
};
441+
442+
sec_jr1: jr@2000 {
443+
compatible = "fsl,p4080-sec4.0-job-ring",
444+
"fsl,sec4.0-job-ring";
445+
reg = <0x2000 0x1000>;
446+
interrupt-parent = <&mpic>;
447+
interrupts = <89 2>;
448+
};
449+
450+
sec_jr2: jr@3000 {
451+
compatible = "fsl,p4080-sec4.0-job-ring",
452+
"fsl,sec4.0-job-ring";
453+
reg = <0x3000 0x1000>;
454+
interrupt-parent = <&mpic>;
455+
interrupts = <90 2>;
456+
};
457+
458+
sec_jr3: jr@4000 {
459+
compatible = "fsl,p4080-sec4.0-job-ring",
460+
"fsl,sec4.0-job-ring";
461+
reg = <0x4000 0x1000>;
462+
interrupt-parent = <&mpic>;
463+
interrupts = <91 2>;
464+
};
465+
466+
rtic@6000 {
467+
compatible = "fsl,p4080-sec4.0-rtic",
468+
"fsl,sec4.0-rtic";
469+
#address-cells = <1>;
470+
#size-cells = <1>;
471+
reg = <0x6000 0x100>;
472+
ranges = <0x0 0x6100 0xe00>;
473+
474+
rtic_a: rtic-a@0 {
475+
compatible = "fsl,p4080-sec4.0-rtic-memory",
476+
"fsl,sec4.0-rtic-memory";
477+
reg = <0x00 0x20 0x100 0x80>;
478+
};
479+
480+
rtic_b: rtic-b@20 {
481+
compatible = "fsl,p4080-sec4.0-rtic-memory",
482+
"fsl,sec4.0-rtic-memory";
483+
reg = <0x20 0x20 0x200 0x80>;
484+
};
485+
486+
rtic_c: rtic-c@40 {
487+
compatible = "fsl,p4080-sec4.0-rtic-memory",
488+
"fsl,sec4.0-rtic-memory";
489+
reg = <0x40 0x20 0x300 0x80>;
490+
};
491+
492+
rtic_d: rtic-d@60 {
493+
compatible = "fsl,p4080-sec4.0-rtic-memory",
494+
"fsl,sec4.0-rtic-memory";
495+
reg = <0x60 0x20 0x500 0x80>;
496+
};
497+
};
498+
};
499+
500+
sec_mon: sec_mon@314000 {
501+
compatible = "fsl,p4080-sec4.0-mon", "fsl,sec4.0-mon";
502+
reg = <0x314000 0x1000>;
503+
interrupt-parent = <&mpic>;
504+
interrupts = <93 2>;
505+
};
413506
};
414507

415508
rapidio0: rapidio@ffe0c0000 {

‎drivers/crypto/Kconfig‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ config CRYPTO_DEV_HIFN_795X_RNG
200200
Select this option if you want to enable the random number generator
201201
on the HIFN 795x crypto adapters.
202202

203+
source drivers/crypto/caam/Kconfig
204+
203205
config CRYPTO_DEV_TALITOS
204206
tristate "Talitos Freescale Security Engine (SEC)"
205207
select CRYPTO_ALGAPI

‎drivers/crypto/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ n2_crypto-y := n2_core.o n2_asm.o
66
obj-$(CONFIG_CRYPTO_DEV_HIFN_795X) += hifn_795x.o
77
obj-$(CONFIG_CRYPTO_DEV_MV_CESA) += mv_cesa.o
88
obj-$(CONFIG_CRYPTO_DEV_TALITOS) += talitos.o
9+
obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM) += caam/
910
obj-$(CONFIG_CRYPTO_DEV_IXP4XX) += ixp4xx_crypto.o
1011
obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += amcc/
1112
obj-$(CONFIG_CRYPTO_DEV_OMAP_SHAM) += omap-sham.o

‎drivers/crypto/caam/Kconfig‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
config CRYPTO_DEV_FSL_CAAM
2+
tristate "Freescale CAAM-Multicore driver backend"
3+
depends on FSL_SOC
4+
help
5+
Enables the driver module for Freescale's Cryptographic Accelerator
6+
and Assurance Module (CAAM), also known as the SEC version 4 (SEC4).
7+
This module adds a job ring operation interface, and configures h/w
8+
to operate as a DPAA component automatically, depending
9+
on h/w feature availability.
10+
11+
To compile this driver as a module, choose M here: the module
12+
will be called caam.
13+
14+
config CRYPTO_DEV_FSL_CAAM_RINGSIZE
15+
int "Job Ring size"
16+
depends on CRYPTO_DEV_FSL_CAAM
17+
range 2 9
18+
default "9"
19+
help
20+
Select size of Job Rings as a power of 2, within the
21+
range 2-9 (ring size 4-512).
22+
Examples:
23+
2 => 4
24+
3 => 8
25+
4 => 16
26+
5 => 32
27+
6 => 64
28+
7 => 128
29+
8 => 256
30+
9 => 512
31+
32+
config CRYPTO_DEV_FSL_CAAM_INTC
33+
bool "Job Ring interrupt coalescing"
34+
depends on CRYPTO_DEV_FSL_CAAM
35+
default y
36+
help
37+
Enable the Job Ring's interrupt coalescing feature.
38+
39+
config CRYPTO_DEV_FSL_CAAM_INTC_COUNT_THLD
40+
int "Job Ring interrupt coalescing count threshold"
41+
depends on CRYPTO_DEV_FSL_CAAM_INTC
42+
range 1 255
43+
default 255
44+
help
45+
Select number of descriptor completions to queue before
46+
raising an interrupt, in the range 1-255. Note that a selection
47+
of 1 functionally defeats the coalescing feature, and a selection
48+
equal or greater than the job ring size will force timeouts.
49+
50+
config CRYPTO_DEV_FSL_CAAM_INTC_TIME_THLD
51+
int "Job Ring interrupt coalescing timer threshold"
52+
depends on CRYPTO_DEV_FSL_CAAM_INTC
53+
range 1 65535
54+
default 2048
55+
help
56+
Select number of bus clocks/64 to timeout in the case that one or
57+
more descriptor completions are queued without reaching the count
58+
threshold. Range is 1-65535.
59+
60+
config CRYPTO_DEV_FSL_CAAM_CRYPTO_API
61+
tristate "Register algorithm implementations with the Crypto API"
62+
depends on CRYPTO_DEV_FSL_CAAM
63+
default y
64+
select CRYPTO_ALGAPI
65+
select CRYPTO_AUTHENC
66+
help
67+
Selecting this will offload crypto for users of the
68+
scatterlist crypto API (such as the linux native IPSec
69+
stack) to the SEC4 via job ring.
70+
71+
To compile this as a module, choose M here: the module
72+
will be called caamalg.

‎drivers/crypto/caam/Makefile‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#
2+
# Makefile for the CAAM backend and dependent components
3+
#
4+
5+
obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM) += caam.o
6+
obj-$(CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API) += caamalg.o
7+
8+
caam-objs := ctrl.o jr.o error.o

0 commit comments

Comments
 (0)