linux-stable/drivers/net
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
..
appletalk
arcnet
bonding bonding: fix NULL deref in bond_rr_gen_slave_id 2022-09-22 06:39:40 -07:00
caif
can can: gs_usb: gs_usb_set_phys_id(): return with error if identify is not supported 2022-09-21 09:48:52 +02:00
dsa net: mt7531: ensure all MACs are powered down before reset 2022-09-23 06:58:49 -07:00
ethernet net: stmmac: power up/down serdes in stmmac_open/release 2022-09-27 10:38:11 +02:00
fddi skfp/h: fix repeated words in comments 2022-08-12 11:20:29 +01:00
fjes
hamradio
hippi net: hippi: Add missing pci_disable_device() in rr_init_one() 2022-09-26 13:22:39 -07:00
hyperv
ieee802154 ieee802154: cc2520: add rc code in cc2520_tx() 2022-08-29 11:10:22 +02:00
ipa net: ipa: properly limit modem routing table use 2022-09-20 08:11:13 -07:00
ipvlan ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header 2022-09-09 12:46:06 +01:00
mctp
mdio of: mdio: Add of_node_put() when breaking out of for_each_xx 2022-09-20 07:32:09 -07:00
netdevsim netdevsim: Fix hwstats debugfs file permissions 2022-09-19 14:40:38 -07:00
pcs
phy net: phy: micrel: fix shared interrupt on LAN8814 2022-09-22 06:36:32 -07:00
plip
ppp
slip
team net: team: Unsync device addresses on ndo_stop 2022-09-16 14:34:01 +01:00
usb usbnet: Fix memory leak in usbnet_disconnect() 2022-09-26 11:23:22 -07:00
vmxnet3
vxlan
wan
wireguard wireguard: netlink: avoid variable-sized memcpy on sockaddr 2022-09-20 11:26:14 -07:00
wireless wifi: mt76: fix 5 GHz connection regression on mt76x0/mt76x2 2022-09-12 14:26:02 +03:00
wwan
xen-netback xen-netback: only remove 'hotplug-status' when the vif is actually destroyed 2022-09-03 09:53:02 +01:00
amt.c
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
Kconfig
LICENSE.SRC
loopback.c
macsec.c Revert "net: macsec: update SCI upon MAC address change." 2022-08-19 16:50:36 -07:00
macvlan.c
macvtap.c
Makefile
mdio.c
mhi_net.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c tun: support not enabling carrier in TUNSETIFF 2022-09-23 12:02:03 +01:00
veth.c
virtio_net.c Including fixes from netfilter. 2022-08-18 19:37:15 -07:00
vrf.c
vsockmon.c
xen-netfront.c