From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83997C433F5 for ; Fri, 15 Oct 2021 18:22:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6264860FE3 for ; Fri, 15 Oct 2021 18:22:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242586AbhJOSYy (ORCPT ); Fri, 15 Oct 2021 14:24:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234813AbhJOSYw (ORCPT ); Fri, 15 Oct 2021 14:24:52 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F178EC061570 for ; Fri, 15 Oct 2021 11:22:45 -0700 (PDT) Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbRqp-0001OM-Qj; Fri, 15 Oct 2021 20:22:39 +0200 Message-ID: <8f855cf445e2b7827524d5d4adfba80d3a924c60.camel@pengutronix.de> Subject: Re: [RESEND v2 3/5] PCI: imx6: Fix the regulator dump when link never came up From: Lucas Stach To: Richard Zhu , bhelgaas@google.com, lorenzo.pieralisi@arm.com Cc: linux-pci@vger.kernel.org, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Date: Fri, 15 Oct 2021 20:22:38 +0200 In-Reply-To: <1634277941-6672-4-git-send-email-hongxing.zhu@nxp.com> References: <1634277941-6672-1-git-send-email-hongxing.zhu@nxp.com> <1634277941-6672-4-git-send-email-hongxing.zhu@nxp.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.40.4 (3.40.4-1.fc34) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Freitag, dem 15.10.2021 um 14:05 +0800 schrieb Richard Zhu: > When PCIe PHY link never came up and vpcie regulator is present, there > would be following dump when try to put the regulator. > Disable this regulator to fix this dump when link never came up. > > imx6q-pcie 33800000.pcie: Phy link never came up > imx6q-pcie: probe of 33800000.pcie failed with error -110 > ------------[ cut here ]------------ > WARNING: CPU: 3 PID: 119 at drivers/regulator/core.c:2256 _regulator_put.part.0+0x14c/0x158 > Modules linked in: > CPU: 3 PID: 119 Comm: kworker/u8:2 Not tainted 5.13.0-rc7-next-20210625-94710-ge4e92b2588a3 #10 > Hardware name: FSL i.MX8MM EVK board (DT) > Workqueue: events_unbound async_run_entry_fn > pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--) > pc : _regulator_put.part.0+0x14c/0x158 > lr : regulator_put+0x34/0x48 > sp : ffff8000122ebb30 > x29: ffff8000122ebb30 x28: ffff800011be7000 x27: 0000000000000000 > x26: 0000000000000000 x25: 0000000000000000 x24: ffff00000025f2bc > x23: ffff00000025f2c0 x22: ffff00000025f010 x21: ffff8000122ebc18 > x20: ffff800011e3fa60 x19: ffff00000375fd80 x18: 0000000000000010 > x17: 000000040044ffff x16: 00400032b5503510 x15: 0000000000000108 > x14: ffff0000003cc938 x13: 00000000ffffffea x12: 0000000000000000 > x11: 0000000000000000 x10: ffff80001076ba88 x9 : ffff80001076a540 > x8 : ffff00000025f2c0 x7 : ffff0000001f4450 x6 : ffff000000176cd8 > x5 : ffff000003857880 x4 : 0000000000000000 x3 : ffff800011e3fe30 > x2 : ffff0000003cc4c0 x1 : 0000000000000000 x0 : 0000000000000001 > Call trace: > _regulator_put.part.0+0x14c/0x158 > regulator_put+0x34/0x48 > devm_regulator_release+0x10/0x18 > release_nodes+0x38/0x60 > devres_release_all+0x88/0xd0 > really_probe+0xd0/0x2e8 > __driver_probe_device+0x74/0xd8 > driver_probe_device+0x7c/0x108 > __device_attach_driver+0x8c/0xd0 > bus_for_each_drv+0x74/0xc0 > __device_attach_async_helper+0xb4/0xd8 > async_run_entry_fn+0x30/0x100 > process_one_work+0x19c/0x320 > worker_thread+0x48/0x418 > kthread+0x14c/0x158 > ret_from_fork+0x10/0x18 > ---[ end trace 3664ca4a50ce849b ]--- > > Signed-off-by: Richard Zhu > --- > drivers/pci/controller/dwc/pci-imx6.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c > index 3372775834a2..cc837f8bf6d4 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -853,6 +853,8 @@ 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); > + if (imx6_pcie->vpcie && regulator_is_enabled(imx6_pcie->vpcie) > 0) > + regulator_disable(imx6_pcie->vpcie); This doesn't seem like the right place to add this. I guess it would be better to have proper error handling after dw_pcie_host_init to roll back things like the clock and regulator enable. Regards, Lucas > return ret; > } > From mboxrd@z Thu Jan 1 00:00:00 1970 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EE8BC433EF for ; Fri, 15 Oct 2021 18:24:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 393C760FF2 for ; Fri, 15 Oct 2021 18:24:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 393C760FF2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MEWAWceChwevoMxIMDLQ6CfQL5Zbmo9lFTeqLGWdBv8=; b=m5hdPMGkT56Ws5 8uyWAWeXE51nZM9tPpUdk00ult7I2c1algSxBuo2aznMSrfdsVmSEUnEROyLv/6z5WeKIgYBEZqf/ 5IS5uQno/WZofVVPNUr+gxNz8UBBtvFIytWCwjwavAbl7V+ulFl46L0+j6RGbcfLFKpxktn1MjgH1 p3VmbYXlkQ2W2/dSfb7SNnkYIWxQN1Hv3djkGjyU1nNQCQjUEsONZTLDUZIcHh2TCwNllCn2UFHhX P9MjTz7EiMx+cp+bQiGt3A54JTAUS1SgpvPL6aUmLsznNfec/qqJa8Nmjl9ojb7w9J3s9fqsyMfwL fK/y8oswGZ7BE5wTr7sw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbRqz-008Qbw-PL; Fri, 15 Oct 2021 18:22:49 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mbRqv-008Qas-Lc for linux-arm-kernel@lists.infradead.org; Fri, 15 Oct 2021 18:22:47 +0000 Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mbRqp-0001OM-Qj; Fri, 15 Oct 2021 20:22:39 +0200 Message-ID: <8f855cf445e2b7827524d5d4adfba80d3a924c60.camel@pengutronix.de> Subject: Re: [RESEND v2 3/5] PCI: imx6: Fix the regulator dump when link never came up From: Lucas Stach To: Richard Zhu , bhelgaas@google.com, lorenzo.pieralisi@arm.com Cc: linux-pci@vger.kernel.org, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de Date: Fri, 15 Oct 2021 20:22:38 +0200 In-Reply-To: <1634277941-6672-4-git-send-email-hongxing.zhu@nxp.com> References: <1634277941-6672-1-git-send-email-hongxing.zhu@nxp.com> <1634277941-6672-4-git-send-email-hongxing.zhu@nxp.com> User-Agent: Evolution 3.40.4 (3.40.4-1.fc34) MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211015_112245_745855_39E1114C X-CRM114-Status: GOOD ( 17.28 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Am Freitag, dem 15.10.2021 um 14:05 +0800 schrieb Richard Zhu: > When PCIe PHY link never came up and vpcie regulator is present, there > would be following dump when try to put the regulator. > Disable this regulator to fix this dump when link never came up. > > imx6q-pcie 33800000.pcie: Phy link never came up > imx6q-pcie: probe of 33800000.pcie failed with error -110 > ------------[ cut here ]------------ > WARNING: CPU: 3 PID: 119 at drivers/regulator/core.c:2256 _regulator_put.part.0+0x14c/0x158 > Modules linked in: > CPU: 3 PID: 119 Comm: kworker/u8:2 Not tainted 5.13.0-rc7-next-20210625-94710-ge4e92b2588a3 #10 > Hardware name: FSL i.MX8MM EVK board (DT) > Workqueue: events_unbound async_run_entry_fn > pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--) > pc : _regulator_put.part.0+0x14c/0x158 > lr : regulator_put+0x34/0x48 > sp : ffff8000122ebb30 > x29: ffff8000122ebb30 x28: ffff800011be7000 x27: 0000000000000000 > x26: 0000000000000000 x25: 0000000000000000 x24: ffff00000025f2bc > x23: ffff00000025f2c0 x22: ffff00000025f010 x21: ffff8000122ebc18 > x20: ffff800011e3fa60 x19: ffff00000375fd80 x18: 0000000000000010 > x17: 000000040044ffff x16: 00400032b5503510 x15: 0000000000000108 > x14: ffff0000003cc938 x13: 00000000ffffffea x12: 0000000000000000 > x11: 0000000000000000 x10: ffff80001076ba88 x9 : ffff80001076a540 > x8 : ffff00000025f2c0 x7 : ffff0000001f4450 x6 : ffff000000176cd8 > x5 : ffff000003857880 x4 : 0000000000000000 x3 : ffff800011e3fe30 > x2 : ffff0000003cc4c0 x1 : 0000000000000000 x0 : 0000000000000001 > Call trace: > _regulator_put.part.0+0x14c/0x158 > regulator_put+0x34/0x48 > devm_regulator_release+0x10/0x18 > release_nodes+0x38/0x60 > devres_release_all+0x88/0xd0 > really_probe+0xd0/0x2e8 > __driver_probe_device+0x74/0xd8 > driver_probe_device+0x7c/0x108 > __device_attach_driver+0x8c/0xd0 > bus_for_each_drv+0x74/0xc0 > __device_attach_async_helper+0xb4/0xd8 > async_run_entry_fn+0x30/0x100 > process_one_work+0x19c/0x320 > worker_thread+0x48/0x418 > kthread+0x14c/0x158 > ret_from_fork+0x10/0x18 > ---[ end trace 3664ca4a50ce849b ]--- > > Signed-off-by: Richard Zhu > --- > drivers/pci/controller/dwc/pci-imx6.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c > index 3372775834a2..cc837f8bf6d4 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -853,6 +853,8 @@ 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); > + if (imx6_pcie->vpcie && regulator_is_enabled(imx6_pcie->vpcie) > 0) > + regulator_disable(imx6_pcie->vpcie); This doesn't seem like the right place to add this. I guess it would be better to have proper error handling after dw_pcie_host_init to roll back things like the clock and regulator enable. Regards, Lucas > return ret; > } > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel