aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorLEROY Christophe <christophe.leroy@c-s.fr>2015-04-17 10:32:05 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-04-20 21:14:41 -0400
commit21590888490ce2a46ff4703b1503f562f4a59571 (patch)
tree294bb6fe792885dda4fa1074d9b46e2d8e629fdc /drivers/crypto
parent5b841a65dcae3ac76dc34e56c948c629de48c1a3 (diff)
crypto: talitos - Add a feature to tag SEC1
We add a new feature in the features field, to mark compatible "fsl,sec1.0" We also define a helper function called has_ftr_sec1() to help functions quickly determine if they are running on SEC1 or SEC2+. When only SEC1 or SEC2 is compiled in, has_ftr_sec1() return trivial corresponding value. If both are compiled in, feature field is checked. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/talitos.c3
-rw-r--r--drivers/crypto/talitos.h17
2 files changed, 20 insertions, 0 deletions
diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index bca6dedb357d..db950236183d 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -2709,6 +2709,9 @@ static int talitos_probe(struct platform_device *ofdev)
2709 TALITOS_FTR_SHA224_HWINIT | 2709 TALITOS_FTR_SHA224_HWINIT |
2710 TALITOS_FTR_HMAC_OK; 2710 TALITOS_FTR_HMAC_OK;
2711 2711
2712 if (of_device_is_compatible(np, "fsl,sec1.0"))
2713 priv->features |= TALITOS_FTR_SEC1;
2714
2712 priv->chan = kzalloc(sizeof(struct talitos_channel) * 2715 priv->chan = kzalloc(sizeof(struct talitos_channel) *
2713 priv->num_channels, GFP_KERNEL); 2716 priv->num_channels, GFP_KERNEL);
2714 if (!priv->chan) { 2717 if (!priv->chan) {
diff --git a/drivers/crypto/talitos.h b/drivers/crypto/talitos.h
index f078da1d387a..b0bdb4ec79fc 100644
--- a/drivers/crypto/talitos.h
+++ b/drivers/crypto/talitos.h
@@ -156,6 +156,23 @@ extern int talitos_submit(struct device *dev, int ch, struct talitos_desc *desc,
156#define TALITOS_FTR_HW_AUTH_CHECK 0x00000002 156#define TALITOS_FTR_HW_AUTH_CHECK 0x00000002
157#define TALITOS_FTR_SHA224_HWINIT 0x00000004 157#define TALITOS_FTR_SHA224_HWINIT 0x00000004
158#define TALITOS_FTR_HMAC_OK 0x00000008 158#define TALITOS_FTR_HMAC_OK 0x00000008
159#define TALITOS_FTR_SEC1 0x00000010
160
161/*
162 * If both CONFIG_CRYPTO_DEV_TALITOS1 and CONFIG_CRYPTO_DEV_TALITOS2 are
163 * defined, we check the features which are set according to the device tree.
164 * Otherwise, we answer true or false directly
165 */
166static inline bool has_ftr_sec1(struct talitos_private *priv)
167{
168#if defined(CONFIG_CRYPTO_DEV_TALITOS1) && defined(CONFIG_CRYPTO_DEV_TALITOS2)
169 return priv->features & TALITOS_FTR_SEC1 ? true : false;
170#elif defined(CONFIG_CRYPTO_DEV_TALITOS1)
171 return true;
172#else
173 return false;
174#endif
175}
159 176
160/* 177/*
161 * TALITOS_xxx_LO addresses point to the low data bits (32-63) of the register 178 * TALITOS_xxx_LO addresses point to the low data bits (32-63) of the register