ctrl.c (374ed5429346a021c8e2d26fafce14c5b15dedd0) | ctrl.c (1b46c90c8e002028dc622bf7bd8cf89efcaab274) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2/* * CAAM control-plane driver backend 3 * Controller-level driver, kernel property detection, initialization 4 * 5 * Copyright 2008-2012 Freescale Semiconductor, Inc. | 1// SPDX-License-Identifier: GPL-2.0+ 2/* * CAAM control-plane driver backend 3 * Controller-level driver, kernel property detection, initialization 4 * 5 * Copyright 2008-2012 Freescale Semiconductor, Inc. |
6 * Copyright 2018 NXP | 6 * Copyright 2018-2019 NXP |
7 */ 8 9#include <linux/device.h> 10#include <linux/of_address.h> 11#include <linux/of_irq.h> 12#include <linux/sys_soc.h> 13 14#include "compat.h" --- 683 unchanged lines hidden (view full) --- 698 } 699 if (ret) { 700 dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n", ret); 701 goto iounmap_ctrl; 702 } 703 704 ctrlpriv->era = caam_get_era(ctrl); 705 | 7 */ 8 9#include <linux/device.h> 10#include <linux/of_address.h> 11#include <linux/of_irq.h> 12#include <linux/sys_soc.h> 13 14#include "compat.h" --- 683 unchanged lines hidden (view full) --- 698 } 699 if (ret) { 700 dev_err(dev, "dma_set_mask_and_coherent failed (%d)\n", ret); 701 goto iounmap_ctrl; 702 } 703 704 ctrlpriv->era = caam_get_era(ctrl); 705 |
706 ret = of_platform_populate(nprop, caam_match, NULL, dev); 707 if (ret) { 708 dev_err(dev, "JR platform devices creation error\n"); 709 goto iounmap_ctrl; 710 } 711 | |
712#ifdef CONFIG_DEBUG_FS 713 /* 714 * FIXME: needs better naming distinction, as some amalgamation of 715 * "caam" and nprop->full_name. The OF name isn't distinctive, 716 * but does separate instances 717 */ 718 perfmon = (struct caam_perfmon __force *)&ctrl->perfmon; 719 720 ctrlpriv->dfs_root = debugfs_create_dir(dev_name(dev), NULL); 721 ctrlpriv->ctl = debugfs_create_dir("ctl", ctrlpriv->dfs_root); 722#endif 723 | 706#ifdef CONFIG_DEBUG_FS 707 /* 708 * FIXME: needs better naming distinction, as some amalgamation of 709 * "caam" and nprop->full_name. The OF name isn't distinctive, 710 * but does separate instances 711 */ 712 perfmon = (struct caam_perfmon __force *)&ctrl->perfmon; 713 714 ctrlpriv->dfs_root = debugfs_create_dir(dev_name(dev), NULL); 715 ctrlpriv->ctl = debugfs_create_dir("ctl", ctrlpriv->dfs_root); 716#endif 717 |
724 ring = 0; 725 for_each_available_child_of_node(nprop, np) 726 if (of_device_is_compatible(np, "fsl,sec-v4.0-job-ring") || 727 of_device_is_compatible(np, "fsl,sec4.0-job-ring")) { 728 ctrlpriv->jr[ring] = (struct caam_job_ring __iomem __force *) 729 ((__force uint8_t *)ctrl + 730 (ring + JR_BLOCK_NUMBER) * 731 BLOCK_OFFSET 732 ); 733 ctrlpriv->total_jobrs++; 734 ring++; 735 } 736 | |
737 /* Check to see if (DPAA 1.x) QI present. If so, enable */ 738 ctrlpriv->qi_present = !!(comp_params & CTPR_MS_QI_MASK); 739 if (ctrlpriv->qi_present && !caam_dpaa2) { 740 ctrlpriv->qi = (struct caam_queue_if __iomem __force *) 741 ((__force uint8_t *)ctrl + 742 BLOCK_OFFSET * QI_BLOCK_NUMBER 743 ); 744 /* This is all that's required to physically enable QI */ 745 wr_reg32(&ctrlpriv->qi->qi_control_lo, QICTL_DQEN); 746 747 /* If QMAN driver is present, init CAAM-QI backend */ 748#ifdef CONFIG_CAAM_QI 749 ret = caam_qi_init(pdev); 750 if (ret) 751 dev_err(dev, "caam qi i/f init failed: %d\n", ret); 752#endif 753 } 754 | 718 /* Check to see if (DPAA 1.x) QI present. If so, enable */ 719 ctrlpriv->qi_present = !!(comp_params & CTPR_MS_QI_MASK); 720 if (ctrlpriv->qi_present && !caam_dpaa2) { 721 ctrlpriv->qi = (struct caam_queue_if __iomem __force *) 722 ((__force uint8_t *)ctrl + 723 BLOCK_OFFSET * QI_BLOCK_NUMBER 724 ); 725 /* This is all that's required to physically enable QI */ 726 wr_reg32(&ctrlpriv->qi->qi_control_lo, QICTL_DQEN); 727 728 /* If QMAN driver is present, init CAAM-QI backend */ 729#ifdef CONFIG_CAAM_QI 730 ret = caam_qi_init(pdev); 731 if (ret) 732 dev_err(dev, "caam qi i/f init failed: %d\n", ret); 733#endif 734 } 735 |
736 ret = of_platform_populate(nprop, caam_match, NULL, dev); 737 if (ret) { 738 dev_err(dev, "JR platform devices creation error\n"); 739 goto shutdown_qi; 740 } 741 742 ring = 0; 743 for_each_available_child_of_node(nprop, np) 744 if (of_device_is_compatible(np, "fsl,sec-v4.0-job-ring") || 745 of_device_is_compatible(np, "fsl,sec4.0-job-ring")) { 746 ctrlpriv->jr[ring] = (struct caam_job_ring __iomem __force *) 747 ((__force uint8_t *)ctrl + 748 (ring + JR_BLOCK_NUMBER) * 749 BLOCK_OFFSET 750 ); 751 ctrlpriv->total_jobrs++; 752 ring++; 753 } 754 |
|
755 /* If no QI and no rings specified, quit and go home */ 756 if ((!ctrlpriv->qi_present) && (!ctrlpriv->total_jobrs)) { 757 dev_err(dev, "no queues configured, terminating\n"); 758 ret = -ENOMEM; 759 goto caam_remove; 760 } 761 762 if (ctrlpriv->era < 10) --- 130 unchanged lines hidden (view full) --- 893 &ctrlpriv->ctl_tdsk_wrap); 894#endif 895 return 0; 896 897caam_remove: 898 caam_remove(pdev); 899 return ret; 900 | 755 /* If no QI and no rings specified, quit and go home */ 756 if ((!ctrlpriv->qi_present) && (!ctrlpriv->total_jobrs)) { 757 dev_err(dev, "no queues configured, terminating\n"); 758 ret = -ENOMEM; 759 goto caam_remove; 760 } 761 762 if (ctrlpriv->era < 10) --- 130 unchanged lines hidden (view full) --- 893 &ctrlpriv->ctl_tdsk_wrap); 894#endif 895 return 0; 896 897caam_remove: 898 caam_remove(pdev); 899 return ret; 900 |
901shutdown_qi: 902#ifdef CONFIG_CAAM_QI 903 if (ctrlpriv->qidev) 904 caam_qi_shutdown(ctrlpriv->qidev); 905#endif |
|
901iounmap_ctrl: 902 iounmap(ctrl); 903disable_caam_emi_slow: 904 if (ctrlpriv->caam_emi_slow) 905 clk_disable_unprepare(ctrlpriv->caam_emi_slow); 906disable_caam_aclk: 907 clk_disable_unprepare(ctrlpriv->caam_aclk); 908disable_caam_mem: --- 21 unchanged lines hidden --- | 906iounmap_ctrl: 907 iounmap(ctrl); 908disable_caam_emi_slow: 909 if (ctrlpriv->caam_emi_slow) 910 clk_disable_unprepare(ctrlpriv->caam_emi_slow); 911disable_caam_aclk: 912 clk_disable_unprepare(ctrlpriv->caam_aclk); 913disable_caam_mem: --- 21 unchanged lines hidden --- |