netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] Unify platform suspend/resume routines for PCI DWMAC glue
@ 2025-10-28 15:43 Yao Zi
  2025-10-28 15:43 ` [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers Yao Zi
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Yao Zi @ 2025-10-28 15:43 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Yanteng Si, Huacai Chen, Russell King (Oracle),
	Philipp Stanner, Tiezhu Yang, Qunqin Zhao, Yao Zi,
	Vladimir Oltean, Furong Xu, Kunihiko Hayashi, Jacob Keller
  Cc: netdev, linux-kernel

There are currently three PCI-based DWMAC glue drivers in tree,
stmmac_pci.c, dwmac-intel.c, and dwmac-loongson.c. Both stmmac_pci.c and
dwmac-intel.c implements the same and duplicated platform suspend/resume
routines.

This series introduces a pair of helpers,
stmmac_pci_plat_{suspend,resume}, and replaces the driver-specific
implementation with the helpers to reduce code duplication. The helper
will also work for the Motorcomm DWMAC glue driver which I'm working on.

The glue driver for Intel controllers isn't covered by the series, since
its suspend routine doesn't call pci_disable_device() and thus is a
little different from the new generic helpers.

I only have Loongson hardware on hand, thus the series is only tested on
Loongson 3A5000 machine. I could confirm the controller works after
resume, and WoL works as expected. This shouldn't break stmmac_pci.c,
either, since the new helpers have the exactly same code as the old
driver-specific suspend/resume hooks.

Yao Zi (3):
  net: stmmac: Add generic suspend/resume helper for PCI-based
    controllers
  net: stmmac: loongson: Use generic PCI suspend/resume routines
  net: stmmac: pci: Use generic PCI suspend/resume routines

 .../ethernet/stmicro/stmmac/dwmac-loongson.c  | 35 +-----------------
 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |  2 +
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 37 +++++++++++++++++++
 .../net/ethernet/stmicro/stmmac/stmmac_pci.c  | 35 +-----------------
 4 files changed, 43 insertions(+), 66 deletions(-)

-- 
2.50.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers
  2025-10-28 15:43 [PATCH net-next 0/3] Unify platform suspend/resume routines for PCI DWMAC glue Yao Zi
@ 2025-10-28 15:43 ` Yao Zi
  2025-10-28 15:59   ` Russell King (Oracle)
  2025-10-28 15:43 ` [PATCH net-next 2/3] net: stmmac: loongson: Use generic PCI suspend/resume routines Yao Zi
  2025-10-28 15:43 ` [PATCH net-next 3/3] net: stmmac: pci: " Yao Zi
  2 siblings, 1 reply; 9+ messages in thread
From: Yao Zi @ 2025-10-28 15:43 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Yanteng Si, Huacai Chen, Russell King (Oracle),
	Philipp Stanner, Tiezhu Yang, Qunqin Zhao, Yao Zi,
	Vladimir Oltean, Furong Xu, Kunihiko Hayashi, Jacob Keller
  Cc: netdev, linux-kernel

Most glue driver for PCI-based DWMAC controllers utilize similar
platform suspend/resume routines. Add a generic implementation to reduce
duplicated code.

Signed-off-by: Yao Zi <ziyao@disroot.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac.h  |  2 +
 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 37 +++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac.h b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
index d5af9344dfb0..baa4ff14bdfe 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
@@ -395,6 +395,8 @@ int stmmac_xdp_open(struct net_device *dev);
 void stmmac_xdp_release(struct net_device *dev);
 int stmmac_resume(struct device *dev);
 int stmmac_suspend(struct device *dev);
+int stmmac_pci_plat_suspend(struct device *dev, void *bsp_priv);
+int stmmac_pci_plat_resume(struct device *dev, void *bsp_priv);
 void stmmac_dvr_remove(struct device *dev);
 int stmmac_dvr_probe(struct device *device,
 		     struct plat_stmmacenet_data *plat_dat,
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index fd5106880192..3bd284019ca7 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -28,6 +28,7 @@
 #include <linux/if_vlan.h>
 #include <linux/dma-mapping.h>
 #include <linux/slab.h>
+#include <linux/pci.h>
 #include <linux/pm_runtime.h>
 #include <linux/pm_wakeirq.h>
 #include <linux/prefetch.h>
@@ -7938,6 +7939,42 @@ EXPORT_SYMBOL_GPL(stmmac_resume);
 DEFINE_SIMPLE_DEV_PM_OPS(stmmac_simple_pm_ops, stmmac_suspend, stmmac_resume);
 EXPORT_SYMBOL_GPL(stmmac_simple_pm_ops);
 
+#ifdef CONFIG_PCI
+int stmmac_pci_plat_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;
+}
+EXPORT_SYMBOL_GPL(stmmac_pci_plat_suspend);
+
+int stmmac_pci_plat_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;
+}
+EXPORT_SYMBOL_GPL(stmmac_pci_plat_resume);
+#endif /* CONFIG_PCI */
+
 #ifndef MODULE
 static int __init stmmac_cmdline_opt(char *str)
 {
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 2/3] net: stmmac: loongson: Use generic PCI suspend/resume routines
  2025-10-28 15:43 [PATCH net-next 0/3] Unify platform suspend/resume routines for PCI DWMAC glue Yao Zi
  2025-10-28 15:43 ` [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers Yao Zi
@ 2025-10-28 15:43 ` Yao Zi
  2025-10-28 15:43 ` [PATCH net-next 3/3] net: stmmac: pci: " Yao Zi
  2 siblings, 0 replies; 9+ messages in thread
From: Yao Zi @ 2025-10-28 15:43 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Yanteng Si, Huacai Chen, Russell King (Oracle),
	Philipp Stanner, Tiezhu Yang, Qunqin Zhao, Yao Zi,
	Vladimir Oltean, Furong Xu, Kunihiko Hayashi, Jacob Keller
  Cc: netdev, linux-kernel

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>
---
 .../ethernet/stmicro/stmmac/dwmac-loongson.c  | 35 ++-----------------
 1 file changed, 2 insertions(+), 33 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
index 2a3ac0136cdb..cf4c12d2de0b 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-loongson.c
@@ -525,37 +525,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 +569,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;
 
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH net-next 3/3] net: stmmac: pci: Use generic PCI suspend/resume routines
  2025-10-28 15:43 [PATCH net-next 0/3] Unify platform suspend/resume routines for PCI DWMAC glue Yao Zi
  2025-10-28 15:43 ` [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers Yao Zi
  2025-10-28 15:43 ` [PATCH net-next 2/3] net: stmmac: loongson: Use generic PCI suspend/resume routines Yao Zi
