From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v3 4/4] PCI: j721e: Add support to provide refclk to PCIe connector
Date: Tue, 23 Feb 2021 01:17:19 +0800 [thread overview]
Message-ID: <202102230121.acDay2zX-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 16615 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210222114030.26445-5-kishon@ti.com>
References: <20210222114030.26445-5-kishon@ti.com>
TO: Kishon Vijay Abraham I <kishon@ti.com>
TO: Kishon Vijay Abraham I <kishon@ti.com>
TO: Bjorn Helgaas <helgaas@kernel.org>
TO: Rob Herring <robh+dt@kernel.org>
TO: Tom Joseph <tjoseph@cadence.com>
TO: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
CC: linux-pci(a)vger.kernel.org
CC: devicetree(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
CC: linux-arm-kernel(a)lists.infradead.org
Hi Kishon,
I love your patch! Perhaps something to improve:
[auto build test WARNING on pci/next]
[also build test WARNING on robh/for-next v5.11 next-20210222]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Kishon-Vijay-Abraham-I/AM64-Add-PCIe-bindings-and-driver-support/20210222-194422
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago
config: i386-randconfig-m021-20210222 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/pci/controller/cadence/pci-j721e.c:420 j721e_pcie_probe() warn: missing error code 'ret'
vim +/ret +420 drivers/pci/controller/cadence/pci-j721e.c
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 304
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 305 static int j721e_pcie_probe(struct platform_device *pdev)
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 306 {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 307 struct device *dev = &pdev->dev;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 308 struct device_node *node = dev->of_node;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 309 struct pci_host_bridge *bridge;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 310 struct j721e_pcie_data *data;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 311 struct cdns_pcie *cdns_pcie;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 312 struct j721e_pcie *pcie;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 313 struct cdns_pcie_rc *rc;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 314 struct cdns_pcie_ep *ep;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 315 struct gpio_desc *gpiod;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 316 void __iomem *base;
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 317 struct clk *clk;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 318 u32 num_lanes;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 319 u32 mode;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 320 int ret;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 321 int irq;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 322
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 323 data = (struct j721e_pcie_data *)of_device_get_match_data(dev);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 324 if (!data)
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 325 return -EINVAL;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 326
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 327 mode = (u32)data->mode;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 328
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 329 pcie = devm_kzalloc(dev, sizeof(*pcie), GFP_KERNEL);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 330 if (!pcie)
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 331 return -ENOMEM;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 332
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 333 pcie->dev = dev;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 334 pcie->mode = mode;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 335
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 336 base = devm_platform_ioremap_resource_byname(pdev, "intd_cfg");
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 337 if (IS_ERR(base))
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 338 return PTR_ERR(base);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 339 pcie->intd_cfg_base = base;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 340
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 341 base = devm_platform_ioremap_resource_byname(pdev, "user_cfg");
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 342 if (IS_ERR(base))
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 343 return PTR_ERR(base);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 344 pcie->user_cfg_base = base;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 345
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 346 ret = of_property_read_u32(node, "num-lanes", &num_lanes);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 347 if (ret || num_lanes > MAX_LANES)
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 348 num_lanes = 1;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 349 pcie->num_lanes = num_lanes;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 350
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 351 if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)))
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 352 return -EINVAL;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 353
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 354 irq = platform_get_irq_byname(pdev, "link_state");
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 355 if (irq < 0)
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 356 return irq;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 357
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 358 dev_set_drvdata(dev, pcie);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 359 pm_runtime_enable(dev);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 360 ret = pm_runtime_get_sync(dev);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 361 if (ret < 0) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 362 dev_err(dev, "pm_runtime_get_sync failed\n");
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 363 goto err_get_sync;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 364 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 365
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 366 ret = j721e_pcie_ctrl_init(pcie);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 367 if (ret < 0) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 368 dev_err(dev, "pm_runtime_get_sync failed\n");
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 369 goto err_get_sync;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 370 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 371
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 372 ret = devm_request_irq(dev, irq, j721e_pcie_link_irq_handler, 0,
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 373 "j721e-pcie-link-down-irq", pcie);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 374 if (ret < 0) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 375 dev_err(dev, "failed to request link state IRQ %d\n", irq);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 376 goto err_get_sync;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 377 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 378
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 379 j721e_pcie_config_link_irq(pcie);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 380
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 381 switch (mode) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 382 case PCI_MODE_RC:
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 383 if (!IS_ENABLED(CONFIG_PCIE_CADENCE_HOST)) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 384 ret = -ENODEV;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 385 goto err_get_sync;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 386 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 387
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 388 bridge = devm_pci_alloc_host_bridge(dev, sizeof(*rc));
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 389 if (!bridge) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 390 ret = -ENOMEM;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 391 goto err_get_sync;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 392 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 393
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 394 bridge->ops = &cdns_ti_pcie_host_ops;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 395 rc = pci_host_bridge_priv(bridge);
4740b969aaf58a Nadeem Athani 2021-02-09 396 rc->quirk_retrain_flag = data->quirk_retrain_flag;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 397
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 398 cdns_pcie = &rc->pcie;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 399 cdns_pcie->dev = dev;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 400 cdns_pcie->ops = &j721e_pcie_ops;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 401 pcie->cdns_pcie = cdns_pcie;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 402
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 403 gpiod = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 404 if (IS_ERR(gpiod)) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 405 ret = PTR_ERR(gpiod);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 406 if (ret != -EPROBE_DEFER)
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 407 dev_err(dev, "Failed to get reset GPIO\n");
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 408 goto err_get_sync;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 409 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 410
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 411 ret = cdns_pcie_init_phy(dev, cdns_pcie);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 412 if (ret) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 413 dev_err(dev, "Failed to init phy\n");
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 414 goto err_get_sync;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 415 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 416
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 417 clk = devm_clk_get_optional(dev, "pcie_refclk");
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 418 if (IS_ERR(clk)) {
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 419 dev_err(dev, "failed to get pcie_refclk\n");
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 @420 goto err_pcie_setup;
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 421 }
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 422
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 423 ret = clk_prepare_enable(clk);
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 424 if (ret) {
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 425 dev_err(dev, "failed to enable pcie_refclk\n");
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 426 goto err_get_sync;
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 427 }
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 428 pcie->refclk = clk;
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 429
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 430 /*
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 431 * "Power Sequencing and Reset Signal Timings" table in
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 432 * PCI EXPRESS CARD ELECTROMECHANICAL SPECIFICATION, REV. 3.0
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 433 * indicates PERST# should be deasserted after minimum of 100us
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 434 * once REFCLK is stable. The REFCLK to the connector in RC
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 435 * mode is selected while enabling the PHY. So deassert PERST#
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 436 * after 100 us.
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 437 */
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 438 if (gpiod) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 439 usleep_range(100, 200);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 440 gpiod_set_value_cansleep(gpiod, 1);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 441 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 442
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 443 ret = cdns_pcie_host_setup(rc);
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 444 if (ret < 0) {
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 445 clk_disable_unprepare(pcie->refclk);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 446 goto err_pcie_setup;
c77817a9fba361 Kishon Vijay Abraham I 2021-02-22 447 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 448
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 449 break;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 450 case PCI_MODE_EP:
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 451 if (!IS_ENABLED(CONFIG_PCIE_CADENCE_EP)) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 452 ret = -ENODEV;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 453 goto err_get_sync;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 454 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 455
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 456 ep = devm_kzalloc(dev, sizeof(*ep), GFP_KERNEL);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 457 if (!ep) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 458 ret = -ENOMEM;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 459 goto err_get_sync;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 460 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 461
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 462 cdns_pcie = &ep->pcie;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 463 cdns_pcie->dev = dev;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 464 cdns_pcie->ops = &j721e_pcie_ops;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 465 pcie->cdns_pcie = cdns_pcie;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 466
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 467 ret = cdns_pcie_init_phy(dev, cdns_pcie);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 468 if (ret) {
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 469 dev_err(dev, "Failed to init phy\n");
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 470 goto err_get_sync;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 471 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 472
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 473 ret = cdns_pcie_ep_setup(ep);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 474 if (ret < 0)
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 475 goto err_pcie_setup;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 476
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 477 break;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 478 default:
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 479 dev_err(dev, "INVALID device type %d\n", mode);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 480 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 481
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 482 return 0;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 483
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 484 err_pcie_setup:
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 485 cdns_pcie_disable_phy(cdns_pcie);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 486
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 487 err_get_sync:
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 488 pm_runtime_put(dev);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 489 pm_runtime_disable(dev);
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 490
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 491 return ret;
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 492 }
f3e25911a430ed Kishon Vijay Abraham I 2020-07-22 493
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 41663 bytes --]
next reply other threads:[~2021-02-22 17:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-22 17:17 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-02-22 11:40 [PATCH v3 0/4] AM64: Add PCIe bindings and driver support Kishon Vijay Abraham I
2021-02-22 11:40 ` [PATCH v3 4/4] PCI: j721e: Add support to provide refclk to PCIe connector Kishon Vijay Abraham I
2021-02-22 11:40 ` Kishon Vijay Abraham I
2021-02-23 7:50 ` Dan Carpenter
2021-02-23 7:50 ` Dan Carpenter
2021-02-23 7:50 ` Dan Carpenter
2021-02-23 7:50 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202102230121.acDay2zX-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.