All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yanteng Si <si.yanteng@linux.dev>
To: Yao Zi <ziyao@disroot.org>, Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Huacai Chen <chenhuacai@kernel.org>,
	"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
	Philipp Stanner <phasta@kernel.org>,
	Tiezhu Yang <yangtiezhu@loongson.cn>,
	Qunqin Zhao <zhaoqunqin@loongson.cn>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	Furong Xu <0x1207@gmail.com>,
	Kunihiko Hayashi <hayashi.kunihiko@socionext.com>,
	Jacob Keller <jacob.e.keller@intel.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v4 2/3] net: stmmac: loongson: Use generic PCI suspend/resume routines
Date: Wed, 12 Nov 2025 09:23:15 +0800	[thread overview]
Message-ID: <583585ca-8e89-4a61-93dc-6c47a0362830@linux.dev> (raw)
In-Reply-To: <20251111100727.15560-4-ziyao@disroot.org>


在 2025/11/11 18:07, Yao Zi 写道:
> 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>
Acked-by: Yanteng Si <siyanteng@cqsoftware.com.cn


Thanks,

Yanteng
> ---
>   drivers/net/ethernet/stmicro/stmmac/Kconfig   |  6 +++-
>   .../ethernet/stmicro/stmmac/dwmac-loongson.c  | 36 ++-----------------
>   2 files changed, 8 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> index 1350f16f7138..d2bff28fe409 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> @@ -367,15 +367,19 @@ config DWMAC_INTEL
>   	  This selects the Intel platform specific bus support for the
>   	  stmmac driver. This driver is used for Intel Quark/EHL/TGL.
>   
> +if STMMAC_LIBPCI
> +
>   config DWMAC_LOONGSON
>   	tristate "Loongson PCI DWMAC support"
>   	default MACH_LOONGSON64
> -	depends on (MACH_LOONGSON64 || COMPILE_TEST) && STMMAC_ETH && PCI
> +	depends on MACH_LOONGSON64 || COMPILE_TEST
>   	depends on COMMON_CLK
>   	help
>   	  This selects the LOONGSON PCI bus support for the stmmac driver,
>   	  Support for ethernet controller on Loongson-2K1000 SoC and LS7A1000 bridge.
>   
> +endif
> +
>   config STMMAC_PCI
>   	tristate "STMMAC PCI bus support"
>   	depends on STMMAC_ETH && PCI
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> index 2a3ac0136cdb..584dc4ff8320 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
> @@ -8,6 +8,7 @@
>   #include <linux/device.h>
>   #include <linux/of_irq.h>
>   #include "stmmac.h"
> +#include "stmmac_libpci.h"
>   #include "dwmac_dma.h"
>   #include "dwmac1000.h"
>   
> @@ -525,37 +526,6 @@ static int loongson_dwmac_fix_reset(struct stmmac_priv *priv, void __iomem *ioad
>   				  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)
>   {
>   	struct plat_stmmacenet_data *plat;
> @@ -600,8 +570,8 @@ static int loongson_dwmac_probe(struct pci_dev *pdev, const struct pci_device_id
>   	plat->bsp_priv = ld;
>   	plat->setup = loongson_dwmac_setup;
>   	plat->fix_soc_reset = loongson_dwmac_fix_reset;
> -	plat->suspend = loongson_dwmac_suspend;
> -	plat->resume = loongson_dwmac_resume;
> +	plat->suspend = stmmac_pci_plat_suspend;
> +	plat->resume = stmmac_pci_plat_resume;
>   	ld->dev = &pdev->dev;
>   	ld->loongson_id = readl(res.addr + GMAC_VERSION) & 0xff;
>   

  parent reply	other threads:[~2025-11-12  1:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-11 10:07 [PATCH net-next v4 0/3] Unify platform suspend/resume routines for PCI DWMAC glue Yao Zi
2025-11-11 10:07 ` [PATCH net-next v4 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers Yao Zi
2025-11-12  1:22   ` Yanteng Si
2025-11-12 14:57   ` Jakub Kicinski
2025-11-12 15:15     ` Russell King (Oracle)
2025-11-15  9:37       ` Yao Zi
2025-11-11 10:07 ` [PATCH net-next v4 2/3] net: stmmac: loongson: Use generic PCI suspend/resume routines Yao Zi
2025-11-11 10:23   ` Russell King (Oracle)
2025-11-12  1:23   ` Yanteng Si [this message]
2025-11-11 10:11 ` [PATCH net-next v4 3/3] net: stmmac: pci: " Yao Zi
2025-11-11 10:24   ` Russell King (Oracle)
2025-11-12  1:24   ` Yanteng Si

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=583585ca-8e89-4a61-93dc-6c47a0362830@linux.dev \
    --to=si.yanteng@linux.dev \
    --cc=0x1207@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=chenhuacai@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=phasta@kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=vladimir.oltean@nxp.com \
    --cc=yangtiezhu@loongson.cn \
    --cc=zhaoqunqin@loongson.cn \
    --cc=ziyao@disroot.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 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.