CC: [email protected]
CC: [email protected]
TO: Dhaval Shah <[email protected]>
CC: Michal Simek <[email protected]>
CC: Rohit Visavalia <[email protected]>

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.10
head:   f6f032f82f0a13def702a0154df535db88f43391
commit: 8403eb824c74c67f14360f6d33e499df3d8ca972 [1399/1756] soc: xilinx: vcu: 
Update vcu init/reset sequence
:::::: branch date: 5 days ago
:::::: commit date: 8 weeks ago
config: x86_64-randconfig-m001-20210718 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

New smatch warnings:
drivers/soc/xilinx/xlnx_vcu.c:661 xvcu_probe() warn: 'xvcu->aclk' not released 
on lines: 631.
drivers/soc/xilinx/xlnx_vcu.c:661 xvcu_probe() warn: 'xvcu->pll_ref' not 
released on lines: 631.

Old smatch warnings:
drivers/soc/xilinx/xlnx_vcu.c:482 xvcu_set_vcu_pll_info() warn: 'xvcu->pll_ref' 
not released on lines: 389,421.

vim +661 drivers/soc/xilinx/xlnx_vcu.c

cee8113a295acf Dhaval Shah       2017-12-21  534  
cee8113a295acf Dhaval Shah       2017-12-21  535  /**
cee8113a295acf Dhaval Shah       2017-12-21  536   * xvcu_probe - Probe 
existence of the logicoreIP
cee8113a295acf Dhaval Shah       2017-12-21  537   *                    and 
initialize PLL
cee8113a295acf Dhaval Shah       2017-12-21  538   *
cee8113a295acf Dhaval Shah       2017-12-21  539   * @pdev:     Pointer to the 
platform_device structure
cee8113a295acf Dhaval Shah       2017-12-21  540   *
cee8113a295acf Dhaval Shah       2017-12-21  541   * Return:    Returns 0 on 
success
cee8113a295acf Dhaval Shah       2017-12-21  542   *            Negative error 
code otherwise
cee8113a295acf Dhaval Shah       2017-12-21  543   */
cee8113a295acf Dhaval Shah       2017-12-21  544  static int xvcu_probe(struct 
platform_device *pdev)
cee8113a295acf Dhaval Shah       2017-12-21  545  {
cee8113a295acf Dhaval Shah       2017-12-21  546        struct resource *res;
cee8113a295acf Dhaval Shah       2017-12-21  547        struct xvcu_device 
*xvcu;
816934060798dc Michael Tretter   2020-11-09  548        void __iomem *regs;
cee8113a295acf Dhaval Shah       2017-12-21  549        int ret;
cee8113a295acf Dhaval Shah       2017-12-21  550  
cee8113a295acf Dhaval Shah       2017-12-21  551        xvcu = 
devm_kzalloc(&pdev->dev, sizeof(*xvcu), GFP_KERNEL);
cee8113a295acf Dhaval Shah       2017-12-21  552        if (!xvcu)
cee8113a295acf Dhaval Shah       2017-12-21  553                return -ENOMEM;
cee8113a295acf Dhaval Shah       2017-12-21  554  
cee8113a295acf Dhaval Shah       2017-12-21  555        xvcu->dev = &pdev->dev;
cee8113a295acf Dhaval Shah       2017-12-21  556        res = 
platform_get_resource_byname(pdev, IORESOURCE_MEM, "vcu_slcr");
cee8113a295acf Dhaval Shah       2017-12-21  557        if (!res) {
cee8113a295acf Dhaval Shah       2017-12-21  558                
dev_err(&pdev->dev, "get vcu_slcr memory resource failed.\n");
cee8113a295acf Dhaval Shah       2017-12-21  559                return -ENODEV;
cee8113a295acf Dhaval Shah       2017-12-21  560        }
cee8113a295acf Dhaval Shah       2017-12-21  561  
4bdc0d676a6431 Christoph Hellwig 2020-01-06  562        xvcu->vcu_slcr_ba = 
devm_ioremap(&pdev->dev, res->start,
cee8113a295acf Dhaval Shah       2017-12-21  563                                
                 resource_size(res));
cee8113a295acf Dhaval Shah       2017-12-21  564        if (!xvcu->vcu_slcr_ba) 
{
cee8113a295acf Dhaval Shah       2017-12-21  565                
dev_err(&pdev->dev, "vcu_slcr register mapping failed.\n");
cee8113a295acf Dhaval Shah       2017-12-21  566                return -ENOMEM;
cee8113a295acf Dhaval Shah       2017-12-21  567        }
cee8113a295acf Dhaval Shah       2017-12-21  568  
816934060798dc Michael Tretter   2020-11-09  569        xvcu->logicore_reg_ba =
816934060798dc Michael Tretter   2020-11-09  570                
syscon_regmap_lookup_by_compatible("xlnx,vcu-settings");
816934060798dc Michael Tretter   2020-11-09  571        if 
(IS_ERR(xvcu->logicore_reg_ba)) {
816934060798dc Michael Tretter   2020-11-09  572                
dev_info(&pdev->dev,
816934060798dc Michael Tretter   2020-11-09  573                         "could 
not find xlnx,vcu-settings: trying direct register access\n");
816934060798dc Michael Tretter   2020-11-09  574  
816934060798dc Michael Tretter   2020-11-09  575                res = 
platform_get_resource_byname(pdev,
816934060798dc Michael Tretter   2020-11-09  576                                
                   IORESOURCE_MEM, "logicore");
cee8113a295acf Dhaval Shah       2017-12-21  577                if (!res) {
cee8113a295acf Dhaval Shah       2017-12-21  578                        
dev_err(&pdev->dev, "get logicore memory resource failed.\n");
cee8113a295acf Dhaval Shah       2017-12-21  579                        return 
-ENODEV;
cee8113a295acf Dhaval Shah       2017-12-21  580                }
cee8113a295acf Dhaval Shah       2017-12-21  581  
816934060798dc Michael Tretter   2020-11-09  582                regs = 
devm_ioremap(&pdev->dev, res->start, resource_size(res));
816934060798dc Michael Tretter   2020-11-09  583                if (!regs) {
cee8113a295acf Dhaval Shah       2017-12-21  584                        
dev_err(&pdev->dev, "logicore register mapping failed.\n");
cee8113a295acf Dhaval Shah       2017-12-21  585                        return 
-ENOMEM;
cee8113a295acf Dhaval Shah       2017-12-21  586                }
cee8113a295acf Dhaval Shah       2017-12-21  587  
816934060798dc Michael Tretter   2020-11-09  588                
xvcu->logicore_reg_ba =
816934060798dc Michael Tretter   2020-11-09  589                        
devm_regmap_init_mmio(&pdev->dev, regs,
816934060798dc Michael Tretter   2020-11-09  590                                
              &vcu_settings_regmap_config);
816934060798dc Michael Tretter   2020-11-09  591                if 
(IS_ERR(xvcu->logicore_reg_ba)) {
816934060798dc Michael Tretter   2020-11-09  592                        
dev_err(&pdev->dev, "failed to init regmap\n");
816934060798dc Michael Tretter   2020-11-09  593                        return 
PTR_ERR(xvcu->logicore_reg_ba);
816934060798dc Michael Tretter   2020-11-09  594                }
816934060798dc Michael Tretter   2020-11-09  595        }
816934060798dc Michael Tretter   2020-11-09  596  
cee8113a295acf Dhaval Shah       2017-12-21  597        xvcu->aclk = 
devm_clk_get(&pdev->dev, "aclk");
cee8113a295acf Dhaval Shah       2017-12-21  598        if (IS_ERR(xvcu->aclk)) 
{
cee8113a295acf Dhaval Shah       2017-12-21  599                
dev_err(&pdev->dev, "Could not get aclk clock\n");
cee8113a295acf Dhaval Shah       2017-12-21  600                return 
PTR_ERR(xvcu->aclk);
cee8113a295acf Dhaval Shah       2017-12-21  601        }
cee8113a295acf Dhaval Shah       2017-12-21  602  
cee8113a295acf Dhaval Shah       2017-12-21  603        xvcu->pll_ref = 
devm_clk_get(&pdev->dev, "pll_ref");
cee8113a295acf Dhaval Shah       2017-12-21  604        if 
(IS_ERR(xvcu->pll_ref)) {
cee8113a295acf Dhaval Shah       2017-12-21  605                
dev_err(&pdev->dev, "Could not get pll_ref clock\n");
cee8113a295acf Dhaval Shah       2017-12-21  606                return 
PTR_ERR(xvcu->pll_ref);
cee8113a295acf Dhaval Shah       2017-12-21  607        }
cee8113a295acf Dhaval Shah       2017-12-21  608  
cee8113a295acf Dhaval Shah       2017-12-21  609        ret = 
clk_prepare_enable(xvcu->aclk);
cee8113a295acf Dhaval Shah       2017-12-21  610        if (ret) {
cee8113a295acf Dhaval Shah       2017-12-21  611                
dev_err(&pdev->dev, "aclk clock enable failed\n");
cee8113a295acf Dhaval Shah       2017-12-21  612                return ret;
cee8113a295acf Dhaval Shah       2017-12-21  613        }
cee8113a295acf Dhaval Shah       2017-12-21  614  
cee8113a295acf Dhaval Shah       2017-12-21  615        ret = 
clk_prepare_enable(xvcu->pll_ref);
cee8113a295acf Dhaval Shah       2017-12-21  616        if (ret) {
cee8113a295acf Dhaval Shah       2017-12-21  617                
dev_err(&pdev->dev, "pll_ref clock enable failed\n");
cee8113a295acf Dhaval Shah       2017-12-21  618                goto error_aclk;
cee8113a295acf Dhaval Shah       2017-12-21  619        }
cee8113a295acf Dhaval Shah       2017-12-21  620  
cee8113a295acf Dhaval Shah       2017-12-21  621        /*
cee8113a295acf Dhaval Shah       2017-12-21  622         * Do the Gasket 
isolation and put the VCU out of reset
cee8113a295acf Dhaval Shah       2017-12-21  623         * Bit 0 : Gasket 
isolation
cee8113a295acf Dhaval Shah       2017-12-21  624         * Bit 1 : put VCU out 
of reset
cee8113a295acf Dhaval Shah       2017-12-21  625         */
8403eb824c74c6 Dhaval Shah       2021-01-29  626        xvcu->reset_gpio = 
devm_gpiod_get_optional(&pdev->dev, "reset",
8403eb824c74c6 Dhaval Shah       2021-01-29  627                                
                   GPIOD_OUT_LOW);
8403eb824c74c6 Dhaval Shah       2021-01-29  628        if 
(IS_ERR(xvcu->reset_gpio)) {
8403eb824c74c6 Dhaval Shah       2021-01-29  629                ret = 
PTR_ERR(xvcu->reset_gpio);
8403eb824c74c6 Dhaval Shah       2021-01-29  630                
dev_err(&pdev->dev, "failed to get reset gpio for vcu.\n");
8403eb824c74c6 Dhaval Shah       2021-01-29  631                return ret;
8403eb824c74c6 Dhaval Shah       2021-01-29  632        }
8403eb824c74c6 Dhaval Shah       2021-01-29  633  
8403eb824c74c6 Dhaval Shah       2021-01-29  634        if (xvcu->reset_gpio) {
8403eb824c74c6 Dhaval Shah       2021-01-29  635                
gpiod_set_value(xvcu->reset_gpio, 0);
8403eb824c74c6 Dhaval Shah       2021-01-29  636                /* min 2 clock 
cycle of vcu pll_ref, slowest freq is 33.33KHz */
8403eb824c74c6 Dhaval Shah       2021-01-29  637                
usleep_range(60, 120);
8403eb824c74c6 Dhaval Shah       2021-01-29  638                
gpiod_set_value(xvcu->reset_gpio, 1);
8403eb824c74c6 Dhaval Shah       2021-01-29  639                
usleep_range(60, 120);
8403eb824c74c6 Dhaval Shah       2021-01-29  640        } else {
8403eb824c74c6 Dhaval Shah       2021-01-29  641                
dev_warn(&pdev->dev, "No reset gpio info from dts for vcu. This may lead to 
incorrect functionality if VCU isolation is removed post initialization.\n");
8403eb824c74c6 Dhaval Shah       2021-01-29  642        }
8403eb824c74c6 Dhaval Shah       2021-01-29  643  
816934060798dc Michael Tretter   2020-11-09  644        
regmap_write(xvcu->logicore_reg_ba, VCU_GASKET_INIT, VCU_GASKET_VALUE);
cee8113a295acf Dhaval Shah       2017-12-21  645  
cee8113a295acf Dhaval Shah       2017-12-21  646        /* Do the PLL Settings 
based on the ref clk,core and mcu clk freq */
cee8113a295acf Dhaval Shah       2017-12-21  647        ret = 
xvcu_set_pll(xvcu);
cee8113a295acf Dhaval Shah       2017-12-21  648        if (ret) {
cee8113a295acf Dhaval Shah       2017-12-21  649                
dev_err(&pdev->dev, "Failed to set the pll\n");
cee8113a295acf Dhaval Shah       2017-12-21  650                goto 
error_pll_ref;
cee8113a295acf Dhaval Shah       2017-12-21  651        }
cee8113a295acf Dhaval Shah       2017-12-21  652  
cee8113a295acf Dhaval Shah       2017-12-21  653        
dev_set_drvdata(&pdev->dev, xvcu);
cee8113a295acf Dhaval Shah       2017-12-21  654  
cee8113a295acf Dhaval Shah       2017-12-21  655        return 0;
cee8113a295acf Dhaval Shah       2017-12-21  656  
cee8113a295acf Dhaval Shah       2017-12-21  657  error_pll_ref:
cee8113a295acf Dhaval Shah       2017-12-21  658        
clk_disable_unprepare(xvcu->pll_ref);
cee8113a295acf Dhaval Shah       2017-12-21  659  error_aclk:
cee8113a295acf Dhaval Shah       2017-12-21  660        
clk_disable_unprepare(xvcu->aclk);
cee8113a295acf Dhaval Shah       2017-12-21 @661        return ret;
cee8113a295acf Dhaval Shah       2017-12-21  662  }
cee8113a295acf Dhaval Shah       2017-12-21  663  

:::::: The code at line 661 was first introduced by commit
:::::: cee8113a295acfc4cd25728d7c3d44e6bc3bbff9 soc: xilinx: xlnx_vcu: Add 
Xilinx ZYNQMP VCU logicoreIP init driver

:::::: TO: Dhaval Shah <[email protected]>
:::::: CC: Michal Simek <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to