From patchwork Wed Jun 15 23:15:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 12883028 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47285CCA473 for ; Wed, 15 Jun 2022 23:16:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356444AbiFOXQ4 (ORCPT ); Wed, 15 Jun 2022 19:16:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350792AbiFOXQg (ORCPT ); Wed, 15 Jun 2022 19:16:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD8363464E; Wed, 15 Jun 2022 16:16:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 63959B81FE1; Wed, 15 Jun 2022 23:16:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3152C3411A; Wed, 15 Jun 2022 23:16:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655334984; bh=dW1LoSHvZjh0g3Ks+7fF1K2Mo4Xweob8fflXZGetkLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GqU7Vu6k49begI+Z+OJvWmWLw2PHtnTl0CwR5k5b5RyrEDDj9qe+/30iOALkMfbNK 0AjvUG9RIqKUg/ghFaWYmzlA6lNFSxgkcCsANC4WfkTKHRys+BETY1E8NgmN0wVRdD wVpP7nmdgK5UBopiBj5GZR59xGcA03wwMfrbq6BhxlMLKS5/zhii3nhoOSuyniCScm 73EnSvH3H634MNjo2VD9CO/+L1YxAWWUzAJ7pFbIrzJQftdrB4spFT6YcDMiXufwS1 jVO9bY78jaRyprycy6w+0Ra+7l7Euz2PFq8N8clOZObIBvk5pQ/UAd0i1j7Ge4gT1k 6pW/TGRBjyKag== From: Bjorn Helgaas To: Richard Zhu , Lucas Stach , Rob Herring , Mark Brown , Lorenzo Pieralisi , Fabio Estevam , Francesco Dolcini Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, linux-imx@nxp.com, Bjorn Helgaas Subject: [PATCH v12 10/13] PCI: imx6: Mark the link down as non-fatal error Date: Wed, 15 Jun 2022 18:15:48 -0500 Message-Id: <20220615231551.1054753-11-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220615231551.1054753-1-helgaas@kernel.org> References: <20220615231551.1054753-1-helgaas@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Richard Zhu Let the driver probe successfully, return zero in imx6_pcie_start_link() when PCIe link is down. Link: https://lore.kernel.org/r/1655189942-12678-7-git-send-email-hongxing.zhu@nxp.com Signed-off-by: Richard Zhu Signed-off-by: Bjorn Helgaas --- drivers/pci/controller/dwc/pci-imx6.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 537b8a2e0e3b..7d3592540b8a 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -855,7 +855,9 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) /* Start LTSSM. */ imx6_pcie_ltssm_enable(dev); - dw_pcie_wait_for_link(pci); + ret = dw_pcie_wait_for_link(pci); + if (ret) + goto err_reset_phy; if (pci->link_gen == 2) { /* Allow Gen2 mode after the link is up. */ @@ -891,7 +893,9 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) } /* Make sure link training is finished as well! */ - dw_pcie_wait_for_link(pci); + ret = dw_pcie_wait_for_link(pci); + if (ret) + goto err_reset_phy; } else { dev_info(dev, "Link: Gen2 disabled\n"); } @@ -905,7 +909,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG0), dw_pcie_readl_dbi(pci, PCIE_PORT_DEBUG1)); imx6_pcie_reset_phy(imx6_pcie); - return ret; + return 0; } static int imx6_pcie_host_init(struct pcie_port *pp)