diff options
author | Shengzhou Liu <Shengzhou.Liu@freescale.com> | 2012-03-21 02:09:10 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2012-03-29 04:34:57 -0400 |
commit | a0ea0f6d17a6f14319069b039b7a9ebf54009678 (patch) | |
tree | b93604fcb422863fb01b60c38f0b3cc709eaa821 /drivers/crypto/caam | |
parent | 6a76a6992341faab0ef31e7d97000e0cf336d0ba (diff) |
crypto: caam - add backward compatible string sec4.0
In some device trees of previous version, there were string "fsl,sec4.0".
To be backward compatible with device trees, we have CAAM driver first
check "fsl,sec-v4.0", if it fails, then check for "fsl,sec4.0".
Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com>
Acked-by: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/caam')
-rw-r--r-- | drivers/crypto/caam/caamalg.c | 14 | ||||
-rw-r--r-- | drivers/crypto/caam/ctrl.c | 16 |
2 files changed, 26 insertions, 4 deletions
diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 534a36469d57..4eec389184d3 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c | |||
@@ -2267,8 +2267,11 @@ static void __exit caam_algapi_exit(void) | |||
2267 | int i, err; | 2267 | int i, err; |
2268 | 2268 | ||
2269 | dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0"); | 2269 | dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0"); |
2270 | if (!dev_node) | 2270 | if (!dev_node) { |
2271 | return; | 2271 | dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec4.0"); |
2272 | if (!dev_node) | ||
2273 | return; | ||
2274 | } | ||
2272 | 2275 | ||
2273 | pdev = of_find_device_by_node(dev_node); | 2276 | pdev = of_find_device_by_node(dev_node); |
2274 | if (!pdev) | 2277 | if (!pdev) |
@@ -2350,8 +2353,11 @@ static int __init caam_algapi_init(void) | |||
2350 | int i = 0, err = 0; | 2353 | int i = 0, err = 0; |
2351 | 2354 | ||
2352 | dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0"); | 2355 | dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec-v4.0"); |
2353 | if (!dev_node) | 2356 | if (!dev_node) { |
2354 | return -ENODEV; | 2357 | dev_node = of_find_compatible_node(NULL, NULL, "fsl,sec4.0"); |
2358 | if (!dev_node) | ||
2359 | return -ENODEV; | ||
2360 | } | ||
2355 | 2361 | ||
2356 | pdev = of_find_device_by_node(dev_node); | 2362 | pdev = of_find_device_by_node(dev_node); |
2357 | if (!pdev) | 2363 | if (!pdev) |
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index c5f61c55d923..77557ebcd337 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c | |||
@@ -98,6 +98,12 @@ static int caam_probe(struct platform_device *pdev) | |||
98 | rspec = 0; | 98 | rspec = 0; |
99 | for_each_compatible_node(np, NULL, "fsl,sec-v4.0-job-ring") | 99 | for_each_compatible_node(np, NULL, "fsl,sec-v4.0-job-ring") |
100 | rspec++; | 100 | rspec++; |
101 | if (!rspec) { | ||
102 | /* for backward compatible with device trees */ | ||
103 | for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring") | ||
104 | rspec++; | ||
105 | } | ||
106 | |||
101 | ctrlpriv->jrdev = kzalloc(sizeof(struct device *) * rspec, GFP_KERNEL); | 107 | ctrlpriv->jrdev = kzalloc(sizeof(struct device *) * rspec, GFP_KERNEL); |
102 | if (ctrlpriv->jrdev == NULL) { | 108 | if (ctrlpriv->jrdev == NULL) { |
103 | iounmap(&topregs->ctrl); | 109 | iounmap(&topregs->ctrl); |
@@ -111,6 +117,13 @@ static int caam_probe(struct platform_device *pdev) | |||
111 | ctrlpriv->total_jobrs++; | 117 | ctrlpriv->total_jobrs++; |
112 | ring++; | 118 | ring++; |
113 | } | 119 | } |
120 | if (!ring) { | ||
121 | for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring") { | ||
122 | caam_jr_probe(pdev, np, ring); | ||
123 | ctrlpriv->total_jobrs++; | ||
124 | ring++; | ||
125 | } | ||
126 | } | ||
114 | 127 | ||
115 | /* Check to see if QI present. If so, enable */ | 128 | /* Check to see if QI present. If so, enable */ |
116 | ctrlpriv->qi_present = !!(rd_reg64(&topregs->ctrl.perfmon.comp_parms) & | 129 | ctrlpriv->qi_present = !!(rd_reg64(&topregs->ctrl.perfmon.comp_parms) & |
@@ -226,6 +239,9 @@ static struct of_device_id caam_match[] = { | |||
226 | { | 239 | { |
227 | .compatible = "fsl,sec-v4.0", | 240 | .compatible = "fsl,sec-v4.0", |
228 | }, | 241 | }, |
242 | { | ||
243 | .compatible = "fsl,sec4.0", | ||
244 | }, | ||
229 | {}, | 245 | {}, |
230 | }; | 246 | }; |
231 | MODULE_DEVICE_TABLE(of, caam_match); | 247 | MODULE_DEVICE_TABLE(of, caam_match); |