From patchwork Wed Jun 15 23:15:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Helgaas X-Patchwork-Id: 12883039 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9E91C43334 for ; Wed, 15 Jun 2022 23:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/RUk0/kTIm9TwP8hLIqhVBfxMYiXa3tNLAjCx6xLnEo=; b=4CFLHu/dYYVXTO AAwy/kmAq9bDpgkRYlGk+8FKQ+JEH540mBQizEjJuCA2S7Gkh8kOYtLPpSj9+/3lJcvXssxQf3PBY CC+OxQjvQajFIUNJCuheO+lLZaHThJBCAGK/RuRN+ZZSGnIA1QMFOcgCZmQx58J2vaSQpRDrPGXTz Zr996h3yGKIXvsCzt/0gt91WjPoQJ1CUSzztCzHQSSyNX1SNb9LqDAHAIYQuL8MvkVAv7NZoRqafD +Px8/Sjfv73Fze1iW8GhZX400vHHcGTkOuZFBLN/+pgX0JpGO95pFA56FIMxV1HofVidSQ2Dgmg3X hBFSGYyoUEO8T/4ZvjyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1cHO-00Gpqw-KY; Wed, 15 Jun 2022 23:18:30 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o1cFJ-00Gokb-25 for linux-arm-kernel@lists.infradead.org; Wed, 15 Jun 2022 23:16:22 +0000 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 87E82B821F7; Wed, 15 Jun 2022 23:16:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2D0EC3411A; Wed, 15 Jun 2022 23:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655334978; bh=V4zjeqs/MW9qGeVecOnDdm0aX5MRgdE+/XPrfaRGJOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RQ/DVBgE0biMDbO51l/bj0ujSHagDKrGVelfZfyLYW39UloPhtmDo3umogTTy4Pc6 ZxDPLafKqipRV8v//O13deY5q53bxFc7BEanZlqgUZaH6w1HWixrpfG2h71Q58l6Ka dhtAhKU2tUDu1HiO9lA0lxlEgPyrnpM7hB73AGWlf4StaeLGWcaAAlVXX8UsyvGB6P ATwye+6PyGbczlmNjOMD72sVqKlMin+w5am0ch/4Ymst7GvyNW0zspLe92eG4+/6hd kjadA+mcKYhXDIWqgIqWmYT9Wu57vbLlf3/izosfvjfWK1UqKNYbq6748HZdkrRF8x Dqlz2IrlPPzag== 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 07/13] PCI: imx6: Propagate .host_init() errors to caller Date: Wed, 15 Jun 2022 18:15:45 -0500 Message-Id: <20220615231551.1054753-8-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220615_161621_421530_87C0F93E X-CRM114-Status: GOOD ( 15.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Richard Zhu Since dw_pcie_host_init() checks for errors from ops->host_init(), check for errors when enabling power regulators and clocks and return them. [bhelgaas: commit log] Link: https://lore.kernel.org/r/1655189942-12678-3-git-send-email-hongxing.zhu@nxp.com Signed-off-by: Richard Zhu Signed-off-by: Bjorn Helgaas Reviewed-by: Lucas Stach --- drivers/pci/controller/dwc/pci-imx6.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index e36ca08a7c51..90ab9397a935 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -708,7 +708,7 @@ static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) imx6_pcie->gpio_active_high); } -static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) +static int imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) { struct dw_pcie *pci = imx6_pcie->pci; struct device *dev = pci->dev; @@ -719,7 +719,7 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) if (ret) { dev_err(dev, "failed to enable vpcie regulator: %d\n", ret); - return; + return ret; } } @@ -785,7 +785,7 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) msleep(100); } - return; + return 0; err_clks: if (imx6_pcie->vpcie && regulator_is_enabled(imx6_pcie->vpcie) > 0) { @@ -794,6 +794,7 @@ static void imx6_pcie_deassert_core_reset(struct imx6_pcie *imx6_pcie) dev_err(dev, "failed to disable vpcie regulator: %d\n", ret); } + return err; } static int imx6_pcie_wait_for_speed_change(struct imx6_pcie *imx6_pcie) @@ -912,11 +913,18 @@ static int imx6_pcie_start_link(struct dw_pcie *pci) static int imx6_pcie_host_init(struct pcie_port *pp) { struct dw_pcie *pci = to_dw_pcie_from_pp(pp); + struct device *dev = pci->dev; struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); + int ret; imx6_pcie_assert_core_reset(imx6_pcie); imx6_pcie_init_phy(imx6_pcie); - imx6_pcie_deassert_core_reset(imx6_pcie); + ret = imx6_pcie_deassert_core_reset(imx6_pcie); + if (ret < 0) { + dev_err(dev, "pcie host init failed: %d\n", ret); + return ret; + } + imx6_setup_phy_mpll(imx6_pcie); return 0;