net: stmmac: Fix WoL for PCI-based setups
[ Upstream commit b7d0f08e91
]
WoL won't work in PCI-based setups because we are not saving the PCI EP
state before entering suspend state and not allowing D3 wake.
Fix this by using a wrapper around stmmac_{suspend/resume} which
correctly sets the PCI EP state.
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
67f0a2887b
commit
c9bd4fd4b7
@ -183,7 +183,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* Enable pci device */
|
/* Enable pci device */
|
||||||
ret = pcim_enable_device(pdev);
|
ret = pci_enable_device(pdev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "%s: ERROR: failed to enable device\n",
|
dev_err(&pdev->dev, "%s: ERROR: failed to enable device\n",
|
||||||
__func__);
|
__func__);
|
||||||
@ -232,9 +232,45 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
|
|||||||
static void stmmac_pci_remove(struct pci_dev *pdev)
|
static void stmmac_pci_remove(struct pci_dev *pdev)
|
||||||
{
|
{
|
||||||
stmmac_dvr_remove(&pdev->dev);
|
stmmac_dvr_remove(&pdev->dev);
|
||||||
|
pci_disable_device(pdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_suspend, stmmac_resume);
|
static int stmmac_pci_suspend(struct device *dev)
|
||||||
|
{
|
||||||
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = stmmac_suspend(dev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ret = pci_save_state(pdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
pci_disable_device(pdev);
|
||||||
|
pci_wake_from_d3(pdev, true);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int stmmac_pci_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
pci_restore_state(pdev);
|
||||||
|
pci_set_power_state(pdev, PCI_D0);
|
||||||
|
|
||||||
|
ret = pci_enable_device(pdev);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
pci_set_master(pdev);
|
||||||
|
|
||||||
|
return stmmac_resume(dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static SIMPLE_DEV_PM_OPS(stmmac_pm_ops, stmmac_pci_suspend, stmmac_pci_resume);
|
||||||
|
|
||||||
#define STMMAC_VENDOR_ID 0x700
|
#define STMMAC_VENDOR_ID 0x700
|
||||||
#define STMMAC_QUARK_ID 0x0937
|
#define STMMAC_QUARK_ID 0x0937
|
||||||
|
Reference in New Issue
Block a user