From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-by2lp0244.outbound.protection.outlook.com ([207.46.163.244]:33513 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753028AbaGAGvS (ORCPT ); Tue, 1 Jul 2014 02:51:18 -0400 Date: Tue, 1 Jul 2014 14:51:07 +0800 From: Shawn Guo To: Lucas Stach CC: Shawn Guo , Richard Zhu , "linux-pci@vger.kernel.org" , Sascha Hauer , Bjorn Helgaas , Fabio Estevam , "linux-arm-kernel@lists.infradead.org" Subject: Re: The imx6q suspend/resume is broken on 3.16-rc due to PCIe Message-ID: <20140701065105.GE14471@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> <1404135864.4305.23.camel@weser.hi.pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" In-Reply-To: <1404135864.4305.23.camel@weser.hi.pengutronix.de> Sender: linux-pci-owner@vger.kernel.org List-ID: On Mon, Jun 30, 2014 at 03:44:24PM +0200, Lucas Stach wrote: > 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. Unfortunately, it doesn't work. With your change, now it hangs in suspend procedure. $ echo mem > /sys/power/state PM: Syncing filesystems ... done. PM: Preparing system for mem sleep Freezing user space processes ... (elapsed 0.005 seconds) done. Freezing remaining freezable tasks ... (elapsed 0.003 seconds) done. PM: Entering mem sleep sd 0:0:0:0: [sda] Synchronizing SCSI cache sd 0:0:0:0: [sda] Stopping disk PM: suspend of devices complete after 102.992 msecs PM: suspend devices took 0.110 seconds PM: late suspend of devices complete after 12.808 msecs Shawn > > 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, > }, > }; > > -- > 2.0.0 > > > -- > Pengutronix e.K. | Lucas Stach | > Industrial Linux Solutions | http://www.pengutronix.de/ | >