From patchwork Thu May 24 14:36:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 10424917 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2571460327 for ; Thu, 24 May 2018 14:36:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31AD22951B for ; Thu, 24 May 2018 14:36:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2617D29620; Thu, 24 May 2018 14:36:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F01429614 for ; Thu, 24 May 2018 14:36:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970458AbeEXOgq (ORCPT ); Thu, 24 May 2018 10:36:46 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:42729 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970449AbeEXOgk (ORCPT ); Thu, 24 May 2018 10:36:40 -0400 Received: by mail-wr0-f195.google.com with SMTP id w10-v6so3563263wrk.9; Thu, 24 May 2018 07:36:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xGVSewyvnr7SLIDMtVcKqPt5EeRhEfZ6OxhzgQogU/s=; b=sNX0rHh1AfDhuynd5QeH02JdDj262R91/OdcZKp4H7UU7pN7qf4MFaeu+RXtQ+8nHb gysmWmSquei1aRfOj2Pb6DKWAYjonhrrHiBN/321j2ZiZMi9s5WkCEU0Iy7avaZvAifr /COK6xyM8/w0Y22HidgNLdp/Ijd4keKyDlPeG8Ol5/SHwaPcaYuAejGfxNja1PKkHCli aolAcE+Cfo+HzW3wXUXZipq8pfhnTfjBzreToC9KQuevB3P0sgnXp3I4nbFwThFzdMcm BD4DbDiHlLxhFYGB2t6XkYF3E3iVbdzWvQgP6Nj8LbeJ9epGf3D8tAgbJLWuUEggxIDf 0HdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xGVSewyvnr7SLIDMtVcKqPt5EeRhEfZ6OxhzgQogU/s=; b=Gu4K604n+l0nsj2PJHw1zdoMOGmmyJYYrJ0t2L/0b6VcT01TdLPhw9VJLHTylXiO3u /Yjopf4oobh63+LGQT3QT7VlSQQnr0YWn8iFqXGTG2cuZoZXxjaIuxSsD5tKTC4zoU4y 4z/lkOl6JfuodFmGgrKN6NsFieVX3JN1aWHWR+RYDMhgogvFSvSbydYuBcoOFT8H09Ts j2ppk21sfbspN0DnaMeJZSZ6aOqvxR1Bs9b18D3JLB4qwerzqCsTu6N4HLqu8zGf/udv zbgWMpnd8BjNtie6x/MEuHNa+yhQfdqvklJXKmGCcfZXaV/f2zRs2joL6dk0tKfIZduu 7/eA== X-Gm-Message-State: ALKqPwfW8iveDqXi1/CFF1VO3Pn4YGlyH30o1N29BZMtK0ModhdB/r6b gHHV92yXoRUguZMPYm5Ez5KpweE2 X-Google-Smtp-Source: AB8JxZpFv3mTWsZvJnCwDACRreWn90pD/mvJ5/FrymdsmLwS5DlsWUxo4S1gKIFxp0WZOsjqMLJwvA== X-Received: by 2002:adf:c358:: with SMTP id e24-v6mr2304773wrg.257.1527172598311; Thu, 24 May 2018 07:36:38 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id x17-v6sm14348276wmd.46.2018.05.24.07.36.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 May 2018 07:36:37 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: linux-pci@vger.kernel.org Cc: Marek Vasut , Geert Uytterhoeven , Lorenzo Pieralisi , Phil Edworthy , Simon Horman , Wolfram Sang , linux-renesas-soc@vger.kernel.org Subject: [PATCH v4 6/6] PCI: rcar: Shut the PHY down in failpath Date: Thu, 24 May 2018 16:36:24 +0200 Message-Id: <20180524143624.26718-7-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180524143624.26718-1-marek.vasut+renesas@gmail.com> References: <20180524143624.26718-1-marek.vasut+renesas@gmail.com> Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If anything fails past phy_init_fn() and the system is a Gen3 with a PHY, the PHY will be left on and inited. This is caused by the phy_init_fn, which is in fact a pointer to rcar_pcie_phy_init_gen3() function, which starts the PHY, yet has no counterpart in the failpath. Add that counterpart. Signed-off-by: Marek Vasut Cc: Geert Uytterhoeven Cc: Lorenzo Pieralisi Cc: Phil Edworthy Cc: Simon Horman Cc: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org Fixes: 517ca93a7159 ("PCI: rcar: Add R-Car gen3 PHY support") Reviewed-by: Geert Uytterhoeven Acked-by: Simon Horman --- V4: New patch --- drivers/pci/host/pcie-rcar.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c index 636c3c5095d2..695781934f0a 100644 --- a/drivers/pci/host/pcie-rcar.c +++ b/drivers/pci/host/pcie-rcar.c @@ -1163,7 +1163,7 @@ static int rcar_pcie_probe(struct platform_device *pdev) if (rcar_pcie_hw_init(pcie)) { dev_info(dev, "PCIe link down\n"); err = -ENODEV; - goto err_clk_disable; + goto err_phy_shutdown; } data = rcar_pci_read_reg(pcie, MACSR); @@ -1175,7 +1175,7 @@ static int rcar_pcie_probe(struct platform_device *pdev) dev_err(dev, "failed to enable MSI support: %d\n", err); - goto err_clk_disable; + goto err_phy_shutdown; } } @@ -1189,6 +1189,12 @@ static int rcar_pcie_probe(struct platform_device *pdev) if (IS_ENABLED(CONFIG_PCI_MSI)) rcar_pcie_teardown_msi(pcie); +err_phy_shutdown: + if (pcie->phy) { + phy_power_off(pcie->phy); + phy_exit(pcie->phy); + } + err_clk_disable: clk_disable_unprepare(pcie->bus_clk);