All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bhelgaas@google.com>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
	Gregory Clement <gregory.clement@free-electrons.com>,
	Tawfik Bayouk <tawfik@marvell.com>,
	Nadav Haklai <nadavh@marvell.com>,
	Lior Amsalem <alior@marvell.com>
Subject: Re: [PATCH] PCI: mvebu: add suspend/resume support
Date: Fri, 20 Mar 2015 18:27:01 -0500	[thread overview]
Message-ID: <20150320232701.GQ26935@google.com> (raw)
In-Reply-To: <1426604145-12335-1-git-send-email-thomas.petazzoni@free-electrons.com>

On Tue, Mar 17, 2015 at 03:55:45PM +0100, Thomas Petazzoni wrote:
> This commit implements suspend/resume support for the mvebu PCIe host
> driver. Without this commit, the system will panic at resume time when
> PCIe devices are connected.
> 
> Note that we have to use the ->suspend_noirq() and ->resume_noirq()
> hooks, because at resume time, the PCI fixups are done at
> ->resume_noirq() time, so the PCIe controller has to be ready at this
> point.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Applied with Jason's ack to pci/host-mvebu for v4.1, thanks!

> ---
>  drivers/pci/host/pci-mvebu.c | 38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
> index 1309cfb..1ab8635 100644
> --- a/drivers/pci/host/pci-mvebu.c
> +++ b/drivers/pci/host/pci-mvebu.c
> @@ -129,6 +129,7 @@ struct mvebu_pcie_port {
>  	size_t memwin_size;
>  	phys_addr_t iowin_base;
>  	size_t iowin_size;
> +	u32 saved_pcie_stat;
>  };
>  
>  static inline void mvebu_writel(struct mvebu_pcie_port *port, u32 val, u32 reg)
> @@ -899,6 +900,35 @@ static void mvebu_pcie_msi_enable(struct mvebu_pcie *pcie)
>  		pcie->msi->dev = &pcie->pdev->dev;
>  }
>  
> +static int mvebu_pcie_suspend(struct device *dev)
> +{
> +	struct mvebu_pcie *pcie;
> +	int i;
> +
> +	pcie = dev_get_drvdata(dev);
> +	for (i = 0; i < pcie->nports; i++) {
> +		struct mvebu_pcie_port *port = pcie->ports + i;
> +		port->saved_pcie_stat = mvebu_readl(port, PCIE_STAT_OFF);
> +	}
> +
> +	return 0;
> +}
> +
> +static int mvebu_pcie_resume(struct device *dev)
> +{
> +	struct mvebu_pcie *pcie;
> +	int i;
> +
> +	pcie = dev_get_drvdata(dev);
> +	for (i = 0; i < pcie->nports; i++) {
> +		struct mvebu_pcie_port *port = pcie->ports + i;
> +		mvebu_writel(port, port->saved_pcie_stat, PCIE_STAT_OFF);
> +		mvebu_pcie_setup_hw(port);
> +	}
> +
> +	return 0;
> +}
> +
>  static int mvebu_pcie_probe(struct platform_device *pdev)
>  {
>  	struct mvebu_pcie *pcie;
> @@ -1056,6 +1086,8 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
>  	mvebu_pcie_msi_enable(pcie);
>  	mvebu_pcie_enable(pcie);
>  
> +	platform_set_drvdata(pdev, pcie);
> +
>  	return 0;
>  }
>  
> @@ -1068,12 +1100,18 @@ static const struct of_device_id mvebu_pcie_of_match_table[] = {
>  };
>  MODULE_DEVICE_TABLE(of, mvebu_pcie_of_match_table);
>  
> +static struct dev_pm_ops mvebu_pcie_pm_ops = {
> +	.suspend_noirq = mvebu_pcie_suspend,
> +	.resume_noirq = mvebu_pcie_resume,
> +};
> +
>  static struct platform_driver mvebu_pcie_driver = {
>  	.driver = {
>  		.name = "mvebu-pcie",
>  		.of_match_table = mvebu_pcie_of_match_table,
>  		/* driver unloading/unbinding currently not supported */
>  		.suppress_bind_attrs = true,
> +		.pm = &mvebu_pcie_pm_ops,
>  	},
>  	.probe = mvebu_pcie_probe,
>  };
> -- 
> 2.1.0
> 

WARNING: multiple messages have this Message-ID (diff)
From: bhelgaas@google.com (Bjorn Helgaas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] PCI: mvebu: add suspend/resume support
Date: Fri, 20 Mar 2015 18:27:01 -0500	[thread overview]
Message-ID: <20150320232701.GQ26935@google.com> (raw)
In-Reply-To: <1426604145-12335-1-git-send-email-thomas.petazzoni@free-electrons.com>