@ 2025-10-28 15:43 ` Yao Zi
  2 siblings, 0 replies; 9+ messages in thread
From: Yao Zi @ 2025-10-28 15:43 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Yanteng Si, Huacai Chen, Russell King (Oracle),
	Philipp Stanner, Tiezhu Yang, Qunqin Zhao, Yao Zi,
	Vladimir Oltean, Furong Xu, Kunihiko Hayashi, Jacob Keller
  Cc: netdev, linux-kernel

Convert STMMAC PCI glue driver 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>
---
 .../net/ethernet/stmicro/stmmac/stmmac_pci.c  | 35 ++-----------------
 1 file changed, 2 insertions(+), 33 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 94b3a3b27270..9e48e9b0016e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -139,37 +139,6 @@ static const struct stmmac_pci_info snps_gmac5_pci_info = {
 	.setup = snps_gmac5_default_data,
 };
 
-static int stmmac_pci_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 stmmac_pci_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;
-}
-
 /**
  * stmmac_pci_probe
  *
@@ -249,8 +218,8 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 	plat->safety_feat_cfg->prtyen = 1;
 	plat->safety_feat_cfg->tmouten = 1;
 
-	plat->suspend = stmmac_pci_suspend;
-	plat->resume = stmmac_pci_resume;
+	plat->suspend = stmmac_pci_plat_suspend;
+	plat->resume = stmmac_pci_plat_resume;
 
 	return stmmac_dvr_probe(&pdev->dev, plat, &res);
 }
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers
  2025-10-28 15:43 ` [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers Yao Zi
@ 2025-10-28 15:59   ` Russell King (Oracle)
  2025-10-29  2:27     ` Yanteng Si
  0 siblings, 1 reply; 9+ messages in thread
From: Russell King (Oracle) @ 2025-10-28 15:59 UTC (permalink / raw)
  To: Yao Zi
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Yanteng Si, Huacai Chen, Philipp Stanner,
	Tiezhu Yang, Qunqin Zhao, Vladimir Oltean, Furong Xu,
	Kunihiko Hayashi, Jacob Keller, netdev, linux-kernel

On Tue, Oct 28, 2025 at 03:43:30PM +0000, Yao Zi wrote:
> Most glue driver for PCI-based DWMAC controllers utilize similar
> platform suspend/resume routines. Add a generic implementation to reduce
> duplicated code.
> 
> Signed-off-by: Yao Zi <ziyao@disroot.org>
> ---
>  drivers/net/ethernet/stmicro/stmmac/stmmac.h  |  2 +
>  .../net/ethernet/stmicro/stmmac/stmmac_main.c | 37 +++++++++++++++++++

I would prefer not to make stmmac_main.c even larger by including bus
specific helpers there. We already have stmmac_pltfm.c for those which
use struct platform_device. The logical name would be stmmac_pci.c, but
that's already taken by a driver.

One way around that would be to rename stmmac_pci.c to dwmac-pci.c
(glue drivers tend to be named dwmac-foo.c) and then re-use
stmmac_pci.c for PCI-related stuff in the same way that stmmac_pltfm.c
is used.

Another idea would be stmmac_libpci.c.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers
  2025-10-28 15:59   ` Russell King (Oracle)
@ 2025-10-29  2:27     ` Yanteng Si
  2025-10-29  2:50       ` Yao Zi
  2025-10-29  9:00       ` Russell King (Oracle)
  0 siblings, 2 replies; 9+ messages in thread
From: Yanteng Si @ 2025-10-29  2:27 UTC (permalink / raw)
  To: Russell King (Oracle), Yao Zi
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Huacai Chen, Philipp Stanner, Tiezhu Yang,
	Qunqin Zhao, Vladimir Oltean, Furong Xu, Kunihiko Hayashi,
	Jacob Keller, netdev, linux-kernel


在 2025/10/28 下午11:59, Russell King (Oracle) 写道:
> On Tue, Oct 28, 2025 at 03:43:30PM +0000, Yao Zi wrote:
>> Most glue driver for PCI-based DWMAC controllers utilize similar
>> platform suspend/resume routines. Add a generic implementation to reduce
>> duplicated code.
>>
>> Signed-off-by: Yao Zi <ziyao@disroot.org>
>> ---
>>   drivers/net/ethernet/stmicro/stmmac/stmmac.h  |  2 +
>>   .../net/ethernet/stmicro/stmmac/stmmac_main.c | 37 +++++++++++++++++++
> I would prefer not to make stmmac_main.c even larger by including bus
> specific helpers there. We already have stmmac_pltfm.c for those which
> use struct platform_device. The logical name would be stmmac_pci.c, but
> that's already taken by a driver.
>
> One way around that would be to rename stmmac_pci.c to dwmac-pci.c
> (glue drivers tend to be named dwmac-foo.c) and then re-use
> stmmac_pci.c for PCI-related stuff in the same way that stmmac_pltfm.c
> is used.
>
> Another idea would be stmmac_libpci.c.

I also don't want stmmac_main.c to grow larger, and I prefer

stmmac_libpci.c instead. Another approach - maybe we can

keep these helper functions in stmmac_pci.c and just declare

them as extern where needed?


Thanks,

Yanteng

>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers
  2025-10-29  2:27     ` Yanteng Si
@ 2025-10-29  2:50       ` Yao Zi
  2025-10-29  9:00       ` Russell King (Oracle)
  1 sibling, 0 replies; 9+ messages in thread
From: Yao Zi @ 2025-10-29  2:50 UTC (permalink / raw)
  To: Yanteng Si, Russell King (Oracle)
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Huacai Chen, Philipp Stanner, Tiezhu Yang,
	Qunqin Zhao, Vladimir Oltean, Furong Xu, Kunihiko Hayashi,
	Jacob Keller, netdev, linux-kernel

On Wed, Oct 29, 2025 at 10:27:18AM +0800, Yanteng Si wrote:
> 
> 在 2025/10/28 下午11:59, Russell King (Oracle) 写道:
> > On Tue, Oct 28, 2025 at 03:43:30PM +0000, Yao Zi wrote:
> > > Most glue driver for PCI-based DWMAC controllers utilize similar
> > > platform suspend/resume routines. Add a generic implementation to reduce
> > > duplicated code.
> > > 
> > > Signed-off-by: Yao Zi <ziyao@disroot.org>
> > > ---
> > >   drivers/net/ethernet/stmicro/stmmac/stmmac.h  |  2 +
> > >   .../net/ethernet/stmicro/stmmac/stmmac_main.c | 37 +++++++++++++++++++
> > I would prefer not to make stmmac_main.c even larger by including bus
> > specific helpers there. We already have stmmac_pltfm.c for those which
> > use struct platform_device. The logical name would be stmmac_pci.c, but
> > that's already taken by a driver.
> > 
> > One way around that would be to rename stmmac_pci.c to dwmac-pci.c
> > (glue drivers tend to be named dwmac-foo.c) and then re-use
> > stmmac_pci.c for PCI-related stuff in the same way that stmmac_pltfm.c
> > is used.
> > 
> > Another idea would be stmmac_libpci.c.
> 
> I also don't want stmmac_main.c to grow larger, and I prefer
> 
> stmmac_libpci.c instead.

Okay, then I'll separate the code into stmmac_libpci.c instead. This
also avoids moving code around, making it easier to track git log in the
future.

> Another approach - maybe we can
> 
> keep these helper functions in stmmac_pci.c and just declare
> 
> them as extern where needed?

stmmac_pci.c is a standalone DWMAC glue driver, none of its symbols are
for external usage. I don't think it's appropriate to put these helpers
in the driver. Furthermore, this will also require PCI-based glues
making use of these helpers to depend on an unrelated driver,
introducing unnecessary code size, which doesn't sound like a good idea
to me.

I'd still like to introduce stmmac_libpci.c for these helpers.

> Thanks,
> 
> Yanteng
> 
> > 

Best regards,
Yao Zi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers
  2025-10-29  2:27     ` Yanteng Si
  2025-10-29  2:50       ` Yao Zi
@ 2025-10-29  9:00       ` Russell King (Oracle)
  2025-10-29  9:07         ` Yanteng Si
  1 sibling, 1 reply; 9+ messages in thread
From: Russell King (Oracle) @ 2025-10-29  9:00 UTC (permalink / raw)
  To: Yanteng Si
  Cc: Yao Zi, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Huacai Chen, Philipp Stanner,
	Tiezhu Yang, Qunqin Zhao, Vladimir Oltean, Furong Xu,
	Kunihiko Hayashi, Jacob Keller, netdev, linux-kernel

On Wed, Oct 29, 2025 at 10:27:18AM +0800, Yanteng Si wrote:
> 在 2025/10/28 下午11:59, Russell King (Oracle) 写道:
> > On Tue, Oct 28, 2025 at 03:43:30PM +0000, Yao Zi wrote:
> > > Most glue driver for PCI-based DWMAC controllers utilize similar
> > > platform suspend/resume routines. Add a generic implementation to reduce
> > > duplicated code.
> > > 
> > > Signed-off-by: Yao Zi <ziyao@disroot.org>
> > > ---
> > >   drivers/net/ethernet/stmicro/stmmac/stmmac.h  |  2 +
> > >   .../net/ethernet/stmicro/stmmac/stmmac_main.c | 37 +++++++++++++++++++
> > I would prefer not to make stmmac_main.c even larger by including bus
> > specific helpers there. We already have stmmac_pltfm.c for those which
> > use struct platform_device. The logical name would be stmmac_pci.c, but
> > that's already taken by a driver.
> > 
> > One way around that would be to rename stmmac_pci.c to dwmac-pci.c
> > (glue drivers tend to be named dwmac-foo.c) and then re-use
> > stmmac_pci.c for PCI-related stuff in the same way that stmmac_pltfm.c
> > is used.
> > 
> > Another idea would be stmmac_libpci.c.
> 
> I also don't want stmmac_main.c to grow larger, and I prefer
> stmmac_libpci.c instead. Another approach - maybe we can
> keep these helper functions in stmmac_pci.c and just declare
> them as extern where needed?

stmmac_pci.c is itself a glue driver, supporting PCI IDs:

	0x0700, 0x1108	- synthetic ID
	0x104a, 0xcc09	- ST Micro MAC
	0x16c3, 0x7102	- Synopsys GMAC5

I don't think we should try to turn a glue driver into a library,
even though it would be the easier option (we could reuse
CONFIG_STMMAC_PCI.)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers
  2025-10-29  9:00       ` Russell King (Oracle)
@ 2025-10-29  9:07         ` Yanteng Si
  0 siblings, 0 replies; 9+ messages in thread
From: Yanteng Si @ 2025-10-29  9:07 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Yao Zi, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Huacai Chen, Philipp Stanner,
	Tiezhu Yang, Qunqin Zhao, Vladimir Oltean, Furong Xu,
	Kunihiko Hayashi, Jacob Keller, netdev, linux-kernel


在 2025/10/29 下午5:00, Russell King (Oracle) 写道:
> On Wed, Oct 29, 2025 at 10:27:18AM +0800, Yanteng Si wrote:
>> 在 2025/10/28 下午11:59, Russell King (Oracle) 写道:
>>> On Tue, Oct 28, 2025 at 03:43:30PM +0000, Yao Zi wrote:
>>>> Most glue driver for PCI-based DWMAC controllers utilize similar
>>>> platform suspend/resume routines. Add a generic implementation to reduce
>>>> duplicated code.
>>>>
>>>> Signed-off-by: Yao Zi<ziyao@disroot.org>
>>>> ---
>>>>    drivers/net/ethernet/stmicro/stmmac/stmmac.h  |  2 +
>>>>    .../net/ethernet/stmicro/stmmac/stmmac_main.c | 37 +++++++++++++++++++
>>> I would prefer not to make stmmac_main.c even larger by including bus
>>> specific helpers there. We already have stmmac_pltfm.c for those which
>>> use struct platform_device. The logical name would be stmmac_pci.c, but
>>> that's already taken by a driver.
>>>
>>> One way around that would be to rename stmmac_pci.c to dwmac-pci.c
>>> (glue drivers tend to be named dwmac-foo.c) and then re-use
>>> stmmac_pci.c for PCI-related stuff in the same way that stmmac_pltfm.c
>>> is used.
>>>
>>> Another idea would be stmmac_libpci.c.
>> I also don't want stmmac_main.c to grow larger, and I prefer
>> stmmac_libpci.c instead. Another approach - maybe we can
>> keep these helper functions in stmmac_pci.c and just declare
>> them as extern where needed?
> stmmac_pci.c is itself a glue driver, supporting PCI IDs:
>
> 	0x0700, 0x1108	- synthetic ID
> 	0x104a, 0xcc09	- ST Micro MAC
> 	0x16c3, 0x7102	- Synopsys GMAC5
>
> I don't think we should try to turn a glue driver into a library,
> even though it would be the easier option (we could reuse
> CONFIG_STMMAC_PCI.)

I agree with your opinion; let's build a new library.


Thanks,

Yanteng


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-10-29  9:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-28 15:43 [PATCH net-next 0/3] Unify platform suspend/resume routines for PCI DWMAC glue Yao Zi
2025-10-28 15:43 ` [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers Yao Zi
2025-10-28 15:59   ` Russell King (Oracle)
2025-10-29  2:27     ` Yanteng Si
2025-10-29  2:50       ` Yao Zi
2025-10-29  9:00       ` Russell King (Oracle)
2025-10-29  9:07         ` Yanteng Si
2025-10-28 15:43 ` [PATCH net-next 2/3] net: stmmac: loongson: Use generic PCI suspend/resume routines Yao Zi
2025-10-28 15:43 ` [PATCH net-next 3/3] net: stmmac: pci: " Yao Zi

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).