net: stmmac: loongson: Use generic PCI suspend/resume routines

Convert glue driver for Loongson DWMAC controller to use the generic
platform suspend/resume routines for PCI controllers, instead of
implementing its own one.

Signed-off-by: Yao Zi <ziyao@disroot.org>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Acked-by: Yanteng Si <siyanteng@cqsoftware.com.cn>
Link: https://patch.msgid.link/20251124160417.51514-3-ziyao@disroot.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Yao Zi
2025-11-24 16:04:16 +00:00
committed by Jakub Kicinski
parent 4440bf5f2e
commit c4064af1c7
2 changed files with 5 additions and 34 deletions

View File

@@ -367,8 +367,9 @@ config DWMAC_INTEL
config DWMAC_LOONGSON config DWMAC_LOONGSON
tristate "Loongson PCI DWMAC support" tristate "Loongson PCI DWMAC support"
default MACH_LOONGSON64 default MACH_LOONGSON64
depends on (MACH_LOONGSON64 || COMPILE_TEST) && STMMAC_ETH && PCI depends on (MACH_LOONGSON64 || COMPILE_TEST) && PCI
depends on COMMON_CLK depends on COMMON_CLK
select STMMAC_LIBPCI
help help
This selects the LOONGSON PCI bus support for the stmmac driver, This selects the LOONGSON PCI bus support for the stmmac driver,
Support for ethernet controller on Loongson-2K1000 SoC and LS7A1000 bridge. Support for ethernet controller on Loongson-2K1000 SoC and LS7A1000 bridge.

View File

@@ -8,6 +8,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include "stmmac.h" #include "stmmac.h"
#include "stmmac_libpci.h"
#include "dwmac_dma.h" #include "dwmac_dma.h"
#include "dwmac1000.h" #include "dwmac1000.h"
@@ -502,37 +503,6 @@ static int loongson_dwmac_fix_reset(struct stmmac_priv *priv, void __iomem *ioad
10000, 2000000); 10000, 2000000);
} }
static int loongson_dwmac_suspend(struct device *dev, void *bsp_priv)
{
struct pci_dev *pdev = to_pci_dev(dev);
int ret;
ret = pci_save_state(pdev);
if (ret)
return ret;
pci_disable_device(pdev);
pci_wake_from_d3(pdev, true);
return 0;
}
static int loongson_dwmac_resume(struct device *dev, void *bsp_priv)
{
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 0;
}
static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id *id) static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{ {
struct plat_stmmacenet_data *plat; struct plat_stmmacenet_data *plat;
@@ -577,8 +547,8 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
plat->bsp_priv = ld; plat->bsp_priv = ld;
plat->mac_setup = loongson_dwmac_setup; plat->mac_setup = loongson_dwmac_setup;
plat->fix_soc_reset = loongson_dwmac_fix_reset; plat->fix_soc_reset = loongson_dwmac_fix_reset;
plat->suspend = loongson_dwmac_suspend; plat->suspend = stmmac_pci_plat_suspend;
plat->resume = loongson_dwmac_resume; plat->resume = stmmac_pci_plat_resume;
ld->dev = &pdev->dev; ld->dev = &pdev->dev;
ld->loongson_id = readl(res.addr + GMAC_VERSION) & 0xff; ld->loongson_id = readl(res.addr + GMAC_VERSION) & 0xff;