On Tue, Mar 17, 2015 at 03:55:45PM +0100, Thomas Petazzoni wrote:
> This commit implements suspend/resume support for the mvebu PCIe host
> driver. Without this commit, the system will panic at resume time when
> PCIe devices are connected.
> 
> Note that we have to use the ->suspend_noirq() and ->resume_noirq()
> hooks, because at resume time, the PCI fixups are done at
> ->resume_noirq() time, so the PCIe controller has to be ready at this
> point.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Applied with Jason's ack to pci/host-mvebu for v4.1, thanks!

> ---
>  drivers/pci/host/pci-mvebu.c | 38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
> index 1309cfb..1ab8635 100644
> --- a/drivers/pci/host/pci-mvebu.c
> +++ b/drivers/pci/host/pci-mvebu.c
> @@ -129,6 +129,7 @@ struct mvebu_pcie_port {
>  	size_t memwin_size;
>  	phys_addr_t iowin_base;
>  	size_t iowin_size;
> +	u32 saved_pcie_stat;
>  };
>  
>  static inline void mvebu_writel(struct mvebu_pcie_port *port, u32 val, u32 reg)
> @@ -899,6 +900,35 @@ static void mvebu_pcie_msi_enable(struct mvebu_pcie *pcie)
>  		pcie->msi->dev = &pcie->pdev->dev;
>  }
>  
> +static int mvebu_pcie_suspend(struct device *dev)
> +{
> +	struct mvebu_pcie *pcie;
> +	int i;
> +
> +	pcie = dev_get_drvdata(dev);
> +	for (i = 0; i < pcie->nports; i++) {
> +		struct mvebu_pcie_port *port = pcie->ports + i;
> +		port->saved_pcie_stat = mvebu_readl(port, PCIE_STAT_OFF);
> +	}
> +
> +	return 0;
> +}
> +
> +static int mvebu_pcie_resume(struct device *dev)
> +{
> +	struct mvebu_pcie *pcie;
> +	int i;
> +
> +	pcie = dev_get_drvdata(dev);
> +	for (i = 0; i < pcie->nports; i++) {
> +		struct mvebu_pcie_port *port = pcie->ports + i;
> +		mvebu_writel(port, port->saved_pcie_stat, PCIE_STAT_OFF);
> +		mvebu_pcie_setup_hw(port);
> +	}
> +
> +	return 0;
> +}
> +
>  static int mvebu_pcie_probe(struct platform_device *pdev)
>  {
>  	struct mvebu_pcie *pcie;
> @@ -1056,6 +1086,8 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
>  	mvebu_pcie_msi_enable(pcie);
>  	mvebu_pcie_enable(pcie);
>  
> +	platform_set_drvdata(pdev, pcie);
> +
>  	return 0;
>  }
>  
> @@ -1068,12 +1100,18 @@ static const struct of_device_id mvebu_pcie_of_match_table[] = {
>  };
>  MODULE_DEVICE_TABLE(of, mvebu_pcie_of_match_table);
>  
> +static struct dev_pm_ops mvebu_pcie_pm_ops = {
> +	.suspend_noirq = mvebu_pcie_suspend,
> +	.resume_noirq = mvebu_pcie_resume,
> +};
> +
>  static struct platform_driver mvebu_pcie_driver = {
>  	.driver = {
>  		.name = "mvebu-pcie",
>  		.of_match_table = mvebu_pcie_of_match_table,
>  		/* driver unloading/unbinding currently not supported */
>  		.suppress_bind_attrs = true,
> +		.pm = &mvebu_pcie_pm_ops,
>  	},
>  	.probe = mvebu_pcie_probe,
>  };
> -- 
> 2.1.0
> 

  parent reply	other threads:[~2015-03-20 23:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 14:55 [PATCH] PCI: mvebu: add suspend/resume support Thomas Petazzoni
2015-03-17 14:55 ` Thomas Petazzoni
2015-03-17 15:15 ` Jason Cooper
2015-03-17 15:15   ` Jason Cooper
2015-03-19  8:24   ` Thomas Petazzoni
2015-03-19  8:24     ` Thomas Petazzoni
2015-03-20 23:27 ` Bjorn Helgaas [this message]
2015-03-20 23:27   ` Bjorn Helgaas

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=20150320232701.GQ26935@google.com \
    --to=bhelgaas@google.com \
    --cc=alior@marvell.com \
    --cc=andrew@lunn.ch \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=nadavh@marvell.com \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=tawfik@marvell.com \
    --cc=thomas.petazzoni@free-electrons.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.