|
18 | 18 | bool caam_little_end;
|
19 | 19 | EXPORT_SYMBOL(caam_little_end);
|
20 | 20 |
|
| 21 | +#ifdef CONFIG_CAAM_QI |
| 22 | +#include "qi.h" |
| 23 | +#endif |
| 24 | + |
21 | 25 | /*
|
22 | 26 | * i.MX targets tend to have clock control subsystems that can
|
23 | 27 | * enable/disable clocking to our device.
|
@@ -311,6 +315,11 @@ static int caam_remove(struct platform_device *pdev)
|
311 | 315 | for (ring = 0; ring < ctrlpriv->total_jobrs; ring++)
|
312 | 316 | of_device_unregister(ctrlpriv->jrpdev[ring]);
|
313 | 317 |
|
| 318 | +#ifdef CONFIG_CAAM_QI |
| 319 | + if (ctrlpriv->qidev) |
| 320 | + caam_qi_shutdown(ctrlpriv->qidev); |
| 321 | +#endif |
| 322 | + |
314 | 323 | /* De-initialize RNG state handles initialized by this driver. */
|
315 | 324 | if (ctrlpriv->rng4_sh_init)
|
316 | 325 | deinstantiate_rng(ctrldev, ctrlpriv->rng4_sh_init);
|
@@ -401,23 +410,6 @@ int caam_get_era(void)
|
401 | 410 | }
|
402 | 411 | EXPORT_SYMBOL(caam_get_era);
|
403 | 412 |
|
404 |
| -#ifdef CONFIG_DEBUG_FS |
405 |
| -static int caam_debugfs_u64_get(void *data, u64 *val) |
406 |
| -{ |
407 |
| - *val = caam64_to_cpu(*(u64 *)data); |
408 |
| - return 0; |
409 |
| -} |
410 |
| - |
411 |
| -static int caam_debugfs_u32_get(void *data, u64 *val) |
412 |
| -{ |
413 |
| - *val = caam32_to_cpu(*(u32 *)data); |
414 |
| - return 0; |
415 |
| -} |
416 |
| - |
417 |
| -DEFINE_SIMPLE_ATTRIBUTE(caam_fops_u32_ro, caam_debugfs_u32_get, NULL, "%llu\n"); |
418 |
| -DEFINE_SIMPLE_ATTRIBUTE(caam_fops_u64_ro, caam_debugfs_u64_get, NULL, "%llu\n"); |
419 |
| -#endif |
420 |
| - |
421 | 413 | /* Probe routine for CAAM top (controller) level */
|
422 | 414 | static int caam_probe(struct platform_device *pdev)
|
423 | 415 | {
|
@@ -615,6 +607,17 @@ static int caam_probe(struct platform_device *pdev)
|
615 | 607 | goto iounmap_ctrl;
|
616 | 608 | }
|
617 | 609 |
|
| 610 | +#ifdef CONFIG_DEBUG_FS |
| 611 | + /* |
| 612 | + * FIXME: needs better naming distinction, as some amalgamation of |
| 613 | + * "caam" and nprop->full_name. The OF name isn't distinctive, |
| 614 | + * but does separate instances |
| 615 | + */ |
| 616 | + perfmon = (struct caam_perfmon __force *)&ctrl->perfmon; |
| 617 | + |
| 618 | + ctrlpriv->dfs_root = debugfs_create_dir(dev_name(dev), NULL); |
| 619 | + ctrlpriv->ctl = debugfs_create_dir("ctl", ctrlpriv->dfs_root); |
| 620 | +#endif |
618 | 621 | ring = 0;
|
619 | 622 | ridx = 0;
|
620 | 623 | ctrlpriv->total_jobrs = 0;
|
@@ -650,6 +653,13 @@ static int caam_probe(struct platform_device *pdev)
|
650 | 653 | );
|
651 | 654 | /* This is all that's required to physically enable QI */
|
652 | 655 | wr_reg32(&ctrlpriv->qi->qi_control_lo, QICTL_DQEN);
|
| 656 | + |
| 657 | + /* If QMAN driver is present, init CAAM-QI backend */ |
| 658 | +#ifdef CONFIG_CAAM_QI |
| 659 | + ret = caam_qi_init(pdev); |
| 660 | + if (ret) |
| 661 | + dev_err(dev, "caam qi i/f init failed: %d\n", ret); |
| 662 | +#endif |
653 | 663 | }
|
654 | 664 |
|
655 | 665 | /* If no QI and no rings specified, quit and go home */
|
@@ -737,17 +747,6 @@ static int caam_probe(struct platform_device *pdev)
|
737 | 747 | ctrlpriv->total_jobrs, ctrlpriv->qi_present);
|
738 | 748 |
|
739 | 749 | #ifdef CONFIG_DEBUG_FS
|
740 |
| - /* |
741 |
| - * FIXME: needs better naming distinction, as some amalgamation of |
742 |
| - * "caam" and nprop->full_name. The OF name isn't distinctive, |
743 |
| - * but does separate instances |
744 |
| - */ |
745 |
| - perfmon = (struct caam_perfmon __force *)&ctrl->perfmon; |
746 |
| - |
747 |
| - ctrlpriv->dfs_root = debugfs_create_dir(dev_name(dev), NULL); |
748 |
| - ctrlpriv->ctl = debugfs_create_dir("ctl", ctrlpriv->dfs_root); |
749 |
| - |
750 |
| - /* Controller-level - performance monitor counters */ |
751 | 750 |
|
752 | 751 | ctrlpriv->ctl_rq_dequeued =
|
753 | 752 | debugfs_create_file("rq_dequeued",
|
@@ -830,6 +829,9 @@ static int caam_probe(struct platform_device *pdev)
|
830 | 829 | return 0;
|
831 | 830 |
|
832 | 831 | caam_remove:
|
| 832 | +#ifdef CONFIG_DEBUG_FS |
| 833 | + debugfs_remove_recursive(ctrlpriv->dfs_root); |
| 834 | +#endif |
833 | 835 | caam_remove(pdev);
|
834 | 836 | return ret;
|
835 | 837 |
|
|
0 commit comments