mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
crypto: caam - Fix job ring discovery in controller driver
The SEC Controller driver creates platform devices for it's child job ring nodes. Currently the driver uses for_each_compatible routine which traverses the whole device tree to create the job rings for the platform device. The patch changes this to search for the compatible property of job ring only in the child nodes i.e., the job rings are created as per the number of children associated with the crypto node. Signed-off-by: Nitesh Lal <NiteshNarayanLal@freescale.com> Reviewed-by: Horia Geanta <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
2021abaa00
commit
0a63b09dd6
1 changed files with 6 additions and 19 deletions
|
@ -443,13 +443,10 @@ static int caam_probe(struct platform_device *pdev)
|
||||||
* for all, then go probe each one.
|
* for all, then go probe each one.
|
||||||
*/
|
*/
|
||||||
rspec = 0;
|
rspec = 0;
|
||||||
for_each_compatible_node(np, NULL, "fsl,sec-v4.0-job-ring")
|
for_each_available_child_of_node(nprop, np)
|
||||||
rspec++;
|
if (of_device_is_compatible(np, "fsl,sec-v4.0-job-ring") ||
|
||||||
if (!rspec) {
|
of_device_is_compatible(np, "fsl,sec4.0-job-ring"))
|
||||||
/* for backward compatible with device trees */
|
|
||||||
for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring")
|
|
||||||
rspec++;
|
rspec++;
|
||||||
}
|
|
||||||
|
|
||||||
ctrlpriv->jrpdev = kzalloc(sizeof(struct platform_device *) * rspec,
|
ctrlpriv->jrpdev = kzalloc(sizeof(struct platform_device *) * rspec,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
@ -460,18 +457,9 @@ static int caam_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
ring = 0;
|
ring = 0;
|
||||||
ctrlpriv->total_jobrs = 0;
|
ctrlpriv->total_jobrs = 0;
|
||||||
for_each_compatible_node(np, NULL, "fsl,sec-v4.0-job-ring") {
|
for_each_available_child_of_node(nprop, np)
|
||||||
ctrlpriv->jrpdev[ring] =
|
if (of_device_is_compatible(np, "fsl,sec-v4.0-job-ring") ||
|
||||||
of_platform_device_create(np, NULL, dev);
|
of_device_is_compatible(np, "fsl,sec4.0-job-ring")) {
|
||||||
if (!ctrlpriv->jrpdev[ring]) {
|
|
||||||
pr_warn("JR%d Platform device creation error\n", ring);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ctrlpriv->total_jobrs++;
|
|
||||||
ring++;
|
|
||||||
}
|
|
||||||
if (!ring) {
|
|
||||||
for_each_compatible_node(np, NULL, "fsl,sec4.0-job-ring") {
|
|
||||||
ctrlpriv->jrpdev[ring] =
|
ctrlpriv->jrpdev[ring] =
|
||||||
of_platform_device_create(np, NULL, dev);
|
of_platform_device_create(np, NULL, dev);
|
||||||
if (!ctrlpriv->jrpdev[ring]) {
|
if (!ctrlpriv->jrpdev[ring]) {
|
||||||
|
@ -482,7 +470,6 @@ static int caam_probe(struct platform_device *pdev)
|
||||||
ctrlpriv->total_jobrs++;
|
ctrlpriv->total_jobrs++;
|
||||||
ring++;
|
ring++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Check to see if QI present. If so, enable */
|
/* Check to see if QI present. If so, enable */
|
||||||
ctrlpriv->qi_present = !!(rd_reg64(&topregs->ctrl.perfmon.comp_parms) &
|
ctrlpriv->qi_present = !!(rd_reg64(&topregs->ctrl.perfmon.comp_parms) &
|
||||||
|
|
Loading…
Reference in a new issue