linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Shawn Guo <shawn.guo@linaro.org>
Cc: Shawn Guo <shawn.guo@freescale.com>,
	Richard Zhu <r65037@freescale.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Sascha Hauer <kernel@pengutronix.de>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Fabio Estevam <festevam@gmail.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: The imx6q suspend/resume is broken on 3.16-rc due to PCIe
Date: Mon, 30 Jun 2014 15:44:24 +0200	[thread overview]
Message-ID: <1404135864.4305.23.camel@weser.hi.pengutronix.de> (raw)
In-Reply-To: <20140628143712.GA7869@dragon>

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 <shawn.guo@linaro.org> 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 <l.stach@pengutronix.de>
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 <l.stach@pengutronix.de>
---
 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/  |


  reply	other threads:[~2014-06-30 13:46 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24 15:36 The imx6q suspend/resume is broken on 3.16-rc due to PCIe Shawn Guo
2014-06-24 16:13 ` Lucas Stach
2014-06-25  6:12   ` Shawn Guo
2014-06-24 19:37 ` Fabio Estevam
2014-06-25  6:22   ` Shawn Guo
2014-06-25 10:50     ` Fabio Estevam
2014-06-25 10:50       ` Lucas Stach
2014-06-25 12:53         ` Shawn Guo
2014-06-26  8:43           ` Lucas Stach
2014-06-28 14:37             ` Shawn Guo
2014-06-30 13:44               ` Lucas Stach [this message]
2014-07-01  6:51                 ` Shawn Guo
2014-07-07  9:10                   ` Lucas Stach
2014-07-07 13:55                     ` Shawn Guo
2014-07-16  6:55                       ` Shawn Guo
2014-07-17 13:55                         ` Lucas Stach
2014-07-18  2:11                           ` Hong-Xing.Zhu
2014-07-18  9:21                             ` Lucas Stach
2014-07-21  2:50                               ` Shawn Guo
2014-07-21  2:55                                 ` Fabio Estevam
2014-07-21  3:19                                   ` Shawn Guo
2014-06-25 12:46     ` Shawn Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1404135864.4305.23.camel@weser.hi.pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=bhelgaas@google.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=r65037@freescale.com \
    --cc=shawn.guo@freescale.com \
    --cc=shawn.guo@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).