linux/drivers/net/ethernet
Junxiao Chang 49725ffc15 net: stmmac: power up/down serdes in stmmac_open/release
This commit fixes DMA engine reset timeout issue in suspend/resume
with ADLink I-Pi SMARC Plus board which dmesg shows:
...
[   54.678271] PM: suspend exit
[   54.754066] intel-eth-pci 0000:00:1d.2 enp0s29f2: PHY [stmmac-3:01] driver [Maxlinear Ethernet GPY215B] (irq=POLL)
[   54.755808] intel-eth-pci 0000:00:1d.2 enp0s29f2: Register MEM_TYPE_PAGE_POOL RxQ-0
...
[   54.780482] intel-eth-pci 0000:00:1d.2 enp0s29f2: Register MEM_TYPE_PAGE_POOL RxQ-7
[   55.784098] intel-eth-pci 0000:00:1d.2: Failed to reset the dma
[   55.784111] intel-eth-pci 0000:00:1d.2 enp0s29f2: stmmac_hw_setup: DMA engine initialization failed
[   55.784115] intel-eth-pci 0000:00:1d.2 enp0s29f2: stmmac_open: Hw setup failed
...

The issue is related with serdes which impacts clock.  There is
serdes in ADLink I-Pi SMARC board ethernet controller. Please refer to
commit b9663b7ca6 ("net: stmmac: Enable SERDES power up/down sequence")
for detial. When issue is reproduced, DMA engine clock is not ready
because serdes is not powered up.

To reproduce DMA engine reset timeout issue with hardware which has
serdes in GBE controller, install Ubuntu. In Ubuntu GUI, click
"Power Off/Log Out" -> "Suspend" menu, it disables network interface,
then goes to sleep mode. When it wakes up, it enables network
interface again. Stmmac driver is called in this way:

1. stmmac_release: Stop network interface. In this function, it
   disables DMA engine and network interface;
2. stmmac_suspend: It is called in kernel suspend flow. But because
   network interface has been disabled(netif_running(ndev) is
   false), it does nothing and returns directly;
3. System goes into S3 or S0ix state. Some time later, system is
   waken up by keyboard or mouse;
4. stmmac_resume: It does nothing because network interface has
   been disabled;
5. stmmac_open: It is called to enable network interace again. DMA
   engine is initialized in this API, but serdes is not power on so
   there will be DMA engine reset timeout issue.

Similarly, serdes powerdown should be added in stmmac_release.
Network interface might be disabled by cmd "ifconfig eth0 down",
DMA engine, phy and mac have been disabled in ndo_stop callback,
serdes should be powered down as well. It doesn't make sense that
serdes is on while other components have been turned off.

If ethernet interface is in enabled state(netif_running(ndev) is true)
before suspend/resume, the issue couldn't be reproduced  because serdes
could be powered up in stmmac_resume.

Because serdes_powerup is added in stmmac_open, it doesn't need to be
called in probe function.

