From patchwork Mon Jun 30 13:44:24 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 4450381 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 89867BEEAA for ; Mon, 30 Jun 2014 13:48:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91668201FB for ; Mon, 30 Jun 2014 13:48:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AC59420170 for ; Mon, 30 Jun 2014 13:48:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1bui-0000cI-TH; Mon, 30 Jun 2014 13:46:32 +0000 Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1buf-0000VW-VZ for linux-arm-kernel@lists.infradead.org; Mon, 30 Jun 2014 13:46:30 +0000 Received: from weser.hi.pengutronix.de ([2001:6f8:1178:2:fa0f:41ff:fe58:4010]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1X1buC-0004NN-SN; Mon, 30 Jun 2014 15:46:00 +0200 Message-ID: <1404135864.4305.23.camel@weser.hi.pengutronix.de> Subject: Re: The imx6q suspend/resume is broken on 3.16-rc due to PCIe From: Lucas Stach To: Shawn Guo Date: Mon, 30 Jun 2014 15:44:24 +0200 In-Reply-To: <20140628143712.GA7869@dragon> References: <20140624153559.GA5741@dragon> <20140625062243.GD3242@dragon> <1403693452.4249.1.camel@weser.hi.pengutronix.de> <20140625125306.GB6917@dragon> <1403772229.4254.4.camel@weser.hi.pengutronix.de> <20140628143712.GA7869@dragon> X-Mailer: Evolution 3.8.5-2+b1 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 2001:6f8:1178:2:fa0f:41ff:fe58:4010 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-20140630_064630_483037_5F10D3B2 X-CRM114-Status: GOOD ( 30.15 ) X-Spam-Score: -0.0 (/) Cc: Richard Zhu , "linux-pci@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , Sascha Hauer , Bjorn Helgaas , Fabio Estevam , Shawn Guo X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Am Samstag, den 28.06.2014, 22:37 +0800 schrieb Shawn Guo: > On Thu, Jun 26, 2014 at 10:43:49AM +0200, Lucas Stach wrote: > > Am Mittwoch, den 25.06.2014, 20:53 +0800 schrieb Shawn Guo: > > > On Wed, Jun 25, 2014 at 12:50:52PM +0200, Lucas Stach wrote: > > > > Am Mittwoch, den 25.06.2014, 07:50 -0300 schrieb Fabio Estevam: > > > > > On Wed, Jun 25, 2014 at 3:22 AM, Shawn Guo wrote: > > > > > > > > > > > Please test against v3.16-rc1 or -rc2. The breakage on linux-next > > > > > > should be another issue. > > > > > > > > > > Yes, I see it now. Tested on -rc2 and suspend/resume works with PCI > > > > > driver removed. > > > > > > > > Can you please send me a dmesg from a working boot? > > > > > > What do you mean by "working boot"? Boot is always working. What fails > > > is system resuming. > > > > > > Shawn > > > > > Oops, what I meant is a dmesg after a working resume (from kernel 3.15). > > I can see how failing to resume from L2 can cause the hang and we should > > really implement the PHY PD toggling in the pcie driver, but I would > > like to understand why you don't hit this on 3.15. > > Sorry, Lucas. I just noticed that in my 3.15 testing PCIe is not > enabled in device tree at all. So the issue should have already been > there before your changes to PCIe driver. > Hi Shawn, can you please test the attached patch on top of 3.16-rc* to see if it helps? If it works for you I would like to try and get this into 3.16 as a bugfix. Regards, Lucas --------------------------->8----------------------------- From f3bfdc9c19249188fa153b1568c3129cd31af4f5 Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Mon, 30 Jun 2014 15:33:04 +0200 Subject: [PATCH] PCI: imx6: add workaround for errata ERR005723 Fixes system hang after resume from suspend to mem. Signed-off-by: Lucas Stach --- drivers/pci/host/pci-imx6.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index a568efaa331c..5c58a3ee5dbf 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c @@ -589,6 +589,38 @@ static int __init imx6_pcie_probe(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int imx6_pcie_suspend(struct device *dev) +{ + struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); + + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + IMX6Q_GPR1_PCIE_TEST_PD, 1 << 18); + + return 0; +} + +static int imx6_pcie_resume(struct device *dev) +{ + struct imx6_pcie *imx6_pcie = dev_get_drvdata(dev); + + /* + * This is a workaround for + * ERR005723: PCIe does not support L2 power down + * Toggling the PHY PD bit around system L2 state switching seems to be + * enough to wake the PCIe logic after a power down. + */ + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, + IMX6Q_GPR1_PCIE_TEST_PD, 0 << 18); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(imx6_pcie_pm_ops, + imx6_pcie_suspend, + imx6_pcie_resume); + static const struct of_device_id imx6_pcie_of_match[] = { { .compatible = "fsl,imx6q-pcie", }, {}, @@ -600,6 +632,7 @@ static struct platform_driver imx6_pcie_driver = { .name = "imx6q-pcie", .owner = THIS_MODULE, .of_match_table = imx6_pcie_of_match, + .pm = &imx6_pcie_pm_ops, }, };