Fixes: b9663b7ca6 ("net: stmmac: Enable SERDES power up/down sequence")
Signed-off-by: Junxiao Chang <junxiao.chang@intel.com>
Reviewed-by: Voon Weifeng <weifeng.voon@intel.com>
Tested-by: Jimmy JS Chen <jimmyjs.chen@adlinktech.com>
Tested-by: Looi, Hong Aun <hong.aun.looi@intel.com>
Link: https://lore.kernel.org/r/20220923050448.1220250-1-junxiao.chang@intel.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2022-09-27 10:38:11 +02:00
..
3com eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
8390
actions
adaptec eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
aeroflex
agere agere: fix repeated words in comments 2022-06-27 22:06:14 -07:00
alacritech slic: remove a copy of the NAPI_POLL_WEIGHT define 2022-04-29 11:56:41 +01:00
allwinner
alteon
altera Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-06-09 16:38:15 -07:00
amazon eth: remove remaining copies of the NAPI_POLL_WEIGHT define 2022-04-30 14:00:45 +01:00
amd net: amd8111e: remove repeated dev->features assignement 2022-07-20 21:01:16 -07:00
apm drivers: net: xgene: Fix regression in CRC stripping 2022-03-23 10:30:05 -07:00
apple net: ethernet: Prepare cleanup of powerpc's asm/prom.h 2022-05-05 15:53:02 -07:00
aquantia net: atlantic: fix potential memory leak in aq_ndev_close() 2022-09-21 12:50:57 +01:00
arc eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
asix
atheros atl1c: use netif_napi_add_tx() for Tx NAPI 2022-07-18 11:31:28 +01:00
broadcom bnxt: prevent skb UAF after handing over to PTP worker 2022-09-22 07:33:17 -07:00
brocade net: add skb_[inner_]tcp_all_headers helpers 2022-07-02 16:22:25 +01:00
cadence net: macb: Fix ZynqMP SGMII non-wakeup source resume failure 2022-09-23 12:32:49 +01:00
calxeda net: calxedaxgmac: Fix typo (doubled "the") 2022-04-11 20:49:21 -07:00
cavium net: add skb_[inner_]tcp_all_headers helpers 2022-07-02 16:22:25 +01:00
chelsio cxgb4: fix missing unlock on ETHOFLD desc collect fail path 2022-09-26 13:17:53 -07:00
cirrus cirrus: cs89x0: fix typo in comment 2022-05-22 20:44:29 +01:00
cisco SPDX changes for 6.0-rc1 2022-08-04 12:12:54 -07:00
cortina net: Use u64_stats_fetch_begin_irq() for stats fetch. 2022-08-29 13:02:27 +01:00
davicom
dec eth: de4x5: remove support for Generic DECchip & DIGITAL EtherWORKS PCI/EISA 2022-05-23 11:43:51 +01:00
dlink
emulex Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-07-21 13:03:39 -07:00
engleder tsnep: Fix tsnep_tx_unmap() error path usage 2022-08-08 20:44:33 -07:00
ezchip eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
faraday net: ftgmac100: Hold reference returned by of_get_child_by_name() 2022-07-13 13:29:07 +01:00
freescale net: enetc: deny offload of tc-based TSN features on VF interfaces 2022-09-20 11:27:10 -07:00
fujitsu
fungible net: Use u64_stats_fetch_begin_irq() for stats fetch. 2022-08-29 13:02:27 +01:00
google gve: Fix GFP flags when allocing pages 2022-09-19 18:31:06 -07:00
hisilicon net: hns: Fix spelling mistakes in comments. 2022-07-04 11:15:45 +01:00
huawei net: Use u64_stats_fetch_begin_irq() for stats fetch. 2022-08-29 13:02:27 +01:00
i825xx Networking changes for 5.18. 2022-03-24 13:13:26 -07:00
ibm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-07-07 12:07:37 -07:00
intel Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue 2022-09-21 18:39:47 -07:00
litex
marvell Revert "net: mvpp2: debugfs: fix memory leak when using debugfs_lookup()" 2022-09-26 10:06:34 -07:00
mediatek net: ethernet: mtk_eth_soc: enable XDP support just for MT7986 SoC 2022-09-19 16:30:54 -07:00
mellanox net/mlxbf_gige: Fix an IS_ERR() vs NULL bug in mlxbf_gige_mdio_probe 2022-09-26 13:20:23 -07:00
micrel net: micrel: Fix KS8851 Kconfig 2022-04-05 17:32:05 -07:00
microchip net: lan966x: improve error handle in lan966x_fdma_rx_get_frame() 2022-08-30 23:18:17 -07:00
microsoft Including fixes from wifi, netfilter and can. 2022-09-22 10:58:13 -07:00
moxa net: moxa: get rid of asymmetry in DMA mapping/unmapping 2022-08-22 18:15:44 -07:00
mscc net: mscc: ocelot: report ndo_get_stats64 from the wraparound-resistant ocelot->stats 2022-08-17 21:58:33 -07:00
myricom net: add skb_[inner_]tcp_all_headers helpers 2022-07-02 16:22:25 +01:00
natsemi ethernet/natsemi: fix repeated words in comments 2022-07-01 11:14:24 +01:00
neterion eth: remove neterion/vxge 2022-07-05 15:26:31 -07:00
netronome nfp: fix the access to management firmware hanging 2022-08-30 23:03:44 -07:00
ni
nvidia eth: remove remaining copies of the NAPI_POLL_WEIGHT define 2022-04-30 14:00:45 +01:00
nxp eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
oki-semi eth: pch_gbe: remove a copy of the NAPI_POLL_WEIGHT define 2022-04-29 11:56:41 +01:00
packetengines drivers: net: packetengines: fix typos in comments 2022-03-14 10:04:28 -07:00
pasemi
pensando ionic: VF initial random MAC address if no assigned mac 2022-08-25 12:39:54 -07:00
qlogic qlogic: qed: fix clang -Wformat warnings 2022-07-12 20:36:41 -07:00
qualcomm net: add skb_[inner_]tcp_all_headers helpers 2022-07-02 16:22:25 +01:00
rdc
realtek r8169: fix accessing unset transport header 2022-07-06 19:53:21 -07:00
renesas net: sh_eth: Fix PHY state warning splat during system resume 2022-09-20 17:05:50 -07:00
rocker ethernet: rocker: fix sleep in atomic context bug in neigh_timer_handler 2022-08-31 14:01:29 +01:00
samsung samsung/sxgbe: fix repeated words in comments 2022-07-01 20:13:39 -07:00
seeq
sfc sfc: correct filter_table_remove method for EF10 PFs 2022-09-23 20:57:14 -07:00
sgi
silan
sis
smsc net: smsc911x: Stop and start PHY during suspend and resume 2022-08-26 18:48:15 -07:00
socionext net: switch to netif_napi_add_tx() 2022-05-05 15:54:12 -07:00
stmicro net: stmmac: power up/down serdes in stmmac_open/release 2022-09-27 10:38:11 +02:00
sun net: sunhme: Fix packet reception for len < RX_COPY_THRESHOLD 2022-09-22 06:44:28 -07:00
sunplus eth: sp7021: switch to netif_napi_add_tx() 2022-07-08 12:12:27 +01:00
synopsys net: add skb_[inner_]tcp_all_headers helpers 2022-07-02 16:22:25 +01:00
tehuti
ti net: ethernet: ti: am65-cpsw: Fix devlink port register sequence 2022-07-07 17:21:44 -07:00
toshiba eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
tundra
vertexcom
via ethernet/via: fix repeated words in comments 2022-07-11 14:12:54 +01:00
wangxun eth: fix the help in Wangxun's Kconfig 2022-08-05 19:01:45 -07:00
wiznet eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
xilinx net: axienet: Modify function description 2022-06-27 21:53:04 -07:00
xircom
xscale ixp4xx_eth: Set MAC address from device tree 2022-07-09 12:34:18 +01:00
dnet.c
dnet.h
ec_bhf.c
ethoc.c
fealnx.c
jme.c jme: remove an unnecessary indirection 2022-05-05 15:53:28 -07:00
jme.h jme: remove an unnecessary indirection 2022-05-05 15:53:28 -07:00
Kconfig net: txgbe: Add build support for txgbe 2022-06-29 20:57:06 -07:00
korina.c
lantiq_etop.c eth: switch to netif_napi_add_weight() 2022-05-08 11:33:57 +01:00
lantiq_xrx200.c net: lantiq_xrx200: restore buffer if memory allocation failed 2022-08-25 12:41:39 -07:00
Makefile net: txgbe: Add build support for txgbe 2022-06-29 20:57:06 -07:00